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: Withdrawals Test Suite #659

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
162eb3f
clients/go-ethereum: Changes to use withdrawals branch
marioevz Nov 18, 2022
adca3d3
simulators/ethereum/engine: Withdrawals Sanity test
marioevz Nov 18, 2022
cf02f1a
clients/nethermind: Use withdrawals branch
marioevz Nov 19, 2022
e9c6bb5
simulators/ethereum/engine: CLMock changes
marioevz Nov 19, 2022
06754b1
simulators/ethereum/engine: Add timestamp global
marioevz Nov 19, 2022
43ef149
simulators/ethereum/engine: Withdrawals required changes
marioevz Nov 19, 2022
4c525d3
simulators/ethereum/engine: Fix request payload
marioevz Nov 19, 2022
1e92ad6
simulators/ethereum/engine: Withdrawals tests
marioevz Nov 19, 2022
6afbbf4
simulators/ethereum/engine: Withdrawals tests update
marioevz Nov 21, 2022
06501a2
simulators/ethereum/engine: Test spec interface
marioevz Nov 21, 2022
19e0ac3
simulators/ethereum/engine: Add withdrawals test cases
marioevz Nov 21, 2022
178e3a0
simulators/ethereum/engine: Withdraw many accounts fix
marioevz Nov 21, 2022
12afc87
clients/nethermind: Temporarily remove MergeForkIdTransition
marioevz Nov 21, 2022
fa13e38
simulators/ethereum/engine: Withdrawals sync tests
marioevz Nov 22, 2022
12dd0ae
simulators/ethereum/engine: Withdrawals re-org
marioevz Nov 23, 2022
2a69716
simulators/ethereum/engine: More withdrawals tests
marioevz Nov 23, 2022
197db62
simulators/ethereum/engine: Variable timestamp increments on CLMock
marioevz Nov 24, 2022
306df1d
simulators/ethereum/engine: Withdrawals reorg changes
marioevz Nov 24, 2022
7e7c461
simulators/ethereum/engine: withdrawals reorg tests
marioevz Nov 25, 2022
2483d79
simulators/ethereum/engine: Add LVH check
marioevz Nov 25, 2022
9611842
simulators/ethereum/engine: Dynamic genesis
marioevz Nov 28, 2022
152f4ef
simulators/ethereum/engine: Fix HTTP Transport usage
marioevz Nov 28, 2022
16ecb18
simulators/ethereum/engine: Roundtrip change
marioevz Nov 28, 2022
6f2d52c
clients/go-ethereum: add delve debugging
marioevz Nov 29, 2022
e92ff01
simulator/ethereum/engine: Add txs to withdrawal tests
marioevz Nov 30, 2022
fe7f0f5
simulators/ethereum/engine: Decrease withdrawals count
marioevz Dec 5, 2022
cbb85dc
simulators/ethereum/engine: Withdrawals test change
marioevz Dec 7, 2022
c9e2628
simulators/ethereum/engine: Withdrawals, comments
marioevz Dec 8, 2022
d4b3142
clients/erigon: Shanghai
marioevz Dec 8, 2022
5816a2c
simulators/ethereum/engine: fix lvh in withdrawals
marioevz Dec 12, 2022
e8da0c9
simulators/ethereum/engine: go mod tidy
marioevz Dec 13, 2022
b52fd13
simulators/ethereum/engine: Fix lvh check on genesis
marioevz Dec 16, 2022
3499b9f
simulators/ethereum/engine: Fix long sync test
marioevz Dec 19, 2022
4666b52
simulators/ethereum/engine: Fix sync tests take 2
marioevz Dec 19, 2022
29a5c9a
simulators/ethereum/engine: Add blockValue to getPayload
marioevz Dec 16, 2022
3c2c437
clients/go-ethereum: update shanghai config string
marioevz Jan 13, 2023
e4b4de2
simulators/ethereum/engine: withdrawals, wei to gwei
marioevz Jan 13, 2023
03e086e
simulators/ethereum/engine: fix genesis block
marioevz Jan 14, 2023
ab04d00
simulators/ethereum/engine: implement error code expect check
marioevz Jan 14, 2023
d093221
simulators/ethereum/engine: withdrawals, expect errors on invalid ver…
marioevz Jan 14, 2023
1e3784c
simulators/ethereum/engine: Withdrawals readme
marioevz Jan 18, 2023
42c28eb
simulators/ethereum/engine: update withdrawals readme
marioevz Jan 18, 2023
62a69bf
simulators/ethereum/engine: update test parameter, description
marioevz Jan 18, 2023
ca6dfa6
clients/nethermind: revert docker image to normal
marioevz Jan 19, 2023
994d92d
simulators/ethereum/engine: update branch
marioevz Jan 19, 2023
09e048b
clients/erigon: use devel
marioevz Jan 19, 2023
731037e
simulators/ethereum/engine: Support querying txs from client
marioevz Jan 20, 2023
11e9385
simulators/ethereum/engine: Add eip 3860 invalid tx test
marioevz Jan 20, 2023
835ce3d
simulators/ethereum/engine: fix gaslimit everywhere
marioevz Jan 23, 2023
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
1 change: 1 addition & 0 deletions clients/erigon/mapper.jq
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ def to_bool:
"berlinBlock": env.HIVE_FORK_BERLIN|to_int,
"londonBlock": env.HIVE_FORK_LONDON|to_int,
"terminalTotalDifficulty": env.HIVE_TERMINAL_TOTAL_DIFFICULTY|to_int,
"shanghaiTime": env.HIVE_SHANGHAI_TIMESTAMP|to_int,
}|remove_empty
}
41 changes: 21 additions & 20 deletions clients/go-ethereum/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,30 @@
# produce a very minimalistic container that can be reused many times without
# needing to constantly rebuild.

