Skip to content

Commit

Permalink
Merge branch 'main' into fix_BatchID_json_format_
Browse files Browse the repository at this point in the history
  • Loading branch information
mask-pp authored Jan 9, 2025
2 parents 339dd82 + d81a630 commit 986dc81
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 27 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/taiko-client--pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main

- name: Set up Go
uses: actions/setup-go@v4
Expand All @@ -33,8 +36,8 @@ jobs:
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
if ! git diff --quiet; then
git add -u
git commit -m "Update Swagger documentation"
git push origin HEAD:${{ github.ref_name }}
else
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (s *BeaconSyncProgressTrackerTestSuite) TestSyncProgressed() {
func (s *BeaconSyncProgressTrackerTestSuite) TestClearMeta() {
s.t.triggered = true
s.t.ClearMeta()
s.False(s.t.triggered)
s.True(s.t.triggered)
}

func (s *BeaconSyncProgressTrackerTestSuite) TestHeadChanged() {
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

0 comments on commit 986dc81

Please sign in to comment.