Skip to content

Conversation

@marioevz
Copy link
Member

@marioevz marioevz commented Jun 16, 2022

This PR adds following EL-mock-based testnet test cases:

  • Invalid Transition Payload: Validator produces an incorrect (invalid stateRoot) transition payload and generates an invalid beacon block with it, which shall be rejected by the rest of the validators.
  • Invalid Payload BlockHash: Validator produces payload with an invalid hash and generates an invalid beacon block with it, which shall be rejected by the rest of the validators.
  • Invalid Payload Timestamp: Validator produces payload with a timestamp that is beyond the slot timespan, which shall be rejected by the rest of the validators.
  • Invalid Header PrevRandao: Validator produces a valid payload but with an incorrect PrevRandao value and generates an invalid beacon block with it, which shall be rejected by the rest of the validators.
  • Syncing with Invalid Chain: Verifies the latestValidHash value is correctly interpreted by the CL when the EL had been SYNCING.
  • baseFee Encoding Check: Verifies that the endianess is correct when a payload that contains a base fee greater than 255, by generating a execution chain with a high base fee on genesis and then performing the merge.
  • Equal Timestamp Terminal Transition Block: Verifies that the CL does not request an invalid transition payload when the slot timestamp coincides with the terminal block's time.
  • TTD Before Bellatrix: Verifies that the CL and EL can perform the transition to Proof of Stake even when the TTD is hit before the Bellatrix epoch is reached by the beacon chain.
  • Invalid Quantity Fields: Injects invalid payload responses by swapping the quantity fields with different errors: leading zero (e.g. 0x01), empty value (0x), and overflow.
  • Invalid Terminal Block Total Difficulty: Starts a non-validating beacon node with an incorrect TTD configuration, the beacon node must not import beacon block containing transition payload based on the incorrect terminal block.

All test cases use a new functionality of the proxy that implements callbacks and allows to introduce logic before modifying/corrupting a payload.

@marioevz marioevz force-pushed the el-mock-new-testcases branch from bf4eb09 to 9a69d3a Compare June 21, 2022 23:11
@marioevz
Copy link
Member Author

Update:

  • Added "SYNCING with invalid chain" test case
  • Added parameter --data-storage-mode=ARCHIVE to Teku, which allows queries on finalized states
  • Rebased to master

@marioevz
Copy link
Member Author

Update, fixed "syncing-with-invalid-chain" by spoofing forkchoiceUpdated to also return SYNCING. Test is now passing in at least one client.

@marioevz
Copy link
Member Author

Fixed a small issue that left proxies running in the bg after a test case had finished.

@marioevz marioevz marked this pull request as ready for review June 23, 2022 00:20
@marioevz marioevz force-pushed the el-mock-new-testcases branch from 7ec2c93 to 503e4f6 Compare June 27, 2022 22:13
@marioevz
Copy link
Member Author

