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 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
Prev Previous commit
Next Next commit
fix comments
  • Loading branch information
mask-pp committed May 9, 2024
commit 570fb379dd384d3a23b70785be08919140ea174a
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 {
Expand Down Expand Up @@ -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())
Expand All @@ -116,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