-
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?
feat: Add Unit Tests for get_batch_pubdata
endpoint
#160
Conversation
get_batch_pubdata
endpoint in EthSender Moduleget_batch_pubdata
endpoint
get_batch_pubdata
endpoint get_batch_pubdata
endpoint
9fdd035
to
75271c5
Compare
…'s no pubdata in the requested batch
b5a3e35
to
421897f
Compare
.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. |
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
.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Could we consider using iter().all()
to compare if all elements of partial_pubdata
are zeroes?
This approach can potentially optimize performance by avoiding unnecessary allocation of a new vector of zeroes, particularly beneficial for larger vectors. The suggested change would look like:
if partial_pubdata.iter().all(|&x| x == 0) {
Bytes::default()
} else {
partial_pubdata.into()
}
Your thoughts on this optimization would be appreciated. Thank you!
Description:
Overview:
Changes Made:
For running the test:
zk test rust -- get_batch_pubdata_impl --nocapture