-
Notifications
You must be signed in to change notification settings - Fork 73
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
[5.0] Fix base64 encoding - take 2 #1888
Conversation
- Use string_view and return vector<char> instead of string
This has the potential to affect downstream usages when |
Good point. I'm not a fan of |
The issue is that if |
For better compatibility, maybe we should add a '\0' at the end of the vector (not included in its |
You mean append a |
libraries/libfc/src/variant.cpp
Outdated
// fc version of base64_decode allows for extra `=` at the end of the string. | ||
// Other base64 decoders will not accept the extra `=`. | ||
std::vector<char> b64 = base64_decode( str ); | ||
return blob( { std::move(b64) } ); |
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.
Very minor detail
return blob( { std::move(b64) } ); | |
return { std::move(b64) }; |
#1482 fixed base64 encoding by removing the unneeded extra
=
that variant added to base64 encoded data. However, it also updated the base64 library with a stricter one. This PR leaves the old base64 encoding/decoding library but does remove the extra=
from the base64 encoded data so non-fc base64 decoders will not claim the data is invalid.This change still breaks backward compatibility with 3.2 & 4.0
cleos/nodeos
. PRs to 3.2 (#1889) and (#1892) 4.0 will be created that will allow them to work with this new base64 encoding (they will no longer expect the invalid=
character).PR #1886 reverts #1482. This PR provided an alternative fix for #1461.
Included in this PR is an optimization to the existing
base64_decode
to avoid a copy for our use-cases by returning avector<char>
instead of astring
.Included in this PR is a change to the
nodeos_run_test.py
to keep thekeosd
running with passed--leaving-running
which is useful for local testing. This was used to manually test using 3.2cleos
with 5.0.Resolves #1461