ARG branch=latest
FROM ethereum/client-go:$branch
ARG branch=withdrawals-timestamp
# FROM ethereum/client-go:$branch

RUN apk add --update bash curl jq
# RUN apk add --update bash curl jq

# FROM alpine:latest
# ARG branch=master
FROM alpine:latest
ARG branch=master

# Build go-ethereum on the fly and delete all build tools afterwards
# RUN \
# apk add --update bash curl jq go git make gcc musl-dev \
# ca-certificates linux-headers && \
# git clone --depth 1 --branch $branch https://github.com/ethereum/go-ethereum && \
# (cd go-ethereum && make geth) && \
# (cd go-ethereum && \
# echo "{}" \
# | jq ".+ {\"repo\":\"$(git config --get remote.origin.url)\"}" \
# | jq ".+ {\"branch\":\"$(git rev-parse --abbrev-ref HEAD)\"}" \
# | jq ".+ {\"commit\":\"$(git rev-parse HEAD)\"}" \
# > /version.json) && \
# cp go-ethereum/build/bin/geth /geth && \
# apk del go git make gcc musl-dev linux-headers && \
# rm -rf /go-ethereum && rm -rf /var/cache/apk/*
RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN \
apk add --update bash curl jq go delve git make gcc musl-dev \
ca-certificates linux-headers && \
git clone --depth 1 --branch withdrawals-timestamp https://github.com/lightclient/go-ethereum && \
(cd go-ethereum && make geth) && \
(cd go-ethereum && \
echo "{}" \
| jq ".+ {\"repo\":\"$(git config --get remote.origin.url)\"}" \
| jq ".+ {\"branch\":\"$(git rev-parse --abbrev-ref HEAD)\"}" \
| jq ".+ {\"commit\":\"$(git rev-parse HEAD)\"}" \
> /version.json) && \
cp go-ethereum/build/bin/geth /usr/local/bin/geth && \
apk del go git make gcc musl-dev linux-headers && \
rm -rf /var/cache/apk/*

RUN /usr/local/bin/geth console --exec 'console.log(admin.nodeInfo.name)' --maxpeers=0 --nodiscover --dev 2>/dev/null | head -1 > /version.txt

Expand All @@ -43,7 +44,7 @@ RUN chmod +x /hive-bin/enode.sh
ADD genesis.json /genesis.json

# Export the usual networking ports to allow outside access to the node
EXPOSE 8545 8546 8547 8551 30303 30303/udp
EXPOSE 8545 8546 8547 8551 30303 30303/udp 40000

# Generate the ethash verification caches
RUN \
Expand Down
9 changes: 7 additions & 2 deletions clients/go-ethereum/geth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,10 @@ fi

# Run the go-ethereum implementation with the requested flags.
FLAGS="$FLAGS --nat=none"
echo "Running go-ethereum with flags $FLAGS"
$geth $FLAGS
if [ "$HIVE_CLIENT_DEBUGGING" != "" ]; then
echo "Running go-ethereum in debugger mode with flags $FLAGS"
"dlv" "--listen=:40000" "--headless=true" "--api-version=2" "--accept-multiclient" "--allow-non-terminal-interactive" "exec" $geth -- $FLAGS
else
echo "Running go-ethereum with flags $FLAGS"
$geth $FLAGS
fi
1 change: 1 addition & 0 deletions clients/go-ethereum/mapper.jq
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ def to_bool:
"londonBlock": env.HIVE_FORK_LONDON|to_int,
"mergeForkBlock": env.HIVE_MERGE_BLOCK_ID|to_int,
"terminalTotalDifficulty": env.HIVE_TERMINAL_TOTAL_DIFFICULTY|to_int,
"shanghaiTime": env.HIVE_SHANGHAI_TIMESTAMP|to_int,
}|remove_empty
}
5 changes: 4 additions & 1 deletion clients/nethermind/mapper.jq
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ def clique_engine:
"eip3198Transition": env.HIVE_FORK_LONDON|to_hex,

# Merge
"MergeForkIdTransition": env.HIVE_MERGE_BLOCK_ID|to_hex,
# "MergeForkIdTransition": env.HIVE_MERGE_BLOCK_ID|to_hex,

# Shanghai
"eip4895TransitionTimestamp": env.HIVE_SHANGHAI_TIMESTAMP|to_hex,

# Other chain parameters
"networkID": env.HIVE_NETWORK_ID|to_hex,
Expand Down
9 changes: 9 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
cloud.google.com/go/bigtable v1.2.0 h1:F4cCmA4nuV84V5zYQ3MKY+M1Cw1avHDuf3S/LcZPA9c=
github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08=
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db h1:nxAtV4VajJDhKysp2kdcJZsq8Ss1xSA0vZTkVHHJd0E=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/c-bata/go-prompt v0.2.2 h1:uyKRz6Z6DUyj49QVijyM339UJV9yhbr70gESwbNU3e0=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5 h1:2U0HzY8BJ8hVwDKIzp7y4voR9CX/nvcfymLmg2UiOio=
github.com/lightclient/go-ethereum v1.10.10-0.20230116085521-6ab6d738866f h1:Pox2oxBYKWVEw2JUCyiEybqEIurSkq8VHjRp6s9jdf8=
github.com/lightclient/go-ethereum v1.10.10-0.20230116085521-6ab6d738866f/go.mod h1:n7VlOgCwYheLB/mi+V8ni2yf8K2qM3N9WAmalxkhk+c=
github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo=
5 changes: 4 additions & 1 deletion simulators/ethereum/engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,4 +455,7 @@ Invalid token error is expected.

- Positive time drift, within limit, correct secret:
Engine API call where the `iat` claim contains a positive time drift smaller than the maximum threshold, and the secret to calculate the token is correct.
No error is expected.
No error is expected.

## Engine API Shanghai Upgrade Tests:
See [withdrawals](suites/withdrawals/README.md).
18 changes: 12 additions & 6 deletions simulators/ethereum/engine/client/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"math/big"

"github.com/ethereum/go-ethereum/core"
api "github.com/ethereum/go-ethereum/core/beacon"
"github.com/ethereum/hive/hivesim"

Expand All @@ -21,15 +22,20 @@ type Eth interface {
StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)
TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
}

type Engine interface {
ForkchoiceUpdatedV1(ctx context.Context, fcState *api.ForkchoiceStateV1, pAttributes *api.PayloadAttributesV1) (api.ForkChoiceResponse, error)
GetPayloadV1(ctx context.Context, payloadId *api.PayloadID) (api.ExecutableDataV1, error)
NewPayloadV1(ctx context.Context, payload *api.ExecutableDataV1) (api.PayloadStatusV1, error)
ForkchoiceUpdatedV1(ctx context.Context, fcState *api.ForkchoiceStateV1, pAttributes *api.PayloadAttributes) (api.ForkChoiceResponse, error)
ForkchoiceUpdatedV2(ctx context.Context, fcState *api.ForkchoiceStateV1, pAttributes *api.PayloadAttributes) (api.ForkChoiceResponse, error)

LatestForkchoiceSent() (fcState *api.ForkchoiceStateV1, pAttributes *api.PayloadAttributesV1)
LatestNewPayloadSent() (payload *api.ExecutableDataV1)
GetPayloadV1(ctx context.Context, payloadId *api.PayloadID) (api.ExecutableData, error)
GetPayloadV2(ctx context.Context, payloadId *api.PayloadID) (api.ExecutableData, *big.Int, error)
NewPayloadV1(ctx context.Context, payload *api.ExecutableData) (api.PayloadStatusV1, error)
NewPayloadV2(ctx context.Context, payload *api.ExecutableData) (api.PayloadStatusV1, error)

LatestForkchoiceSent() (fcState *api.ForkchoiceStateV1, pAttributes *api.PayloadAttributes)
LatestNewPayloadSent() (payload *api.ExecutableData)

LatestForkchoiceResponse() (fcuResponse *api.ForkChoiceResponse)
LatestNewPayloadResponse() (payloadResponse *api.PayloadStatusV1)
Expand Down Expand Up @@ -57,7 +63,7 @@ type EngineClient interface {
}

type EngineStarter interface {
StartClient(T *hivesim.T, testContext context.Context, ClientParams hivesim.Params, ClientFiles hivesim.Params, bootClients ...EngineClient) (EngineClient, error)
StartClient(T *hivesim.T, testContext context.Context, genesis *core.Genesis, ClientParams hivesim.Params, ClientFiles hivesim.Params, bootClients ...EngineClient) (EngineClient, error)
}

var (
Expand Down
Loading