Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(l2geth dependency): downgrade to l2geth latest develop #32

Merged
merged 3 commits into from
Dec 18, 2024
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