Added invalid timestamp test case.

} else if !exists {
ch <- res{err: fmt.Errorf("beacon %d: Expected state for head block", i)}
return
if exists, err := beaconapi.FinalityCheckpoints(ctx, b.API, eth2api.StateIdRoot(headInfo.Header.Message.StateRoot), &checkpoints); err != nil || !exists {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add these changes and few blocks below to simulators/eth2/testnet/running_testnet.go so we could pass eth2/testnet too? I don't want to just copy and make PR from it but if you want, I can

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to create another PR to do this to not mix different simulators on the same PR.

@zilm13
Copy link
Contributor

zilm13 commented Jul 1, 2022

When we are adding keystores and there are no validators on certain client like the 3rd client in test syncing-with-invalid-chain, this client is not started with failure, you could check this in vc logs for this test, so we need to change this in all vc clients setup files like clients/teku-vc/teku_vc.sh those lines, I guess.

for keystore_path in /hive/input/keystores/*
do
  pubkey=$(basename "$keystore_path")
  cp "/hive/input/keystores/$pubkey/keystore.json" "/data/validators/keys/voting-keystore-$pubkey.json"
  cp "/hive/input/secrets/$pubkey" "/data/validators/passwords/voting-keystore-$pubkey.txt"
done

To something like this. Maybe there is better fix, I'm not good in bash

[ ! -d "/hive/input/keystores/" ]; then
   echo "No keystores to setup"
else
  for keystore_path in /hive/input/keystores/*
  do
    pubkey=$(basename "$keystore_path")
    cp "/hive/input/keystores/$pubkey/keystore.json" "/data/validators/keys/voting-keystore-$pubkey.json"
    cp "/hive/input/secrets/$pubkey" "/data/validators/passwords/voting-keystore-$pubkey.txt"
  done
fi

And ideally move this method to some mixin so we are not duplicating this in every bash script

UPDATE: btw, why do we need vc without validators?

@marioevz
Copy link
Member Author

marioevz commented Jul 1, 2022

@zilm13 I think it would be better to not launch the validator if it has nothing to validate, so I will try this change directly in the simulator.

The reason to include beacon nodes without validators is to verify that they don't follow a chain if their configuration mismatches (e.g. Terminal Total Difficulty), even if the chain has 66%+ participation.

@marioevz
Copy link
Member Author

marioevz commented Jul 4, 2022

Hi @fjl, I think this PR should be ready to merge with a few considerations:

I think these changes can be part of new PRs to keep this PR from further growing.
Let me know what you think.

@marioevz marioevz force-pushed the el-mock-new-testcases branch from a9d96cd to 3332e8b Compare July 7, 2022 16:54
@marioevz marioevz merged commit 976d36b into ethereum:master Jul 7, 2022
racytech pushed a commit to racytech/hive that referenced this pull request Apr 4, 2025
racytech pushed a commit to racytech/hive that referenced this pull request Apr 4, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.2.0](ethpandaops/ethereum-package@2.1.0...2.2.0)
(2024-04-19)


### Features

* add assertoor test for per PR CI job
([ethereum#537](ethpandaops/ethereum-package#537))
([8ef5c57](ethpandaops/ethereum-package@8ef5c57))
* add blutgang rpc load balancer
([ethereum#569](ethpandaops/ethereum-package#569))
([1be5f95](ethpandaops/ethereum-package@1be5f95))
* add dugtrio beacon load balancer
([ethereum#568](ethpandaops/ethereum-package#568))
([56d2fa3](ethpandaops/ethereum-package@56d2fa3))
* add new assertoor test to per ci jobs
([ethereum#545](ethpandaops/ethereum-package#545))
([3005d46](ethpandaops/ethereum-package@3005d46))
* use new rpc snooper from `ethpandaops/rpc-snooper`
([ethereum#567](ethpandaops/ethereum-package#567))
([5676f0d](ethpandaops/ethereum-package@5676f0d))


### Bug Fixes

* add --contract-deployment-block parameter for Prysm
([ethereum#557](ethpandaops/ethereum-package#557))
([d8dfbae](ethpandaops/ethereum-package@d8dfbae))
* Added '--enable-private-discovery' to Grandine
([ethereum#541](ethpandaops/ethereum-package#541))
([a1ae708](ethpandaops/ethereum-package@a1ae708))
* beaconchain explorer
([ethereum#531](ethpandaops/ethereum-package#531))
([b62ed6f](ethpandaops/ethereum-package@b62ed6f))
* beaconchain explorer
([ethereum#538](ethpandaops/ethereum-package#538))
([ce1f337](ethpandaops/ethereum-package@ce1f337))
* blobber incorrect url
([ethereum#528](ethpandaops/ethereum-package#528))
([6f84e3d](ethpandaops/ethereum-package@6f84e3d))
* bump json rpc snooper
([ethereum#553](ethpandaops/ethereum-package#553))
([f69c4a7](ethpandaops/ethereum-package@f69c4a7))
* disable full sync if gcmode is archive
([ethereum#563](ethpandaops/ethereum-package#563))
([b7592ec](ethpandaops/ethereum-package@b7592ec))
* disable pbss when gcmode archive set
([ethereum#559](ethpandaops/ethereum-package#559))
([e085462](ethpandaops/ethereum-package@e085462))
* disable pbss when gcmode archive set, force hash based init
([ethereum#562](ethpandaops/ethereum-package#562))
([3e1c7a6](ethpandaops/ethereum-package@3e1c7a6))
* disable static peers
([ethereum#529](ethpandaops/ethereum-package#529))
([c5d4028](ethpandaops/ethereum-package@c5d4028))
* enable single node mode on lodestar by default
([ethereum#558](ethpandaops/ethereum-package#558))
([555ad7d](ethpandaops/ethereum-package@555ad7d))
* fix doc string typo
([ethereum#560](ethpandaops/ethereum-package#560))
([13de3f6](ethpandaops/ethereum-package@13de3f6))
* fix failing persistence test
([ethereum#554](ethpandaops/ethereum-package#554))
([99242d6](ethpandaops/ethereum-package@99242d6))
* increase mem limit of snooper
([ethereum#546](ethpandaops/ethereum-package#546))
([6ba5770](ethpandaops/ethereum-package@6ba5770))
* prysm beacon http url
([ethereum#536](ethpandaops/ethereum-package#536))
([4914531](ethpandaops/ethereum-package@4914531))
* prysm beacon_http_url
([ethereum#535](ethpandaops/ethereum-package#535))
([ee7528c](ethpandaops/ethereum-package@ee7528c))
* prysm vc
([ethereum#533](ethpandaops/ethereum-package#533))
([72ddeb2](ethpandaops/ethereum-package@72ddeb2))
* remove un-needed prysm vc check
([ethereum#542](ethpandaops/ethereum-package#542))
([f6326fe](ethpandaops/ethereum-package@f6326fe))
* set application protocol to be http for rpc
([ethereum#548](ethpandaops/ethereum-package#548))
([905de7c](ethpandaops/ethereum-package@905de7c))
* set the correct default vc image
([ethereum#544](ethpandaops/ethereum-package#544))
([953741d](ethpandaops/ethereum-package@953741d))
* uniformize keymanager
([ethereum#534](ethpandaops/ethereum-package#534))
([a6a2830](ethpandaops/ethereum-package@a6a2830))
* update prometheus api
([ethereum#539](ethpandaops/ethereum-package#539))
([d2b9fb8](ethpandaops/ethereum-package@d2b9fb8))
* update vc &lt;&gt; cl matrix
([ethereum#564](ethpandaops/ethereum-package#564))
([0ffcf74](ethpandaops/ethereum-package@0ffcf74))
* update vc compatibility matrix
([ethereum#543](ethpandaops/ethereum-package#543))
([58c4684](ethpandaops/ethereum-package@58c4684))
* use `minimal-preset` images for dora & assertoor when minimal preset
is used
([ethereum#532](ethpandaops/ethereum-package#532))
([ad7773e](ethpandaops/ethereum-package@ad7773e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants