From d4b1899acfa247b87a344dcfc29abcf11bde1a9d Mon Sep 17 00:00:00 2001 From: maskpp Date: Wed, 8 May 2024 17:27:28 +0800 Subject: [PATCH 1/2] use taiko-geth params --- .../driver/anchor_tx_constructor/anchor_tx_constructor.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go b/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go index c97bbbe040..a190ee0ce7 100644 --- a/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go +++ b/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go @@ -8,6 +8,7 @@ import ( "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus/taiko" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" @@ -19,8 +20,8 @@ import ( var ( // Each TaikoL2.anchor transaction should use this value as it's gas limit. - AnchorGasLimit uint64 = 250_000 - GoldenTouchAddress = common.HexToAddress("0x0000777735367b36bC9B61C50022d9D0700dB4Ec") + AnchorGasLimit = taiko.AnchorGasLimit + GoldenTouchAddress = taiko.GoldenTouchAccount ) // AnchorTxConstructor is responsible for assembling the anchor transaction (TaikoL2.anchor) in From 570fb379dd384d3a23b70785be08919140ea174a Mon Sep 17 00:00:00 2001 From: maskpp Date: Thu, 9 May 2024 09:20:28 +0800 Subject: [PATCH 2/2] fix comments --- .../anchor_tx_constructor.go | 18 ++++++------------ .../anchor_tx_constructor_test.go | 3 ++- .../driver/chain_syncer/blob/syncer.go | 3 ++- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go b/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go index a190ee0ce7..a930c86244 100644 --- a/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go +++ b/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go @@ -8,7 +8,7 @@ import ( "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/taiko" + consensus "github.com/ethereum/go-ethereum/consensus/taiko" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" @@ -18,12 +18,6 @@ import ( "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" ) -var ( - // Each TaikoL2.anchor transaction should use this value as it's gas limit. - AnchorGasLimit = taiko.AnchorGasLimit - GoldenTouchAddress = taiko.GoldenTouchAccount -) - // AnchorTxConstructor is responsible for assembling the anchor transaction (TaikoL2.anchor) in // each L2 block, which must be the first transaction, and its sender must be the golden touch account. type AnchorTxConstructor struct { @@ -88,22 +82,22 @@ func (c *AnchorTxConstructor) transactOpts( ) // Get the nonce of golden touch account at the specified parentHeight. - nonce, err := c.rpc.L2AccountNonce(ctx, GoldenTouchAddress, parentHeight) + nonce, err := c.rpc.L2AccountNonce(ctx, consensus.GoldenTouchAccount, parentHeight) if err != nil { return nil, err } log.Info( "Golden touch account nonce", - "address", GoldenTouchAddress, + "address", consensus.GoldenTouchAccount, "nonce", nonce, "parent", parentHeight, ) return &bind.TransactOpts{ - From: GoldenTouchAddress, + From: consensus.GoldenTouchAccount, Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) { - if address != GoldenTouchAddress { + if address != consensus.GoldenTouchAccount { return nil, bind.ErrNotAuthorized } signature, err := c.signTxPayload(signer.Hash(tx).Bytes()) @@ -116,7 +110,7 @@ func (c *AnchorTxConstructor) transactOpts( Context: ctx, GasFeeCap: baseFee, GasTipCap: common.Big0, - GasLimit: AnchorGasLimit, + GasLimit: consensus.AnchorGasLimit, NoSend: true, }, nil } diff --git a/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor_test.go b/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor_test.go index 0aa240a1a0..4b6e2831bd 100644 --- a/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor_test.go +++ b/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor_test.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + consensus "github.com/ethereum/go-ethereum/consensus/taiko" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/suite" @@ -32,7 +33,7 @@ func (s *AnchorTxConstructorTestSuite) SetupTest() { } func (s *AnchorTxConstructorTestSuite) TestGasLimit() { - s.Greater(AnchorGasLimit, uint64(0)) + s.Greater(consensus.AnchorGasLimit, uint64(0)) } func (s *AnchorTxConstructorTestSuite) TestAssembleAnchorTx() { diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index 82c8ad671d..fdaed3bd41 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -12,6 +12,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/beacon/engine" "github.com/ethereum/go-ethereum/common" + consensus "github.com/ethereum/go-ethereum/consensus/taiko" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" @@ -454,7 +455,7 @@ func (s *Syncer) createExecutionPayloads( BlockMetadata: &engine.BlockMetadata{ HighestBlockID: headBlockID, Beneficiary: event.Meta.Coinbase, - GasLimit: uint64(event.Meta.GasLimit) + anchorTxConstructor.AnchorGasLimit, + GasLimit: uint64(event.Meta.GasLimit) + consensus.AnchorGasLimit, Timestamp: event.Meta.Timestamp, TxList: txListBytes, MixHash: event.Meta.Difficulty,