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

ExecutionClient returns PromiseInterface #2856

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
baec7fc
ExecutionClient.ResultAtPos returns PromiseInterface
diegoximenes Dec 24, 2024
46da509
ExecutionClient.DigestMessage returns PromiseInterface
diegoximenes Dec 24, 2024
f880b81
ExecutionClient.Reorg returns PromiseInterface
diegoximenes Dec 24, 2024
9614533
ExecutionClient.HeadMessageNumber returns PromiseInterface
diegoximenes Dec 24, 2024
cf800b4
ExecutionClient.HeadMessageNumberSync returns PromiseInterface
diegoximenes Dec 24, 2024
700de67
Fixes context usage when awaiting promises returned by ExecutionClient
diegoximenes Dec 24, 2024
4e6c52f
Fixes reorg_requesequencing_test
diegoximenes Dec 24, 2024
f3d2051
Fixes context used for execution client in transaction_streamer
diegoximenes Dec 24, 2024
6146145
Moves MarkFeedStart to ExecutionClient
diegoximenes Dec 26, 2024
2d09773
NonFullExecutionClient
diegoximenes Dec 26, 2024
df91186
Renames NonFullExecutionClient to ExecutionClientImpl
diegoximenes Dec 26, 2024
d2e3841
Fix lint issue
diegoximenes Dec 26, 2024
3d9b619
Removes HeadMessageNumberSync from ExecutionClient
diegoximenes Dec 30, 2024
dd72cf6
Uses ExecutionClient instead of ExecutionSequencer in TransactionStre…
diegoximenes Dec 30, 2024
504060b
Moves Maintenance from FullExecutionClient to ExecutionClient
diegoximenes Dec 30, 2024
8147b2c
Uses ExecutionClient instead of FullExecutionClient in MaintenanceRunner
diegoximenes Dec 30, 2024
e03febc
ExecutionClient.Maintenance returns promise
diegoximenes Dec 30, 2024
962c3a0
Refactor CreateNode
diegoximenes Dec 31, 2024
316e9e9
Renames CreateNode to CreateNodeFullExecutionClient
diegoximenes Dec 31, 2024
ff3d3d7
Uses more specific execution interfaces in createNodeImpl
diegoximenes Jan 1, 2025
621d945
ExecutionBatchPoster
diegoximenes Jan 1, 2025
b4bd1fc
Get rid of FullExecutionClient
diegoximenes Jan 1, 2025
db2c8dc
Checks execution clients in CreateNodeFullExecutionClient
diegoximenes Jan 2, 2025
5ff9d78
Moves execution clients nil check to get funcs
diegoximenes Jan 2, 2025
db9c5c4
Pass config to get functions
diegoximenes Jan 2, 2025
c7efe24
Split arguments of get functions in multiple lines
diegoximenes Jan 2, 2025
7cbae44
Get rid of ExecutionClientImpl
diegoximenes Jan 2, 2025
70a1743
Fixes inbox_test
diegoximenes Jan 2, 2025
375bd8d
Fixes Node.Start nil reference
diegoximenes Jan 2, 2025
483c082
ExecutionClient.Start and ExecutionClient.StopAndWait return promises
diegoximenes Jan 3, 2025
f5034ab
Fixes challengetests
diegoximenes Jan 3, 2025
da6022a
Fixes snap sync test procedure when creating arb node
diegoximenes Jan 3, 2025
53701a7
Avoids using context.Background() in transaction streamer
diegoximenes Jan 15, 2025
aec3f68
Merge branch 'master' into promise_exec_client
eljobe Jan 16, 2025
65aebb6
Merge branch 'master' into promise_exec_client
eljobe Jan 16, 2025
ad1f72a
Merge branch 'master' into promise_exec_client
eljobe Jan 17, 2025
251166c
Merge branch 'master' into promise_exec_client
eljobe Jan 17, 2025
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
4 changes: 2 additions & 2 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type BatchPoster struct {
l1Reader *headerreader.HeaderReader
inbox *InboxTracker
streamer *TransactionStreamer
arbOSVersionGetter execution.FullExecutionClient
arbOSVersionGetter execution.ExecutionBatchPoster
config BatchPosterConfigFetcher
seqInbox *bridgegen.SequencerInbox
syncMonitor *SyncMonitor
Expand Down Expand Up @@ -307,7 +307,7 @@ type BatchPosterOpts struct {
L1Reader *headerreader.HeaderReader
Inbox *InboxTracker
Streamer *TransactionStreamer
VersionGetter execution.FullExecutionClient
VersionGetter execution.ExecutionBatchPoster
SyncMonitor *SyncMonitor
Config BatchPosterConfigFetcher
DeployInfo *chaininfo.RollupAddresses
Expand Down
64 changes: 59 additions & 5 deletions arbnode/inbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,81 @@ import (
"github.com/offchainlabs/nitro/arbos/l2pricing"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/execution"
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/statetransfer"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/containers"
"github.com/offchainlabs/nitro/util/testhelpers"
"github.com/offchainlabs/nitro/util/testhelpers/env"
)

type execClientWrapper struct {
*gethexec.ExecutionEngine
t *testing.T
ExecutionEngine *gethexec.ExecutionEngine
t *testing.T
}

func (w *execClientWrapper) Pause() { w.t.Error("not supported") }
func (w *execClientWrapper) Activate() { w.t.Error("not supported") }
func (w *execClientWrapper) Pause() { w.t.Error("not supported") }

func (w *execClientWrapper) Activate() { w.t.Error("not supported") }

func (w *execClientWrapper) ForwardTo(url string) error { w.t.Error("not supported"); return nil }
func (w *execClientWrapper) Synced() bool { w.t.Error("not supported"); return false }

func (w *execClientWrapper) SequenceDelayedMessage(message *arbostypes.L1IncomingMessage, delayedSeqNum uint64) error {
return w.ExecutionEngine.SequenceDelayedMessage(message, delayedSeqNum)
}

func (w *execClientWrapper) NextDelayedMessageNumber() (uint64, error) {
return w.ExecutionEngine.NextDelayedMessageNumber()
}

func (w *execClientWrapper) MarkFeedStart(to arbutil.MessageIndex) containers.PromiseInterface[struct{}] {
markFeedStartWithReturn := func(to arbutil.MessageIndex) (struct{}, error) {
w.ExecutionEngine.MarkFeedStart(to)
return struct{}{}, nil
}
return containers.NewReadyPromise(markFeedStartWithReturn(to))
}

func (w *execClientWrapper) Maintenance() containers.PromiseInterface[struct{}] {
return containers.NewReadyPromise(struct{}{}, nil)
}

func (w *execClientWrapper) Synced() bool { w.t.Error("not supported"); return false }

func (w *execClientWrapper) FullSyncProgressMap() map[string]interface{} {
w.t.Error("not supported")
return nil
}

func (w *execClientWrapper) DigestMessage(num arbutil.MessageIndex, msg *arbostypes.MessageWithMetadata, msgForPrefetch *arbostypes.MessageWithMetadata) containers.PromiseInterface[*execution.MessageResult] {
return containers.NewReadyPromise(w.ExecutionEngine.DigestMessage(num, msg, msgForPrefetch))
}

func (w *execClientWrapper) Reorg(count arbutil.MessageIndex, newMessages []arbostypes.MessageWithMetadataAndBlockHash, oldMessages []*arbostypes.MessageWithMetadata) containers.PromiseInterface[[]*execution.MessageResult] {
return containers.NewReadyPromise(w.ExecutionEngine.Reorg(count, newMessages, oldMessages))
}

func (w *execClientWrapper) HeadMessageNumber() containers.PromiseInterface[arbutil.MessageIndex] {
return containers.NewReadyPromise(w.ExecutionEngine.HeadMessageNumber())
}

func (w *execClientWrapper) HeadMessageNumberSync(t *testing.T) containers.PromiseInterface[arbutil.MessageIndex] {
return containers.NewReadyPromise(w.ExecutionEngine.HeadMessageNumberSync(t))
}

func (w *execClientWrapper) ResultAtPos(pos arbutil.MessageIndex) containers.PromiseInterface[*execution.MessageResult] {
return containers.NewReadyPromise(w.ExecutionEngine.ResultAtPos(pos))
}

func (w *execClientWrapper) Start(ctx context.Context) containers.PromiseInterface[struct{}] {
return containers.NewReadyPromise(struct{}{}, nil)
}

func (w *execClientWrapper) StopAndWait() containers.PromiseInterface[struct{}] {
return containers.NewReadyPromise(struct{}{}, nil)
}

func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (*gethexec.ExecutionEngine, *TransactionStreamer, ethdb.Database, *core.BlockChain) {
chainConfig := chaininfo.ArbitrumDevTestChainConfig()

Expand Down
7 changes: 4 additions & 3 deletions arbnode/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
type MaintenanceRunner struct {
stopwaiter.StopWaiter

exec execution.FullExecutionClient
exec execution.ExecutionClient
config MaintenanceConfigFetcher
seqCoordinator *SeqCoordinator
dbs []ethdb.Database
Expand Down Expand Up @@ -87,7 +87,7 @@ var DefaultMaintenanceConfig = MaintenanceConfig{

type MaintenanceConfigFetcher func() *MaintenanceConfig

func NewMaintenanceRunner(config MaintenanceConfigFetcher, seqCoordinator *SeqCoordinator, dbs []ethdb.Database, exec execution.FullExecutionClient) (*MaintenanceRunner, error) {
func NewMaintenanceRunner(config MaintenanceConfigFetcher, seqCoordinator *SeqCoordinator, dbs []ethdb.Database, exec execution.ExecutionClient) (*MaintenanceRunner, error) {
cfg := config()
if err := cfg.Validate(); err != nil {
return nil, fmt.Errorf("validating config: %w", err)
Expand Down Expand Up @@ -183,7 +183,8 @@ func (mr *MaintenanceRunner) runMaintenance() {
}
expected++
go func() {
results <- mr.exec.Maintenance()
_, res := mr.exec.Maintenance().Await(mr.GetContext())
results <- res
}()
for i := 0; i < expected; i++ {
err := <-results
Expand Down
Loading
Loading