fix(tests): create values of block_size #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #5
Description
This PR introduces a way to utilize the
extensions
field ofValue
so that we can have blocks of roughlyblock_size
in the tests.Note that the size of blocks will not be exactly
block_size
because a block besides theValue
contains the commit certificate that adds a few tens of bytes to the total block size. Additionally, the actual block sent over the wire might be slightly more bytes due to encoding. This PR also bringsProtobufCodec
instead ofJsonCodec
when encoding values in order to be able to be "closer" to theblock_size
, otherwise, 1 KiB ofextensions
, might lead to having 10 more KiB in theblock_size
due to the wayextensions
would JSON encoded.Finally, note that this PR, besides a nit change in
code/examples/channel/src/state.rs
, did not modify thechannel
example and left it as is.Testing
To see that it works, you can try the following 2 tests in
code/crates/test/tests/it/value_sync.rs
:Ideally, we should be able to include
test_block_size_more_than_rpc_size_times_out
in the codebase and have it verify that it times out. However, the way the testing framework is currently written,run_with_params
does not return a result andexit
s internally, so we cannot do this without quite some refactoring.PR author checklist
For all contributors
RELEASE_NOTES.md
if the change warrants itBREAKING_CHANGES.md
if the change warrants itFor external contributors