forked from maticnetwork/heimdall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenesis.go
48 lines (39 loc) · 1.03 KB
/
genesis.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package simulation
import (
"time"
"github.com/maticnetwork/heimdall/checkpoint/types"
hmTypes "github.com/maticnetwork/heimdall/types"
"github.com/maticnetwork/heimdall/types/module"
)
// RandomizedGenState return dummy genesis
func RandomizedGenState(simState *module.SimulationState) {
lastNoACK := 0
ackCount := 1
startBlock := uint64(0)
endBlock := uint64(256)
rootHash := hmTypes.HexToHeimdallHash("123")
proposerAddress := hmTypes.HexToHeimdallAddress("123")
timestamp := uint64(time.Now().Unix())
borChainID := "1234"
bufferedCheckpoint := hmTypes.CreateBlock(
startBlock,
endBlock,
rootHash,
proposerAddress,
borChainID,
timestamp,
)
Checkpoints := make([]hmTypes.Checkpoint, ackCount)
for i := range Checkpoints {
Checkpoints[i] = bufferedCheckpoint
}
params := types.DefaultParams()
genesisState := types.NewGenesisState(
params,
&bufferedCheckpoint,
uint64(lastNoACK),
uint64(ackCount),
Checkpoints,
)
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(genesisState)
}