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

Move tee address #392

Merged
merged 8 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 4 additions & 9 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +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"`
EspressoTEEVerifierAddress string `koanf:"espresso-tee-verifier-address"`
}

func (c *BatchPosterConfig) Validate() error {
Expand Down Expand Up @@ -249,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.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)
Expand Down Expand Up @@ -287,6 +289,7 @@ var DefaultBatchPosterConfig = BatchPosterConfig{
EspressoSwitchDelayThreshold: 350,
LightClientAddress: "",
HotShotUrl: "",
EspressoTEEVerifierAddress: "",
}

var DefaultBatchPosterL1WalletConfig = genericconf.WalletConfig{
Expand Down Expand Up @@ -387,6 +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().EspressoTEEVerifierAddress)
}

b := &BatchPoster{
Expand Down Expand Up @@ -1827,15 +1831,6 @@ func (b *BatchPoster) Start(ctxIn context.Context) {
}
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 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we deleting this check?

Copy link
Member Author

@zacshowa zacshowa Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this check only happens when the batch poster is started to prevent it from posting any data until the chain config was updated. Given we don't populate this at runtime anymore, the check doesn't matter

// 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
}
}
if common.HexToAddress(b.config().GasRefunderAddress) != (common.Address{}) {
gasRefunderBalance, err := b.l1Reader.Client().BalanceAt(ctx, common.HexToAddress(b.config().GasRefunderAddress), nil)
if err != nil {
Expand Down
25 changes: 4 additions & 21 deletions arbnode/transaction_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ type TransactionStreamer struct {
espressoTxnsPollingInterval time.Duration
espressoSwitchDelayThreshold uint64
// Public these fields for testing
HotshotDown bool
UseEscapeHatch bool
HotshotDown bool
UseEscapeHatch bool
espressoTEEVerifierAddress common.Address
}

type TransactionStreamerConfig struct {
Expand Down Expand Up @@ -670,21 +671,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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually can we remove the GetArbOSConfigAtHeight function? What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was planning to do that in a separate PR with an issue created here

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()
Expand Down Expand Up @@ -1777,10 +1763,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()
if err != nil {
return retryRate
}
enabledEspresso := s.espressoTEEVerifierAddress != common.Address{}
if enabledEspresso {
err := s.toggleEscapeHatch(ctx)
if err != nil {
Expand Down
129 changes: 0 additions & 129 deletions system_tests/espresso_arbos_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion system_tests/espresso_sovereign_sequencer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.EspressoTEEVerifierAddress = verifierAddress

// validator config
builder.nodeConfig.BlockValidator.Enable = true
Expand Down
Loading