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

simulators/ethereum/engine: Fix ForkID Tests #837

Merged
merged 5 commits into from
Aug 31, 2023
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
6 changes: 3 additions & 3 deletions simulators/ethereum/engine/devp2p/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func (c *Conn) negotiateEthProtocol(caps []p2p.Cap) {
func (c *Conn) statusExchange(status *Status) (Message, error) {
defer c.SetDeadline(time.Time{})
c.SetDeadline(time.Now().Add(20 * time.Second))

localForkID := c.consensusEngine.ForkID()
// read status message from client
var message Message
loop:
Expand All @@ -364,7 +364,7 @@ loop:
if have, want := msg.TD.Cmp(c.consensusEngine.ChainTotalDifficulty), 0; have != want {
return nil, fmt.Errorf("wrong TD in status: have %d want %d", have, want)
}
if have, want := msg.ForkID, c.consensusEngine.ForkID(); !reflect.DeepEqual(have, want) {
if have, want := msg.ForkID, localForkID; !reflect.DeepEqual(have, want) {
return nil, fmt.Errorf("wrong fork ID in status: have (hash=%#x, next=%d), want (hash=%#x, next=%d)", have.Hash, have.Next, want.Hash, want.Next)
}
if have, want := msg.ProtocolVersion, c.ourHighestProtoVersion; have != uint32(want) {
Expand Down Expand Up @@ -393,7 +393,7 @@ loop:
TD: c.consensusEngine.ChainTotalDifficulty,
Head: c.consensusEngine.LatestHeader.Hash(),
Genesis: c.consensusEngine.GenesisBlock().Hash(),
ForkID: c.consensusEngine.ForkID(),
ForkID: localForkID,
}
}
if _, err := c.Write(status); err != nil {
Expand Down
3 changes: 0 additions & 3 deletions simulators/ethereum/engine/globals/globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ func (f *ForkConfig) ConfigGenesis(genesis *core.Genesis) error {
if genesis.ExcessBlobGas == nil {
genesis.ExcessBlobGas = new(uint64)
}
if genesis.BeaconRoot == nil {
genesis.BeaconRoot = new(common.Hash)
}
}
}
return nil
Expand Down
12 changes: 7 additions & 5 deletions simulators/ethereum/engine/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ require (
github.com/golang-jwt/jwt/v4 v4.4.3
github.com/holiman/uint256 v1.2.3
github.com/pkg/errors v0.9.1
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad
)

require (
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.0 // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand All @@ -24,15 +25,15 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect
github.com/cockroachdb/pebble v0.0.0-20230821143352-55b44ac08de8 // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.11.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/deepmap/oapi-codegen v1.12.4 // indirect
github.com/ethereum/c-kzg-4844 v0.3.0 // indirect
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
github.com/fjl/memsize v0.0.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
Expand Down Expand Up @@ -85,15 +86,16 @@ require (
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/ethereum/go-ethereum => github.com/lightclient/go-ethereum v1.10.10-0.20230811210943-0cee617571f0
replace github.com/ethereum/go-ethereum => github.com/lightclient/go-ethereum v1.10.10-0.20230829211949-79f3c2d9c96b
28 changes: 16 additions & 12 deletions simulators/ethereum/engine/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMd
github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8=
github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
github.com/VictoriaMetrics/fastcache v1.12.0 h1:vnVi/y9yKDcD9akmc4NqAoqgQhJrOwUF+j9LTgn4QDE=
Expand Down Expand Up @@ -37,15 +39,15 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA=
github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877 h1:1MLK4YpFtIEo3ZtMA5C795Wtv5VuUnrXX7mQG+aHg6o=
github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8=
github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk=
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk=
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM=
github.com/cockroachdb/pebble v0.0.0-20230821143352-55b44ac08de8 h1:2fNOyQqrHSjFdqnKqSLj9W7eGTcqKujJPA8vAuT1zN8=
github.com/cockroachdb/pebble v0.0.0-20230821143352-55b44ac08de8/go.mod h1:bynZ3gvVyhlvjLI7PT6dmZ7g76xzJ7HpxfjgkzCGz6s=
github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ=
github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
Expand Down Expand Up @@ -74,16 +76,16 @@ github.com/deepmap/oapi-codegen v1.12.4 h1:pPmn6qI9MuOtCz82WY2Xaw46EQjgvxednXXrP
github.com/deepmap/oapi-codegen v1.12.4/go.mod h1:3lgHGMu6myQ2vqbbTXH2H1o4eXFTGnFiDaOaKKl5yas=
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/docker/docker v20.10.17+incompatible h1:JYCuMrWaVNophQTOrMMoSwudOVEfcegoZZrleKc1xwE=
github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
github.com/ethereum/c-kzg-4844 v0.3.0 h1:3Y3hD6l5i0dEYsBL50C+Om644kve3pNqoAcvE26o9zI=
github.com/ethereum/c-kzg-4844 v0.3.0/go.mod h1:WI2Nd82DMZAAZI1wV2neKGost9EKjvbpQR9OqE5Qqa8=
github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg=
github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/hive v0.0.0-20230313141339-8e3200bfc09e h1:3g9cqRqpbZ92tSlGL4PfFoq435axKw6HiZ1Gz3fOkfk=
github.com/ethereum/hive v0.0.0-20230313141339-8e3200bfc09e/go.mod h1:PlpDuxHg6q1jU0K8Ouf+RXlHguignJ7k8Eyukc9RCPQ=
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
Expand Down Expand Up @@ -232,8 +234,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y=
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
github.com/lightclient/go-ethereum v1.10.10-0.20230811210943-0cee617571f0 h1:TDi8DB9gLSiWJ7mnsdAFDE5zBcY/qYBfvfLGCYepPGA=
github.com/lightclient/go-ethereum v1.10.10-0.20230811210943-0cee617571f0/go.mod h1:B/cPTafll0UGQ1m2ceGgP0JTNKL+pxPebUEptS4mXYQ=
github.com/lightclient/go-ethereum v1.10.10-0.20230829211949-79f3c2d9c96b h1:dglsK4NuDRreW5+/0EoTFxCiZwkRZay/aDoOul2lca0=
github.com/lightclient/go-ethereum v1.10.10-0.20230829211949-79f3c2d9c96b/go.mod h1:UWQqzN9473khWbdvlh2QjYXX0ykhKT1OuPYus9Hgv+o=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
Expand Down Expand Up @@ -401,8 +403,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad h1:g0bG7Z4uG+OgH2QDODnjp6ggkk1bJDsINcuWmJN1iJU=
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand All @@ -411,6 +413,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU=
golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -510,6 +514,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo=
golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -554,8 +560,6 @@ gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU=
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
56 changes: 28 additions & 28 deletions simulators/ethereum/engine/helper/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ type PayloadCustomizer interface {
}

type CustomPayloadData struct {
ParentHash *common.Hash
FeeRecipient *common.Address
StateRoot *common.Hash
ReceiptsRoot *common.Hash
LogsBloom *[]byte
PrevRandao *common.Hash
Number *uint64
GasLimit *uint64
GasUsed *uint64
Timestamp *uint64
ExtraData *[]byte
BaseFeePerGas *big.Int
BlockHash *common.Hash
Transactions *[][]byte
Withdrawals types.Withdrawals
RemoveWithdrawals bool
BlobGasUsed *uint64
RemoveBlobGasUsed bool
ExcessBlobGas *uint64
RemoveExcessBlobGas bool
BeaconRoot *common.Hash
RemoveBeaconRoot bool
ParentHash *common.Hash
FeeRecipient *common.Address
StateRoot *common.Hash
ReceiptsRoot *common.Hash
LogsBloom *[]byte
PrevRandao *common.Hash
Number *uint64
GasLimit *uint64
GasUsed *uint64
Timestamp *uint64
ExtraData *[]byte
BaseFeePerGas *big.Int
BlockHash *common.Hash
Transactions *[][]byte
Withdrawals types.Withdrawals
RemoveWithdrawals bool
BlobGasUsed *uint64
RemoveBlobGasUsed bool
ExcessBlobGas *uint64
RemoveExcessBlobGas bool
ParentBeaconRoot *common.Hash
RemoveParentBeaconRoot bool
}

var _ PayloadCustomizer = (*CustomPayloadData)(nil)
Expand Down Expand Up @@ -136,12 +136,12 @@ func (customData *CustomPayloadData) CustomizePayload(basePayload *typ.Executabl
} else if basePayload.ExcessBlobGas != nil {
customPayloadHeader.ExcessBlobGas = basePayload.ExcessBlobGas
}
if customData.RemoveBeaconRoot {
customPayloadHeader.BeaconRoot = nil
} else if customData.BeaconRoot != nil {
customPayloadHeader.BeaconRoot = customData.BeaconRoot
if customData.RemoveParentBeaconRoot {
customPayloadHeader.ParentBeaconRoot = nil
} else if customData.ParentBeaconRoot != nil {
customPayloadHeader.ParentBeaconRoot = customData.ParentBeaconRoot
} else if baseBeaconRoot != nil {
customPayloadHeader.BeaconRoot = baseBeaconRoot
customPayloadHeader.ParentBeaconRoot = baseBeaconRoot
}

// Return the new payload
Expand Down Expand Up @@ -170,7 +170,7 @@ func (customData *CustomPayloadData) CustomizePayload(basePayload *typ.Executabl
} else if basePayload.Withdrawals != nil {
result.Withdrawals = basePayload.Withdrawals
}
return result, customPayloadHeader.BeaconRoot, nil
return result, customPayloadHeader.ParentBeaconRoot, nil
}

func CustomizePayloadTransactions(basePayload *typ.ExecutableData, baseBeaconRoot *common.Hash, customTransactions types.Transactions) (*typ.ExecutableData, *common.Hash, error) {
Expand Down
31 changes: 29 additions & 2 deletions simulators/ethereum/engine/suites/cancun/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (step ParallelSteps) Execute(t *CancunTestContext) error {
}

func (step ParallelSteps) Description() string {
desc := fmt.Sprintf("ParallelSteps: running steps in parallel:\n")
desc := "ParallelSteps: running steps in parallel:\n"
for i, step := range step.Steps {
desc += fmt.Sprintf("%d: %s\n", i, step.Description())
}
Expand Down Expand Up @@ -670,6 +670,33 @@ func (step DevP2PClientPeering) Execute(t *CancunTestContext) error {
}
defer conn.Close()
t.Logf("INFO: Connected to client %d, remote public key: %s", step.ClientIndex, conn.RemoteKey())

// Sleep
time.Sleep(1 * time.Second)

// Timeout value for all requests
timeout := 20 * time.Second

// Send a ping request to verify that we are not immediately disconnected
pingReq := &devp2p.Ping{}
if size, err := conn.Write(pingReq); err != nil {
return errors.Wrap(err, "could not write to conn")
} else {
t.Logf("INFO: Wrote %d bytes to conn", size)
}

// Finally wait for the pong response
msg, err := conn.WaitForResponse(timeout, 0)
if err != nil {
return errors.Wrap(err, "error waiting for response")
}
switch msg := msg.(type) {
case *devp2p.Pong:
t.Logf("INFO: Received pong response: %v", msg)
default:
return fmt.Errorf("unexpected message type: %T", msg)
}

return nil
}

Expand Down Expand Up @@ -794,7 +821,7 @@ func (step DevP2PRequestPooledTransactionHash) Execute(t *CancunTestContext) err
return fmt.Errorf("expected size %d, got %d", len(expBytes), len(txBytes))
}

if bytes.Compare(expBytes, txBytes) != 0 {
if !bytes.Equal(expBytes, txBytes) {
return fmt.Errorf("expected tx %#x, got %#x", expBytes, txBytes)
}

Expand Down
28 changes: 23 additions & 5 deletions simulators/ethereum/engine/suites/cancun/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ var Tests = []test.SpecInterface{
ExpectedIncludedBlobCount: 0,
Version: 3,
PayloadCustomizer: &helper.CustomPayloadData{
BeaconRoot: &(common.Hash{}),
ParentBeaconRoot: &(common.Hash{}),
},
ExpectedError: INVALID_PARAMS_ERROR,
ExpectationDescription: fmt.Sprintf(`
Expand Down Expand Up @@ -702,9 +702,9 @@ var Tests = []test.SpecInterface{
Blobs: []helper.BlobID{},
},
PayloadCustomizer: &helper.CustomPayloadData{
ExcessBlobGas: pUint64(0),
BlobGasUsed: pUint64(0),
BeaconRoot: &(common.Hash{}),
ExcessBlobGas: pUint64(0),
BlobGasUsed: pUint64(0),
ParentBeaconRoot: &(common.Hash{}),
},
ExpectedError: UNSUPPORTED_FORK_ERROR,
ExpectationDescription: fmt.Sprintf(`
Expand Down Expand Up @@ -788,7 +788,7 @@ var Tests = []test.SpecInterface{
ExpectedIncludedBlobCount: 0,
Version: 3,
PayloadCustomizer: &helper.CustomPayloadData{
RemoveBeaconRoot: true,
RemoveParentBeaconRoot: true,
},
ExpectedError: INVALID_PARAMS_ERROR,
ExpectationDescription: fmt.Sprintf(`
Expand Down Expand Up @@ -1420,6 +1420,24 @@ var Tests = []test.SpecInterface{
},
},

&CancunForkSpec{
GenesisTimestamp: 1,
ShanghaiTimestamp: 0,
CancunTimestamp: 1,

CancunBaseSpec: CancunBaseSpec{
Spec: test.Spec{
Name: "ForkID, genesis at 1, shanghai at 0, cancun at 1",
About: `
Attemp to peer client with the following configuration at height 0:
- genesis timestamp 1
- shanghai fork at timestamp 0
- cancun fork at timestamp 1
`,
},
},
},

&CancunForkSpec{
GenesisTimestamp: 0,
ShanghaiTimestamp: 0,
Expand Down
Loading