Skip to content
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: update libtester eosio.bios to match latest eosio.bios in reference-contracts, add more validation to set_finalizers host function #1989

Merged
merged 12 commits into from
Dec 18, 2023

Conversation

linh2931
Copy link
Member

Port latest eosio.bios from #1987 to libtester, add POP check, and update tests.

In set_finalizers host function, add overflow check for f_weight_sum and always validate public key.

Resolved #1987

…ontract, add more valiation to set_finalizers host function
@linh2931 linh2931 requested review from heifner and arhag December 14, 2023 18:56
Comment on lines 58 to 59
check(f.public_key.substr(0, pk_prefix.length()) == pk_prefix, "public key not started with PUB_BLS");
check(f.pop.substr(0, sig_prefix.length()) == sig_prefix, "proof of possession signature not started with SIG_BLS");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
check(f.public_key.substr(0, pk_prefix.length()) == pk_prefix, "public key not started with PUB_BLS");
check(f.pop.substr(0, sig_prefix.length()) == sig_prefix, "proof of possession signature not started with SIG_BLS");
check(f.public_key.substr(0, pk_prefix.length()) == pk_prefix, "public key should start with PUB_BLS");
check(f.pop.substr(0, sig_prefix.length()) == sig_prefix, "proof of possession signature should start with SIG_BLS");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of our error messages state the fact of error. Not sure which way is clearer. Will change.

Copy link
Member

@heifner heifner Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is changed it needs to be updated in reference contracts. Not sure it is worth it for bios contract.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it is not worthwhile for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe the current message is correct English.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed by 3e1f8cc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference Contracts changes will be done by AntelopeIO/reference-contracts#34

abi_finalizer_policy.finalizers.emplace_back(eosio::abi_finalizer_authority{f.description, f.weight, std::move(pk_vector)});
}

check(finalizer_policy.threshold > weight_sum / 2, "finalizer policy threshold cannot be met by finalizer weights");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
check(finalizer_policy.threshold > weight_sum / 2, "finalizer policy threshold cannot be met by finalizer weights");
check(finalizer_policy.threshold > weight_sum / 2, "finalizer policy threshold must be greater than half of the sum of the weights");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linh2931 linh2931 requested review from greg7mdp and heifner December 15, 2023 13:29
@linh2931 linh2931 requested a review from heifner December 15, 2023 21:40
@linh2931 linh2931 merged commit e12d06e into hotstuff_integration Dec 18, 2023
29 checks passed
@linh2931 linh2931 deleted the new_bios_contract branch December 18, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants