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

feat(fw): verkle pydantic rebase and t8n changes #507

Draft
wants to merge 50 commits into
base: verkle/main
Choose a base branch
from

Conversation

spencer-tb
Copy link
Collaborator

@spencer-tb spencer-tb commented Apr 12, 2024

🗒️ Description

Adds specific changes from #465 & #485, including a rebase onto main after the pydantic PR #486.

Usage

Use the following geth branch gballet/t8n-verkle-exec to *both fill and execute tests.

Fill tests with the following commands (until we update the framework fully).

fill --fork ShanghaiToPragueAtTime32 -k "blockchain" --output fixtures-verkle-0 -n 4 -v
fill --fork Prague -k "verkle" --output fixtures-verkle-0 -n 4 -v

Execute tests using the consume rlp eest based hive simulator. Run the following command after generating the tests:

consume rlp --input=fixtures-verkle-0/ -v

Future Todos

STILL TO BE UPDATED

Tweaks

  • Refine pydantic VerkleTree model and its integration within the TransitionToolOutput model.
  • Add state test generation. Currently only blocktest and hive blocktest fixtures can be generated.

Fixture Validation

  • Utilize the evm verkle tree-keys command to convert the post state expected allocation to its verkle tree representation. Compare these values with those from the final verkle tree output from t8n. Example subcommand usage below for an idea of what happens when calling the command: image
  • Add the witness values from evm t8n ... --output.witness to each block in the fixture, furthermore utilize during filling to backtest the vkt keys and values against the witness generated for each block.
  • Add the witness with there respective key/values to the t8n debug dump dir.

Basic Fixture Execution

  • Pass all appropriate generated fixtures in the consume rlp simulator.

The below errors all occur on the first verkle block, and look to be from the same cause:

  • Pass the execution from the generated fixture within the evm blocktest command. Note the following error below. This can be ran within the same directory as fill. image
  • Pass the execution of the generated fixture within the hive pyspec simulator. Currently it assumes that we are using a full node. Blocks are executed via the engine api using engine_newPayloadV2, against the dockerized client under test. Currently we get a similar error. But from the engine new payload method.
    image This can be ran on the following branch - https://github.com/spencer-tb/hive/tree/verkle/pyspec using this command below. We are using the kaustinan-with-shapella geth branch.
./hive --sim ethereum/pyspec --client go-ethereum --client-file "configs/verkle.yaml" --docker.output --docker.nocache pyspec --sim.loglevel 5 --loglevel 5

Further Fixture Generation and Execution

Once we are passing the basic fixture generation we should add the verkle transition for all tests.

Furthermore, add the filling and exection of all these tests starting from Prague. Note the input alloc to t8n will no longer exist in this case so we should first convert it using the evm verkle tree-keys subcommand to VKT reprenstation.

🔗 Related Issues & PRs

None

✅ PR Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • Tests: All converted JSON/YML tests from ethereum/tests have been added to converted-ethereum-tests.txt.
  • Tests: Included the type and version of evm t8n tool used to locally execute test cases: e.g., ref with commit hash or geth 1.13.1-stable-3f40e65.
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.

@spencer-tb spencer-tb force-pushed the verkle/pydantic-rebase branch 2 times, most recently from 28b389a to 5ca669d Compare April 12, 2024 16:45
@spencer-tb spencer-tb changed the title feat(fw): verkle pydantic rebase feat(fw): verkle pydantic rebase and t8n changes Apr 12, 2024
danceratopz and others added 25 commits April 12, 2024 17:37
* test(fw): add json serialization tests for new pydantic models

* fix(fw): fix exception enum serialization in pydantic models

This required:
1. Changing the from_pipe_str() BeforeValidator method to convert the serialized exception string back to an Exception enum instance (or list).
2. Modifying the annotated types to also accept single TransactionException or BlockchainException types so that they are also correctly coerced via from_pipe_str().

* chore: update whitelist

* fix(fw): deserialize an empty Transaction 'to' field as None

This fixes src/ethereum_test_tools/tests/test_types.py::TestPydanticModelConversion::test_json_serialization[transaction_t8n_to_none].

An additional class TransactionTransitionToolConverter now specifies how an evm transition tool should validate and serialize the to field. Whilst this didn't break test generation, it caused deserialization to fail on individual Transaction models.

* fix(fw): fix fixture hash generation if info field already exists

The incorrect field name was specified. This only became apparent when deserializing fixtures, as the info field is not present when the hash gets generated after filling.

Patches up existing tests and also adds a dedicated test for this: src/ethereum_test_tools/tests/test_spec_base.py::test_json_dict

* refactor(fw): prefix fixture class names with type

* feat(fw): add pydantic root models for json fixture files

* feat(fw): add a cli command to verify fixture serialization/deserialization

* test(fw): fix fixture tests when executed with solc<0.8.21

* test(fw): refactor tests - use valid json fixtuers in test_filling

* refactor: use snek case for script module and function names

* chore: remove test code in script

* test(fw): use check_fixtures to verify test helper fixtures

* docs: update changelog

* chore: make cli modules importable; fix mypy/tox

* Update src/cli/check_fixtures.py

