-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: bytes
to base64 encoding in VM
#6785
Conversation
crates/cheatcodes/spec/src/vm.rs
Outdated
|
||
/// Encodes a `string` value to base64 string | ||
#[cheatcode(group = Base64)] | ||
function toBase64(string calldata data) external pure returns (string memory); |
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 feel like we don't need functions for both bytes
and string
because bytes
alone suffices.
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.
Removed
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.
Why is bytes
alone preferable? My understanding is the primary use case here will be for encoding/decoding tokenURIs which are strings, so if anything it seems string
only would be preferable to avoid unnecessary casting? However looking at existing Base64 libs (OZ and solady) they also use bytes
input, so maybe I'm missing something
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.
Thought strings coerce to bytes but that's only for literals. It's not that big of a deal if we can support both.
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 believe this can be just abi_encode
d.
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.
Thanks, LGTM! FYI I've edited the description to use GitHub keywords when referencing issues.
Thanks for your help! |
Motivation
Closes #6744
Solution