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

fix(taiko-client): remove finalizedBlock info when P2P syncing #18735

Merged
merged 2 commits into from
Jan 9, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ func (t *SyncProgressTracker) ClearMeta() {

log.Debug("Clear sync progress tracker meta")

t.triggered = false
t.lastSyncedBlockID = nil
t.lastSyncedBlockHash = common.Hash{}
t.outOfSync = false
Expand Down
25 changes: 1 addition & 24 deletions packages/taiko-client/driver/chain_syncer/beaconsync/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"math/big"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/eth/downloader"
Expand Down Expand Up @@ -72,30 +71,8 @@ func (s *Syncer) TriggerBeaconSync(blockID uint64) error {
return fmt.Errorf("unexpected NewPayload response status: %s", status.Status)
}

var lastVerifiedBlockHash common.Hash
if lastVerifiedBlockHash, err = s.rpc.GetLastVerifiedBlockHash(s.ctx); err != nil {
log.Debug("Failed to fetch the last verified block hash", "err", err)

stateVars, err := s.rpc.GetProtocolStateVariables(&bind.CallOpts{Context: s.ctx})
if err != nil {
return fmt.Errorf("failed to fetch protocol state variables: %w", err)
}

lastVerifiedBlockHeader, err := s.rpc.L2CheckPoint.HeaderByNumber(
s.ctx,
new(big.Int).SetUint64(stateVars.B.LastVerifiedBlockId),
)
if err != nil {
return fmt.Errorf("failed to fetch the last verified block hash: %w", err)
}

lastVerifiedBlockHash = lastVerifiedBlockHeader.Hash()
}

fcRes, err := s.rpc.L2Engine.ForkchoiceUpdate(s.ctx, &engine.ForkchoiceStateV1{
HeadBlockHash: headPayload.BlockHash,
SafeBlockHash: lastVerifiedBlockHash,
FinalizedBlockHash: lastVerifiedBlockHash,
HeadBlockHash: headPayload.BlockHash,
}, nil)
if err != nil {
return err
Expand Down
Loading