Skip to content

Commit 9382d73

Browse files
authored
Merge pull request #11 from multiversx/update-node-version-genesis-nonce
New features
2 parents 70f5aee + 33008cf commit 9382d73

File tree

7 files changed

+59
-17
lines changed

7 files changed

+59
-17
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,13 @@ The **_[config.toml](./cmd/chainsimulator/config/config.toml)_** file:
255255
# round-duration-in-milliseconds parameter specifies the duration of a simulated round. The timestamp between two headers will correspond to the round duration but will not reflect real-time
256256
round-duration-in-milliseconds = 6000
257257
# rounds-per-epoch specifies the number of rounds per epoch
258-
# initial-round when the chain simulator will start
259-
initial-round = 1
260258
rounds-per-epoch = 20
259+
# initial-round specifies with what round the chain simulator will start
260+
initial-round = 0
261+
# initial-nonce specifies with what nonce the chain simulator will start
262+
initial-nonce = 0
263+
# initial-epoch specifies with what epoch the chain simulator will start
264+
initial-epoch = 0
261265
# mx-chain-go-repo will be used to fetch the node configs folder
262266
mx-chain-go-repo = "https://github.com/multiversx/mx-chain-go"
263267
# mx-chain-proxy-go-repo will be used to fetch the proxy configs folder

cmd/chainsimulator/config/config.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
# rounds-per-epoch specifies the number of rounds per epoch
1010
rounds-per-epoch = 20
1111
# initial-round when the chain simulator will start
12-
initial-round = 1
12+
initial-round = 0
13+
# initial-epoch when the chain simulator will start
14+
initial-epoch = 0
15+
# initial-nonce when the chain simulator will start
16+
initial-nonce = 0
1317
# mx-chain-go-repo will be used to fetch the node configs folder
1418
mx-chain-go-repo = "https://github.com/multiversx/mx-chain-go"
1519
# mx-chain-proxy-go-repo will be used to fetch the proxy configs folder

cmd/chainsimulator/flags.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,21 @@ var (
8181
Usage: "This flag is used to specify the number of validators on metachain",
8282
Value: 1,
8383
}
84+
initialRound = cli.Uint64Flag{
85+
Name: "initial-round",
86+
Usage: "This flag is used to specify the initial round when chain simulator will start",
87+
Value: 0,
88+
}
89+
initialNonce = cli.Uint64Flag{
90+
Name: "initial-nonce",
91+
Usage: "This flag is used to specify the initial nonce when chain simulator will start",
92+
Value: 0,
93+
}
94+
initialEpoch = cli.UintFlag{
95+
Name: "initial-epoch",
96+
Usage: "This flag is used to specify the initial epoch when chain simulator will start",
97+
Value: 0,
98+
}
8499
)
85100

