diff --git a/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go b/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go index de997f98af7..fc70d6ae903 100644 --- a/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go +++ b/packages/taiko-client/driver/anchor_tx_constructor/anchor_tx_constructor.go @@ -66,7 +66,7 @@ func (c *AnchorTxConstructor) AssembleAnchorTx( "baseFee", utils.WeiToGWei(baseFee), "gasUsed", parentGasUsed, ) - + // #nosec G115 return c.rpc.TaikoL2.Anchor(opts, l1Hash, l1Header.Root, l1Height.Uint64(), uint32(parentGasUsed)) } @@ -97,7 +97,7 @@ func (c *AnchorTxConstructor) AssembleAnchorV2Tx( "basefeeAdjustmentQuotient", baseFeeConfig.AdjustmentQuotient, "baseFee", utils.WeiToGWei(baseFee), ) - + // #nosec G115 return c.rpc.TaikoL2.AnchorV2( opts, anchorBlockID.Uint64(), diff --git a/packages/taiko-client/driver/chain_syncer/beaconsync/syncer.go b/packages/taiko-client/driver/chain_syncer/beaconsync/syncer.go index 4bb4a5f79f2..90d91e86f90 100644 --- a/packages/taiko-client/driver/chain_syncer/beaconsync/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/beaconsync/syncer.go @@ -119,6 +119,7 @@ func (s *Syncer) getBlockPayload(ctx context.Context, blockID uint64) (*engine.E ts, err := s.rpc.GetTransition( ctx, new(big.Int).SetUint64(blockInfo.BlockId), + // #nosec G115 uint32(blockInfo.VerifiedTransitionId.Uint64()), ) if err != nil { diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index 13fab14b606..97ce314fc95 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -211,6 +211,7 @@ func (s *Syncer) onBlockProposed( // only happen when testing. if meta.GetTimestamp() > uint64(time.Now().Unix()) { log.Warn("Future L2 block, waiting", "L2BlockTimestamp", meta.GetTimestamp(), "now", time.Now().Unix()) + // #nosec G115 time.Sleep(time.Until(time.Unix(int64(meta.GetTimestamp()), 0))) } @@ -346,6 +347,7 @@ func (s *Syncer) insertNewHead( baseFeeInfo, err = s.rpc.TaikoL2.GetBasefee( &bind.CallOpts{BlockNumber: parent.Number, Context: ctx}, meta.GetRawBlockHeight().Uint64()-1, + // #nosec G115 uint32(parent.GasUsed), ) if err != nil { @@ -403,6 +405,7 @@ func (s *Syncer) insertNewHead( *meta.GetBaseFeeConfig(), meta.GetTimestamp()-parent.Time, parentGasExcess, + // #nosec G115 uint32(parent.GasUsed), ) if err != nil { @@ -631,6 +634,7 @@ func (s *Syncer) retrievePastBlock( ts, err := s.rpc.GetTransition( ctx, new(big.Int).SetUint64(blockInfo.BlockId), + // #nosec G115 uint32(blockInfo.VerifiedTransitionId.Uint64()), ) if err != nil { diff --git a/packages/taiko-client/driver/txlist_decompressor/txlist_decompressor.go b/packages/taiko-client/driver/txlist_decompressor/txlist_decompressor.go index e288115fc8b..7e760252d84 100644 --- a/packages/taiko-client/driver/txlist_decompressor/txlist_decompressor.go +++ b/packages/taiko-client/driver/txlist_decompressor/txlist_decompressor.go @@ -50,6 +50,7 @@ func (v *TxListDecompressor) TryDecompress( // If calldata is used, the compressed bytes of the transaction list must be // less than or equal to maxBytesPerTxList. + // #nosec G115 if !blobUsed && (len(txListBytes) > int(v.maxBytesPerTxList)) { log.Info("Compressed transactions list binary too large", "length", len(txListBytes), "blockID", blockID) return []byte{} @@ -102,6 +103,7 @@ func (v *TxListDecompressor) TryDecompressHekla( // If calldata is used, the compressed bytes of the transaction list must be // less than or equal to maxBytesPerTxList. + // #nosec G115 if !blobUsed && (len(txListBytes) > int(v.maxBytesPerTxList)) { log.Info("Compressed transactions list binary too large", "length", len(txListBytes), "blockID", blockID) return []byte{} diff --git a/packages/taiko-client/internal/testutils/helper.go b/packages/taiko-client/internal/testutils/helper.go index f8a96b2a582..fa51d95f177 100644 --- a/packages/taiko-client/internal/testutils/helper.go +++ b/packages/taiko-client/internal/testutils/helper.go @@ -135,6 +135,7 @@ func (s *ClientTestSuite) ProposeAndInsertValidBlock( close(sink2) }() + // #nosec G115 baseFeeInfo, err := s.RPCClient.TaikoL2.GetBasefee(nil, l1Head.Number.Uint64()+1, uint32(l2Head.GasUsed)) s.Nil(err) @@ -214,6 +215,7 @@ func (s *ClientTestSuite) ProposeValidBlock( close(sink) }() + // #nosec G115 baseFeeInfo, err := s.RPCClient.TaikoL2.GetBasefee(nil, l1Head.Number.Uint64()+1, uint32(l2Head.GasUsed)) s.Nil(err) diff --git a/packages/taiko-client/internal/utils/utils.go b/packages/taiko-client/internal/utils/utils.go index 1eaea75dd87..7e02ec85b7c 100644 --- a/packages/taiko-client/internal/utils/utils.go +++ b/packages/taiko-client/internal/utils/utils.go @@ -54,6 +54,7 @@ func RandUint32(max *big.Int) uint32 { max.SetUint64(math.MaxUint32) } num, _ := rand.Int(rand.Reader, max) + // #nosec G115 return uint32(num.Uint64()) } diff --git a/packages/taiko-client/pkg/rpc/methods.go b/packages/taiko-client/pkg/rpc/methods.go index 71b899ddc01..37b0314ee3f 100644 --- a/packages/taiko-client/pkg/rpc/methods.go +++ b/packages/taiko-client/pkg/rpc/methods.go @@ -292,7 +292,7 @@ func (c *Client) GetPoolContent( baseFeeInfo, err := c.TaikoL2.GetBasefee( &bind.CallOpts{Context: ctx}, l1Head.Number.Uint64(), - uint32(l2Head.GasUsed), + uint32(l2Head.GasUsed), // #nosec G115 ) if err != nil { return nil, err @@ -602,6 +602,7 @@ func (c *Client) checkSyncedL1SnippetFromAnchor( return true, nil } + // #nosec G115 if parentGasUsed != uint32(parent.GasUsed()) { log.Info( "Reorg detected due to parent gas used mismatch", diff --git a/packages/taiko-client/pkg/rpc/methods_test.go b/packages/taiko-client/pkg/rpc/methods_test.go index 0aa743b994b..47d0fa48ac3 100644 --- a/packages/taiko-client/pkg/rpc/methods_test.go +++ b/packages/taiko-client/pkg/rpc/methods_test.go @@ -81,7 +81,7 @@ func TestGetSyncedL1SnippetFromAnchor(t *testing.T) { l1BlockHash := randomHash() l1StateRoot := randomHash() l1Height := randomHash().Big().Uint64() - parentGasUsed := uint32(randomHash().Big().Uint64()) + parentGasUsed := uint32(randomHash().Big().Uint64()) // #nosec G115 testAddrPrivKey, err := crypto.ToECDSA(common.Hex2Bytes(encoding.GoldenTouchPrivKey)) require.Nil(t, err) diff --git a/packages/taiko-client/proposer/transaction_builder/blob.go b/packages/taiko-client/proposer/transaction_builder/blob.go index 70a76c4fd6a..1ca91aa4604 100644 --- a/packages/taiko-client/proposer/transaction_builder/blob.go +++ b/packages/taiko-client/proposer/transaction_builder/blob.go @@ -86,7 +86,7 @@ func (b *BlobTransactionBuilder) Build( if err != nil { return nil, err } - signature[64] = uint8(uint(signature[64])) + 27 + signature[64] = signature[64] + 27 var ( to = &b.taikoL1Address @@ -128,6 +128,7 @@ func (b *BlobTransactionBuilder) Build( AnchorBlockId: 0, Timestamp: 0, BlobTxListOffset: 0, + // #nosec G115 BlobTxListLength: uint32(len(txListBytes)), BlobIndex: 0, }); err != nil { diff --git a/packages/taiko-client/proposer/transaction_builder/calldata.go b/packages/taiko-client/proposer/transaction_builder/calldata.go index b824401871d..1ed91290154 100644 --- a/packages/taiko-client/proposer/transaction_builder/calldata.go +++ b/packages/taiko-client/proposer/transaction_builder/calldata.go @@ -72,7 +72,7 @@ func (b *CalldataTransactionBuilder) Build( if err != nil { return nil, err } - signature[64] = uint8(uint(signature[64])) + 27 + signature[64] = signature[64] + 27 var ( to = &b.taikoL1Address diff --git a/packages/taiko-client/prover/event_handler/util.go b/packages/taiko-client/prover/event_handler/util.go index 97e84bd3e80..1f851941d3b 100644 --- a/packages/taiko-client/prover/event_handler/util.go +++ b/packages/taiko-client/prover/event_handler/util.go @@ -130,6 +130,6 @@ func IsProvingWindowExpired( now = uint64(time.Now().Unix()) expiredAt = metadata.GetTimestamp() + uint64(provingWindow.Seconds()) ) - + // #nosec G115 return now > expiredAt, time.Unix(int64(expiredAt), 0), time.Duration(expiredAt-now) * time.Second, nil }