* fix(fw): rollback fixture class rename

---------

Co-authored-by: Mario Vega <marioevz@gmail.com>
…ereum#508)

* refactor(fw): augment & use Fixtures model in fixture collection

* docs: update changelog
* chore: soften trie package requirements for compatibility w/eth2spec

* chore: soften minor/patch & sharpen major dependency versions

* docs: update changelog
* feat(all): add EOF fixture format and test spec

* feat(tests): add EOF example

* feat(fw): EOF library

tools/vm: EOF opcode changes

tools: CREATE3 helper

tox: EOF Keywords

post rebase changes: align EOF tests with main.

Co-authored-by: spencer-tb <spencer@spencertaylorbrown.uk>

post rebase: tox fixes.

Co-authored-by: spencer-tb <spencer@spencertaylorbrown.uk>

Fix existing EOF tests (#11)

Co-authored-by: Hugo <jhugodc@gmail.com>

* new(tests): prague: EOF V1 tests

tests/eof: move to prague

tests/eof: fixes

post rebase changes: align EOF tests with main. (tests)

Co-authored-by: spencer-tb <spencer@spencertaylorbrown.uk>

post rebase: tox fixes (tests).

Co-authored-by: spencer-tb <spencer@spencertaylorbrown.uk>

Fix existing EOF tests (tests) (#11)

Co-authored-by: Hugo <jhugodc@gmail.com>

* refactor(fw): EOF container code

* fix(fw): vm: re-order JUMPDEST, NOOP

* fix(fw): cli tests

* fix(tests): refactor fixes

* fix(fw): eof: fix raw bytes processing

* fix(tests): eof: change `test_code_validation.py` to use `EOFTestFiller`

* eof unit tests

* fix eof exceptions

* refactor(fw): compute_create3_address

* fix(tests): tox

* refactor(fw): eof_v1: use pydantic

* fix(fw): tpx

* fix(fw): RJUMPV custom dataportion parser

* fix(tests): eofv1: RJUMPI calls

* new(fw): RJUMPV unit test

* feat(fw): subscriptable opcodes

* fix(fw): Opcode add, mul

* fix(tests): test hardcoding bytecode of initcode

* fix(fw): fix

* fix(tests): eof: fix RJUMP*, CALLF data portions

* hack(fw): Add str as allowed EOF exception

* fix(tests): eof: fix test_execution_function.py

* changelog

* chore: add unknown words to dictionary

* fetch exceptions with evmone
lots of TODOs

* eof .py test example

* fix(fw): add unchecked_stack opcode property (CALLF)

* refactor(fw): eof: refactor and add section creation helpers

* fix: tox

* fix(tests): eof: refactor

* refactor(tests): replace Section(kind=, with Section.Code, Section.Data

* fix(fw): eof: consistent magic, version, and header terminator types.

* fix(fw): eof: proper magic

* rm(tests): eof: duplicate prague folder with redundant examples

* fix(fw): eof: data-container body order

* docs: add EOF

* fix(docs): word

* fix(tests): eof: file rename

---------

Co-authored-by: Mario Vega <marioevz@gmail.com>
Co-authored-by: Hugo <jhugodc@gmail.com>
Co-authored-by: danceratopz <danceratopz@gmail.com>
* Updates based on non-returning sections

Update tests to conform with besu
* sample code needs non-returning and data
* all codesection zeros need to be non-returning
* RETF is not valid in non-returning sections
* CALL is not in EOF, use EXTCALL

Signed-off-by: Danno Ferrin <danno@numisight.com>

* Apply suggestions from code review

---------

Signed-off-by: Danno Ferrin <danno@numisight.com>
Co-authored-by: Mario Vega <marioevz@gmail.com>
Creates a set of containers and tests DATA* operations along
the test boundaries of zero, too little, just right, and
more than enough.  Including validation tests.

Signed-off-by: Danno Ferrin <danno@numisight.com>
Co-authored-by: Mario Vega <marioevz@gmail.com>
…um#527)

* chore(ci): Update workflow actions to use Node.js 20 versions.

* chore: Add changelog.
Add support for adding traces to output when using Besu.

Signed-off-by: Danno Ferrin <danno@numisight.com>
…thereum#519)

Co-authored-by: Dimitry Kh <dimitry@ethereum.org>
Co-authored-by: danceratopz <danceratopz@gmail.com>
…um#542)

* feat(pytest): use --tb=short as the default failure traceback style

* docs: update changelog

* chore: update whitelist
Co-authored-by: spencer-tb <spencer@spencertaylorbrown.uk>
Co-authored-by: spencer <spencer.taylor-brown@ethereum.org>
Co-authored-by: Mario Vega <marioevz@gmail.com>
* fix formatting, add eofparse string to whitelist

* translate Ori's validInvalid eof tests

* fix eof opcodes implementation rjumpv and jumpf

* add a few more tweaks to eof Container class

* add new EOF exceptions

* add a few efExample ori tests

* fix unit tests and tox

* changelog, address pr review issues

* Apply suggestions from code review

---------

Co-authored-by: Mario Vega <marioevz@gmail.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.

None yet

5 participants