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

Do not log 'error applying transaction' errors when the block is being created for the prefetcher #2215

Merged
merged 1 commit into from
Apr 1, 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: 6 additions & 2 deletions arbos/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func ProduceBlock(
chainContext core.ChainContext,
chainConfig *params.ChainConfig,
batchFetcher arbostypes.FallibleBatchFetcher,
isMsgForPrefetch bool,
) (*types.Block, types.Receipts, error) {
var batchFetchErr error
txes, err := ParseL2Transactions(message, chainConfig.ChainID, func(batchNum uint64, batchHash common.Hash) []byte {
Expand All @@ -171,7 +172,7 @@ func ProduceBlock(

hooks := NoopSequencingHooks()
return ProduceBlockAdvanced(
message.Header, txes, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, hooks,
message.Header, txes, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, hooks, isMsgForPrefetch,
)
}

Expand All @@ -185,6 +186,7 @@ func ProduceBlockAdvanced(
chainContext core.ChainContext,
chainConfig *params.ChainConfig,
sequencingHooks *SequencingHooks,
isMsgForPrefetch bool,
) (*types.Block, types.Receipts, error) {

state, err := arbosState.OpenSystemArbosState(statedb, nil, true)
Expand Down Expand Up @@ -374,7 +376,9 @@ func ProduceBlockAdvanced(
if chainConfig.DebugMode() {
logLevel = log.Warn
}
logLevel("error applying transaction", "tx", printTxAsJson{tx}, "err", err)
if !isMsgForPrefetch {
logLevel("error applying transaction", "tx", printTxAsJson{tx}, "err", err)
}
if !hooks.DiscardInvalidTxsEarly {
// we'll still deduct a TxGas's worth from the block-local rate limiter even if the tx was invalid
blockGasLeft = arbmath.SaturatingUSub(blockGasLeft, params.TxGas)
Expand Down
2 changes: 1 addition & 1 deletion cmd/replay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func main() {
batchFetcher := func(batchNum uint64) ([]byte, error) {
return wavmio.ReadInboxMessage(batchNum), nil
}
newBlock, _, err = arbos.ProduceBlock(message.Message, message.DelayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, batchFetcher)
newBlock, _, err = arbos.ProduceBlock(message.Message, message.DelayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, batchFetcher, false)
if err != nil {
panic(err)
}
Expand Down
1 change: 1 addition & 0 deletions execution/gethexec/block_recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func (r *BlockRecorder) RecordBlockCreation(
chaincontext,
chainConfig,
batchFetcher,
false,
)
if err != nil {
return nil, err
Expand Down
10 changes: 6 additions & 4 deletions execution/gethexec/executionengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ func (s *ExecutionEngine) sequenceTransactionsWithBlockMutex(header *arbostypes.
s.bc,
s.bc.Config(),
hooks,
false,
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -419,7 +420,7 @@ func (s *ExecutionEngine) sequenceDelayedMessageWithBlockMutex(message *arbostyp
}

startTime := time.Now()
block, statedb, receipts, err := s.createBlockFromNextMessage(&messageWithMeta)
block, statedb, receipts, err := s.createBlockFromNextMessage(&messageWithMeta, false)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -451,7 +452,7 @@ func (s *ExecutionEngine) MessageIndexToBlockNumber(messageNum arbutil.MessageIn
}

// must hold createBlockMutex
func (s *ExecutionEngine) createBlockFromNextMessage(msg *arbostypes.MessageWithMetadata) (*types.Block, *state.StateDB, types.Receipts, error) {
func (s *ExecutionEngine) createBlockFromNextMessage(msg *arbostypes.MessageWithMetadata, isMsgForPrefetch bool) (*types.Block, *state.StateDB, types.Receipts, error) {
currentHeader := s.bc.CurrentBlock()
if currentHeader == nil {
return nil, nil, nil, errors.New("failed to get current block header")
Expand Down Expand Up @@ -487,6 +488,7 @@ func (s *ExecutionEngine) createBlockFromNextMessage(msg *arbostypes.MessageWith
s.bc,
s.bc.Config(),
batchFetcher,
isMsgForPrefetch,
)

return block, statedb, receipts, err
Expand Down Expand Up @@ -614,14 +616,14 @@ func (s *ExecutionEngine) digestMessageWithBlockMutex(num arbutil.MessageIndex,
wg.Add(1)
go func() {
defer wg.Done()
_, _, _, err := s.createBlockFromNextMessage(msgForPrefetch)
_, _, _, err := s.createBlockFromNextMessage(msgForPrefetch, true)
if err != nil {
return
}
}()
}

block, statedb, receipts, err := s.createBlockFromNextMessage(msg)
block, statedb, receipts, err := s.createBlockFromNextMessage(msg, false)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion system_tests/state_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func BuildBlock(
return seqBatch, nil
}
block, _, err := arbos.ProduceBlock(
l1Message, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, batchFetcher,
l1Message, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, batchFetcher, false,
)
return block, err
}
Expand Down
Loading