Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 aptos-move/framework/aptos-framework/doc/staking_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ Only called during genesis.
<a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument">error::invalid_argument</a>(<a href="staking_config.md#0x1_staking_config_EZERO_REWARDS_RATE_DENOMINATOR">EZERO_REWARDS_RATE_DENOMINATOR</a>),
);
<b>assert</b>!(
voting_power_increase_limit &gt; 0 && voting_power_increase_limit &lt;= 50,
voting_power_increase_limit &gt; 0,
<a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument">error::invalid_argument</a>(<a href="staking_config.md#0x1_staking_config_EINVALID_VOTING_POWER_INCREASE_LIMIT">EINVALID_VOTING_POWER_INCREASE_LIMIT</a>),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module aptos_framework::staking_config {
error::invalid_argument(EZERO_REWARDS_RATE_DENOMINATOR),
);
assert!(
voting_power_increase_limit > 0 && voting_power_increase_limit <= 50,
voting_power_increase_limit > 0,
error::invalid_argument(EINVALID_VOTING_POWER_INCREASE_LIMIT),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,15 @@ module aptos_framework::delegation_pool {
account::create_signer_with_capability(&pool.stake_pool_signer_cap)
}

#[test_only]
/// Testing function to retrieves the shared resource account owning the stake pool in order
/// to relock the validator
public fun relock_validator(pool_address: address) acquires DelegationPool {
let pool = borrow_global<DelegationPool>(pool_address);
let owner_cap = account::create_signer_with_capability(&pool.stake_pool_signer_cap);
stake::increase_lockup(&owner_cap);
}

/// Get the address of delegation pool reference `pool`.
fun get_pool_address(pool: &DelegationPool): address {
account::get_signer_capability_address(&pool.stake_pool_signer_cap)
Expand Down
37 changes: 37 additions & 0 deletions aptos-move/framework/aptos-framework/sources/genesis.move
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,43 @@ module aptos_framework::genesis {
)
}

#[test_only]
public fun init_for_test(
epoch_interval_microsecs: u64,
minimum_stake: u64,
maximum_stake: u64,
recurring_lockup_duration_secs: u64,
rewards_rate: u64,
) {
initialize(
x"000000000000000000", // empty gas schedule
4u8, // TESTING chain ID
0, // initial version
x"12", // conesus config
x"13", // execution config
epoch_interval_microsecs,
minimum_stake,
maximum_stake,
recurring_lockup_duration_secs,
true,
rewards_rate,
100,
maximum_stake,
)
}

#[test_only]
public fun init_aptos_coin_for_test(
aptos_framework: &signer
) {
initialize_aptos_coin(aptos_framework);
}

#[test_only]
public fun set_genesis_end_for_test(aptos_framework: &signer) {
chain_status::set_genesis_end(aptos_framework);
}

#[test]
fun test_setup() {
setup();
Expand Down