-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[testsuite] CLI & smoke test for multi-step governance proposal #5975
Conversation
_execution_hash = | ||
HashValue::sha3_256_of(result.last().unwrap().1.as_bytes()).to_string(); | ||
args.push(&_execution_hash); | ||
_next_execution_hash_string = hex::encode(get_execution_hash(&result)); |
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.
Why do we need to do hex encode here?
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.
need to convert from bytes to string for the CLI command
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.
Let's add a comment here as well why you have to convert it.
"gas_schedule::set_gas_schedule(framework_signer, gas_schedule_blob);" | ||
); | ||
if next_execution_hash.is_empty() { | ||
emitln!( |
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.
What’s the diff between the if else cases here?
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.
else has &
before the framework_signer
.
the testnet single-step generation had something like let framework_signer = &core_signer;
so that their framework_signer
is of type &signer
, but for mainnet single-step and multi-step the framework_signer
is of type signer
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.
Let's add a comment describing this choice so the next person doesn't have to ask the question again.
c201f62
to
8bfb727
Compare
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.
Some comments around style / documentation that will help the future user.
Also, could we get an update to any governance docs since this introduces the new multi-step process?
"gas_schedule::set_gas_schedule(framework_signer, gas_schedule_blob);" | ||
); | ||
if next_execution_hash.is_empty() { | ||
emitln!( |
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.
Let's add a comment describing this choice so the next person doesn't have to ask the question again.
testsuite/smoke-test/src/upgrade.rs
Outdated
cli.create_proposal( | ||
validator_cli_index, | ||
// placeholder url | ||
"https://gist.githubusercontent.com/movekevin/057fb145b40866eff8c22c91fb9da919/raw/bab85f0f7434f008a8781eec7fcadd1ac5a55481/gistfile1.txt", |
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.
We should commit something directly to the codebase rather than use a gist from Kevin's account. Then reference that via the Github link.
Kevin's account could be suspended, removed, etc. And then this would magically stop working and we would be confused.
cli.fund_account(i, Some(1000000000000000)).await.unwrap(); | ||
|
||
let mut keygen = KeyGen::from_os_rng(); | ||
let (validator_cli_index, _) = | ||
init_validator_account(&mut cli, &mut keygen, Some(1000000000000000)).await; | ||
|
||
cli.initialize_stake_owner( | ||
i, | ||
1000000000000000, |
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.
When using magic numbers, use a constant that describes what it is. I can't tell if these are all supposed to be the same number of 0s.
let mut i = 0; | ||
while i < 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.
Looks like someone's been writing a lot of Move.
for i in 1..2 {
}
Either that or take that whole first part and put it in a function and then just do the one off work in the middle:
function()
create_proposal
function()
_execution_hash = | ||
HashValue::sha3_256_of(result.last().unwrap().1.as_bytes()).to_string(); | ||
args.push(&_execution_hash); | ||
_next_execution_hash_string = hex::encode(get_execution_hash(&result)); |
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.
Let's add a comment here as well why you have to convert it.
b4fb9ac
to
af86ca9
Compare
wanted to close this PR by saying that I'll optimize this later (was trying to optimize, and then ran into a stack overflow problem and realize there's a circular dependency somewhere in my optimized code, and I need to rewrite a series of functions. I'm half-way through it, but it's taking too long and not that important so I would like to land this PR first). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
Description
Background
This PR is part of multi-step governance proposal work. In this PR, we
Detailed Changes in this PR
Tests
test_upgrade_flow_multi_step()
in testsuite/smoke-test/src/upgrade.rsnext_execution_hash
in voting.move and aptos_governance.move.CLI
is_multi_step
flag to CLI'sSubmitProposal
command in crates/aptos/src/governance/mod.rs.GenerateExecutionHash
to support generating execution hash of a script.GenerateExecutionHash
for hash generation. (i.e., updated the get_execution_hash() function in aptos-release-builder to directly callGenerateExecutionHash
for the sake of consistency).Miscellaneous
References
Design
Merged PRs
Test Plan
Tests included in this PR : )