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

Issue #210: Check required_auths on custom_operation #1629

Merged
merged 7 commits into from
Aug 13, 2019

Conversation

nathanielhourt
Copy link
Contributor

This PR resolves issue #210. See issue for discussion.

libraries/chain/db_block.cpp Outdated Show resolved Hide resolved
libraries/chain/proposal_object.cpp Outdated Show resolved Hide resolved
libraries/chain/protocol/transaction.cpp Outdated Show resolved Hide resolved
tests/tests/authority_tests.cpp Show resolved Hide resolved
tests/tests/authority_tests.cpp Show resolved Hide resolved
libraries/chain/proposal_object.cpp Outdated Show resolved Hide resolved
@nathanielhourt
Copy link
Contributor Author

OK, did I get everything?

I did some refactoring in proposal_create_evaluator while I was in there, too. Hopefully it all looks good. The goal was to remove some redundant calculations, and move computation out of db.create() and into do_evaluate().

libraries/app/database_api.cpp Outdated Show resolved Hide resolved
libraries/app/database_api.cpp Outdated Show resolved Hide resolved
libraries/chain/db_notify.cpp Outdated Show resolved Hide resolved
libraries/chain/hardfork.d/CORE_210.hf Show resolved Hide resolved
libraries/chain/proposal_evaluator.cpp Outdated Show resolved Hide resolved
libraries/chain/protocol/transaction.cpp Outdated Show resolved Hide resolved
@abitmore abitmore mentioned this pull request Mar 13, 2019
34 tasks
@abitmore abitmore modified the milestones: 201810-Consensus-Release, 201810 - Consensus-Upgrade Release, 201911 - Consensus-Upgrade Release Mar 13, 2019
@nathanielhourt nathanielhourt dismissed pmconrad’s stale review June 25, 2019 12:22

Changes already applied, no?

@pmconrad
Copy link
Contributor

Please rebase on latest hardfork branch.

nathanielhourt and others added 5 commits July 30, 2019 22:42
The required_auths field on custom_operation was being ignored during authority checking. This commit causes it to be checked correctly, and adds a unit test verifying as much.
Hardfork guards are complex for this issue, because we can't access
chain time in the operation's get_required_active_authorities() method.

There was no apparent 'good' way to solve this, so I settled for a
fairly nasty hack which seemed the least bad of bad options. Add a
boolean parameter to the verify_authority() functions determining
whether the custom_operation::required_auths field should be ignored or
not, and call these functions setting the boolean appropriately for
whether we have passed the hardfork or not. This works because chain
time is available at the verify_authority() call sites.
Mostly polish, but one mistake fix as well.
@nathanielhourt
Copy link
Contributor Author

OK, this should be ready. Let me know if I missed anything.

Copy link
Contributor

@pmconrad pmconrad left a comment

Choose a reason for hiding this comment

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

Looks good, but one more thing:

Docker build is consistently failing in db_notify.cpp because it it doesn't know the MUST_IGNORE_CUSTOM_OP_REQD_AUTHS macro. I think db_notify.cpp must include hardfork.hpp (db_block.cpp does include it and is compiled successfully).

The difference between Travis and Docker is that Docker uses -DGRAPHENE_DISABLE_UNITY_BUILD=ON but Travis doesn't. I. e. Travis compiles all db_*.cpp in one go which means that the include in db_block.cpp also works for db_notify.cpp. Docker compiles db_notify.cpp separately, so the include is missing.

@nathanielhourt nathanielhourt requested a review from pmconrad August 7, 2019 14:29
@nathanielhourt nathanielhourt merged commit ab54bcb into bitshares:hardfork Aug 13, 2019
@nathanielhourt nathanielhourt deleted the issue-210-hardfork branch August 13, 2019 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants