Code review rework

This commit is contained in:
Bruce Riley 2022-09-29 17:56:08 +00:00 committed by Evan Gray
parent d45a1e95cb
commit aebbbdcb9a
2 changed files with 6 additions and 2 deletions

View File

@ -463,7 +463,7 @@ func runNode(cmd *cobra.Command, args []string) {
*moonbeamContract = devnet.GanacheWormholeContractAddress.Hex()
*neonContract = devnet.GanacheWormholeContractAddress.Hex()
if *arbitrumContract == "" {
*neonContract = devnet.GanacheWormholeContractAddress.Hex()
*arbitrumContract = devnet.GanacheWormholeContractAddress.Hex()
}
}

View File

@ -52,10 +52,14 @@ func NewArbitrumFinalizer(logger *zap.Logger, connector connectors.Connector, cl
}
}
// IsBlockFinalized queries the NodeInfrastructure precompiled contract to see if the L2 (Arbitrum) block has appeared
// in an L1 (Ethereum) block. We don't really care what L2 block it appeared in, just that it has.
func (a *ArbitrumFinalizer) IsBlockFinalized(ctx context.Context, block *connectors.NewBlock) (bool, error) {
_, err := a.caller.FindBatchContainingBlock(&ethBind.CallOpts{Context: ctx}, block.Number.Uint64())
if err != nil {
// "requested block 430842 is after latest on-chain block 430820 published in batch 4686"
// If it hasn't been published yet, the method returns an error, so we check for that and treat it as
// not finalized, rather than as an error. Here's what that looks like:
// "requested block 430842 is after latest on-chain block 430820 published in batch 4686"
if strings.ContainsAny(err.Error(), "is after latest on-chain block") {
return false, nil
}