-
Notifications
You must be signed in to change notification settings - Fork 15
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
IF: Add setfinalizer action to eosio.bios #33
Conversation
@@ -62,7 +62,7 @@ jobs: | |||
echo cdt-prerelease=${{inputs.override-cdt-prerelease}} >> $GITHUB_OUTPUT | |||
fi | |||
- name: Download cdt | |||
uses: AntelopeIO/asset-artifact-download-action@v2 | |||
uses: AntelopeIO/asset-artifact-download-action@v3 |
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 also change the download below to v3
,
reference-contracts/.github/workflows/build.yaml
Lines 74 to 75 in da83307
- name: Download leap-dev | |
uses: AntelopeIO/asset-artifact-download-action@v2 |
Also, v3 does not require the token
in our usage, so you can remove lines
token: ${{github.token}} |
token: ${{github.token}} |
…nalizer_description_size definition
…ow, max_finalizers, and max_finalizer_description_size
…ption length equal to max allowed size
struct g1_hash { | ||
// bls_g1 is defined as std::array<char, 96> | ||
std::size_t operator()(const eosio::bls_g1& g1) const { | ||
std::hash<std::string> hash_func; |
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 could use std::hash<const char*>
instead as each memory location will be unique and should be quicker than hashing all 96 bytes.
There is no specialization for C strings. std::hash<const char*> produces a hash of the value of the pointer (the memory address), it does not examine the contents of any character array.
|
||
struct g1_equal { | ||
bool operator()(const eosio::bls_g1& lhs, const eosio::bls_g1& rhs) const { | ||
return std::memcmp(lhs.data(), rhs.data(), 96 * sizeof(char)) == 0; |
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.
Use lhs.size()
would be better here. Even better to add a static_assert(lhs.size() == sizeof(bls_g1))
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. Changed to use lhs.size()
. But the static_assert
is not possible as lhs.size() is not a constant integral value. The compiler complains
error: static_assert expression is not an integral constant expression
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 moved g1_hash
and g1_equal
inside the function body for better encapsulation.
… use std::hash<const char*> for hashing, use size() instead of 96 * sizeof(char)
Add
setfinalizer
action to bios contract to set a new finalizer policy. For each public key, a proof of possession of private key are validated.Extensive tests are included.
Resolves #26
Change Description
Deployment Changes
API Changes
Documentation Additions