-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Extract Semantics Tests #4223
Comments
Some initial and unrefined ideas for the expectation syntax: The syntax originally suggested in #3486, slightly adapted to be closer to the syntax already used for the syntax tests, would be the following:
We could also consider the following to keep arguments and their values closer together and adopt a more "function-call-like" syntax. It might also make sense to explicitly state the types of return values:
The signature can easily be extracted during parsing of the expectations. The colon could be also be replaced by "==" and the return arguments given as tuple, e.g. The parser for the return values should remember the used formatting and recreate expectations with the same format when updating expectations (for The first line of the expectations could optionally be an explicit deploy command:
Maybe a simple constructor call would suffice, however that may be more ambiguous: Additionally there needs to be an optional way to send ether to both the constructor and functions. As a suggestion:
I'll start writing the general framework already and I'll keep thinking about further syntax options for the expectations in the process - suggestions are welcome. |
To be honest, I find Perhaps we should split inputs and expectations across two lines. Ether could be given in square brackets. Also I'm not sure if we should implement a full ABI-encoder here. If we always assume expectations to be abi-encoded, we lose the ability to test data encoded invalidly and also providing input data that is encoded in a weird way.
If we assume each field to be exactly 32 bytes with decimals padded on the left and hex and strings padded on the right, then we also need a way to specify things that are not padded, but that could be left for the tests that do not work like that. |
OK, I adopted that syntax. Regarding padding: the current WIP PR pads both decimals and hex numbers on the left, but hex strings Should expectation and result mismatch, the PR attempts to format the actual result exactly like the expected result and, if that's impossible, falls back to hex numbers (and unpadded bytes in the absence of 32-byte alignment). (the PR still needs quite some cleaning up in detail, though) |
The padding is probably a good idea, yes! What is the difference between About |
OK - I can remove the The difference between |
One issue is that the RPC interface doesn't distinguish between revert and no return data, so I'm not sure whether we should just use |
The "success condition" should be part of the receipt. It might be that cpp-ethereum does not implement it or the json-rpc parser in the testing framework does not implement it. |
So far I haven't found a way to properly deduce a revert - probably related: ethereum/aleth#4157 |
This issue existed to track the progress of isoltest in regards with semantic test capabilities. @erak says this is done now and we favor closing this issue and create a new one that is purely for extracting more semantic tests. |
Part of #3486 concerning semantics tests (i.e. "end-to-end"-tests).
Similarly to #3644 the semantics tests (resp. end-to-end tests) should be extracted into individual files.
ìsoltest
should support running the semantics tests interactively.This issue is meant to discuss the syntax of the test expectations and the encoding of arguments and expected results.
The text was updated successfully, but these errors were encountered: