From ba4ff22e638b00cd91715fc4d08e3fbb03f02eba Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Fri, 24 May 2024 20:16:47 +0530 Subject: [PATCH] Make rpc head configurable --- arbnode/node.go | 3 ++- staker/state_provider.go | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arbnode/node.go b/arbnode/node.go index f7b6a32eac..0033c3f296 100644 --- a/arbnode/node.go +++ b/arbnode/node.go @@ -605,7 +605,8 @@ func createNodeImpl( if err != nil { return nil, fmt.Errorf("could not get challenge manager: %w", err) } - assertionChain, err := solimpl.NewAssertionChain(ctx, deployInfo.Rollup, chalManager, txOptsValidator, l1client, solimpl.NewDataPosterTransactor(dp)) + + assertionChain, err := solimpl.NewAssertionChain(ctx, deployInfo.Rollup, chalManager, txOptsValidator, l1client, solimpl.NewDataPosterTransactor(dp), solimpl.WithRpcHeadBlockNumber(rpc.BlockNumber(config.Bold.RpcHeadBlockNumber))) if err != nil { return nil, fmt.Errorf("could not create assertion chain: %w", err) } diff --git a/staker/state_provider.go b/staker/state_provider.go index e492b0b256..601ab614c8 100644 --- a/staker/state_provider.go +++ b/staker/state_provider.go @@ -57,6 +57,7 @@ type BoldConfig struct { APIHost string `koanf:"api-host"` APIPort uint16 `koanf:"api-port"` APIDBPath string `koanf:"api-db-path"` + RpcHeadBlockNumber int64 `koanf:"rpc-head-block-number"` } var DefaultBoldConfig = BoldConfig{ @@ -77,6 +78,7 @@ var DefaultBoldConfig = BoldConfig{ APIHost: "127.0.0.1", APIPort: 9393, APIDBPath: "/tmp/bold-api-db", + RpcHeadBlockNumber: -3, // Finalized block } func BoldConfigAddOptions(prefix string, f *flag.FlagSet) { @@ -97,6 +99,7 @@ func BoldConfigAddOptions(prefix string, f *flag.FlagSet) { f.String(prefix+".api-host", DefaultBoldConfig.APIHost, "bold api host") f.Uint16(prefix+".api-port", DefaultBoldConfig.APIPort, "bold api port") f.String(prefix+".api-db-path", DefaultBoldConfig.APIDBPath, "bold api db path") + f.Int64(prefix+".rpc-head-block-number", DefaultBoldConfig.RpcHeadBlockNumber, "head block number (safe(-4), final(-3), latest(-2)) to use for RPC calls") } func (c *BoldConfig) Validate() error {