-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Unit Tests for get_batch_pubdata
endpoint
#160
base: feat_get_pubdata_endpoint
Are you sure you want to change the base?
Changes from all commits
251e8b3
e8e028d
fddb8c2
b03c90f
e4857f7
5aece03
07bfc0e
438e7e3
24f1343
ec24862
f93dfd9
0d05f73
1e6fd30
59f5686
421897f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -648,7 +648,16 @@ impl ZksNamespace { | |
.get_l1_batch_metadata(l1_batch_number) | ||
.await | ||
.map_err(|err| internal_error(METHOD_NAME, err))? | ||
.map(|l1_batch_with_metadata| l1_batch_with_metadata.construct_pubdata().into()); | ||
.map(|l1_batch_with_metadata| { | ||
let partial_pubdata = l1_batch_with_metadata.construct_pubdata(); | ||
// The encoding of empty pubdata results in a vector of zeroes. We should return | ||
// `None in this case. | ||
if partial_pubdata == vec![0u8; partial_pubdata.len()] { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we consider using if partial_pubdata.iter().all(|&x| x == 0) {
Bytes::default()
} else {
partial_pubdata.into()
} Your thoughts on this optimization would be appreciated. Thank you! |
||
Bytes::default() | ||
} else { | ||
partial_pubdata.into() | ||
} | ||
}); | ||
|
||
method_latency.observe(); | ||
Ok(pubdata) | ||
|
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 think you accidentally left out the character ` before
None
.