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

(op-geth) Add extra error info when meet an unexpected el sync #132

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"math/big"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -681,6 +682,9 @@ func (api *ConsensusAPI) delayPayloadImport(block *types.Block) (engine.PayloadS
// that the parent state is missing and the syncer rejected extending the
// current cycle with the new payload.
log.Warn("Ignoring payload with missing parent", "number", block.NumberU64(), "hash", block.Hash(), "parent", block.ParentHash(), "reason", err)
if strings.Contains(err.Error(), "forced head needed for startup") {
welkin22 marked this conversation as resolved.
Show resolved Hide resolved
return engine.PayloadStatusV1{Status: engine.SYNCING}, err
}
} else {
// In non-full sync mode (i.e. snap sync) all payloads are rejected until
// snap sync terminates as snap sync relies on direct database injections
Expand Down
12 changes: 7 additions & 5 deletions eth/catalyst/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ import (
"math/big"
"math/rand"
"reflect"
"strings"
"sync"
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/mattn/go-colorable"

"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
Expand All @@ -50,7 +53,6 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/trie"
"github.com/mattn/go-colorable"
)

var (
Expand Down Expand Up @@ -717,7 +719,7 @@ func TestEmptyBlocks(t *testing.T) {
payload := getNewPayload(t, api, commonAncestor, nil)

status, err := api.NewPayloadV1(*payload)
if err != nil {
if err != nil && !strings.Contains(err.Error(), "forced head needed for startup") {
t.Fatal(err)
}
if status.Status != engine.VALID {
Expand All @@ -733,7 +735,7 @@ func TestEmptyBlocks(t *testing.T) {
payload = setBlockhash(payload)
// Now latestValidHash should be the common ancestor
status, err = api.NewPayloadV1(*payload)
if err != nil {
if err != nil && !strings.Contains(err.Error(), "forced head needed for startup") {
t.Fatal(err)
}
if status.Status != engine.INVALID {
Expand All @@ -751,7 +753,7 @@ func TestEmptyBlocks(t *testing.T) {
payload = setBlockhash(payload)
// Now latestValidHash should be the common ancestor
status, err = api.NewPayloadV1(*payload)
if err != nil {
if err != nil && !strings.Contains(err.Error(), "forced head needed for startup") {
t.Fatal(err)
}
if status.Status != engine.SYNCING {
Expand Down Expand Up @@ -863,7 +865,7 @@ func TestTrickRemoteBlockCache(t *testing.T) {
// feed the payloads to node B
for _, payload := range invalidChain {
status, err := apiB.NewPayloadV1(*payload)
if err != nil {
if err != nil && !strings.Contains(err.Error(), "forced head needed for startup") {
panic(err)
}
if status.Status == engine.VALID {
Expand Down
Loading