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

[testsuite] CLI & smoke test for multi-step governance proposal #5975

Merged
merged 1 commit into from
Jan 19, 2023

Conversation

0xchloe
Copy link
Contributor

@0xchloe 0xchloe commented Dec 22, 2022

Description

Background

This PR is part of multi-step governance proposal work. In this PR, we

  • added e2e and unit tests to test out the multi-step governance proposal flow e2e;
  • added CLI support for (1) submitting multi-step proposal and (2) generating execution hash for a script.

Detailed Changes in this PR

Tests

CLI

Miscellaneous

References

Design

Merged PRs

Test Plan

Tests included in this PR : )

_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));
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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!(
Copy link
Contributor

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?

Copy link
Contributor Author

@0xchloe 0xchloe Dec 22, 2022

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

Copy link
Contributor

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.

@0xchloe 0xchloe requested a review from movekevin December 22, 2022 03:34
@0xchloe 0xchloe force-pushed the smoketest branch 5 times, most recently from c201f62 to 8bfb727 Compare December 22, 2022 04:25
Copy link
Contributor

@gregnazario gregnazario left a 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!(
Copy link
Contributor

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.

cli.create_proposal(
validator_cli_index,
// placeholder url
"https://gist.githubusercontent.com/movekevin/057fb145b40866eff8c22c91fb9da919/raw/bab85f0f7434f008a8781eec7fcadd1ac5a55481/gistfile1.txt",
Copy link
Contributor

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.

Comment on lines +194 to +198
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,
Copy link
Contributor

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.

Comment on lines +191 to +188
let mut i = 0;
while i < 2 {
Copy link
Contributor

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));
Copy link
Contributor

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.

@0xchloe 0xchloe force-pushed the smoketest branch 4 times, most recently from b4fb9ac to af86ca9 Compare January 19, 2023 00:05
@0xchloe 0xchloe enabled auto-merge (squash) January 19, 2023 00:45
@0xchloe
Copy link
Contributor Author

0xchloe commented Jan 19, 2023

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).

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

✅ Forge suite land_blocking success on f6d2df63c91ad371b57b864ccebaf9e35fe49ed8

performance benchmark with full nodes : 6527 TPS, 6076 ms latency, 8100 ms p99 latency,(!) expired 140 out of 2787540 txns
Test Ok

@github-actions
Copy link
Contributor

✅ Forge suite compat success on testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> f6d2df63c91ad371b57b864ccebaf9e35fe49ed8

Compatibility test results for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> f6d2df63c91ad371b57b864ccebaf9e35fe49ed8 (PR)
1. Check liveness of validators at old version: testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b
compatibility::simple-validator-upgrade::liveness-check : 7393 TPS, 5278 ms latency, 6900 ms p99 latency,no expired txns
2. Upgrading first Validator to new version: f6d2df63c91ad371b57b864ccebaf9e35fe49ed8
compatibility::simple-validator-upgrade::single-validator-upgrade : 4547 TPS, 8812 ms latency, 11800 ms p99 latency,no expired txns
3. Upgrading rest of first batch to new version: f6d2df63c91ad371b57b864ccebaf9e35fe49ed8
compatibility::simple-validator-upgrade::half-validator-upgrade : 4693 TPS, 9086 ms latency, 13600 ms p99 latency,no expired txns
4. upgrading second batch to new version: f6d2df63c91ad371b57b864ccebaf9e35fe49ed8
compatibility::simple-validator-upgrade::rest-validator-upgrade : 6514 TPS, 5943 ms latency, 11200 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> f6d2df63c91ad371b57b864ccebaf9e35fe49ed8 passed
Test Ok

@0xchloe 0xchloe merged commit accfde9 into main Jan 19, 2023
@0xchloe 0xchloe deleted the smoketest branch January 19, 2023 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants