diff --git a/command/rootchain/deploy/deploy.go b/command/rootchain/deploy/deploy.go index 8d2dc817e9..213992465b 100644 --- a/command/rootchain/deploy/deploy.go +++ b/command/rootchain/deploy/deploy.go @@ -343,6 +343,16 @@ func runCommand(cmd *cobra.Command, _ []string) { } } + // set event tracker start blocks for rootchain contract(s) of interest + // the block number should be queried before deploying contracts so that no events during deployment + // and initialization are missed + blockNum, err := client.Eth().BlockNumber() + if err != nil { + outputter.SetError(fmt.Errorf("failed to query rootchain latest block number: %w", err)) + + return + } + deploymentResultInfo, err := deployContracts(outputter, client, chainConfig.Params.ChainID, consensusCfg.InitialValidatorSet, cmd.Context()) if err != nil { @@ -363,14 +373,6 @@ func runCommand(cmd *cobra.Command, _ []string) { consensusCfg.Bridge = bridgeConfig - // set event tracker start blocks for rootchain contract(s) of interest - blockNum, err := client.Eth().BlockNumber() - if err != nil { - outputter.SetError(fmt.Errorf("failed to query rootchain latest block number: %w", err)) - - return - } - consensusCfg.Bridge.EventTrackerStartBlocks = map[types.Address]uint64{ deploymentResultInfo.RootchainCfg.StateSenderAddress: blockNum, }