diff --git a/encoding/codecv3.go b/encoding/codecv3.go index 3ea65f1..6127b66 100644 --- a/encoding/codecv3.go +++ b/encoding/codecv3.go @@ -7,7 +7,6 @@ import ( "fmt" "github.com/scroll-tech/go-ethereum/common" - "github.com/scroll-tech/go-ethereum/params" ) type DACodecV3 struct { @@ -115,7 +114,7 @@ func (d *DACodecV3) EstimateChunkL1CommitGas(c *Chunk) (uint64, error) { if err != nil { return 0, fmt.Errorf("failed to estimate L1 commit gas for chunk: %w", err) } - totalL1CommitGas += params.BlobTxPointEvaluationPrecompileGas // plus gas cost for the point-evaluation precompile call. + totalL1CommitGas += blobTxPointEvaluationPrecompileGas // plus gas cost for the point-evaluation precompile call. return totalL1CommitGas, nil } @@ -127,7 +126,7 @@ func (d *DACodecV3) EstimateBatchL1CommitGas(b *Batch) (uint64, error) { if err != nil { return 0, fmt.Errorf("failed to estimate L1 commit gas for batch: %w", err) } - totalL1CommitGas += params.BlobTxPointEvaluationPrecompileGas // plus gas cost for the point-evaluation precompile call. + totalL1CommitGas += blobTxPointEvaluationPrecompileGas // plus gas cost for the point-evaluation precompile call. return totalL1CommitGas, nil } diff --git a/encoding/da.go b/encoding/da.go index 5f22756..480679d 100644 --- a/encoding/da.go +++ b/encoding/da.go @@ -78,18 +78,19 @@ const ( ) const ( - payloadLengthBytes = 4 - calldataNonZeroByteGas = 16 - coldSloadGas = 2100 - coldAddressAccessGas = 2600 - warmAddressAccessGas = 100 - warmSloadGas = 100 - baseTxGas = 21000 - sstoreGas = 20000 - extraGasCost = 100000 // over-estimate the gas cost for ops like _getAdmin, _implementation, _requireNotPaused, etc - skippedL1MessageBitmapByteSize = 32 - functionSignatureBytes = 4 - defaultParameterBytes = 32 + payloadLengthBytes = 4 + calldataNonZeroByteGas = 16 + coldSloadGas = 2100 + coldAddressAccessGas = 2600 + warmAddressAccessGas = 100 + warmSloadGas = 100 + baseTxGas = 21000 + sstoreGas = 20000 + extraGasCost = 100000 // over-estimate the gas cost for ops like _getAdmin, _implementation, _requireNotPaused, etc + blobTxPointEvaluationPrecompileGas = 50000 + skippedL1MessageBitmapByteSize = 32 + functionSignatureBytes = 4 + defaultParameterBytes = 32 ) // Block represents an L2 block. @@ -628,9 +629,9 @@ func GetHardforkName(config *params.ChainConfig, blockHeight, blockTimestamp uin return "homestead" } else if !config.IsCurie(blockHeightBigInt) { return "bernoulli" - } else if !config.IsDarwin(blockHeightBigInt, blockTimestamp) { + } else if !config.IsDarwin(blockTimestamp) { return "curie" - } else if !config.IsDarwinV2(blockHeightBigInt, blockTimestamp) { + } else if !config.IsDarwinV2(blockTimestamp) { return "darwin" } else { return "darwinV2" @@ -644,9 +645,9 @@ func GetCodecVersion(config *params.ChainConfig, blockHeight, blockTimestamp uin return CodecV0 } else if !config.IsCurie(blockHeightBigInt) { return CodecV1 - } else if !config.IsDarwin(blockHeightBigInt, blockTimestamp) { + } else if !config.IsDarwin(blockTimestamp) { return CodecV2 - } else if !config.IsDarwinV2(blockHeightBigInt, blockTimestamp) { + } else if !config.IsDarwinV2(blockTimestamp) { return CodecV3 } else { return CodecV4 diff --git a/encoding/interfaces.go b/encoding/interfaces.go index 80b44e6..6461a30 100644 --- a/encoding/interfaces.go +++ b/encoding/interfaces.go @@ -98,9 +98,9 @@ func CodecFromVersion(version CodecVersion) (Codec, error) { // CodecFromConfig determines and returns the appropriate codec based on chain configuration, block number, and timestamp. func CodecFromConfig(chainCfg *params.ChainConfig, startBlockNumber *big.Int, startBlockTimestamp uint64) Codec { - if chainCfg.IsDarwinV2(startBlockNumber, startBlockTimestamp) { + if chainCfg.IsDarwinV2(startBlockTimestamp) { return &DACodecV4{} - } else if chainCfg.IsDarwin(startBlockNumber, startBlockTimestamp) { + } else if chainCfg.IsDarwin(startBlockTimestamp) { return &DACodecV3{} } else if chainCfg.IsCurie(startBlockNumber) { return &DACodecV2{} diff --git a/go.mod b/go.mod index a3e1927..5e59df2 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/agiledragon/gomonkey/v2 v2.12.0 - github.com/scroll-tech/go-ethereum v1.10.14-0.20241010064814-3d88e870ae22 + github.com/scroll-tech/go-ethereum v1.10.14-0.20241206090635-a5ecce2dc333 github.com/stretchr/testify v1.9.0 ) diff --git a/go.sum b/go.sum index d8f830f..6df06ba 100644 --- a/go.sum +++ b/go.sum @@ -115,6 +115,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/scroll-tech/go-ethereum v1.10.14-0.20241010064814-3d88e870ae22 h1:s1/8G2HP1z9jd0FBbUVs7viv/lQZA/8QoQppXYTX1CU= github.com/scroll-tech/go-ethereum v1.10.14-0.20241010064814-3d88e870ae22/go.mod h1:r9FwtxCtybMkTbWYCyBuevT9TW3zHmOTHqD082Uh+Oo= +github.com/scroll-tech/go-ethereum v1.10.14-0.20241206090635-a5ecce2dc333 h1:qJXViC4vPMcYNVImHnSWIL4IMXtiyolaN687+qVwc0Y= +github.com/scroll-tech/go-ethereum v1.10.14-0.20241206090635-a5ecce2dc333/go.mod h1:xRDJvaNUe7lCU2fB+AqyS7gahar+dfJPrUJplfXF4dw= github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE= github.com/scroll-tech/zktrie v0.8.4/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=