Skip to content

Commit

Permalink
🔧 v.2.2.2 no-blobstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferret-san committed Jan 24, 2024
1 parent a6bbfaf commit 034c74f
Show file tree
Hide file tree
Showing 8 changed files with 396 additions and 881 deletions.
22 changes: 17 additions & 5 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,21 @@ var TestBatchPosterConfig = BatchPosterConfig{
L1BlockBoundBypass: time.Hour,
}

func NewBatchPoster(ctx context.Context, dataPosterDB ethdb.Database, l1Reader *headerreader.HeaderReader, inbox *InboxTracker, streamer *TransactionStreamer, syncMonitor *SyncMonitor, config BatchPosterConfigFetcher, deployInfo *chaininfo.RollupAddresses, transactOpts *bind.TransactOpts, daWriter das.DataAvailabilityServiceWriter, celestiaWriter celestia.DataAvailabilityWriter) (*BatchPoster, error) {
seqInbox, err := bridgegen.NewSequencerInbox(deployInfo.SequencerInbox, l1Reader.Client())
type BatchPosterOpts struct {
DataPosterDB ethdb.Database
L1Reader *headerreader.HeaderReader
Inbox *InboxTracker
Streamer *TransactionStreamer
SyncMonitor *SyncMonitor
Config BatchPosterConfigFetcher
DeployInfo *chaininfo.RollupAddresses
TransactOpts *bind.TransactOpts
DAWriter das.DataAvailabilityServiceWriter
CelestiaWriter celestia.DataAvailabilityWriter
}

func NewBatchPoster(ctx context.Context, opts *BatchPosterOpts) (*BatchPoster, error) {
seqInbox, err := bridgegen.NewSequencerInbox(opts.DeployInfo.SequencerInbox, opts.L1Reader.Client())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -262,7 +275,7 @@ func NewBatchPoster(ctx context.Context, dataPosterDB ethdb.Database, l1Reader *
gasRefunderAddr: opts.Config().gasRefunder,
bridgeAddr: opts.DeployInfo.Bridge,
daWriter: opts.DAWriter,
celestiaWriter: celestiaWriter,
celestiaWriter: opts.CelestiaWriter,
redisLock: redisLock,
}
b.messagesPerBatch, err = arbmath.NewMovingAverage[uint64](20)
Expand Down Expand Up @@ -1026,7 +1039,6 @@ func (b *BatchPoster) maybePostSequencerBatch(ctx context.Context) (bool, error)
}
}

data, err := b.encodeAddBatch(new(big.Int).SetUint64(batchPosition.NextSeqNum), batchPosition.MessageCount, b.building.msgCount, sequencerMsg, b.building.segments.delayedMsg)
// ideally we make this part of the above statment by having everything under a single unified interface (soon TM)
if b.daWriter == nil && b.celestiaWriter != nil {
// Store the data on Celestia and return a marhsalled BlobPointer, which gets used as the sequencerMsg
Expand All @@ -1040,7 +1052,7 @@ func (b *BatchPoster) maybePostSequencerBatch(ctx context.Context) (bool, error)
}
}

gasLimit, err := b.estimateGas(ctx, sequencerMsg, b.building.segments.delayedMsg)
data, err := b.encodeAddBatch(new(big.Int).SetUint64(batchPosition.NextSeqNum), batchPosition.MessageCount, b.building.msgCount, sequencerMsg, b.building.segments.delayedMsg)
if err != nil {
return false, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/pruning/pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func findImportantRoots(ctx context.Context, chainDb ethdb.Database, stack *node
return nil, fmt.Errorf("failed to get finalized block: %w", err)
}
l1BlockNum := l1Block.NumberU64()
tracker, err := arbnode.NewInboxTracker(arbDb, nil, nil)
tracker, err := arbnode.NewInboxTracker(arbDb, nil, nil, nil)
if err != nil {
return nil, err
}
Expand Down
4 changes: 4 additions & 0 deletions das/ipfs_storage_service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2022, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE

// IPFS DAS backend.
// Copyright 2022, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE

// IPFS DAS backend.
// It takes advantage of IPFS' content addressing scheme to be able to directly retrieve
// the batches from IPFS using their root hash from the L1 sequencer inbox contract.
Expand Down
180 changes: 86 additions & 94 deletions go.mod

Large diffs are not rendered by default.

1,043 changes: 275 additions & 768 deletions go.sum

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions system_tests/batch_poster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ func testBatchPosterParallel(t *testing.T, useRedis bool) {
batchPosterConfig := builder.nodeConfig.BatchPoster
batchPoster, err := arbnode.NewBatchPoster(ctx,
&arbnode.BatchPosterOpts{
DataPosterDB: nil,
L1Reader: builder.L2.ConsensusNode.L1Reader,
Inbox: builder.L2.ConsensusNode.InboxTracker,
Streamer: builder.L2.ConsensusNode.TxStreamer,
SyncMonitor: builder.L2.ConsensusNode.SyncMonitor,
Config: func() *arbnode.BatchPosterConfig { return &batchPosterConfig },
DeployInfo: builder.L2.ConsensusNode.DeployInfo,
TransactOpts: &seqTxOpts,
DAWriter: nil,
CelestiaWritter: nil,
DataPosterDB: nil,
L1Reader: builder.L2.ConsensusNode.L1Reader,
Inbox: builder.L2.ConsensusNode.InboxTracker,
Streamer: builder.L2.ConsensusNode.TxStreamer,
SyncMonitor: builder.L2.ConsensusNode.SyncMonitor,
Config: func() *arbnode.BatchPosterConfig { return &batchPosterConfig },
DeployInfo: builder.L2.ConsensusNode.DeployInfo,
TransactOpts: &seqTxOpts,
DAWriter: nil,
CelestiaWriter: nil,
},
)
Require(t, err)
Expand Down
4 changes: 2 additions & 2 deletions system_tests/full_challenge_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func RunChallengeTest(t *testing.T, asserterIsCorrect bool, useStubs bool, chall

confirmLatestBlock(ctx, t, l1Info, l1Backend)

asserterValidator, err := staker.NewStatelessBlockValidator(asserterL2.InboxReader, asserterL2.InboxTracker, asserterL2.TxStreamer, asserterExec.Recorder, asserterL2ArbDb, nil, StaticFetcherFrom(t, &conf.BlockValidator), valStack)
asserterValidator, err := staker.NewStatelessBlockValidator(asserterL2.InboxReader, asserterL2.InboxTracker, asserterL2.TxStreamer, asserterExec.Recorder, asserterL2ArbDb, nil, nil, StaticFetcherFrom(t, &conf.BlockValidator), valStack)
if err != nil {
Fatal(t, err)
}
Expand All @@ -395,7 +395,7 @@ func RunChallengeTest(t *testing.T, asserterIsCorrect bool, useStubs bool, chall
if err != nil {
Fatal(t, err)
}
challengerValidator, err := staker.NewStatelessBlockValidator(challengerL2.InboxReader, challengerL2.InboxTracker, challengerL2.TxStreamer, challengerExec.Recorder, challengerL2ArbDb, nil, StaticFetcherFrom(t, &conf.BlockValidator), valStack)
challengerValidator, err := staker.NewStatelessBlockValidator(challengerL2.InboxReader, challengerL2.InboxTracker, challengerL2.TxStreamer, challengerExec.Recorder, challengerL2ArbDb, nil, nil, StaticFetcherFrom(t, &conf.BlockValidator), valStack)
if err != nil {
Fatal(t, err)
}
Expand Down

0 comments on commit 034c74f

Please sign in to comment.