Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions encoding/codecv0_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"encoding/hex"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/core/types"
"github.com/scroll-tech/go-ethereum/crypto/kzg4844"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestCodecV0BlockEncode(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions encoding/codecv1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import (
"testing"

"github.com/agiledragon/gomonkey/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/common/hexutil"
"github.com/scroll-tech/go-ethereum/core/types"
"github.com/scroll-tech/go-ethereum/crypto"
"github.com/scroll-tech/go-ethereum/crypto/kzg4844"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestCodecV1BlockEncode(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions encoding/codecv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import (
"testing"

"github.com/agiledragon/gomonkey/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/common/hexutil"
"github.com/scroll-tech/go-ethereum/core/types"
"github.com/scroll-tech/go-ethereum/crypto"
"github.com/scroll-tech/go-ethereum/crypto/kzg4844"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestCodecV2BlockEncode(t *testing.T) {
Expand Down
5 changes: 2 additions & 3 deletions encoding/codecv3.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"

"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/params"
)

type DACodecV3 struct {
Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down
5 changes: 3 additions & 2 deletions encoding/codecv3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import (
"testing"

"github.com/agiledragon/gomonkey/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/common/hexutil"
"github.com/scroll-tech/go-ethereum/core/types"
"github.com/scroll-tech/go-ethereum/crypto"
"github.com/scroll-tech/go-ethereum/crypto/kzg4844"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestCodecV3BlockEncode(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions encoding/codecv4_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (
"testing"

"github.com/agiledragon/gomonkey/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/common/hexutil"
"github.com/scroll-tech/go-ethereum/core/types"
"github.com/scroll-tech/go-ethereum/crypto"
"github.com/scroll-tech/go-ethereum/crypto/kzg4844"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestCodecV4BlockEncode(t *testing.T) {
Expand Down
33 changes: 17 additions & 16 deletions encoding/da.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions encoding/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
3 changes: 2 additions & 1 deletion encoding/interfaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"math/big"
"testing"

"github.com/scroll-tech/go-ethereum/params"
"github.com/stretchr/testify/assert"

"github.com/scroll-tech/go-ethereum/params"
)

func TestCodecFromVersion(t *testing.T) {
Expand Down
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,36 @@ 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.20241210104312-bdf64cfb39dc
github.com/stretchr/testify v1.9.0
)

require (
github.com/bits-and-blooms/bitset v1.12.0 // indirect
github.com/btcsuite/btcd v0.20.1-beta // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/iden3/go-iden3-crypto v0.0.15 // indirect
github.com/klauspost/compress v1.17.9
github.com/kr/text v0.2.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/scroll-tech/zktrie v0.8.4 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/sys v0.21.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading
Loading