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

feat(taiko-client): use taiko-geth params #17044

Merged
merged 5 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -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"
consensus "github.com/ethereum/go-ethereum/consensus/taiko"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"

Expand All @@ -17,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 uint64 = 250_000
GoldenTouchAddress = common.HexToAddress("0x0000777735367b36bC9B61C50022d9D0700dB4Ec")
)

// 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 {
Expand Down Expand Up @@ -87,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())
Expand All @@ -115,7 +110,7 @@ func (c *AnchorTxConstructor) transactOpts(
Context: ctx,
GasFeeCap: baseFee,
GasTipCap: common.Big0,
GasLimit: AnchorGasLimit,
GasLimit: consensus.AnchorGasLimit,
NoSend: true,
}, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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() {
Expand Down
3 changes: 2 additions & 1 deletion packages/taiko-client/driver/chain_syncer/blob/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
Loading