-
Notifications
You must be signed in to change notification settings - Fork 29
Implemented missing data structure for serialization and deserialization of external transition #202
Conversation
75b6e47
to
07ae35f
Compare
Codecov Report
@@ Coverage Diff @@
## main #202 +/- ##
==========================================
+ Coverage 86.58% 87.52% +0.94%
==========================================
Files 101 103 +2
Lines 4471 4682 +211
==========================================
+ Hits 3871 4098 +227
+ Misses 600 584 -16
Continue to review full report at Codecov.
|
Amazing work, just one thing, is it possible to get block(s) that can exercise uncovered serde code? It looks like the overall codecov drop by |
b5be92f
to
4a0b53a
Compare
dabd9ba
to
a6cdb12
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work dude! Just needs a tidy up and we are good
self.writer.bin_write_variant_index(b)?; | ||
// Use variant name to identify polyvar type, else sum type | ||
fn write_variant_index_or_tag(&mut self, name: &str, index: u32, variant: &str) -> Result<()> { | ||
if name == "Polyvar" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we not already merge this stuff?
@@ -37,5 +37,5 @@ pub struct ExternalTransition { | |||
pub struct ExternalTransitionV1(pub Versioned<ExternalTransition, 1>); | |||
|
|||
impl bin_prot::encodable::BinProtEncodable for ExternalTransitionV1 { | |||
const PREALLOCATE_BUFFER_BYTES: usize = 13 * 1024; | |||
const PREALLOCATE_BUFFER_BYTES: usize = 13 * 1024; // FIXME: This size is not suitable for blocks with snark work data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest removing this trait entirely since it is only a helper for writing tests. Feel free to increase the buffer to make things work (but it might break again if we get a larger block)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
increased the buffer size for now, to support all the sample test blocks we have
@@ -439,6 +449,7 @@ fn test_staged_ledger_diff_diff_commands_status() { | |||
#[wasm_bindgen_test] | |||
fn test_staged_ledger_diff_diff_coinbase() { | |||
block_path_test_batch! { | |||
// FIXME: The given path is not valid for all test blocks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test makes invalid assumptions (that the variant is always the second one in
pub enum CoinBase {
Zero,
// FIXME: other variants are not covered by current test block
One(Option<CoinBaseFeeTransferV1>),
Two,
}
This is invalid so we should just remove the test entirely. It is covered by the next line anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it's safe to disable the test for now since we have e2e coverage, ideally, the logic here should be, deserializing the binary into all variants and asserting there is exactly one being successful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check out #218
CoinBaseBalanceDataV1 => "t/staged_ledger_diff/t/diff/t/0/t/t/internal_command_balances/0/t/[sum]" | ||
// FIXME: The given path is not valid for all test blocks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
protocol/serialization-types/tests/test_deserialize_snark_work.rs
Outdated
Show resolved
Hide resolved
protocol/serialization-types/tests/test_deserialize_staged_ledger_pre_diff_one.rs
Outdated
Show resolved
Hide resolved
eab18d1
to
12d1534
Compare
12d1534
to
5ecac40
Compare
base/src/external_transition.rs
Outdated
@@ -28,3 +28,7 @@ pub struct ExternalTransition { | |||
impl BinProtSerializationType for ExternalTransition { | |||
type T = ExternalTransitionV1; | |||
} | |||
|
|||
impl bin_prot::encodable::BinProtEncodable for ExternalTransition { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been removed
5ecac40
to
11a1154
Compare
It's strange that when I run the tests from #221 in this PR, CI jobs time out, there might be some perf issue to investigate |
} | ||
}; | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a comment describing why we need this dummy struct for later reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i'll add it
d2d860c
to
c5bb937
Compare
05f258f
to
b9d8e53
Compare
b9d8e53
to
e1dae7b
Compare
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes #194
#143 except: test: Implement test_snapp_command().
Other information and links