-
Notifications
You must be signed in to change notification settings - Fork 336
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
Add conviction voting Split, SplitAbstain vote options #2169
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4meta5
added
A3-inprogress
Pull request is in progress. No review needed at this stage.
B7-runtimenoteworthy
Changes should be noted in any runtime-upgrade release notes
D3-trivial
PR contains trivial changes in a runtime directory that do not require an audit
breaking
Needs to be mentioned in breaking changes
labels
Mar 17, 2023
4meta5
commented
Mar 18, 2023
|
I modifed that test to make the error message less useless:
These are the code changes if you want to include them: precompiles/conviction-voting/src/tests.rs// Assert vote events are emitted.
let expected_events = vec![
EvmEvent::Log {
log: log2(
Precompile1,
SELECTOR_LOG_VOTED,
H256::from_low_u64_be(ONGOING_POLL_INDEX as u64),
EvmDataWriter::new()
.write::<Address>(H160::from(Alice).into()) // caller
.write::<bool>(true) // vote
.write::<U256>(100_000.into()) // amount
.write::<u8>(0) // conviction
.build(),
),
}
.into(),
EvmEvent::Log {
log: log2(
Precompile1,
SELECTOR_LOG_VOTED,
H256::from_low_u64_be(ONGOING_POLL_INDEX as u64),
EvmDataWriter::new()
.write::<Address>(H160::from(Alice).into()) // caller
.write::<bool>(false) // vote
.write::<U256>(99_000.into()) // amount
.write::<u8>(1) // conviction
.build(),
),
}
.into(),
];
for log in expected_events {
assert!(
events().contains(&log),
"Expected event not found: {:?}\nAll events:\n{:?}",
log,
events()
);
} |
4meta5
added
A0-pleasereview
Pull request needs code review.
and removed
A3-inprogress
Pull request is in progress. No review needed at this stage.
labels
Mar 21, 2023
tmpolaczyk
reviewed
Mar 22, 2023
tmpolaczyk
reviewed
Mar 22, 2023
Co-authored-by: tmpolaczyk <44604217+tmpolaczyk@users.noreply.github.com>
tmpolaczyk
approved these changes
Mar 22, 2023
…wards compatibility if new variant added
crystalin
added
not-breaking
Does not need to be mentioned in breaking changes
and removed
breaking
Needs to be mentioned in breaking changes
labels
Apr 12, 2023
imstar15
pushed a commit
to AvaProtocol/moonbeam
that referenced
this pull request
May 16, 2023
…dation#2169) * init * Update precompiles/conviction-voting/src/lib.rs * fix * test split vote logs * clean * Update precompiles/conviction-voting/src/lib.rs Co-authored-by: tmpolaczyk <44604217+tmpolaczyk@users.noreply.github.com> * add events to sol file and use in field wherever relevant * add unreachable handling of new AccountVote variants for trivial backwards compatibility if new variant added * revert unnecessary commit --------- Co-authored-by: tmpolaczyk <44604217+tmpolaczyk@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A0-pleasereview
Pull request needs code review.
B7-runtimenoteworthy
Changes should be noted in any runtime-upgrade release notes
D3-trivial
PR contains trivial changes in a runtime directory that do not require an audit
not-breaking
Does not need to be mentioned in breaking changes
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds precompile method coverage for all possible votes expressible by
pallet_conviction::AccountVote
:This PR also makes use of this type inside the conviction voting precompile to simplify the code.
The idea behind SplitAbstain is to vote to end the referendum soon without expressing an opinion on it. substrate PR