diff --git a/packages/taiko-client/bindings/encoding/protocol_config.go b/packages/taiko-client/bindings/encoding/protocol_config.go index bc6d45d3916..406d3ea36f6 100644 --- a/packages/taiko-client/bindings/encoding/protocol_config.go +++ b/packages/taiko-client/bindings/encoding/protocol_config.go @@ -22,6 +22,7 @@ var ( OntakeForkHeight: 2, BaseFeeConfig: bindings.TaikoDataBaseFeeConfig{ AdjustmentQuotient: 8, + SharingPctg: 75, GasIssuancePerSecond: 5_000_000, MinGasExcess: 1_340_000_000, MaxGasIssuancePerBlock: 600_000_000, diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go b/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go index 2d5f35b0104..530e1943a7a 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go @@ -15,11 +15,13 @@ import ( "github.com/stretchr/testify/suite" "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/metadata" "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/chain_syncer/beaconsync" "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/state" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/utils" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/config" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/jwt" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" "github.com/taikoxyz/taiko-mono/packages/taiko-client/proposer" @@ -153,6 +155,7 @@ func (s *BlobSyncerTestSuite) TestTreasuryIncome() { s.True(balanceAfter.Cmp(balance) > 0) var hasNoneAnchorTxs bool + chainConfig := config.NewChainConfig(encoding.GetProtocolConfig(s.RPCClient.L2.ChainID.Uint64())) for i := headBefore + 1; i <= headAfter; i++ { block, err := s.RPCClient.L2.BlockByNumber(context.Background(), new(big.Int).SetUint64(i)) s.Nil(err) @@ -169,8 +172,16 @@ func (s *BlobSyncerTestSuite) TestTreasuryIncome() { s.Nil(err) fee := new(big.Int).Mul(block.BaseFee(), new(big.Int).SetUint64(receipt.GasUsed)) - - balance = new(big.Int).Add(balance, fee) + if chainConfig.IsOntake(block.Number()) { + feeCoinbase := new(big.Int).Div( + new(big.Int).Mul(fee, new(big.Int).SetUint64(uint64(chainConfig.ProtocolConfigs.BaseFeeConfig.SharingPctg))), + new(big.Int).SetUint64(100), + ) + feeTreasury := new(big.Int).Sub(fee, feeCoinbase) + balance = new(big.Int).Add(balance, feeTreasury) + } else { + balance = new(big.Int).Add(balance, fee) + } } } diff --git a/packages/taiko-client/pkg/rpc/methods.go b/packages/taiko-client/pkg/rpc/methods.go index e433c04e76a..12ee41ffb80 100644 --- a/packages/taiko-client/pkg/rpc/methods.go +++ b/packages/taiko-client/pkg/rpc/methods.go @@ -318,7 +318,7 @@ func (c *Client) CalculateBaseFee( } } baseFeeInfo, err = c.TaikoL2.CalculateBaseFee( - &bind.CallOpts{Context: ctx}, + &bind.CallOpts{BlockNumber: l2Head.Number, Context: ctx}, *baseFeeConfig, uint64(time.Now().Unix())-l2Head.Time, parentGasExcess, @@ -329,7 +329,7 @@ func (c *Client) CalculateBaseFee( } } else { baseFeeInfo, err = c.TaikoL2.GetBasefee( - &bind.CallOpts{Context: ctx}, + &bind.CallOpts{BlockNumber: l2Head.Number, Context: ctx}, anchorBlockID.Uint64(), uint32(l2Head.GasUsed), // #nosec G115 )