Closed pugachAG closed 3 hours ago
Attention: Patch coverage is 97.38220%
with 5 lines
in your changes missing coverage. Please review.
Project coverage is 71.78%. Comparing base (
ced534f
) to head (39cd8dc
). Report is 15 commits behind head on master.
Files | Patch % | Lines |
---|---|---|
chain/chain/src/runtime/tests.rs | 98.73% | 2 Missing :warning: |
runtime/runtime/src/actions.rs | 86.66% | 1 Missing and 1 partial :warning: |
core/store/src/trie/mod.rs | 93.33% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This PR introduces a way to generate arbitrary large chunk state witness as a result of processing a single receipt. This is needed to test what happens with the blockchain if we missed something in the witness size checks. Part of #11656.
Large witness generation is triggered by a function call action with a method name
internal_record_storage_garbage_<GARBAGE_SIZE>
with<GARBAGE_SIZE>
corresponding to a number of megabytes of random data to be added to the storage proof. For exampleinternal_record_storage_garbage_20
would result in 20MB of garbage data in the witness. Having size as part of the method name (and not as an argument) makes it easier to send a transaction using near cli (args
needs to be base64 encoded). Note that we don't need to deploy any contracts, failed receipt will still result in garbage added to the witness. This makes it very easy to use, just sending a transaction with a single function call action is enough. The functionality is enabled only when neard is complied withtest_features
enabled.Alternative approaches considered:
11687. The resulting behaviour diverges significantly from what we would expect to happen in the real world when large witness is a result of applying some chunk. For example when testing doomsday scenario we want the next chunk producer to try distributing the same witness after the chunk is missed. This PR also covers the underlying use case #11184.
Large part of this PR is refactoring around runtime tests in chain to make it easier to reuse the existing test setup code.