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

[NIT-1264] V0 Snap Sync #2265

Merged
merged 35 commits into from
Jun 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1588fb7
V0 Snap Sync
amsanghi Apr 30, 2024
0a4b8b7
fixes
amsanghi May 2, 2024
fdf0772
Merge branch 'master' into snap_sync
amsanghi May 2, 2024
b718627
fix typo
amsanghi May 2, 2024
778eb25
cleanup
amsanghi May 2, 2024
a6d0c92
fix test
amsanghi May 2, 2024
ac9f171
fix
amsanghi May 6, 2024
7199df5
Merge branch 'master' into snap_sync
amsanghi May 6, 2024
54b5d7f
Merge branch 'master' into snap_sync
tsahee May 6, 2024
1309d92
Merge branch 'master' into snap_sync
amsanghi May 7, 2024
9259495
Changes based on PR comments
amsanghi May 7, 2024
b71bcd4
Changes based on PR comments
amsanghi May 7, 2024
edfa8f0
Merge branch 'master' into snap_sync
amsanghi May 9, 2024
c57bbae
Changes based on PR comments
amsanghi May 9, 2024
b22cf8f
Merge branch 'master' into snap_sync
amsanghi May 13, 2024
a4d4aeb
Changes based on PR comments
amsanghi May 14, 2024
95c79c2
minor fix
amsanghi May 14, 2024
3dbe2cd
Changes based on PR comments
amsanghi May 14, 2024
551e509
Merge branch 'master' into snap_sync
amsanghi May 14, 2024
46ddd69
Changes based on PR comments
amsanghi May 14, 2024
21208fb
fix test
amsanghi May 15, 2024
ddde138
fix race condition
amsanghi May 15, 2024
045018c
refractor
amsanghi May 15, 2024
1c4f76e
refractor
amsanghi May 15, 2024
4693a7a
Merge branch 'master' into snap_sync
amsanghi May 20, 2024
1fbb0cb
Merge branch 'master' into snap_sync
amsanghi May 28, 2024
45a23a4
Changes based on PR comments
amsanghi May 28, 2024
c8a3c16
Merge branch 'master' into snap_sync
amsanghi May 29, 2024
099cfac
Merge branch 'master' into snap_sync
amsanghi Jun 3, 2024
bd6e9ea
fix tests
amsanghi Jun 3, 2024
80ee48a
Changes based on PR comments
amsanghi Jun 3, 2024
b82d5ec
Changes based on PR comments
amsanghi Jun 3, 2024
4eaaced
Merge branch 'master' into snap_sync
amsanghi Jun 3, 2024
9889555
Merge branch 'master' into snap_sync
tsahee Jun 3, 2024
f299dfc
Merge branch 'master' into snap_sync
tsahee Jun 4, 2024
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
3 changes: 1 addition & 2 deletions arbnode/inbox_test.go
Original file line number Diff line number Diff line change
@@ -61,13 +61,12 @@ func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (*
}

transactionStreamerConfigFetcher := func() *TransactionStreamerConfig { return &DefaultTransactionStreamerConfig }
snapSyncConfigFetcher := func() *SnapSyncConfig { return &DefaultSnapSyncConfig }
execEngine, err := gethexec.NewExecutionEngine(bc)
if err != nil {
Fail(t, err)
}
execSeq := &execClientWrapper{execEngine, t}
inbox, err := NewTransactionStreamer(arbDb, bc.Config(), execSeq, nil, make(chan error, 1), transactionStreamerConfigFetcher, snapSyncConfigFetcher)
inbox, err := NewTransactionStreamer(arbDb, bc.Config(), execSeq, nil, make(chan error, 1), transactionStreamerConfigFetcher, &DefaultSnapSyncConfig)
if err != nil {
Fail(t, err)
}
3 changes: 1 addition & 2 deletions arbnode/node.go
Original file line number Diff line number Diff line change
@@ -429,8 +429,7 @@ func createNodeImpl(
}

transactionStreamerConfigFetcher := func() *TransactionStreamerConfig { return &configFetcher.Get().TransactionStreamer }
snapSyncConfigFetcher := func() *SnapSyncConfig { return &configFetcher.Get().SnapSyncTest }
txStreamer, err := NewTransactionStreamer(arbDb, l2Config, exec, broadcastServer, fatalErrChan, transactionStreamerConfigFetcher, snapSyncConfigFetcher)
txStreamer, err := NewTransactionStreamer(arbDb, l2Config, exec, broadcastServer, fatalErrChan, transactionStreamerConfigFetcher, &configFetcher.Get().SnapSyncTest)
if err != nil {
return nil, err
}
9 changes: 4 additions & 5 deletions arbnode/transaction_streamer.go
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ type TransactionStreamer struct {
db ethdb.Database
fatalErrChan chan<- error
config TransactionStreamerConfigFetcher
snapSyncConfig SnapSyncConfigFetcher
snapSyncConfig *SnapSyncConfig

insertionMutex sync.Mutex // cannot be acquired while reorgMutex is held
reorgMutex sync.RWMutex
@@ -81,7 +81,6 @@ type TransactionStreamerConfig struct {
}

type TransactionStreamerConfigFetcher func() *TransactionStreamerConfig
type SnapSyncConfigFetcher func() *SnapSyncConfig

var DefaultTransactionStreamerConfig = TransactionStreamerConfig{
MaxBroadcasterQueueSize: 50_000,
@@ -108,7 +107,7 @@ func NewTransactionStreamer(
broadcastServer *broadcaster.Broadcaster,
fatalErrChan chan<- error,
config TransactionStreamerConfigFetcher,
snapSyncConfig SnapSyncConfigFetcher,
snapSyncConfig *SnapSyncConfig,
) (*TransactionStreamer, error) {
streamer := &TransactionStreamer{
exec: exec,
@@ -738,8 +737,8 @@ func (s *TransactionStreamer) AddMessagesAndEndBatch(pos arbutil.MessageIndex, m
}

func (s *TransactionStreamer) getPrevPrevDelayedRead(pos arbutil.MessageIndex) (uint64, error) {
if s.snapSyncConfig().Enabled && uint64(pos) == s.snapSyncConfig().PrevBatchMessageCount {
return s.snapSyncConfig().PrevDelayedRead, nil
if s.snapSyncConfig.Enabled && uint64(pos) == s.snapSyncConfig.PrevBatchMessageCount {
return s.snapSyncConfig.PrevDelayedRead, nil
}
var prevDelayedRead uint64
if pos > 0 {
2 changes: 1 addition & 1 deletion system_tests/snap_sync_test.go
Original file line number Diff line number Diff line change
@@ -122,9 +122,9 @@ func TestSnapSync(t *testing.T) {
if metadata != metadataNodeC {
t.Error("Batch metadata mismatch")
}
break
} else {
<-time.After(10 * time.Millisecond)
amsanghi marked this conversation as resolved.
Show resolved Hide resolved
continue
}

header, err := builder.L2.Client.HeaderByNumber(ctx, nil)