-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Document for general test format #39
Conversation
Note: I stole this sample test suite and test vectors from @paulhauner's https://notes.ethereum.org/n7fyPi4cR-Gg9Ypq7ylTrQ?view due to it being the simplest test suite (in terms of number of fields) that we've proposed so far |
This looks good to me. The only thing I can think of is giving some guidance on how to deal with forks and versioning. (Note: I don't know how this works in present Ethereum, so happy to ditch this if there's an already established process). Firstly, I'm assuming that whenever there's a fork all the specs need to change their I propose we use the Semantic Versioning 2.0
Whenever there's a fork, the versioning resets but still communicates the stability of the test vectors. Consider the case where there's a fork that doesn't actually affect the test vectors, we can use the following guide:
If the fork destroys the test cases and we need to start at zero again, it's fine to go from 1.0.0 to 0.0.1. Thoughts? |
Assuming you are talking about the hard forks once Shasper is released, we shouldn't nuke the specs and tests once a new one is released. Either we organize in a functional manner like https://github.com/ethereum/tests:
Or we use a per-fork structure (names courtesy of the Ubuntu Name Generator)
Now versioning is also important because it's much easier to check generically in for a SSZ deserializer for example. One thing regarding specs, when implementing Ethereum 1.0 I find it very hard to exhume the old gas costs of the earlier forks because I couldn't find an old Yellow Paper and EIPs are tracking history of changes but there was no way to get a snapshot of the state of the specs at a certain point of time. So client implementers that are catching up have to check Geth and Parity codebase. |
All client codebases have to handle all forks and all the tests remain! yay legacy code. To sync the chain after a fork, your codebase must remember how to process blocks before the fork and how to process blocks after the fork. py-evm handles this pretty cleanly here |
Good call @mratsim. I take back what I said about the repo only handling
one fork.
…On Thu, 4 Oct 2018 at 10:06 pm, Danny Ryan ***@***.***> wrote:
All client codebases have to handle all forks and all the tests reamin!
yay legacy code.
To sync the chain after a fork, your codebase must remember how to process
blocks before the fork *and* how to process blocks after the fork.
py-evm handles this pretty cleanly here
<https://github.com/ethereum/py-evm/tree/master/eth/vm/forks>
And then they instantiate different chains (like main net or test nets)
like this
<https://github.com/ethereum/py-evm/blob/master/eth/chains/mainnet/constants.py>
defining fork block constants.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#39 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGWiNJklRVmq5KJEZ88aM7Kr48snzDrTks5uhfnWgaJpZM4XHRTX>
.
|
Recalling experience gained from eth1.0 test suite.
With good implementation design, this structure makes it trivial to enable new forks on client side. It's just adding a new line to the list of forks. While per-fork manner would require to handle new folders each time the fork is added. As I understand this structure is suitable for test writers as well. @winsvega might want to comment on that as he works on tests from the very beginning of eth1.0. A bit specific thing, but @holiman has a proposal on improving #ethereum/tests repository: https://gist.github.com/holiman/fdec3547f2b104803abbd2c6e751a8e7#proposed-solution. |
The problem now is that if you want to generate new fork you have to refresh a file with all previous fork tests. So a solution would be to use 1 source file -> generates many test files. Although it wont really work if we keep filler hash checking. |
Seems like we are rediscovering the Expression Problem which this blog post summarizes quite well for sum types vs interfaces:
In our case:
|
My hope is that in this case hardness of adding a test could be mitigated somehow. I am not sure what filler hash checking does exactly mean but solution with one source file that produces several tests could do the trick. IMHO, it's worth betting on some difficulties during test creation if this is a prize of making implementation updates trivial. Cause, there gonna be only one test repository that affects several implementations. |
filler hash checks that test been generated with the latest filler version |
Sorry @winsvega, I'm not sure what a "filler" is. |
filler aka testFiller is a test source file. if we put generated tests into separate files (in order not to touch it with each test updated on each new fork) the fillerHash field will become meaningless. I guess I will have to change it into expectSection hash or remove at all. |
As discussed in the call, we are merging this document in as tentative so that we can use it for simple tests across clients -- SSZ, shuffle, etc. We will iterate from there with the hope that we lock down some more specifications on overall structure and strategy of testing around devcon. |
Also update binary output due to metadata change.
Added
test-format.md
to describe the high level specification that all YAML test documents need to conform to. Once this is approved, I will add our current proposed test suites (ssz, chain tests, and shuffle) as separate documents underspecs/test-suites
Any and all feedback welcome.
CC: @paulhauner, @mratsim