Closed jancionear closed 3 months ago
Attention: Patch coverage is 80.76923%
with 5 lines
in your changes missing coverage. Please review.
Project coverage is 71.73%. Comparing base (
89fad46
) to head (d5cb7d9
).
Files | Patch % | Lines |
---|---|---|
chain/client/src/client.rs | 0.00% | 4 Missing :warning: |
nearcore/src/dyn_config.rs | 0.00% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This seems alright, though to me it seems like appending a field, or perhaps otherwise making the witness serialization invalid from the first principles while this feature is enabled would be a safer bet. But I'm not quite sure why it is necessary to have this be compatible with existing networks...
(Making it invalid to deserialize normally might be just
length * 1024 || random_data || actual_witness_data
or something)
Setting up a new network is a lot of work, so I wanted to make it compatible with existing networks (forknet-20, forknet-100, statelessnet). Changing the serialization format would require us to restart all of the nodes in a network at once, which would be distruptive.
I'm thinking about running a witness size test on statelessnet, as it's the most "real" and diverse test environment we have, and it wouldn't be possible to do a coordinated restart there.
Closing in favor of https://github.com/near/nearcore/pull/11703
This PR adds a new feature to
neard
:artificial_witness_size
. When enabled, the node will readartificial_witness_size_to_add
fromconfig.json
and add this many bytes of data to all produced witnesses. Data is added by injecting a dummy transaction with random contract code of desired size. The injected transaction is automatically removed before witness validation.artificial_witness_size_to_add
is aMutableConfigValue
so it can be adjusted on the fly without restarting the node.The feature has to be enabled on all nodes in the network because normal chunk validators will reject witnesses with the injected transaction when the feature isn't enabled.
Doing it by injecting transactions doesn't change the serialization format, so it's compatible with existing networks.
The extra transaction is only added when
artificial_witness_size_to_add
is larger than zero, so it's safe to go back to using binaries where this feature is disabled by settingartificial_witness_size_to_add
to zero and then disabling the feature.We can use it to test how witness distribution behaves at larger sizes and to simulate doomsday scenarios.
I manually tested that the feature works on
localnet
by setting up a 4 node/6 shard localnet and forcing it to send 100 MB witnesses. The network struggled, but it went forward at 0.1 bps.I increased the number of buckets for witness size because the current ones go only up to 28 MB. After the change they go up to 120 MB.
Refs: https://github.com/near/nearcore/issues/11184