Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Block Number before deploying contracts. #1742

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions command/rootchain/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
}
Expand Down
Loading