Skip to content

Commit

Permalink
Merge branch 'develop' into eip_7702
Browse files Browse the repository at this point in the history
  • Loading branch information
krish-nr committed Feb 6, 2025
2 parents a12cac5 + 906c66c commit 5b20883
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
23 changes: 13 additions & 10 deletions op-program/client/mpt/db.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package mpt

import "github.com/ethereum/go-ethereum/ethdb"
import (
"github.com/ethereum/go-ethereum/ethdb"
)

type Hooks struct {
Get func(key []byte) []byte
Expand All @@ -14,39 +16,40 @@ type DB struct {
}

func (p *DB) StateStoreReader() ethdb.Reader {
panic("not supported")
return nil
}

func (p *DB) BlockStoreReader() ethdb.Reader {
panic("not supported")
return nil
}

func (p *DB) BlockStoreWriter() ethdb.Writer {
panic("not supported")
return nil
}

func (p *DB) StateStore() ethdb.Database {
panic("not supported")
return nil

}

func (p *DB) SetStateStore(state ethdb.Database) {
panic("not supported")
panic("not supported 5")
}

func (p *DB) GetStateStore() ethdb.Database {
panic("not supported")
return nil
}

func (p *DB) BlockStore() ethdb.Database {
panic("not supported")
return nil
}

func (p *DB) SetBlockStore(block ethdb.Database) {
panic("not supported")
panic("not supported 8")
}

func (p *DB) HasSeparateBlockStore() bool {
panic("not supported")
return false
}

func (p *DB) Has(key []byte) (bool, error) {
Expand Down
8 changes: 4 additions & 4 deletions op-service/eth/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import (
type ErrorCode int

const (
UnknownPayload ErrorCode = -32001 // Payload does not exist / is not available.
UnknownPayload ErrorCode = -38001 // Payload does not exist / is not available.
InvalidForkchoiceState ErrorCode = -38002 // Forkchoice state is invalid / inconsistent.
InvalidPayloadAttributes ErrorCode = -38003 // Payload attributes are invalid / inconsistent.
)

const (
GetPayloadStage = "getPayload"
NewPayloadStage = "newPayload"
ForkchoiceUpdatedStage = "forkchoiceUpdated"
GetPayloadStage = "sealApiGetPayloadErrStage"
NewPayloadStage = "sealApiNewPayloadErrStage"
ForkchoiceUpdatedStage = "sealApiForkchoiceUpdatedErrStage"
)

var ErrBedrockScalarPaddingNotEmpty = errors.New("version 0 scalar value has non-empty padding")
Expand Down
32 changes: 17 additions & 15 deletions op-service/sources/engine_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,45 +189,47 @@ func (s *EngineAPIClient) SealPayload(ctx context.Context, payloadInfo eth.Paylo
method := s.evp.SealPayloadVersion(payloadInfo.Timestamp)
err := s.RPC.CallContext(sCtx, &result, string(method), payloadInfo.ID, fc, needPayload)
if err != nil {
e.Error("Failed to seal payload", "payload_id", payloadInfo.ID, "err", err)
switch result.ErrStage {
case eth.GetPayloadStage:
switch {
case strings.Contains(err.Error(), eth.GetPayloadStage):
e.Error("Seal payload get payload stage failed", "payload_id", payloadInfo.ID, "err", err)
if rpcErr, ok := err.(rpc.Error); ok {
code := eth.ErrorCode(rpcErr.ErrorCode())
e.Error("Seal payload get payload stage failed", "err code", code, "payload_id", payloadInfo.ID, "err", err)
switch code {
case eth.UnknownPayload:
return nil, result.ErrStage, eth.InputError{
return nil, eth.GetPayloadStage, eth.InputError{
Inner: err,
Code: code,
}
default:
return nil, result.ErrStage, fmt.Errorf("seal payload unrecognized rpc error: %w", err)
return nil, eth.GetPayloadStage, fmt.Errorf("seal payload get payload stage unrecognized rpc error: %w", err)
}
}
return nil, result.ErrStage, err
case eth.NewPayloadStage:
e.Error("Seal payload execution failed", "err", err)
return nil, eth.GetPayloadStage, err
case strings.Contains(err.Error(), eth.NewPayloadStage):
e.Error("Seal payload new payload stage execution failed", "payload_id", payloadInfo.ID, "err", err)
if strings.Contains(err.Error(), derive.ErrELSyncTriggerUnexpected.Error()) {
result.PayloadStatus.Status = eth.ExecutionSyncing
return &result, result.ErrStage, err
return &result, eth.NewPayloadStage, err
}
return nil, result.ErrStage, fmt.Errorf("seal payload failed to execute payload: %w", err)
case eth.ForkchoiceUpdatedStage:
e.Error("Seal payload failed to share forkchoice-updated signal", "err", err)
return nil, eth.NewPayloadStage, fmt.Errorf("seal payload failed to execute payload: %w", err)
case strings.Contains(err.Error(), eth.ForkchoiceUpdatedStage):
e.Error("Seal payload forkchoice updated stage failed to share forkchoice-updated signal", "payload_id", payloadInfo.ID, "err", err)
if rpcErr, ok := err.(rpc.Error); ok {
code := eth.ErrorCode(rpcErr.ErrorCode())
switch code {
case eth.InvalidForkchoiceState, eth.InvalidPayloadAttributes:
return nil, result.ErrStage, eth.InputError{
return nil, eth.ForkchoiceUpdatedStage, eth.InputError{
Inner: err,
Code: code,
}
default:
return nil, result.ErrStage, fmt.Errorf("seal payload unrecognized rpc error: %w", err)
return nil, eth.ForkchoiceUpdatedStage, fmt.Errorf("seal payload forkchoice updated stage unrecognized rpc error: %w", err)
}
}
return nil, result.ErrStage, err
return nil, eth.ForkchoiceUpdatedStage, err
default:
e.Error("Seal payload network stage failed", "payload_id", payloadInfo.ID, "err", err)
return nil, result.ErrStage, err
}
}
Expand Down

0 comments on commit 5b20883

Please sign in to comment.