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

reconfig with dkg option A stake.move refactoring ver. A #11741

Closed
wants to merge 24 commits into from

Conversation

zjma
Copy link
Contributor

@zjma zjma commented Jan 23, 2024

Diff from: #10328

  • Leave (the majority of) stake::on_new_epoch/update_stake_pool untouched.
  • Create new func: next_validator_consensus_infos

Copy link

trunk-io bot commented Jan 23, 2024

⏱️ 1h 7m total CI duration on this PR
Job Cumulative Duration Recent Runs
windows-build 17m 🟩
run-tests-main-branch 16m 🟩🟩🟩🟩
rust-move-unit-coverage 8m 🟩
rust-lints 8m 🟩
rust-unit-tests 7m 🟥
check 4m 🟥
general-lints 3m 🟩
check-dynamic-deps 2m 🟩
file_change_determinator 59s 🟩🟩🟩🟩
semgrep/ci 23s 🟩
file_change_determinator 17s 🟩
permission-check 13s 🟩🟩🟩🟩
permission-check 11s 🟩🟩🟩🟩
permission-check 9s 🟩🟩🟩🟩
permission-check 8s 🟩🟩🟩🟩

🚨 1 job on the last run was significantly faster/slower than expected

Job Duration vs 7d avg Delta
rust-move-unit-coverage 8m 23m -66%

settingsfeedbackdocs ⋅ learn more about trunk.io

@zjma zjma force-pushed the zjma/reconfig_with_dkg_ver_a_0 branch from 1028ea8 to 12cc22f Compare January 24, 2024 01:58
Copy link

codecov bot commented Jan 24, 2024

Codecov Report

Attention: 92 lines in your changes are missing coverage. Please review.

Comparison is base (354e997) 69.7% compared to head (12cc22f) 58.0%.
Report is 17 commits behind head on main.

❗ Current head 12cc22f differs from pull request most recent head 5f2e960. Consider uploading reports for the commit 5f2e960 to get more accurate results

Files Patch % Lines
aptos-move/e2e-move-tests/src/harness.rs 0.0% 66 Missing ⚠️
...cached-packages/src/aptos_framework_sdk_builder.rs 0.0% 23 Missing ⚠️
aptos-move/framework/src/aptos.rs 0.0% 1 Missing ⚠️
types/src/dkg.rs 0.0% 1 Missing ⚠️
types/src/lib.rs 0.0% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #11741       +/-   ##
===========================================
- Coverage    69.7%    58.0%    -11.8%     
===========================================
  Files        2120      783     -1337     
  Lines      403595   179338   -224257     
===========================================
- Hits       281437   104058   -177379     
+ Misses     122158    75280    -46878     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zjma zjma changed the title reconfig with dkg approach A version 0 reconfig with dkg option A stake.move refactoring ver. A Jan 24, 2024
Copy link
Contributor

@zekun000 zekun000 left a comment

Choose a reason for hiding this comment

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

mostly lgtm

force_update_network_and_fullnode_addresses(operator, pool_address, new_network_addresses, new_fullnode_addresses);
}

public(friend) fun force_update_network_and_fullnode_addresses(
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 see this function being used elsewhere, why it needs to be a separate function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in #11721

spec {
assume timestamp::spec_now_seconds() + recurring_lockup_duration_secs <= MAX_U64;
assume now_secs + recurring_lockup_duration_secs <= MAX_U64;
Copy link
Contributor

Choose a reason for hiding this comment

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

why use now_secs instead of reconfig_start_secs?

Copy link
Contributor Author

@zjma zjma Jan 25, 2024

Choose a reason for hiding this comment

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

i'm not sure: imagine the DKG took so long that reconfig_start_time + recurring_lockup_duration < reconfig_finish_time, i feel we don't want to set the unlock time to be in the past?

let cur_pending_inactive = coin::value(&stake_pool.pending_inactive);

let cur_perf = vector::borrow(&validator_perf.validators, candidate.config.validator_index);
let cur_reward = if (cur_active > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why we need this condition?

/// Assuming we are in a middle of a reconfiguration (no matter it is immediate or async), get its start time.
fun get_reconfig_start_time_secs(): u64 {
if (reconfiguration_state::is_initialized()) {
reconfiguration_state::start_time_secs()
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible for this to be initialized but not used (thus abort)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, in genesis. Fixed in #11721 at caller side.

}

/// Get `ValidatorConsensusInfo.addr`.
public fun get_addr(vci: &ValidatorConsensusInfo): address {
Copy link
Contributor

Choose a reason for hiding this comment

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

for rust naming convention, we don't use get_ prefix, just fun addr, fun pk_bytes

/// See `aptos_framework::aptos_governance::reconfigure()` for more details.
///
/// Can only be called by a signer of @std.
public fun change_feature_flags_for_next_epoch(framework: &signer, enable: vector<u64>, disable: vector<u64>) acquires PendingFeatures, Features {
Copy link
Contributor

Choose a reason for hiding this comment

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

we discussed to let change_feature_flags call this functions and update tests accordingly?

///
/// WARNING: currently only used by tests. In most cases you should use `reconfigure()` instead.
/// TODO: migrate these tests to be aware of async reconfiguration.
public fun force_end_epoch(aptos_framework: &signer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I still think for tests expect this behavior we should just disable the feature instead of adding this function

@@ -149,6 +153,8 @@ module aptos_framework::reconfiguration {
epoch: config_ref.epoch,
},
);

reconfiguration_state::on_reconfig_finish();
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't call all the on_new_epoch update functions? I thought we want to use the buffer for both cases and just make sure it's applied on_new_epoch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel reconfiguration_state has to be at the very bottom of the dependency graph and can't call them (otherwise circular dependency).

Here's the full graph.

image

@zjma zjma closed this Feb 14, 2024
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