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

Update NewAssertionChain call to use dataPoster for sending transactions #2168

Merged
merged 3 commits into from
Mar 7, 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
8 changes: 8 additions & 0 deletions arbnode/dataposter/data_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,14 @@ func (p *DataPoster) feeAndTipCaps(ctx context.Context, nonce uint64, gasLimit u
return newBaseFeeCap, newTipCap, newBlobFeeCap, nil
}

func (p *DataPoster) PostSimpleTransactionAutoNonce(ctx context.Context, to common.Address, calldata []byte, gasLimit uint64, value *big.Int) (*types.Transaction, error) {
nonce, _, err := p.GetNextNonceAndMeta(ctx)
if err != nil {
return nil, err
}
return p.PostSimpleTransaction(ctx, nonce, to, calldata, gasLimit, value)
}

func (p *DataPoster) PostSimpleTransaction(ctx context.Context, nonce uint64, to common.Address, calldata []byte, gasLimit uint64, value *big.Int) (*types.Transaction, error) {
return p.PostTransaction(ctx, time.Now(), nonce, nil, to, calldata, gasLimit, value, nil, nil)
}
Expand Down
39 changes: 27 additions & 12 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,20 @@ func createNodeImpl(
statelessBlockValidator = nil
}

var dp *dataposter.DataPoster
if config.Bold.Enable {
dp, err = StakerDataposter(
ctx,
rawdb.NewTable(arbDb, storage.StakerPrefix),
l1Reader,
txOptsValidator,
configFetcher,
syncMonitor,
parentChainID,
)
if err != nil {
return nil, err
}
rollupBindings, err := rollupgen.NewRollupUserLogic(deployInfo.Rollup, l1client)
if err != nil {
return nil, fmt.Errorf("could not create rollup bindings: %w", err)
Expand All @@ -587,7 +600,7 @@ func createNodeImpl(
if err != nil {
return nil, fmt.Errorf("could not get challenge manager: %w", err)
}
assertionChain, err := solimpl.NewAssertionChain(ctx, deployInfo.Rollup, chalManager, txOptsValidator, l1client, solimpl.NewChainBackendTransactor(l1client))
assertionChain, err := solimpl.NewAssertionChain(ctx, deployInfo.Rollup, chalManager, txOptsValidator, l1client, solimpl.NewDataPosterTransactor(dp))
if err != nil {
return nil, fmt.Errorf("could not create assertion chain: %w", err)
}
Expand Down Expand Up @@ -669,17 +682,19 @@ func createNodeImpl(
var messagePruner *MessagePruner

if config.Staker.Enable {
dp, err := StakerDataposter(
ctx,
rawdb.NewTable(arbDb, storage.StakerPrefix),
l1Reader,
txOptsValidator,
configFetcher,
syncMonitor,
parentChainID,
)
if err != nil {
return nil, err
if dp == nil {
dp, err = StakerDataposter(
ctx,
rawdb.NewTable(arbDb, storage.StakerPrefix),
l1Reader,
txOptsValidator,
configFetcher,
syncMonitor,
parentChainID,
)
if err != nil {
return nil, err
}
}
getExtraGas := func() uint64 { return configFetcher.Get().Staker.ExtraGas }
// TODO: factor this out into separate helper, and split rest of node
Expand Down
Loading