From e77df10dc5ec1bf18807d96b42b9c5c04a73d9bc Mon Sep 17 00:00:00 2001 From: Zach Showalter Date: Mon, 16 Dec 2024 15:56:58 -0500 Subject: [PATCH 1/8] move espressoTeeVerifierAddr to transaction streamer This commit moves the TEE verifier contract address to the transaction streamer, configurable via the batch posters config. --- arbnode/batch_poster.go | 27 ++++++++++----------------- arbnode/transaction_streamer.go | 19 +++---------------- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/arbnode/batch_poster.go b/arbnode/batch_poster.go index a21cdd8f1d..784b5a64ae 100644 --- a/arbnode/batch_poster.go +++ b/arbnode/batch_poster.go @@ -181,13 +181,14 @@ type BatchPosterConfig struct { gasRefunder common.Address l1BlockBound l1BlockBound // Espresso specific flags - LightClientAddress string `koanf:"light-client-address"` - HotShotUrl string `koanf:"hotshot-url"` - UserDataAttestationFile string `koanf:"user-data-attestation-file"` - QuoteFile string `koanf:"quote-file"` - UseEscapeHatch bool `koanf:"use-escape-hatch"` - EspressoTxnsPollingInterval time.Duration `koanf:"espresso-txns-polling-interval"` - EspressoSwitchDelayThreshold uint64 `koanf:"espresso-switch-delay-threshold"` + LightClientAddress string `koanf:"light-client-address"` + HotShotUrl string `koanf:"hotshot-url"` + UserDataAttestationFile string `koanf:"user-data-attestation-file"` + QuoteFile string `koanf:"quote-file"` + UseEscapeHatch bool `koanf:"use-escape-hatch"` + EspressoTxnsPollingInterval time.Duration `koanf:"espresso-txns-polling-interval"` + EspressoSwitchDelayThreshold uint64 `koanf:"espresso-switch-delay-threshold"` + EspressoTEEVerifierAdddress common.Address `koanf:"espresso-tee-verifier-address"` } func (c *BatchPosterConfig) Validate() error { @@ -387,6 +388,7 @@ func NewBatchPoster(ctx context.Context, opts *BatchPosterOpts) (*BatchPoster, e opts.Streamer.UseEscapeHatch = opts.Config().UseEscapeHatch opts.Streamer.espressoTxnsPollingInterval = opts.Config().EspressoTxnsPollingInterval opts.Streamer.espressoSwitchDelayThreshold = opts.Config().EspressoSwitchDelayThreshold + opts.Streamer.espressoTEEVerifierAddress = opts.Config().EspressoTEEVerifierAdddress } b := &BatchPoster{ @@ -1826,16 +1828,7 @@ func (b *BatchPoster) Start(ctxIn context.Context) { espressoEphemeralErrorHandler.Reset() } b.CallIteratively(func(ctx context.Context) time.Duration { - var err error - espresso, _ := b.streamer.isEspressoMode() - if !espresso { - if b.streamer.lightClientReader != nil && b.streamer.espressoClient != nil { - // This mostly happens when a non-espresso nitro is upgrading to espresso nitro. - // The batch poster is set a espresso client and a light client reader, but waiting - // for the upgrade action - return b.config().PollInterval - } - } + var err error if common.HexToAddress(b.config().GasRefunderAddress) != (common.Address{}) { gasRefunderBalance, err := b.l1Reader.Client().BalanceAt(ctx, common.HexToAddress(b.config().GasRefunderAddress), nil) if err != nil { diff --git a/arbnode/transaction_streamer.go b/arbnode/transaction_streamer.go index 4a7296caf5..3baacb5e48 100644 --- a/arbnode/transaction_streamer.go +++ b/arbnode/transaction_streamer.go @@ -86,12 +86,14 @@ type TransactionStreamer struct { // Public these fields for testing HotshotDown bool UseEscapeHatch bool + espressoTEEVerifierAddress common.Address } type TransactionStreamerConfig struct { MaxBroadcasterQueueSize int `koanf:"max-broadcaster-queue-size"` MaxReorgResequenceDepth int64 `koanf:"max-reorg-resequence-depth" reload:"hot"` ExecuteMessageLoopDelay time.Duration `koanf:"execute-message-loop-delay" reload:"hot"` + } type TransactionStreamerConfigFetcher func() *TransactionStreamerConfig @@ -670,21 +672,6 @@ func (s *TransactionStreamer) AddFakeInitMessage() error { }}) } -func (s *TransactionStreamer) isEspressoMode() (bool, error) { - config, err := s.exec.GetArbOSConfigAtHeight(0) // Pass 0 to get the ArbOS config at current block height. - if err != nil { - return false, fmt.Errorf("error obtaining arbos config: %w", err) - } - if config == nil { - return false, fmt.Errorf("arbos config is not defined") - } - isSetInConfig := config.ArbitrumChainParams.EspressoTEEVerifierAddress != common.Address{} - if !isSetInConfig { - return false, nil - } - return true, nil -} - // Used in redis tests func (s *TransactionStreamer) GetMessageCountSync(t *testing.T) (arbutil.MessageIndex, error) { s.insertionMutex.Lock() @@ -1777,7 +1764,7 @@ func getLogLevel(err error) func(string, ...interface{}) { func (s *TransactionStreamer) espressoSwitch(ctx context.Context, ignored struct{}) time.Duration { retryRate := s.espressoTxnsPollingInterval * 50 - enabledEspresso, err := s.isEspressoMode() + enabledEspresso, err := s.espressoTEEVerifierAddress != common.Address{} if err != nil { return retryRate } From 0e1b7d94e0ff9f65ab205c83cba9fdd3a189f86c Mon Sep 17 00:00:00 2001 From: Zach Showalter Date: Mon, 16 Dec 2024 19:08:25 -0500 Subject: [PATCH 2/8] Fix tests and transaction_streamer --- arbnode/transaction_streamer.go | 5 +---- system_tests/espresso_sovereign_sequencer_test.go | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/arbnode/transaction_streamer.go b/arbnode/transaction_streamer.go index 3baacb5e48..3dfbdc36a0 100644 --- a/arbnode/transaction_streamer.go +++ b/arbnode/transaction_streamer.go @@ -1764,10 +1764,7 @@ func getLogLevel(err error) func(string, ...interface{}) { func (s *TransactionStreamer) espressoSwitch(ctx context.Context, ignored struct{}) time.Duration { retryRate := s.espressoTxnsPollingInterval * 50 - enabledEspresso, err := s.espressoTEEVerifierAddress != common.Address{} - if err != nil { - return retryRate - } + enabledEspresso := s.espressoTEEVerifierAddress != common.Address{} if enabledEspresso { err := s.toggleEscapeHatch(ctx) if err != nil { diff --git a/system_tests/espresso_sovereign_sequencer_test.go b/system_tests/espresso_sovereign_sequencer_test.go index 3d203cf20c..e51333345b 100644 --- a/system_tests/espresso_sovereign_sequencer_test.go +++ b/system_tests/espresso_sovereign_sequencer_test.go @@ -25,7 +25,6 @@ func createL1AndL2Node( builder.l1StackConfig.WSHost = "0.0.0.0" builder.l1StackConfig.DataDir = t.TempDir() builder.l1StackConfig.WSModules = append(builder.l1StackConfig.WSModules, "eth") - builder.chainConfig.ArbitrumChainParams.EspressoTEEVerifierAddress = common.HexToAddress(verifierAddress) // poster config builder.nodeConfig.BatchPoster.Enable = true @@ -35,6 +34,7 @@ func createL1AndL2Node( builder.nodeConfig.BatchPoster.MaxDelay = -1000 * time.Hour builder.nodeConfig.BatchPoster.LightClientAddress = lightClientAddress builder.nodeConfig.BatchPoster.HotShotUrl = hotShotUrl + builder.nodeConfig.BatchPoster.EspressoTEEVerifierAdddress = common.HexToAddress(verifierAddress) // validator config builder.nodeConfig.BlockValidator.Enable = true From 70b1ea52187fa4b9b9f5fd69067be902b7937b06 Mon Sep 17 00:00:00 2001 From: Zach Showalter Date: Mon, 16 Dec 2024 20:06:16 -0500 Subject: [PATCH 3/8] use a string for tee verifier address Koanf cannot parse a common.Address by default, so we should use a string when taking in this config option. --- arbnode/batch_poster.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arbnode/batch_poster.go b/arbnode/batch_poster.go index 784b5a64ae..9b470cf7c4 100644 --- a/arbnode/batch_poster.go +++ b/arbnode/batch_poster.go @@ -188,7 +188,7 @@ type BatchPosterConfig struct { UseEscapeHatch bool `koanf:"use-escape-hatch"` EspressoTxnsPollingInterval time.Duration `koanf:"espresso-txns-polling-interval"` EspressoSwitchDelayThreshold uint64 `koanf:"espresso-switch-delay-threshold"` - EspressoTEEVerifierAdddress common.Address `koanf:"espresso-tee-verifier-address"` + EspressoTEEVerifierAdddress string `koanf:"espresso-tee-verifier-address"` } func (c *BatchPosterConfig) Validate() error { @@ -250,6 +250,7 @@ func BatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) { f.Bool(prefix+".use-escape-hatch", DefaultBatchPosterConfig.UseEscapeHatch, "if true, batches will be posted without doing the espresso verification when hotshot is down. If false, wait for hotshot being up") f.Duration(prefix+".espresso-txns-polling-interval", DefaultBatchPosterConfig.EspressoTxnsPollingInterval, "interval between polling for transactions to be included in the block") f.Uint64(prefix+".espresso-switch-delay-threshold", DefaultBatchPosterConfig.EspressoSwitchDelayThreshold, "specifies the switch delay threshold used to determine hotshot liveness") + f.String(prefix+"espresso-tee-verifier-address", DefaultBatchPosterConfig.EspressoTEEVerifierAdddress, "") redislock.AddConfigOptions(prefix+".redis-lock", f) dataposter.DataPosterConfigAddOptions(prefix+".data-poster", f, dataposter.DefaultDataPosterConfig) genericconf.WalletConfigAddOptions(prefix+".parent-chain-wallet", f, DefaultBatchPosterConfig.ParentChainWallet.Pathname) @@ -288,6 +289,7 @@ var DefaultBatchPosterConfig = BatchPosterConfig{ EspressoSwitchDelayThreshold: 350, LightClientAddress: "", HotShotUrl: "", + EspressoTEEVerifierAdddress: "" } var DefaultBatchPosterL1WalletConfig = genericconf.WalletConfig{ @@ -388,7 +390,7 @@ func NewBatchPoster(ctx context.Context, opts *BatchPosterOpts) (*BatchPoster, e opts.Streamer.UseEscapeHatch = opts.Config().UseEscapeHatch opts.Streamer.espressoTxnsPollingInterval = opts.Config().EspressoTxnsPollingInterval opts.Streamer.espressoSwitchDelayThreshold = opts.Config().EspressoSwitchDelayThreshold - opts.Streamer.espressoTEEVerifierAddress = opts.Config().EspressoTEEVerifierAdddress + opts.Streamer.espressoTEEVerifierAddress = common.HexToAddress(opts.Config().EspressoTEEVerifierAdddress) } b := &BatchPoster{ From 0230b1f99c75252bbca3c030d37a546a7a3fa2a4 Mon Sep 17 00:00:00 2001 From: Zach Showalter Date: Mon, 16 Dec 2024 20:30:31 -0500 Subject: [PATCH 4/8] fix compilation --- arbnode/batch_poster.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbnode/batch_poster.go b/arbnode/batch_poster.go index 9b470cf7c4..d3195935ee 100644 --- a/arbnode/batch_poster.go +++ b/arbnode/batch_poster.go @@ -289,7 +289,7 @@ var DefaultBatchPosterConfig = BatchPosterConfig{ EspressoSwitchDelayThreshold: 350, LightClientAddress: "", HotShotUrl: "", - EspressoTEEVerifierAdddress: "" + EspressoTEEVerifierAdddress: "", } var DefaultBatchPosterL1WalletConfig = genericconf.WalletConfig{ From 6a03d80a86dae60c7141edaea90b93c82e98b648 Mon Sep 17 00:00:00 2001 From: Zach Showalter Date: Mon, 16 Dec 2024 21:06:07 -0500 Subject: [PATCH 5/8] fix e2e test --- system_tests/espresso_sovereign_sequencer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system_tests/espresso_sovereign_sequencer_test.go b/system_tests/espresso_sovereign_sequencer_test.go index e51333345b..c315032bf2 100644 --- a/system_tests/espresso_sovereign_sequencer_test.go +++ b/system_tests/espresso_sovereign_sequencer_test.go @@ -34,7 +34,7 @@ func createL1AndL2Node( builder.nodeConfig.BatchPoster.MaxDelay = -1000 * time.Hour builder.nodeConfig.BatchPoster.LightClientAddress = lightClientAddress builder.nodeConfig.BatchPoster.HotShotUrl = hotShotUrl - builder.nodeConfig.BatchPoster.EspressoTEEVerifierAdddress = common.HexToAddress(verifierAddress) + builder.nodeConfig.BatchPoster.EspressoTEEVerifierAdddress = verifierAddress // validator config builder.nodeConfig.BlockValidator.Enable = true From 50e3beb74e7435239716f61da0e25f2e1d521007 Mon Sep 17 00:00:00 2001 From: Zach Showalter Date: Mon, 16 Dec 2024 21:10:32 -0500 Subject: [PATCH 6/8] Fix config parsing --- arbnode/batch_poster.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbnode/batch_poster.go b/arbnode/batch_poster.go index d3195935ee..6710a6ffd6 100644 --- a/arbnode/batch_poster.go +++ b/arbnode/batch_poster.go @@ -250,7 +250,7 @@ func BatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) { f.Bool(prefix+".use-escape-hatch", DefaultBatchPosterConfig.UseEscapeHatch, "if true, batches will be posted without doing the espresso verification when hotshot is down. If false, wait for hotshot being up") f.Duration(prefix+".espresso-txns-polling-interval", DefaultBatchPosterConfig.EspressoTxnsPollingInterval, "interval between polling for transactions to be included in the block") f.Uint64(prefix+".espresso-switch-delay-threshold", DefaultBatchPosterConfig.EspressoSwitchDelayThreshold, "specifies the switch delay threshold used to determine hotshot liveness") - f.String(prefix+"espresso-tee-verifier-address", DefaultBatchPosterConfig.EspressoTEEVerifierAdddress, "") + f.String(prefix+".espresso-tee-verifier-address", DefaultBatchPosterConfig.EspressoTEEVerifierAdddress, "") redislock.AddConfigOptions(prefix+".redis-lock", f) dataposter.DataPosterConfigAddOptions(prefix+".data-poster", f, dataposter.DefaultDataPosterConfig) genericconf.WalletConfigAddOptions(prefix+".parent-chain-wallet", f, DefaultBatchPosterConfig.ParentChainWallet.Pathname) From 2974fc6356d339db9f61db934adb4b239c27fd5e Mon Sep 17 00:00:00 2001 From: Zach Showalter Date: Mon, 16 Dec 2024 22:06:30 -0500 Subject: [PATCH 7/8] Fix lint and run formatter --- arbnode/batch_poster.go | 24 +++++++++---------- arbnode/transaction_streamer.go | 7 +++--- .../espresso_sovereign_sequencer_test.go | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/arbnode/batch_poster.go b/arbnode/batch_poster.go index 6710a6ffd6..080dfea391 100644 --- a/arbnode/batch_poster.go +++ b/arbnode/batch_poster.go @@ -181,14 +181,14 @@ type BatchPosterConfig struct { gasRefunder common.Address l1BlockBound l1BlockBound // Espresso specific flags - LightClientAddress string `koanf:"light-client-address"` - HotShotUrl string `koanf:"hotshot-url"` - UserDataAttestationFile string `koanf:"user-data-attestation-file"` - QuoteFile string `koanf:"quote-file"` - UseEscapeHatch bool `koanf:"use-escape-hatch"` - EspressoTxnsPollingInterval time.Duration `koanf:"espresso-txns-polling-interval"` - EspressoSwitchDelayThreshold uint64 `koanf:"espresso-switch-delay-threshold"` - EspressoTEEVerifierAdddress string `koanf:"espresso-tee-verifier-address"` + LightClientAddress string `koanf:"light-client-address"` + HotShotUrl string `koanf:"hotshot-url"` + UserDataAttestationFile string `koanf:"user-data-attestation-file"` + QuoteFile string `koanf:"quote-file"` + UseEscapeHatch bool `koanf:"use-escape-hatch"` + EspressoTxnsPollingInterval time.Duration `koanf:"espresso-txns-polling-interval"` + EspressoSwitchDelayThreshold uint64 `koanf:"espresso-switch-delay-threshold"` + EspressoTEEVerifierAddress string `koanf:"espresso-tee-verifier-address"` } func (c *BatchPosterConfig) Validate() error { @@ -250,7 +250,7 @@ func BatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) { f.Bool(prefix+".use-escape-hatch", DefaultBatchPosterConfig.UseEscapeHatch, "if true, batches will be posted without doing the espresso verification when hotshot is down. If false, wait for hotshot being up") f.Duration(prefix+".espresso-txns-polling-interval", DefaultBatchPosterConfig.EspressoTxnsPollingInterval, "interval between polling for transactions to be included in the block") f.Uint64(prefix+".espresso-switch-delay-threshold", DefaultBatchPosterConfig.EspressoSwitchDelayThreshold, "specifies the switch delay threshold used to determine hotshot liveness") - f.String(prefix+".espresso-tee-verifier-address", DefaultBatchPosterConfig.EspressoTEEVerifierAdddress, "") + f.String(prefix+".espresso-tee-verifier-address", DefaultBatchPosterConfig.EspressoTEEVerifierAddress, "") redislock.AddConfigOptions(prefix+".redis-lock", f) dataposter.DataPosterConfigAddOptions(prefix+".data-poster", f, dataposter.DefaultDataPosterConfig) genericconf.WalletConfigAddOptions(prefix+".parent-chain-wallet", f, DefaultBatchPosterConfig.ParentChainWallet.Pathname) @@ -289,7 +289,7 @@ var DefaultBatchPosterConfig = BatchPosterConfig{ EspressoSwitchDelayThreshold: 350, LightClientAddress: "", HotShotUrl: "", - EspressoTEEVerifierAdddress: "", + EspressoTEEVerifierAddress: "", } var DefaultBatchPosterL1WalletConfig = genericconf.WalletConfig{ @@ -390,7 +390,7 @@ func NewBatchPoster(ctx context.Context, opts *BatchPosterOpts) (*BatchPoster, e opts.Streamer.UseEscapeHatch = opts.Config().UseEscapeHatch opts.Streamer.espressoTxnsPollingInterval = opts.Config().EspressoTxnsPollingInterval opts.Streamer.espressoSwitchDelayThreshold = opts.Config().EspressoSwitchDelayThreshold - opts.Streamer.espressoTEEVerifierAddress = common.HexToAddress(opts.Config().EspressoTEEVerifierAdddress) + opts.Streamer.espressoTEEVerifierAddress = common.HexToAddress(opts.Config().EspressoTEEVerifierAddress) } b := &BatchPoster{ @@ -1830,7 +1830,7 @@ func (b *BatchPoster) Start(ctxIn context.Context) { espressoEphemeralErrorHandler.Reset() } b.CallIteratively(func(ctx context.Context) time.Duration { - var err error + var err error if common.HexToAddress(b.config().GasRefunderAddress) != (common.Address{}) { gasRefunderBalance, err := b.l1Reader.Client().BalanceAt(ctx, common.HexToAddress(b.config().GasRefunderAddress), nil) if err != nil { diff --git a/arbnode/transaction_streamer.go b/arbnode/transaction_streamer.go index 3dfbdc36a0..7ce33d47c5 100644 --- a/arbnode/transaction_streamer.go +++ b/arbnode/transaction_streamer.go @@ -84,16 +84,15 @@ type TransactionStreamer struct { espressoTxnsPollingInterval time.Duration espressoSwitchDelayThreshold uint64 // Public these fields for testing - HotshotDown bool - UseEscapeHatch bool - espressoTEEVerifierAddress common.Address + HotshotDown bool + UseEscapeHatch bool + espressoTEEVerifierAddress common.Address } type TransactionStreamerConfig struct { MaxBroadcasterQueueSize int `koanf:"max-broadcaster-queue-size"` MaxReorgResequenceDepth int64 `koanf:"max-reorg-resequence-depth" reload:"hot"` ExecuteMessageLoopDelay time.Duration `koanf:"execute-message-loop-delay" reload:"hot"` - } type TransactionStreamerConfigFetcher func() *TransactionStreamerConfig diff --git a/system_tests/espresso_sovereign_sequencer_test.go b/system_tests/espresso_sovereign_sequencer_test.go index c315032bf2..f532b7e4be 100644 --- a/system_tests/espresso_sovereign_sequencer_test.go +++ b/system_tests/espresso_sovereign_sequencer_test.go @@ -34,7 +34,7 @@ func createL1AndL2Node( builder.nodeConfig.BatchPoster.MaxDelay = -1000 * time.Hour builder.nodeConfig.BatchPoster.LightClientAddress = lightClientAddress builder.nodeConfig.BatchPoster.HotShotUrl = hotShotUrl - builder.nodeConfig.BatchPoster.EspressoTEEVerifierAdddress = verifierAddress + builder.nodeConfig.BatchPoster.EspressoTEEVerifierAddress = verifierAddress // validator config builder.nodeConfig.BlockValidator.Enable = true From 39bcf41a53c9e34d817a2b0f8f0907a84980103b Mon Sep 17 00:00:00 2001 From: Zach Showalter Date: Tue, 17 Dec 2024 13:12:22 -0500 Subject: [PATCH 8/8] Remove outdated test --- system_tests/espresso_arbos_test.go | 129 ---------------------------- 1 file changed, 129 deletions(-) delete mode 100644 system_tests/espresso_arbos_test.go diff --git a/system_tests/espresso_arbos_test.go b/system_tests/espresso_arbos_test.go deleted file mode 100644 index 91474e132a..0000000000 --- a/system_tests/espresso_arbos_test.go +++ /dev/null @@ -1,129 +0,0 @@ -package arbtest - -import ( - "context" - "encoding/json" - "fmt" - "math/big" - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/params" - "github.com/offchainlabs/nitro/arbutil" - "github.com/offchainlabs/nitro/solgen/go/precompilesgen" -) - -func EspressoArbOSTestChainConfig() *params.ChainConfig { - return ¶ms.ChainConfig{ - ChainID: big.NewInt(412346), - HomesteadBlock: big.NewInt(0), - DAOForkBlock: nil, - DAOForkSupport: true, - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), - ConstantinopleBlock: big.NewInt(0), - PetersburgBlock: big.NewInt(0), - IstanbulBlock: big.NewInt(0), - MuirGlacierBlock: big.NewInt(0), - BerlinBlock: big.NewInt(0), - LondonBlock: big.NewInt(0), - ArbitrumChainParams: EspressoTestChainParams(), - Clique: ¶ms.CliqueConfig{ - Period: 0, - Epoch: 0, - }, - } -} -func EspressoTestChainParams() params.ArbitrumChainParams { - return params.ArbitrumChainParams{ - EnableArbOS: true, - AllowDebugPrecompiles: true, - DataAvailabilityCommittee: false, - InitialArbOSVersion: 31, - InitialChainOwner: common.Address{}, - EspressoTEEVerifierAddress: common.Address{}, - } -} - -func waitForConfigUpdate(t *testing.T, ctx context.Context, builder *NodeBuilder) error { - - return waitForWith(ctx, 120*time.Second, 1*time.Second, func() bool { - newArbOSConfig, err := builder.L2.ExecNode.GetArbOSConfigAtHeight(0) - Require(t, err) - - emptyAddress := common.Address{} - if newArbOSConfig.ArbitrumChainParams.EspressoTEEVerifierAddress != emptyAddress { - return false - } - Require(t, err) - return true - }) -} - -func TestEspressoArbOSConfig(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - builder, cleanup := createL1AndL2Node(ctx, t, true) - defer cleanup() - - err := waitForL1Node(ctx) - Require(t, err) - - cleanEspresso := runEspresso() - defer cleanEspresso() - - // wait for the builder - err = waitForEspressoNode(ctx) - Require(t, err) - - l2Node := builder.L2 - - // Wait for the initial message - expected := arbutil.MessageIndex(1) - err = waitFor(ctx, func() bool { - msgCnt, err := l2Node.ConsensusNode.TxStreamer.GetMessageCount() - if err != nil { - panic(err) - } - - validatedCnt := l2Node.ConsensusNode.BlockValidator.Validated(t) - return msgCnt >= expected && validatedCnt >= expected - }) - Require(t, err) - - initialArbOSConfig, err := builder.L2.ExecNode.GetArbOSConfigAtHeight(0) - Require(t, err) - - // assert that espresso is initially enabled - if initialArbOSConfig.ArbitrumChainParams.EspressoTEEVerifierAddress != common.HexToAddress(verifierAddress) { - err = fmt.Errorf("Initial config should have EspressoTEEVerifierAddress == common.HexToAddress(verifierAddress)!") - - } - Require(t, err) - - newArbOwner, err := precompilesgen.NewArbOwner(common.HexToAddress("0x070"), builder.L2.Client) - Require(t, err) - - newArbDebug, err := precompilesgen.NewArbDebug(common.HexToAddress("0xff"), builder.L2.Client) - Require(t, err) - - l2auth := builder.L2Info.GetDefaultTransactOpts("Owner", ctx) - - _, err = newArbDebug.BecomeChainOwner(&l2auth) - Require(t, err) - chainConfig, err := json.Marshal(EspressoArbOSTestChainConfig()) - Require(t, err) - - chainConfigString := string(chainConfig) - - _, err = newArbOwner.SetChainConfig(&l2auth, chainConfigString) - Require(t, err) - // check if chain config is updated TODO replace this with a wait for with to poll for some time potentially - - err = waitForConfigUpdate(t, ctx, builder) - Require(t, err) -}