diff --git a/README.md b/README.md index 5f91c190..4061d94c 100644 --- a/README.md +++ b/README.md @@ -255,9 +255,13 @@ The **_[config.toml](./cmd/chainsimulator/config/config.toml)_** file: # 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 round-duration-in-milliseconds = 6000 # rounds-per-epoch specifies the number of rounds per epoch - # initial-round when the chain simulator will start - initial-round = 1 rounds-per-epoch = 20 + # initial-round specifies with what round the chain simulator will start + initial-round = 0 + # initial-nonce specifies with what nonce the chain simulator will start + initial-nonce = 0 + # initial-epoch specifies with what epoch the chain simulator will start + initial-epoch = 0 # mx-chain-go-repo will be used to fetch the node configs folder mx-chain-go-repo = "https://github.com/multiversx/mx-chain-go" # mx-chain-proxy-go-repo will be used to fetch the proxy configs folder diff --git a/cmd/chainsimulator/config/config.toml b/cmd/chainsimulator/config/config.toml index e81fc9ea..efdbfa6f 100644 --- a/cmd/chainsimulator/config/config.toml +++ b/cmd/chainsimulator/config/config.toml @@ -9,7 +9,11 @@ # rounds-per-epoch specifies the number of rounds per epoch rounds-per-epoch = 20 # initial-round when the chain simulator will start - initial-round = 1 + initial-round = 0 + # initial-epoch when the chain simulator will start + initial-epoch = 0 + # initial-nonce when the chain simulator will start + initial-nonce = 0 # mx-chain-go-repo will be used to fetch the node configs folder mx-chain-go-repo = "https://github.com/multiversx/mx-chain-go" # mx-chain-proxy-go-repo will be used to fetch the proxy configs folder diff --git a/cmd/chainsimulator/flags.go b/cmd/chainsimulator/flags.go index 2df8387f..b285b08d 100644 --- a/cmd/chainsimulator/flags.go +++ b/cmd/chainsimulator/flags.go @@ -81,6 +81,21 @@ var ( Usage: "This flag is used to specify the number of validators on metachain", Value: 1, } + initialRound = cli.Uint64Flag{ + Name: "initial-round", + Usage: "This flag is used to specify the initial round when chain simulator will start", + Value: 0, + } + initialNonce = cli.Uint64Flag{ + Name: "initial-nonce", + Usage: "This flag is used to specify the initial nonce when chain simulator will start", + Value: 0, + } + initialEpoch = cli.UintFlag{ + Name: "initial-epoch", + Usage: "This flag is used to specify the initial epoch when chain simulator will start", + Value: 0, + } ) func applyFlags(ctx *cli.Context, cfg *config.Config) { @@ -99,4 +114,16 @@ func applyFlags(ctx *cli.Context, cfg *config.Config) { if ctx.IsSet(roundDurationInMs.Name) { cfg.Config.Simulator.RoundDurationInMs = ctx.GlobalInt(roundDurationInMs.Name) } + + if ctx.IsSet(initialRound.Name) { + cfg.Config.Simulator.InitialRound = ctx.GlobalInt64(initialRound.Name) + } + + if ctx.IsSet(initialNonce.Name) { + cfg.Config.Simulator.InitialNonce = ctx.GlobalUint64(initialNonce.Name) + } + + if ctx.IsSet(initialEpoch.Name) { + cfg.Config.Simulator.InitialEpoch = uint32(ctx.GlobalUint(initialEpoch.Name)) + } } diff --git a/cmd/chainsimulator/main.go b/cmd/chainsimulator/main.go index 7ee21bc9..97ddec74 100644 --- a/cmd/chainsimulator/main.go +++ b/cmd/chainsimulator/main.go @@ -64,6 +64,9 @@ func main() { bypassTransactionsSignature, numValidatorsPerShard, numValidatorsMeta, + initialRound, + initialNonce, + initialEpoch, } app.Authors = []cli.Author{ @@ -154,7 +157,9 @@ func startChainSimulator(ctx *cli.Context) error { ApiInterface: apiConfigurator, MinNodesPerShard: uint32(numValidatorsShard), MetaChainMinNodes: uint32(numValidatorsMetaShard), - InitialRound: int64(cfg.Config.Simulator.InitialRound), + InitialRound: cfg.Config.Simulator.InitialRound, + InitialNonce: cfg.Config.Simulator.InitialNonce, + InitialEpoch: cfg.Config.Simulator.InitialEpoch, } simulator, err := chainSimulator.NewChainSimulator(argsChainSimulator) if err != nil { diff --git a/config/config.go b/config/config.go index aedfd3a8..69f40818 100644 --- a/config/config.go +++ b/config/config.go @@ -8,7 +8,9 @@ type Config struct { NumOfShards int `toml:"num-of-shards"` RoundsPerEpoch int `toml:"rounds-per-epoch"` RoundDurationInMs int `toml:"round-duration-in-milliseconds"` - InitialRound int `toml:"initial-round"` + InitialRound int64 `toml:"initial-round"` + InitialNonce uint64 `toml:"initial-nonce"` + InitialEpoch uint32 `toml:"initial-epoch"` MxChainRepo string `toml:"mx-chain-go-repo"` MxProxyRepo string `toml:"mx-chain-proxy-go-repo"` } `toml:"simulator"` diff --git a/go.mod b/go.mod index f76d4430..70cef155 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/gin-gonic/gin v1.9.1 github.com/multiversx/mx-chain-core-go v1.2.19-0.20240129082057-a76d0c995cf2 - github.com/multiversx/mx-chain-go v1.6.16-0.20240212083448-9b5f0ab6cf86 + github.com/multiversx/mx-chain-go v1.7.3-0.20240221154137-aa16de3cd5e5 github.com/multiversx/mx-chain-logger-go v1.0.14-0.20240129144507-d00e967c890c github.com/multiversx/mx-chain-proxy-go v1.1.41 github.com/stretchr/testify v1.8.4 @@ -118,13 +118,13 @@ require ( github.com/multiversx/mx-chain-communication-go v1.0.13-0.20240126121117-627adccf10ad // indirect github.com/multiversx/mx-chain-crypto-go v1.2.10-0.20231206065052-38843c1f1479 // indirect github.com/multiversx/mx-chain-es-indexer-go v1.4.19-0.20240129150813-a772c480d33a // indirect - github.com/multiversx/mx-chain-scenario-go v1.3.1-0.20240129145446-ca4fba98f6d1 // indirect + github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240212160120-cc32d1580157 // indirect github.com/multiversx/mx-chain-storage-go v1.0.15-0.20240129144933-b1c0d642d7f8 // indirect github.com/multiversx/mx-chain-vm-common-go v1.5.12-0.20240129145149-4fe61574f566 // indirect - github.com/multiversx/mx-chain-vm-go v1.5.27-0.20240129150501-7c828af05c83 // indirect + github.com/multiversx/mx-chain-vm-go v1.5.28-0.20240216071136-6d748b5d6a72 // indirect github.com/multiversx/mx-chain-vm-v1_2-go v1.2.66-0.20240129145751-f814f5525edb // indirect github.com/multiversx/mx-chain-vm-v1_3-go v1.3.67-0.20240129150004-536a22d9c618 // indirect - github.com/multiversx/mx-chain-vm-v1_4-go v1.4.95-0.20240129150215-43996b664ada // indirect + github.com/multiversx/mx-chain-vm-v1_4-go v1.4.96-0.20240216071525-f7d1b8ce8662 // indirect github.com/multiversx/mx-components-big-int v1.0.0 // indirect github.com/onsi/ginkgo/v2 v2.11.0 // indirect github.com/onsi/gomega v1.27.10 // indirect diff --git a/go.sum b/go.sum index 6ebc16d0..e234b072 100644 --- a/go.sum +++ b/go.sum @@ -401,26 +401,26 @@ github.com/multiversx/mx-chain-crypto-go v1.2.10-0.20231206065052-38843c1f1479 h github.com/multiversx/mx-chain-crypto-go v1.2.10-0.20231206065052-38843c1f1479/go.mod h1:Ap6p7QZFtwPlb++OvCG+85BfuZ+bLP/JtQp6EwjWJsI= github.com/multiversx/mx-chain-es-indexer-go v1.4.19-0.20240129150813-a772c480d33a h1:mOMUhbsjTq7n5oAv4KkVnL67ngS0+wkqmkiv1XJfBIY= github.com/multiversx/mx-chain-es-indexer-go v1.4.19-0.20240129150813-a772c480d33a/go.mod h1:3aSGRJNvfUuPQkZUGHWuF11rPPxphsKGuAuIB+eD3is= -github.com/multiversx/mx-chain-go v1.6.16-0.20240212083448-9b5f0ab6cf86 h1:e0mY7Ou1GB952NmCGqR5eWTnN+Kul6NUa2meGSkITUM= -github.com/multiversx/mx-chain-go v1.6.16-0.20240212083448-9b5f0ab6cf86/go.mod h1:yWjiHiKqrQoBsH8PB0WW4sQJQNzt3yTKbEPZG3jnl7k= +github.com/multiversx/mx-chain-go v1.7.3-0.20240221154137-aa16de3cd5e5 h1:Yp/2/WwmVMkukBm8bd9ABZY/ZRYw/Qp2j2yvCu5ib/0= +github.com/multiversx/mx-chain-go v1.7.3-0.20240221154137-aa16de3cd5e5/go.mod h1:lig6YN9ltTpb6gKhu1kXwiOJfO+WEzYTrjggocyxwkU= github.com/multiversx/mx-chain-logger-go v1.0.14-0.20240129144507-d00e967c890c h1:QIUOn8FgNRa5cir4BCWHZi/Qcr6Gg0eGNhns4+jy6+k= github.com/multiversx/mx-chain-logger-go v1.0.14-0.20240129144507-d00e967c890c/go.mod h1:fH/fR/GEBsDjPkBoZDVJMoYo2HhlA7++DP6QfITJ1N8= github.com/multiversx/mx-chain-proxy-go v1.1.41 h1:u5LTek2keNvd25jrOmHLp0N4AFwYFImBnrs+GR7IGRY= github.com/multiversx/mx-chain-proxy-go v1.1.41/go.mod h1:El07IztR9QuhbNPZkd2ew2H8KS2bUqG7/0eQ28BPPsY= -github.com/multiversx/mx-chain-scenario-go v1.3.1-0.20240129145446-ca4fba98f6d1 h1:hkeHftnhRuJoT5FrfF97gEtb5aY351SWEjZPaTb6D+Y= -github.com/multiversx/mx-chain-scenario-go v1.3.1-0.20240129145446-ca4fba98f6d1/go.mod h1:ndk45i9J9McuCJpTcgiaK4ocd0yhnBBCPrlFwO6GRcs= +github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240212160120-cc32d1580157 h1:ydzN3f+Y7H0InXuxAcNUSyVc+omNYL8uYtLqVzqaaX4= +github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240212160120-cc32d1580157/go.mod h1:ndk45i9J9McuCJpTcgiaK4ocd0yhnBBCPrlFwO6GRcs= github.com/multiversx/mx-chain-storage-go v1.0.15-0.20240129144933-b1c0d642d7f8 h1:/EYv/HGX0OKbeNFt667J0yZRtuJiZH0lEK8YtobuH/c= github.com/multiversx/mx-chain-storage-go v1.0.15-0.20240129144933-b1c0d642d7f8/go.mod h1:zl1A6teNe39T8yhdZlkX3ckm5aLYrMIJJZ6Ord1E71M= github.com/multiversx/mx-chain-vm-common-go v1.5.12-0.20240129145149-4fe61574f566 h1:zImJa/r6B5L2OLWbKTn5io53U11PPGDla12H2OaJ9y0= github.com/multiversx/mx-chain-vm-common-go v1.5.12-0.20240129145149-4fe61574f566/go.mod h1:OUyhCFqZKqUk1uaPsenyPDwO1830SlHNDU7Q7b6CBVI= -github.com/multiversx/mx-chain-vm-go v1.5.27-0.20240129150501-7c828af05c83 h1:G/d9aplnwP/9MrLE3gcANEpGfn5e8ZZufijPv2XVUfw= -github.com/multiversx/mx-chain-vm-go v1.5.27-0.20240129150501-7c828af05c83/go.mod h1:64dTd60QUGWx5W3eU28IOfpqAWApWqB/Z7mJHmuQfXo= +github.com/multiversx/mx-chain-vm-go v1.5.28-0.20240216071136-6d748b5d6a72 h1:NMHNT4NcqOdnHttYsT3ydZHVapwOctp6t+WDGDy0UEQ= +github.com/multiversx/mx-chain-vm-go v1.5.28-0.20240216071136-6d748b5d6a72/go.mod h1:YCD2Q+kpzx86ydowe/BKw/ZdzYjfH/4IxWHS0NsyuD0= github.com/multiversx/mx-chain-vm-v1_2-go v1.2.66-0.20240129145751-f814f5525edb h1:UtiY8X73llF9OLtGb2CM7Xewae1chvPjLc8B+ZmDLjw= github.com/multiversx/mx-chain-vm-v1_2-go v1.2.66-0.20240129145751-f814f5525edb/go.mod h1:8uugq3HUeDiE6G4AS3F8/B3zA1Pabzbl7SSD6Cebwz8= github.com/multiversx/mx-chain-vm-v1_3-go v1.3.67-0.20240129150004-536a22d9c618 h1:1uMlT5TjiHUlx81fEH/WQANWlY0PjF3opMlW+E3L3GI= github.com/multiversx/mx-chain-vm-v1_3-go v1.3.67-0.20240129150004-536a22d9c618/go.mod h1:4uezxguZiX42kUaYMK/x46LLbgpYqn/iQXbcGM7zdM0= -github.com/multiversx/mx-chain-vm-v1_4-go v1.4.95-0.20240129150215-43996b664ada h1:NZLV2QmNPW+QTefuAhC24sOuGbOsAQEXzfv2CWoRJKc= -github.com/multiversx/mx-chain-vm-v1_4-go v1.4.95-0.20240129150215-43996b664ada/go.mod h1:tCjtWeBEZCfjEjlBcgLIRDGJbVmdV8dsmG6ydtiUtSo= +github.com/multiversx/mx-chain-vm-v1_4-go v1.4.96-0.20240216071525-f7d1b8ce8662 h1:0y1k2+FjFfWgoPCMi0nkYkCYQJtPYJvph6bre4Elqxk= +github.com/multiversx/mx-chain-vm-v1_4-go v1.4.96-0.20240216071525-f7d1b8ce8662/go.mod h1:Nvanb5BZVhqnFFlWUtn7PQ/GIsl72zPVcMEw/ZvYiQA= github.com/multiversx/mx-components-big-int v1.0.0 h1:Wkr8lSzK2nDqixOrrBa47VNuqdhV1m/aJhaP1EMaiS8= github.com/multiversx/mx-components-big-int v1.0.0/go.mod h1:maIEMgHlNE2u78JaDD0oLzri+ShgU4okHfzP3LWGdQM= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=