Commit Graph

20 Commits

Author SHA1 Message Date
tersec cf8e90615a
More state_transition unification (#953)
* remove incorrect/obsolete comment; deprecate BeaconState state transition functions

* remove deprecated state_transition(state: var BeaconState)

* add specific workarounds for state_transition() and process_slots() to nfuzz_block() and addTestBlock()
2020-04-30 18:27:17 +02:00
Jacek Sieka c74ba5c0c6
ssz: move ref support outside (#943)
* ssz: move ref support outside

Instead of allocating ref's inside SSZ, move it to separate helper:

* makes `ref` allocations explicit
* less magic inside SSZ
* `ref` in nim generally means reference whereas SSZ was loading as
value - if a type indeed used references it would get copies instead of
references to a single value on roundtrip which is unexpected

TODO: EF tests would benefit from some refactoring since they all do the
same thing practically..

Co-authored-by: Zahary Karadjov <zahary@gmail.com>
2020-04-29 22:12:07 +02:00
Jacek Sieka 03a147ab8d
avoid state copy in state transition (#930)
In BlockPool, we keep the head state around, so it's trivial to restore
the temporary state there and keep going as if nothing happened.

This solves 3 problems:
* stack space - the state copy on mainnet is huge
* GC scanning - using stack space for state slows down the GC
significantly
* reckless copying - the copy itself takes a long time

In state_sim, we'll do the same and allocate on heap - this helps a
little with GC - without it, the collection of the temporary strings
created with `toHex` while printing the json dominates the trace.
2020-04-26 21:13:33 +02:00
Zahary Karadjov 4e9fa51ae9 Introduce BeaconNodeRef and use it in all the right places 2020-04-26 13:04:53 +03:00
Zahary Karadjov 740b76d152 Spec-compliant implementation of Eth1 monitoring; Eth1-enabled local sim
BEWARE! This commit will trigger a stack overflow during local sim
2020-04-26 13:04:53 +03:00
Jacek Sieka 7902d070cd prefer endians2 2020-03-05 18:13:28 +02:00
Jacek Sieka 9a3db7a81f
[WIP] Fake bls at runtime (#735)
* Initial implementation of runtime bls skipping.

Add libnfuzz skipBLSValidation handling, check that it propagates.

* Rename skipBLSValidation -> skipBlsValidation, start skipStateRootValidation
* Replace skipValidation flags with more granular flags.

Also added skipBlockParentRootValidation flag
Mainly replaced with skipBlsValidation but also StateRoot or
BlockParentRootValidation flags where appropriate.

* Adjust interop test to pass when skipping merkle validation.
* Stop skipping validation for mainchain_monitor.
* Remove comment.
* Also skipMerkleValidation for test_beacon_chain_db.
2020-03-05 13:52:10 +01:00
Nathaniel Jensen 4f6f2f28f3
Implement additional state transition fuzzing harnesses. 2020-01-28 20:51:06 +02:00
Nathaniel Jensen 9aeef775ae Format code. 2020-01-09 17:44:41 +02:00
Nathaniel Jensen a37fac864f Update exception handling based on discussions.
ValueErrors identified as associated with logging and are classed as a
failure rather than expected behavior.
2020-01-09 17:44:41 +02:00
Nathaniel Jensen e356ae0405 Remove skipValidation for block, block_header handlers.
As differences are being identified due to it skipping block parent root
validation.
2020-01-08 13:46:14 +02:00
Nathaniel Jensen e795234504 Nfuzz to set runtime skipValidation flag where possible.
Note: this does more than just disable bls - see #407,
so is not strictly consistent with other `beacon-fuzz`
implementations.
2020-01-08 13:46:14 +02:00
Nathaniel Jensen a08db4b311 Implement nfuzz_block_header nfuzz_attester_slashing harnesses.
Add notes where not certain whether the error should crash or return
false.

Update header.
2020-01-08 13:46:14 +02:00
Nathaniel Jensen 5978f09261 Allow defects and assertions to propagate in fuzzing harnesses.
Add some slight libnfuzz readme notes.

Adjust exception tagging appropriately.
2020-01-08 13:46:14 +02:00
Nathaniel Jensen 0d764d87af Raise exception when failing deserialization instead of returning false.
Fuzzer preprocessing should provide valid ssz.
2020-01-08 13:46:14 +02:00
kdeme 5599c76d46
Update README.md with const_preset option [skip ci] 2019-12-05 10:07:07 +01:00
kdeme c4aebe423b
Update README.md with bls verification disable [skip ci] 2019-12-03 16:04:02 +01:00
kdeme 41841c7133 Add libnfuzz documentation [skip ci] 2019-12-03 15:08:03 +02:00
kdeme 5a51676a18 Address review comments 2019-12-03 14:33:47 +02:00
kdeme 3b3a2b10f1 First attempt to have some fuzz tests exported for the fuzzing framework 2019-12-03 14:33:47 +02:00