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

feat(iota-framework): Committee Selection (DRAFT) #3903

Open
wants to merge 69 commits into
base: chore/update-incompatibility-reason
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
190098d
migrated first changes
hmoog Nov 5, 2024
a05b426
added new version snapshot files
hmoog Nov 6, 2024
eeefd18
addressed linter remarks
hmoog Nov 6, 2024
ba91dad
Merge branch 'develop' into feat/committee_selection
hmoog Nov 6, 2024
06b1bff
Merge branch 'fix/config-override' into feat/committee_selection
hmoog Nov 7, 2024
351b8c6
fixed errors
hmoog Nov 7, 2024
567ba21
Merge branch 'fix/config-override' into feat/committee_selection
hmoog Nov 7, 2024
4e23ddb
removed unnecessary print
hmoog Nov 7, 2024
0fff237
Merge branch 'fix/config-override' into feat/committee_selection
hmoog Nov 11, 2024
2613eba
updated snapshot
hmoog Nov 11, 2024
0f924ce
reverted commit
hmoog Nov 11, 2024
338c02a
Merge branch 'feat/committee_selection' of github.com:iotaledger/iota…
hmoog Nov 11, 2024
07fb344
use snapshot file from develop
hmoog Nov 11, 2024
14d0217
Merge branch 'fix/config-override' into feat/committee_selection
hmoog Nov 11, 2024
b6c89f3
use snapshot file from develop
hmoog Nov 11, 2024
77ab5af
Merge branch 'feat/committee_selection' of github.com:iotaledger/iota…
hmoog Nov 11, 2024
69d98c3
generated snapshots tests
hmoog Nov 11, 2024
d7d2a19
Merge branch 'fix/config-override' into feat/committee_selection
hmoog Nov 11, 2024
d98d23a
removed unnecessary code
hmoog Nov 12, 2024
40c2960
Merge branch 'feat/committee_selection' of github.com:iotaledger/iota…
hmoog Nov 12, 2024
81835d2
fixed missing field
hmoog Nov 12, 2024
338b865
fixed linter remarks
hmoog Nov 12, 2024
3816d37
fixed upgrade test
hmoog Nov 12, 2024
483ea50
Merge branch 'develop' into feat/committee_selection
hmoog Nov 13, 2024
1f47f37
started adding reasons to compatibility check
hmoog Nov 13, 2024
e525bc5
removed debug prints
hmoog Nov 13, 2024
2c34a6b
Merge branch 'feat/committee_selection' of github.com:iotaledger/iota…
hmoog Nov 13, 2024
3c88426
Merge branch 'develop' into feat/committee_selection
hmoog Nov 13, 2024
22c9757
increased reporting for compatibility checks
hmoog Nov 14, 2024
8a818d4
cleaned up changes
hmoog Nov 14, 2024
689f8b8
started adding macros for specific errors
hmoog Nov 14, 2024
b0e5044
cleaned code
hmoog Nov 14, 2024
dd65c7e
cleaned code
hmoog Nov 14, 2024
ee98cd3
cleaned code
hmoog Nov 14, 2024
6f9e25a
cleaned code
hmoog Nov 14, 2024
1142b58
cleaned code
hmoog Nov 14, 2024
fa11d81
cleaned code
hmoog Nov 14, 2024
10d5808
cleaned code
hmoog Nov 14, 2024
bba0601
cleaned code
hmoog Nov 14, 2024
c05acee
cleaned code
hmoog Nov 14, 2024
99658d7
cleaned code
hmoog Nov 14, 2024
26b8eb8
cleaned code
hmoog Nov 14, 2024
2dbcb46
cleaned code
hmoog Nov 14, 2024
4160662
cleaned code
hmoog Nov 14, 2024
7f68232
cleaned code
hmoog Nov 14, 2024
7ab9e5e
cleaned code
hmoog Nov 14, 2024
bab0f2b
cleaned code
hmoog Nov 14, 2024
c109579
cleaned code
hmoog Nov 14, 2024
5a8fb32
cleaned code
hmoog Nov 14, 2024
6895027
cleaned code
hmoog Nov 14, 2024
da7c8d9
cleaned code
hmoog Nov 14, 2024
76d65be
cleaned code
hmoog Nov 14, 2024
96ff5e7
Merge branch 'develop' into feat/committee_selection
hmoog Nov 14, 2024
6ee0465
Merge branch 'chore/update-incompatibility-reason' of github.com:iota…
hmoog Nov 14, 2024
1a5d658
Merge branch 'chore/update-incompatibility-reason' into feat/committe…
hmoog Nov 19, 2024
231a7c2
Merge branch 'chore/update-incompatibility-reason' into feat/committe…
hmoog Nov 19, 2024
adfac7e
moved logic to module
hmoog Nov 19, 2024
76467bd
generated files
hmoog Nov 19, 2024
94d9162
generated bytecode
hmoog Nov 19, 2024
72dbf44
updated tests
hmoog Nov 19, 2024
17af027
bump version in tests
hmoog Nov 19, 2024
ab69c6f
fixed test value
hmoog Nov 20, 2024
46347d3
fixed test
hmoog Nov 20, 2024
fdb8559
made tests dynamic
hmoog Nov 20, 2024
cfc5c95
addressed linter remark
hmoog Nov 20, 2024
d4a2405
fixed test
hmoog Nov 20, 2024
cb723f4
added select function
hmoog Nov 27, 2024
6fe6830
updated snapshots
hmoog Nov 27, 2024
4d5e9d8
Merge branch 'chore/update-incompatibility-reason' into feat/committe…
hmoog Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/iota-e2e-tests/tests/protocol_version_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ mod sim_only_tests {
// The system state object will be upgraded next time we execute advance_epoch
// transaction at epoch boundary.
let system_state = test_cluster.wait_for_epoch(Some(2)).await;
if let IotaSystemState::V1(inner) = system_state {
if let IotaSystemState::V2(inner) = system_state {
assert_eq!(inner.parameters.min_validator_count, 4);
} else {
unreachable!("Unexpected iota system state version");
Expand Down
4 changes: 2 additions & 2 deletions crates/iota-e2e-tests/tests/reconfiguration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ async fn safe_mode_reconfig_test() {
let system_state = test_cluster.wait_for_epoch(Some(1)).await;
assert!(!system_state.safe_mode());
assert_eq!(system_state.epoch(), 1);
assert_eq!(system_state.system_state_version(), 1);
assert_eq!(system_state.system_state_version(), 2);

let prev_epoch_start_timestamp = system_state.epoch_start_timestamp_ms();

Expand Down Expand Up @@ -876,7 +876,7 @@ async fn safe_mode_reconfig_test() {
let system_state = test_cluster.wait_for_epoch(Some(3)).await;
assert!(!system_state.safe_mode());
assert_eq!(system_state.epoch(), 3);
assert_eq!(system_state.system_state_version(), 1);
assert_eq!(system_state.system_state_version(), 2);
}

async fn add_validator_candidate(
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-e2e-tests/tests/snapshot_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async fn basic_read_cmd_snapshot_tests() -> Result<(), anyhow::Error> {
// 0x3b5121a0603ef7ab4cb57827fceca17db3338ef2cd76126cc1523b681df27cee --bcs", // valid
// object BCS
"iota client object 0x0000000000000000000000000000000000000000000000000000000000000000", /* non-existent object */
"iota client tx-block 5zibcom3dMckjyN16ygFwr5XNa9Exi1MmY3BQs984x1N", // valid tx digest
"iota client tx-block ATrNp2hJwQz1EgbEuZgsbt6Hn7DRmhNWbBxneyyawyxf", // valid tx digest
"iota client tx-block 11111111111111111111111111111111", /* non-existent tx
* digest */
];
Expand Down
868 changes: 434 additions & 434 deletions crates/iota-e2e-tests/tests/snapshots/snapshot_tests__body_fn.snap

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions crates/iota-framework-snapshot/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,15 @@
"0x000000000000000000000000000000000000000000000000000000000000000b",
"0x000000000000000000000000000000000000000000000000000000000000107a"
]
},
"2": {
"git_revision": "cb723f4d0988",
"package_ids": [
"0x0000000000000000000000000000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000000000000000000000000000002",
"0x0000000000000000000000000000000000000000000000000000000000000003",
"0x000000000000000000000000000000000000000000000000000000000000000b",
"0x000000000000000000000000000000000000000000000000000000000000107a"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ module iota_system::iota_system {
use iota::system_admin_cap::IotaSystemAdminCap;
use iota_system::validator::ValidatorV1;
use iota_system::validator_cap::UnverifiedValidatorOperationCap;
use iota_system::iota_system_state_inner::{Self, SystemParametersV1, IotaSystemStateV1};
use iota_system::iota_system_state_inner::{Self, SystemParametersV1, IotaSystemStateV1, IotaSystemStateV2 as IotaSystemStateLatest};
use iota_system::staking_pool::PoolTokenExchangeRate;
use iota::dynamic_field;
use iota::vec_map::VecMap;

#[test_only] use iota::balance;
#[test_only] use iota_system::validator_set::ValidatorSetV1;
#[test_only] use iota_system::validator_set_v2::ValidatorSet as ValidatorSetLatest;
#[test_only] use iota::vec_set::VecSet;

public struct IotaSystemState has key {
Expand Down Expand Up @@ -548,16 +548,23 @@ module iota_system::iota_system {
storage_rebate
}

fun load_system_state(self: &mut IotaSystemState): &IotaSystemStateV1 {
fun load_system_state(self: &mut IotaSystemState): &IotaSystemStateLatest {
load_inner_maybe_upgrade(self)
}

fun load_system_state_mut(self: &mut IotaSystemState): &mut IotaSystemStateV1 {
fun load_system_state_mut(self: &mut IotaSystemState): &mut IotaSystemStateLatest {
load_inner_maybe_upgrade(self)
}

fun load_inner_maybe_upgrade(self: &mut IotaSystemState): &mut IotaSystemStateV1 {
let inner: &mut IotaSystemStateV1 = dynamic_field::borrow_mut(
fun load_inner_maybe_upgrade(self: &mut IotaSystemState): &mut IotaSystemStateLatest {
if (self.version == 1) {
let old_version: IotaSystemStateV1 = dynamic_field::remove(&mut self.id, self.version);
let new_version = old_version.v1_to_v2();
self.version = 2;
dynamic_field::add(&mut self.id, self.version, new_version);
};

let inner: &mut IotaSystemStateLatest = dynamic_field::borrow_mut(
&mut self.id,
self.version
);
Expand Down Expand Up @@ -624,7 +631,7 @@ module iota_system::iota_system {

#[test_only]
/// Return the current validator set
public fun validators(wrapper: &mut IotaSystemState): &ValidatorSetV1 {
public fun validators(wrapper: &mut IotaSystemState): &ValidatorSetLatest {
let self = load_system_state(wrapper);
self.validators()
}
Expand Down
Loading
Loading