-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into snapshotter
- Loading branch information
Showing
34 changed files
with
724 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
version: 0.2 | ||
|
||
env: | ||
exported-variables: | ||
- IMAGE_TAG | ||
|
||
phases: | ||
pre_build: | ||
commands: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule rust
updated
5 files
+8 −2 | stylus-sdk/src/storage/array.rs | |
+16 −4 | stylus-sdk/src/storage/bytes.rs | |
+8 −2 | stylus-sdk/src/storage/map.rs | |
+8 −2 | stylus-sdk/src/storage/mod.rs | |
+8 −2 | stylus-sdk/src/storage/vec.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// Copyright 2021-2025, Offchain Labs, Inc. | ||
// For license information, see https://github.com/nitro/blob/master/LICENSE | ||
|
||
package arbnode | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"time" | ||
|
||
flag "github.com/spf13/pflag" | ||
|
||
"github.com/ethereum/go-ethereum/log" | ||
|
||
"github.com/offchainlabs/nitro/arbutil" | ||
"github.com/offchainlabs/nitro/execution" | ||
"github.com/offchainlabs/nitro/staker" | ||
"github.com/offchainlabs/nitro/util/headerreader" | ||
"github.com/offchainlabs/nitro/util/stopwaiter" | ||
) | ||
|
||
type ConsensusExecutionSyncerConfig struct { | ||
SyncInterval time.Duration `koanf:"sync-interval"` | ||
} | ||
|
||
var DefaultConsensusExecutionSyncerConfig = ConsensusExecutionSyncerConfig{ | ||
SyncInterval: 1 * time.Second, | ||
} | ||
|
||
func ConsensusExecutionSyncerConfigAddOptions(prefix string, f *flag.FlagSet) { | ||
f.Duration(prefix+".sync-interval", DefaultConsensusExecutionSyncerConfig.SyncInterval, "Interval in which finality data is pushed from consensus to execution") | ||
} | ||
|
||
type ConsensusExecutionSyncer struct { | ||
stopwaiter.StopWaiter | ||
|
||
config func() *ConsensusExecutionSyncerConfig | ||
|
||
inboxReader *InboxReader | ||
execClient execution.ExecutionClient | ||
blockValidator *staker.BlockValidator | ||
} | ||
|
||
func NewConsensusExecutionSyncer( | ||
config func() *ConsensusExecutionSyncerConfig, | ||
inboxReader *InboxReader, | ||
execClient execution.ExecutionClient, | ||
blockValidator *staker.BlockValidator, | ||
) *ConsensusExecutionSyncer { | ||
return &ConsensusExecutionSyncer{ | ||
config: config, | ||
inboxReader: inboxReader, | ||
execClient: execClient, | ||
blockValidator: blockValidator, | ||
} | ||
} | ||
|
||
func (c *ConsensusExecutionSyncer) Start(ctx_in context.Context) { | ||
c.StopWaiter.Start(ctx_in, c) | ||
c.CallIteratively(c.pushFinalityDataFromConsensusToExecution) | ||
} | ||
|
||
func (c *ConsensusExecutionSyncer) pushFinalityDataFromConsensusToExecution(ctx context.Context) time.Duration { | ||
safeMsgCount, err := c.inboxReader.GetSafeMsgCount(ctx) | ||
if errors.Is(err, headerreader.ErrBlockNumberNotSupported) { | ||
log.Warn("Finality not supported, not pushing finality data to execution") | ||
return c.config().SyncInterval | ||
} else if err != nil { | ||
log.Error("Error getting safe message count", "err", err) | ||
return c.config().SyncInterval | ||
} | ||
|
||
finalizedMsgCount, err := c.inboxReader.GetFinalizedMsgCount(ctx) | ||
if errors.Is(err, headerreader.ErrBlockNumberNotSupported) { | ||
log.Warn("Finality not supported, not pushing finality data to execution") | ||
return c.config().SyncInterval | ||
} else if err != nil { | ||
log.Error("Error getting finalized message count", "err", err) | ||
return c.config().SyncInterval | ||
} | ||
|
||
var validatedMsgCount arbutil.MessageIndex | ||
if c.blockValidator != nil { | ||
validatedMsgCount = c.blockValidator.GetValidated() | ||
} | ||
|
||
finalityData := &arbutil.FinalityData{ | ||
SafeMsgCount: safeMsgCount, | ||
FinalizedMsgCount: finalizedMsgCount, | ||
ValidatedMsgCount: &validatedMsgCount, | ||
} | ||
|
||
err = c.execClient.SetFinalityData(ctx, finalityData) | ||
if err != nil { | ||
log.Error("Error pushing finality data from consensus to execution", "err", err) | ||
} else { | ||
log.Info("Pushed finality data from consensus to execution", "finalityData", finalityData) | ||
} | ||
|
||
return c.config().SyncInterval | ||
} |
Oops, something went wrong.