Skip to content
Closed
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
6 changes: 1 addition & 5 deletions arbnode/consensus_execution_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/execution"
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/staker"
"github.com/offchainlabs/nitro/util"
"github.com/offchainlabs/nitro/util/headerreader"
Expand All @@ -33,9 +32,6 @@ var TestConsensusExecutionSyncerConfig = ConsensusExecutionSyncerConfig{
SyncInterval: TestSyncMonitorConfig.MsgLag / 2,
}

// We don't define a Test config. For most tests we want the Syncer to behave
// the same as in production.

func ConsensusExecutionSyncerConfigAddOptions(prefix string, f *pflag.FlagSet) {
f.Duration(prefix+".sync-interval", DefaultConsensusExecutionSyncerConfig.SyncInterval, "Interval in which finality and sync data is pushed from consensus to execution")
}
Expand Down Expand Up @@ -108,7 +104,7 @@ func (c *ConsensusExecutionSyncer) getFinalityData(
}
msgIdx := msgCount - 1
msgResult, err := c.txStreamer.ResultAtMessageIndex(msgIdx)
if errors.Is(err, gethexec.ResultNotFound) {
if errors.Is(err, execution.ErrResultNotFound) {
log.Debug("Message result not found, node out of sync", "msgIdx", msgIdx, "err", err)
return nil, nil
} else if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions changelog/jco-move-err-result-not-found.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### Changed
- Move `ResultNotFound` sentinel from `gethexec` to `execution.ErrResultNotFound` to break unnecessary import dependency
3 changes: 1 addition & 2 deletions execution/gethexec/executionengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ var (

var (
ExecutionEngineBlockCreationStopped = errors.New("block creation stopped in execution engine")
ResultNotFound = errors.New("result not found")
BlockNumBeforeGenesis = errors.New("block number is before genesis")
)

Expand Down Expand Up @@ -1024,7 +1023,7 @@ func (s *ExecutionEngine) appendBlock(block *types.Block, statedb *state.StateDB

func (s *ExecutionEngine) resultFromHeader(header *types.Header) (*execution.MessageResult, error) {
if header == nil {
return nil, ResultNotFound
return nil, execution.ErrResultNotFound
}
info := types.DeserializeHeaderExtraInformation(header)
return &execution.MessageResult{
Expand Down
1 change: 1 addition & 0 deletions execution/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type ConsensusSyncData struct {

var ErrRetrySequencer = errors.New("please retry transaction")
var ErrSequencerInsertLockTaken = errors.New("insert lock taken")
var ErrResultNotFound = errors.New("result not found")

// always needed
type ExecutionClient interface {
Expand Down
5 changes: 2 additions & 3 deletions execution/rpcclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/execution"
"github.com/offchainlabs/nitro/execution/gethexec"
"github.com/offchainlabs/nitro/util/containers"
"github.com/offchainlabs/nitro/util/rpcclient"
"github.com/offchainlabs/nitro/util/stopwaiter"
Expand Down Expand Up @@ -48,8 +47,8 @@ func convertError(err error) error {
errStr := err.Error()
if strings.Contains(errStr, execution.ErrRetrySequencer.Error()) {
return execution.ErrRetrySequencer
} else if strings.Contains(errStr, gethexec.ResultNotFound.Error()) {
return gethexec.ResultNotFound
} else if strings.Contains(errStr, execution.ErrResultNotFound.Error()) {
return execution.ErrResultNotFound
}
return err
}
Expand Down
11 changes: 5 additions & 6 deletions execution/rpcclient/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (

"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/execution"
"github.com/offchainlabs/nitro/execution/gethexec"
utilrpc "github.com/offchainlabs/nitro/util/rpcclient"
"github.com/offchainlabs/nitro/util/testhelpers"
)
Expand Down Expand Up @@ -66,13 +65,13 @@ func TestClientErrorHandling(t *testing.T) {
}{
{
name: "ResultNotFound mapped to sentinel",
serverErr: gethexec.ResultNotFound,
expectedErr: gethexec.ResultNotFound,
serverErr: execution.ErrResultNotFound,
expectedErr: execution.ErrResultNotFound,
},
{
name: "ResultNotFound wrapped in longer message mapped to sentinel",
serverErr: fmt.Errorf("execution context: %w", gethexec.ResultNotFound),
expectedErr: gethexec.ResultNotFound,
serverErr: fmt.Errorf("execution context: %w", execution.ErrResultNotFound),
expectedErr: execution.ErrResultNotFound,
},
{
name: "ErrRetrySequencer mapped to sentinel",
Expand Down Expand Up @@ -111,7 +110,7 @@ func TestClientErrorHandling(t *testing.T) {
t.Fatal("expected an error from server, got nil")
}
switch {
case errors.Is(tc.expectedErr, gethexec.ResultNotFound), errors.Is(tc.expectedErr, execution.ErrRetrySequencer):
case errors.Is(tc.expectedErr, execution.ErrResultNotFound), errors.Is(tc.expectedErr, execution.ErrRetrySequencer):
if !errors.Is(err, tc.expectedErr) {
t.Errorf("expected sentinel error %v, got %v", tc.expectedErr, err)
}
Expand Down
Loading