Skip to content

Commit

Permalink
simulators/ethereum/engine: Sharding->Cancun
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Apr 25, 2023
1 parent 5e68485 commit e8c2c4c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions simulators/ethereum/engine/clmock/clmock.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ func isShanghai(blockTimestamp uint64, shanghaiTimestamp *big.Int) bool {
return shanghaiTimestamp != nil && big.NewInt(int64(blockTimestamp)).Cmp(shanghaiTimestamp) >= 0
}

func isSharding(blockTimestamp uint64, shardingTimestamp *big.Int) bool {
return shardingTimestamp != nil && big.NewInt(int64(blockTimestamp)).Cmp(shardingTimestamp) >= 0
func isCancun(blockTimestamp uint64, cancunTimestamp *big.Int) bool {
return cancunTimestamp != nil && big.NewInt(int64(blockTimestamp)).Cmp(cancunTimestamp) >= 0
}

func NewCLMocker(t *hivesim.T, slotsToSafe, slotsToFinalized, safeSlotsToImportOptimistically *big.Int, forkConfig globals.ForkConfig) *CLMocker {
Expand Down Expand Up @@ -369,7 +369,7 @@ func (cl *CLMocker) GetNextPayload() {
var err error
ctx, cancel := context.WithTimeout(cl.TestContext, globals.RPCTimeout)
defer cancel()
if isSharding(cl.LatestPayloadAttributes.Timestamp, cl.ShardingForkTimestamp) {
if isCancun(cl.LatestPayloadAttributes.Timestamp, cl.CancunTimestamp) {
cl.LatestPayloadBuilt, cl.LatestBlockValue, cl.LatestBlobBundle, err = cl.NextBlockProducer.GetPayloadV3(ctx, cl.NextPayloadID)
} else if isShanghai(cl.LatestPayloadAttributes.Timestamp, cl.ShanghaiTimestamp) {
cl.LatestPayloadBuilt, cl.LatestBlockValue, err = cl.NextBlockProducer.GetPayloadV2(ctx, cl.NextPayloadID)
Expand Down Expand Up @@ -619,7 +619,7 @@ func (cl *CLMocker) BroadcastNewPayload(payload *api.ExecutableData) []ExecutePa
execPayloadResp api.PayloadStatusV1
err error
)
if isSharding(payload.Timestamp, cl.ShardingForkTimestamp) {
if isCancun(payload.Timestamp, cl.CancunTimestamp) {
execPayloadResp, err = ec.NewPayloadV3(ctx, payload)
} else if isShanghai(payload.Timestamp, cl.ShanghaiTimestamp) {
execPayloadResp, err = ec.NewPayloadV2(ctx, payload)
Expand Down
4 changes: 2 additions & 2 deletions simulators/ethereum/engine/globals/globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ var (

// Global types
type ForkConfig struct {
ShanghaiTimestamp *big.Int
ShardingForkTimestamp *big.Int
ShanghaiTimestamp *big.Int
CancunTimestamp *big.Int
}
2 changes: 1 addition & 1 deletion simulators/ethereum/engine/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ require (
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/ethereum/go-ethereum => github.com/mdehoog/go-ethereum v1.10.19-0.20230424164545-6f54b68a31de
replace github.com/ethereum/go-ethereum => github.com/mdehoog/go-ethereum v1.10.19-0.20230425170637-4bf5349a398b
4 changes: 2 additions & 2 deletions simulators/ethereum/engine/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpe
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/mdehoog/go-ethereum v1.10.19-0.20230424164545-6f54b68a31de h1:o+C9qzIVKZE8a0+CQhgU0M/hfEaRd+uxqsrvEPLsl2g=
github.com/mdehoog/go-ethereum v1.10.19-0.20230424164545-6f54b68a31de/go.mod h1:LDxvmzuVWhMl85FiRncDQZbgeg4218U/X73hJuRxszc=
github.com/mdehoog/go-ethereum v1.10.19-0.20230425170637-4bf5349a398b h1:kPHJ0IGfdCk7Cry86FXFWwo3dCFx4DMjYRnrmxnNrjg=
github.com/mdehoog/go-ethereum v1.10.19-0.20230425170637-4bf5349a398b/go.mod h1:LDxvmzuVWhMl85FiRncDQZbgeg4218U/X73hJuRxszc=
github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8=
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
Expand Down
4 changes: 2 additions & 2 deletions simulators/ethereum/engine/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ func addTestsToSuite(sim *hivesim.Simulation, suite *hivesim.Suite, tests []test
newParams = newParams.Set("HIVE_SHANGHAI_TIMESTAMP", fmt.Sprintf("%d", currentTest.GetForkConfig().ShanghaiTimestamp))
// Ensure the merge transition is activated before shanghai.
newParams = newParams.Set("HIVE_MERGE_BLOCK_ID", "0")
if currentTest.GetForkConfig().ShardingForkTimestamp != nil {
newParams = newParams.Set("HIVE_SHARDING_FORK_TIMESTAMP", fmt.Sprintf("%d", currentTest.GetForkConfig().ShardingForkTimestamp))
if currentTest.GetForkConfig().CancunTimestamp != nil {
newParams = newParams.Set("HIVE_CANCUN_TIMESTAMP", fmt.Sprintf("%d", currentTest.GetForkConfig().CancunTimestamp))
}
}

Expand Down
6 changes: 3 additions & 3 deletions simulators/ethereum/engine/suites/blobs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"github.com/ethereum/hive/simulators/ethereum/engine/globals"
)

// Generates the fork config, including sharding fork timestamp.
// Generates the fork config, including cancun fork timestamp.
func (bs *BlobsBaseSpec) GetForkConfig() globals.ForkConfig {
return globals.ForkConfig{
ShanghaiTimestamp: big.NewInt(0),
ShardingForkTimestamp: big.NewInt(int64(bs.BlobsForkHeight) * int64(bs.GetBlockTimeIncrements())),
ShanghaiTimestamp: big.NewInt(0),
CancunTimestamp: big.NewInt(int64(bs.BlobsForkHeight) * int64(bs.GetBlockTimeIncrements())),
}
}

Expand Down
4 changes: 2 additions & 2 deletions simulators/ethereum/engine/suites/blobs/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ var Tests = []test.SpecInterface{
&BlobsBaseSpec{

Spec: test.Spec{
Name: "Blob Transactions On Genesis",
Name: "Blob Transactions On Block 1, Cancun Genesis",
About: `
Tests the sharding fork on genesis.
Tests the Cancun fork since genesis.
`,
},

Expand Down
4 changes: 2 additions & 2 deletions simulators/ethereum/go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vq
github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY=
github.com/mdehoog/go-ethereum v1.10.19-0.20230424164545-6f54b68a31de h1:o+C9qzIVKZE8a0+CQhgU0M/hfEaRd+uxqsrvEPLsl2g=
github.com/mdehoog/go-ethereum v1.10.19-0.20230424164545-6f54b68a31de/go.mod h1:LDxvmzuVWhMl85FiRncDQZbgeg4218U/X73hJuRxszc=
github.com/mdehoog/go-ethereum v1.10.19-0.20230425170637-4bf5349a398b h1:kPHJ0IGfdCk7Cry86FXFWwo3dCFx4DMjYRnrmxnNrjg=
github.com/mdehoog/go-ethereum v1.10.19-0.20230425170637-4bf5349a398b/go.mod h1:LDxvmzuVWhMl85FiRncDQZbgeg4218U/X73hJuRxszc=
github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4=
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
Expand Down

0 comments on commit e8c2c4c

Please sign in to comment.