Skip to content

Commit

Permalink
fix(taiko-client): fix timestamp calculation n CalculateBaseFee() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 authored Sep 10, 2024
1 parent 32d95c1 commit 78c876e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/taiko-client/driver/chain_syncer/blob/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ func (s *Syncer) insertNewHead(
new(big.Int).SetUint64(meta.GetAnchorBlockID()),
meta.IsOntakeBlock(),
meta.GetBaseFeeConfig(),
meta.GetTimestamp(),
); err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion packages/taiko-client/pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ func (c *Client) CalculateBaseFee(
anchorBlockID *big.Int,
isOntake bool,
baseFeeConfig *bindings.TaikoDataBaseFeeConfig,
currentTimestamp uint64,
) (*big.Int, error) {
var (
baseFeeInfo struct {
Expand Down Expand Up @@ -320,7 +321,7 @@ func (c *Client) CalculateBaseFee(
baseFeeInfo, err = c.TaikoL2.CalculateBaseFee(
&bind.CallOpts{BlockNumber: l2Head.Number, Context: ctx},
*baseFeeConfig,
uint64(time.Now().Unix())-l2Head.Time,
currentTimestamp-l2Head.Time,
parentGasExcess,
uint32(l2Head.GasUsed), // #nosec G115
)
Expand Down Expand Up @@ -384,6 +385,7 @@ func (c *Client) GetPoolContent(
l1Head.Number,
chainConfig.IsOntake(l2Head.Number),
&chainConfig.ProtocolConfigs.BaseFeeConfig,
uint64(time.Now().Unix()),
)
if err != nil {
return nil, err
Expand Down

0 comments on commit 78c876e

Please sign in to comment.