-
Notifications
You must be signed in to change notification settings - Fork 283
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
[master] Add bech32 utilities and initial migration to bech32 address #2459
Conversation
src/libUtils/Bech32.cpp
Outdated
bool Bech32::HasZilHrp(const std::string& input) { | ||
if (input.length() < 4) return false; | ||
|
||
auto hrp = boost::string_view(input); |
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.
const auto& hrp
src/libUtils/Bech32.cpp
Outdated
return ""; | ||
} | ||
|
||
for (size_t i = 0; i < inputSize; ++i) { |
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.
modernize loop
src/libUtils/Bech32.cpp
Outdated
} | ||
|
||
for (size_t i = 0; i < inputSize; ++i) { | ||
char c = input[i]; |
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 use const auto& here too
src/libUtils/Bech32.cpp
Outdated
|
||
#include "Bech32.h" | ||
#include "libServer/AddressChecksum.h" | ||
|
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 use using namespace std in .cpp file
6a56e0d
to
7d0e84d
Compare
https://github.com/Zilliqa/cryptoutils/tree/main/lib Can we use bech32 from cryptoutils? This is to avoid 2 copy of bech32. @vaivaswatha has recently created it and will be using for his VM. I think on the core side, ethash is already using cryptoutils |
Example usage: https://github.com/Zilliqa/scilla-vm/blob/4c58dae89aa3bc1567f21ad1ad9aa952ee089142/libsrtl/ScillaBuiltins.cpp#L608. This function and the next one do decoding and encoding respectively. |
7d0e84d
to
bb1dca6
Compare
bb1dca6
to
13065fe
Compare
src/libServer/LookupServer.cpp
Outdated
const unsigned int PAGE_SIZE = 10; | ||
const unsigned int NUM_PAGES_CACHE = 2; | ||
const unsigned int TXN_PAGE_SIZE = 100; | ||
const unsigned int UINT8_ADDR_SIZE = ACC_ADDR_SIZE * 2; |
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.
should be HEX_ADDR_SIZE
Can we have the unit test again? |
3bb0588
to
b5d52c7
Compare
GetBalance GetSmartContractCode GetSmartContractInit GetSmartContracts GetSmartContractState GetSmartContractSubState
b5d52c7
to
f879e52
Compare
Description
To add Bech32 utilities and allow the following API to accept both base16 and bech32 for now.
GetBalance
GetSmartContractCode
GetSmartContractInit
GetSmartContracts
GetSmartContractState
GetSmartContractSubState
Backward Compatibility
Review Suggestion
Status
Implementation
Integration Test (Core Team)
Was tested with a local isolated server, testing with the bech32 and base16 address