Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(bindings): update Go contract bindings (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Mar 19, 2024
1 parent 995b449 commit 13c6ac2
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 58 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ jobs:

- uses: actions/checkout@v3
with:
repository: taikoxyz/taiko-mono
repository: taikoxyz/taiko-mono-private
path: ${{ env.TAIKO_MONO_DIR }}
token: ${{ secrets.TK_REPO_ACCESS }}

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down
2 changes: 1 addition & 1 deletion bindings/.githead
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c2d7d6e16ca85e46943af9b520f986921f7b897d
2fba92262869fc58665172ca55c987abc2262368
2 changes: 1 addition & 1 deletion bindings/gen_taiko_l1.go

Large diffs are not rendered by default.

65 changes: 24 additions & 41 deletions bindings/gen_taiko_l2.go

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions driver/chain_syncer/calldata/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func (s *Syncer) insertNewHead(
}

// Get L2 baseFee
baseFee, err := s.rpc.TaikoL2.GetBasefee(
baseFeeInfo, err := s.rpc.TaikoL2.GetBasefee(
&bind.CallOpts{BlockNumber: parent.Number, Context: ctx},
event.Meta.L1Height,
uint32(parent.GasUsed),
Expand All @@ -332,7 +332,7 @@ func (s *Syncer) insertNewHead(
log.Info(
"L2 baseFee",
"blockID", event.BlockId,
"baseFee", baseFee,
"baseFee", baseFeeInfo.Basefee,
"syncedL1Height", event.Meta.L1Height,
"parentGasUsed", parent.GasUsed,
)
Expand All @@ -349,7 +349,7 @@ func (s *Syncer) insertNewHead(
new(big.Int).SetUint64(event.Meta.L1Height),
event.Meta.L1Hash,
new(big.Int).Add(parent.Number, common.Big1),
baseFee,
baseFeeInfo.Basefee,
parent.GasUsed,
)
if err != nil {
Expand All @@ -370,7 +370,7 @@ func (s *Syncer) insertNewHead(
l1Origin,
headBlockID,
txListBytes,
baseFee,
baseFeeInfo.Basefee,
withdrawals,
)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/testutils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (s *ClientTestSuite) ProposeAndInsertValidBlock(
close(sink)
}()

baseFee, err := s.RPCClient.TaikoL2.GetBasefee(nil, 0, uint32(l2Head.GasUsed))
baseFeeInfo, err := s.RPCClient.TaikoL2.GetBasefee(nil, l1Head.Number.Uint64()+1, uint32(l2Head.GasUsed))
s.Nil(err)

nonce, err := s.RPCClient.L2.PendingNonceAt(context.Background(), s.TestAddr)
Expand All @@ -123,7 +123,7 @@ func (s *ClientTestSuite) ProposeAndInsertValidBlock(
common.BytesToAddress(RandomBytes(32)),
common.Big1,
100000,
baseFee,
baseFeeInfo.Basefee,
[]byte{},
)
signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(s.RPCClient.L2.ChainID), s.TestAddrPrivKey)
Expand Down
13 changes: 9 additions & 4 deletions pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,21 +240,26 @@ func (c *Client) GetPoolContent(
ctxWithTimeout, cancel := ctxWithTimeoutOrDefault(ctx, defaultTimeout)
defer cancel()

l1Head, err := c.L1.HeaderByNumber(ctx, nil)
if err != nil {
return nil, err
}

l2Head, err := c.L2.HeaderByNumber(ctx, nil)
if err != nil {
return nil, err
}

baseFee, err := c.TaikoL2.GetBasefee(
baseFeeInfo, err := c.TaikoL2.GetBasefee(
&bind.CallOpts{Context: ctx},
uint64(time.Now().Unix())-l2Head.Time,
l1Head.Number.Uint64(),
uint32(l2Head.GasUsed),
)
if err != nil {
return nil, err
}

log.Info("Current base fee", "fee", baseFee)
log.Info("Current base fee", "fee", baseFeeInfo.Basefee)

var localsArg []string
for _, local := range locals {
Expand All @@ -267,7 +272,7 @@ func (c *Client) GetPoolContent(
&result,
"taiko_txPoolContent",
beneficiary,
baseFee,
baseFeeInfo.Basefee,
blockMaxGasLimit,
maxBytesPerTxList,
localsArg,
Expand Down
4 changes: 2 additions & 2 deletions pkg/rpc/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestL1ContentFrom(t *testing.T) {
l2Head, err := client.L2.HeaderByNumber(context.Background(), nil)
require.Nil(t, err)

baseFee, err := client.TaikoL2.GetBasefee(nil, 0, uint32(l2Head.GasUsed))
baseFeeInfo, err := client.TaikoL2.GetBasefee(nil, 0, uint32(l2Head.GasUsed))
require.Nil(t, err)

testAddrPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROPOSER_PRIVATE_KEY")))
Expand All @@ -56,7 +56,7 @@ func TestL1ContentFrom(t *testing.T) {
testAddr,
common.Big1,
100000,
baseFee,
baseFeeInfo.Basefee,
[]byte{},
)
signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(client.L2.ChainID), testAddrPrivKey)
Expand Down
4 changes: 2 additions & 2 deletions proposer/proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ func (s *ProposerTestSuite) TestProposeOp() {
parent, err := s.p.rpc.L2.BlockByNumber(context.Background(), nil)
s.Nil(err)

baseFee, err := s.p.rpc.TaikoL2.GetBasefee(nil, 1, uint32(parent.GasUsed()))
baseFeeInfo, err := s.p.rpc.TaikoL2.GetBasefee(nil, 1, uint32(parent.GasUsed()))
s.Nil(err)

to := common.BytesToAddress(testutils.RandomBytes(32))
tx := types.NewTx(&types.DynamicFeeTx{
ChainID: s.RPCClient.L2.ChainID,
Nonce: nonce,
GasTipCap: common.Big0,
GasFeeCap: new(big.Int).SetUint64(baseFee.Uint64() * 2),
GasFeeCap: new(big.Int).SetUint64(baseFeeInfo.Basefee.Uint64() * 2),
Gas: 21000,
To: &to,
Value: common.Big1,
Expand Down

0 comments on commit 13c6ac2

Please sign in to comment.