86101
func applyFlags(ctx *cli.Context, cfg *config.Config) {
@@ -99,4 +114,16 @@ func applyFlags(ctx *cli.Context, cfg *config.Config) {
99114
if ctx.IsSet(roundDurationInMs.Name) {
100115
cfg.Config.Simulator.RoundDurationInMs = ctx.GlobalInt(roundDurationInMs.Name)
101116
}
117+
118+
if ctx.IsSet(initialRound.Name) {
119+
cfg.Config.Simulator.InitialRound = ctx.GlobalInt64(initialRound.Name)
120+
}
121+
122+
if ctx.IsSet(initialNonce.Name) {
123+
cfg.Config.Simulator.InitialNonce = ctx.GlobalUint64(initialNonce.Name)
124+
}
125+
126+
if ctx.IsSet(initialEpoch.Name) {
127+
cfg.Config.Simulator.InitialEpoch = uint32(ctx.GlobalUint(initialEpoch.Name))
128+
}
102129
}

cmd/chainsimulator/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ func main() {
6464
bypassTransactionsSignature,
6565
numValidatorsPerShard,
6666
numValidatorsMeta,
67+
initialRound,
68+
initialNonce,
69+
initialEpoch,
6770
}
6871

6972
app.Authors = []cli.Author{
@@ -154,7 +157,9 @@ func startChainSimulator(ctx *cli.Context) error {
154157
ApiInterface: apiConfigurator,
155158
MinNodesPerShard: uint32(numValidatorsShard),
156159
MetaChainMinNodes: uint32(numValidatorsMetaShard),
157-
InitialRound: int64(cfg.Config.Simulator.InitialRound),
160+
InitialRound: cfg.Config.Simulator.InitialRound,
161+
InitialNonce: cfg.Config.Simulator.InitialNonce,
162+
InitialEpoch: cfg.Config.Simulator.InitialEpoch,
158163
}
159164
simulator, err := chainSimulator.NewChainSimulator(argsChainSimulator)
160165
if err != nil {

config/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ type Config struct {
88
NumOfShards int `toml:"num-of-shards"`
99
RoundsPerEpoch int `toml:"rounds-per-epoch"`
1010
RoundDurationInMs int `toml:"round-duration-in-milliseconds"`
11-
InitialRound int `toml:"initial-round"`
11+
InitialRound int64 `toml:"initial-round"`
12+
InitialNonce uint64 `toml:"initial-nonce"`
13+
InitialEpoch uint32 `toml:"initial-epoch"`
1214
MxChainRepo string `toml:"mx-chain-go-repo"`
1315
MxProxyRepo string `toml:"mx-chain-proxy-go-repo"`
1416
} `toml:"simulator"`

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.20
55
require (
66
github.com/gin-gonic/gin v1.9.1
77
github.com/multiversx/mx-chain-core-go v1.2.19-0.20240129082057-a76d0c995cf2
8-
github.com/multiversx/mx-chain-go v1.6.16-0.20240212083448-9b5f0ab6cf86
8+
github.com/multiversx/mx-chain-go v1.7.3-0.20240221154137-aa16de3cd5e5
99
github.com/multiversx/mx-chain-logger-go v1.0.14-0.20240129144507-d00e967c890c
1010
github.com/multiversx/mx-chain-proxy-go v1.1.41
1111
github.com/stretchr/testify v1.8.4
@@ -118,13 +118,13 @@ require (
118118
github.com/multiversx/mx-chain-communication-go v1.0.13-0.20240126121117-627adccf10ad // indirect
119119
github.com/multiversx/mx-chain-crypto-go v1.2.10-0.20231206065052-38843c1f1479 // indirect
120120
github.com/multiversx/mx-chain-es-indexer-go v1.4.19-0.20240129150813-a772c480d33a // indirect
121-
github.com/multiversx/mx-chain-scenario-go v1.3.1-0.20240129145446-ca4fba98f6d1 // indirect
121+
github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240212160120-cc32d1580157 // indirect
122122
github.com/multiversx/mx-chain-storage-go v1.0.15-0.20240129144933-b1c0d642d7f8 // indirect
123123
github.com/multiversx/mx-chain-vm-common-go v1.5.12-0.20240129145149-4fe61574f566 // indirect
124-
github.com/multiversx/mx-chain-vm-go v1.5.27-0.20240129150501-7c828af05c83 // indirect
124+
github.com/multiversx/mx-chain-vm-go v1.5.28-0.20240216071136-6d748b5d6a72 // indirect
125125
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.66-0.20240129145751-f814f5525edb // indirect
126126
github.com/multiversx/mx-chain-vm-v1_3-go v1.3.67-0.20240129150004-536a22d9c618 // indirect
127-
github.com/multiversx/mx-chain-vm-v1_4-go v1.4.95-0.20240129150215-43996b664ada // indirect
127+
github.com/multiversx/mx-chain-vm-v1_4-go v1.4.96-0.20240216071525-f7d1b8ce8662 // indirect
128128
github.com/multiversx/mx-components-big-int v1.0.0 // indirect
129129
github.com/onsi/ginkgo/v2 v2.11.0 // indirect
130130
github.com/onsi/gomega v1.27.10 // indirect

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -401,26 +401,26 @@ github.com/multiversx/mx-chain-crypto-go v1.2.10-0.20231206065052-38843c1f1479 h
401401
github.com/multiversx/mx-chain-crypto-go v1.2.10-0.20231206065052-38843c1f1479/go.mod h1:Ap6p7QZFtwPlb++OvCG+85BfuZ+bLP/JtQp6EwjWJsI=
402402
github.com/multiversx/mx-chain-es-indexer-go v1.4.19-0.20240129150813-a772c480d33a h1:mOMUhbsjTq7n5oAv4KkVnL67ngS0+wkqmkiv1XJfBIY=
403403
github.com/multiversx/mx-chain-es-indexer-go v1.4.19-0.20240129150813-a772c480d33a/go.mod h1:3aSGRJNvfUuPQkZUGHWuF11rPPxphsKGuAuIB+eD3is=
404-
github.com/multiversx/mx-chain-go v1.6.16-0.20240212083448-9b5f0ab6cf86 h1:e0mY7Ou1GB952NmCGqR5eWTnN+Kul6NUa2meGSkITUM=
405-
github.com/multiversx/mx-chain-go v1.6.16-0.20240212083448-9b5f0ab6cf86/go.mod h1:yWjiHiKqrQoBsH8PB0WW4sQJQNzt3yTKbEPZG3jnl7k=
404+
github.com/multiversx/mx-chain-go v1.7.3-0.20240221154137-aa16de3cd5e5 h1:Yp/2/WwmVMkukBm8bd9ABZY/ZRYw/Qp2j2yvCu5ib/0=
405+
github.com/multiversx/mx-chain-go v1.7.3-0.20240221154137-aa16de3cd5e5/go.mod h1:lig6YN9ltTpb6gKhu1kXwiOJfO+WEzYTrjggocyxwkU=
406406
github.com/multiversx/mx-chain-logger-go v1.0.14-0.20240129144507-d00e967c890c h1:QIUOn8FgNRa5cir4BCWHZi/Qcr6Gg0eGNhns4+jy6+k=
407407
github.com/multiversx/mx-chain-logger-go v1.0.14-0.20240129144507-d00e967c890c/go.mod h1:fH/fR/GEBsDjPkBoZDVJMoYo2HhlA7++DP6QfITJ1N8=
408408
github.com/multiversx/mx-chain-proxy-go v1.1.41 h1:u5LTek2keNvd25jrOmHLp0N4AFwYFImBnrs+GR7IGRY=
409409
github.com/multiversx/mx-chain-proxy-go v1.1.41/go.mod h1:El07IztR9QuhbNPZkd2ew2H8KS2bUqG7/0eQ28BPPsY=
410-
github.com/multiversx/mx-chain-scenario-go v1.3.1-0.20240129145446-ca4fba98f6d1 h1:hkeHftnhRuJoT5FrfF97gEtb5aY351SWEjZPaTb6D+Y=
411-
github.com/multiversx/mx-chain-scenario-go v1.3.1-0.20240129145446-ca4fba98f6d1/go.mod h1:ndk45i9J9McuCJpTcgiaK4ocd0yhnBBCPrlFwO6GRcs=
410+
github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240212160120-cc32d1580157 h1:ydzN3f+Y7H0InXuxAcNUSyVc+omNYL8uYtLqVzqaaX4=
411+
github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240212160120-cc32d1580157/go.mod h1:ndk45i9J9McuCJpTcgiaK4ocd0yhnBBCPrlFwO6GRcs=
412412
github.com/multiversx/mx-chain-storage-go v1.0.15-0.20240129144933-b1c0d642d7f8 h1:/EYv/HGX0OKbeNFt667J0yZRtuJiZH0lEK8YtobuH/c=
413413
github.com/multiversx/mx-chain-storage-go v1.0.15-0.20240129144933-b1c0d642d7f8/go.mod h1:zl1A6teNe39T8yhdZlkX3ckm5aLYrMIJJZ6Ord1E71M=
414414
github.com/multiversx/mx-chain-vm-common-go v1.5.12-0.20240129145149-4fe61574f566 h1:zImJa/r6B5L2OLWbKTn5io53U11PPGDla12H2OaJ9y0=
415415
github.com/multiversx/mx-chain-vm-common-go v1.5.12-0.20240129145149-4fe61574f566/go.mod h1:OUyhCFqZKqUk1uaPsenyPDwO1830SlHNDU7Q7b6CBVI=
416-
github.com/multiversx/mx-chain-vm-go v1.5.27-0.20240129150501-7c828af05c83 h1:G/d9aplnwP/9MrLE3gcANEpGfn5e8ZZufijPv2XVUfw=
417-
github.com/multiversx/mx-chain-vm-go v1.5.27-0.20240129150501-7c828af05c83/go.mod h1:64dTd60QUGWx5W3eU28IOfpqAWApWqB/Z7mJHmuQfXo=
416+
github.com/multiversx/mx-chain-vm-go v1.5.28-0.20240216071136-6d748b5d6a72 h1:NMHNT4NcqOdnHttYsT3ydZHVapwOctp6t+WDGDy0UEQ=
417+
github.com/multiversx/mx-chain-vm-go v1.5.28-0.20240216071136-6d748b5d6a72/go.mod h1:YCD2Q+kpzx86ydowe/BKw/ZdzYjfH/4IxWHS0NsyuD0=
418418
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.66-0.20240129145751-f814f5525edb h1:UtiY8X73llF9OLtGb2CM7Xewae1chvPjLc8B+ZmDLjw=
419419
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.66-0.20240129145751-f814f5525edb/go.mod h1:8uugq3HUeDiE6G4AS3F8/B3zA1Pabzbl7SSD6Cebwz8=
420420
github.com/multiversx/mx-chain-vm-v1_3-go v1.3.67-0.20240129150004-536a22d9c618 h1:1uMlT5TjiHUlx81fEH/WQANWlY0PjF3opMlW+E3L3GI=
421421
github.com/multiversx/mx-chain-vm-v1_3-go v1.3.67-0.20240129150004-536a22d9c618/go.mod h1:4uezxguZiX42kUaYMK/x46LLbgpYqn/iQXbcGM7zdM0=
422-
github.com/multiversx/mx-chain-vm-v1_4-go v1.4.95-0.20240129150215-43996b664ada h1:NZLV2QmNPW+QTefuAhC24sOuGbOsAQEXzfv2CWoRJKc=
423-
github.com/multiversx/mx-chain-vm-v1_4-go v1.4.95-0.20240129150215-43996b664ada/go.mod h1:tCjtWeBEZCfjEjlBcgLIRDGJbVmdV8dsmG6ydtiUtSo=
422+
github.com/multiversx/mx-chain-vm-v1_4-go v1.4.96-0.20240216071525-f7d1b8ce8662 h1:0y1k2+FjFfWgoPCMi0nkYkCYQJtPYJvph6bre4Elqxk=
423+
github.com/multiversx/mx-chain-vm-v1_4-go v1.4.96-0.20240216071525-f7d1b8ce8662/go.mod h1:Nvanb5BZVhqnFFlWUtn7PQ/GIsl72zPVcMEw/ZvYiQA=
424424
github.com/multiversx/mx-components-big-int v1.0.0 h1:Wkr8lSzK2nDqixOrrBa47VNuqdhV1m/aJhaP1EMaiS8=
425425
github.com/multiversx/mx-components-big-int v1.0.0/go.mod h1:maIEMgHlNE2u78JaDD0oLzri+ShgU4okHfzP3LWGdQM=
426426
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=

0 commit comments

Comments
 (0)