Skip to content

Commit

Permalink
rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
zjma committed Mar 13, 2024
1 parent 73e5199 commit c5f6317
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
20 changes: 10 additions & 10 deletions aptos-move/framework/aptos-framework/doc/aptos_governance.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ on a proposal multiple times as long as the total voting power of these votes do
- [Function `remove_approved_hash`](#0x1_aptos_governance_remove_approved_hash)
- [Function `reconfigure`](#0x1_aptos_governance_reconfigure)
- [Function `force_end_epoch`](#0x1_aptos_governance_force_end_epoch)
- [Function `force_end_epoch_by_admin`](#0x1_aptos_governance_force_end_epoch_by_admin)
- [Function `force_end_epoch_test_only`](#0x1_aptos_governance_force_end_epoch_test_only)
- [Function `toggle_features`](#0x1_aptos_governance_toggle_features)
- [Function `get_signer_testnet_only`](#0x1_aptos_governance_get_signer_testnet_only)
- [Function `get_voting_power`](#0x1_aptos_governance_get_voting_power)
Expand Down Expand Up @@ -82,7 +82,7 @@ on a proposal multiple times as long as the total voting power of these votes do
- [Function `remove_approved_hash`](#@Specification_1_remove_approved_hash)
- [Function `reconfigure`](#@Specification_1_reconfigure)
- [Function `force_end_epoch`](#@Specification_1_force_end_epoch)
- [Function `force_end_epoch_by_admin`](#@Specification_1_force_end_epoch_by_admin)
- [Function `force_end_epoch_test_only`](#@Specification_1_force_end_epoch_test_only)
- [Function `toggle_features`](#@Specification_1_toggle_features)
- [Function `get_signer_testnet_only`](#@Specification_1_get_signer_testnet_only)
- [Function `get_voting_power`](#@Specification_1_get_voting_power)
Expand Down Expand Up @@ -1531,14 +1531,14 @@ TODO: migrate these tests to be aware of async reconfiguration.

</details>

<a id="0x1_aptos_governance_force_end_epoch_by_admin"></a>
<a id="0x1_aptos_governance_force_end_epoch_test_only"></a>

## Function `force_end_epoch_by_admin`
## Function `force_end_epoch_test_only`

<code><a href="aptos_governance.md#0x1_aptos_governance_force_end_epoch">force_end_epoch</a>()</code> but run as admin.
<code><a href="aptos_governance.md#0x1_aptos_governance_force_end_epoch">force_end_epoch</a>()</code> used in some move tests.


<pre><code><b>public</b> entry <b>fun</b> <a href="aptos_governance.md#0x1_aptos_governance_force_end_epoch_by_admin">force_end_epoch_by_admin</a>(admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>)
<pre><code><b>public</b> entry <b>fun</b> <a href="aptos_governance.md#0x1_aptos_governance_force_end_epoch_test_only">force_end_epoch_test_only</a>(admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>)
</code></pre>


Expand All @@ -1547,7 +1547,7 @@ TODO: migrate these tests to be aware of async reconfiguration.
<summary>Implementation</summary>


<pre><code><b>public</b> entry <b>fun</b> <a href="aptos_governance.md#0x1_aptos_governance_force_end_epoch_by_admin">force_end_epoch_by_admin</a>(admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>) <b>acquires</b> <a href="aptos_governance.md#0x1_aptos_governance_GovernanceResponsbility">GovernanceResponsbility</a> {
<pre><code><b>public</b> entry <b>fun</b> <a href="aptos_governance.md#0x1_aptos_governance_force_end_epoch_test_only">force_end_epoch_test_only</a>(admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>) <b>acquires</b> <a href="aptos_governance.md#0x1_aptos_governance_GovernanceResponsbility">GovernanceResponsbility</a> {
<b>let</b> core_signer = <a href="aptos_governance.md#0x1_aptos_governance_get_signer_testnet_only">get_signer_testnet_only</a>(admin, @0x1);
<a href="system_addresses.md#0x1_system_addresses_assert_aptos_framework">system_addresses::assert_aptos_framework</a>(&core_signer);
<a href="reconfiguration_with_dkg.md#0x1_reconfiguration_with_dkg_finish">reconfiguration_with_dkg::finish</a>(&core_signer);
Expand Down Expand Up @@ -2728,12 +2728,12 @@ Address @aptos_framework must exist ApprovedExecutionHashes and GovernancePropos



<a id="@Specification_1_force_end_epoch_by_admin"></a>
<a id="@Specification_1_force_end_epoch_test_only"></a>

### Function `force_end_epoch_by_admin`
### Function `force_end_epoch_test_only`


<pre><code><b>public</b> entry <b>fun</b> <a href="aptos_governance.md#0x1_aptos_governance_force_end_epoch_by_admin">force_end_epoch_by_admin</a>(admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>)
<pre><code><b>public</b> entry <b>fun</b> <a href="aptos_governance.md#0x1_aptos_governance_force_end_epoch_test_only">force_end_epoch_test_only</a>(admin: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>)
</code></pre>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ module aptos_framework::aptos_governance {
reconfiguration_with_dkg::finish(aptos_framework);
}

/// `force_end_epoch()` but run as admin.
public entry fun force_end_epoch_by_admin(admin: &signer) acquires GovernanceResponsbility {
/// `force_end_epoch()` used in some move tests.
public entry fun force_end_epoch_test_only(admin: &signer) acquires GovernanceResponsbility {
let core_signer = get_signer_testnet_only(admin, @0x1);
system_addresses::assert_aptos_framework(&core_signer);
reconfiguration_with_dkg::finish(&core_signer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ spec aptos_framework::aptos_governance {
aborts_if features::spec_partial_governance_voting_enabled() && !exists<VotingRecordsV2>(@aptos_framework);
}

spec force_end_epoch_by_admin {
spec force_end_epoch_test_only {
pragma verify = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ pub enum EntryFunctionCall {
/// TODO: migrate these tests to be aware of async reconfiguration.
AptosGovernanceForceEndEpoch {},

/// `force_end_epoch()` but run as admin.
AptosGovernanceForceEndEpochByAdmin {},
/// `force_end_epoch()` used in some move tests.
AptosGovernanceForceEndEpochTestOnly {},

/// Vote on proposal with `proposal_id` and specified voting power from `stake_pool`.
AptosGovernancePartialVote {
Expand Down Expand Up @@ -1086,7 +1086,7 @@ impl EntryFunctionCall {
is_multi_step_proposal,
),
AptosGovernanceForceEndEpoch {} => aptos_governance_force_end_epoch(),
AptosGovernanceForceEndEpochByAdmin {} => aptos_governance_force_end_epoch_by_admin(),
AptosGovernanceForceEndEpochTestOnly {} => aptos_governance_force_end_epoch_test_only(),
AptosGovernancePartialVote {
stake_pool,
proposal_id,
Expand Down Expand Up @@ -2071,8 +2071,8 @@ pub fn aptos_governance_force_end_epoch() -> TransactionPayload {
))
}

/// `force_end_epoch()` but run as admin.
pub fn aptos_governance_force_end_epoch_by_admin() -> TransactionPayload {
/// `force_end_epoch()` used in some move tests.
pub fn aptos_governance_force_end_epoch_test_only() -> TransactionPayload {
TransactionPayload::EntryFunction(EntryFunction::new(
ModuleId::new(
AccountAddress::new([
Expand All @@ -2081,7 +2081,7 @@ pub fn aptos_governance_force_end_epoch_by_admin() -> TransactionPayload {
]),
ident_str!("aptos_governance").to_owned(),
),
ident_str!("force_end_epoch_by_admin").to_owned(),
ident_str!("force_end_epoch_test_only").to_owned(),
vec![],
vec![],
))
Expand Down Expand Up @@ -4620,11 +4620,11 @@ mod decoder {
}
}

pub fn aptos_governance_force_end_epoch_by_admin(
pub fn aptos_governance_force_end_epoch_test_only(
payload: &TransactionPayload,
) -> Option<EntryFunctionCall> {
if let TransactionPayload::EntryFunction(_script) = payload {
Some(EntryFunctionCall::AptosGovernanceForceEndEpochByAdmin {})
Some(EntryFunctionCall::AptosGovernanceForceEndEpochTestOnly {})
} else {
None
}
Expand Down Expand Up @@ -6042,8 +6042,8 @@ static SCRIPT_FUNCTION_DECODER_MAP: once_cell::sync::Lazy<EntryFunctionDecoderMa
Box::new(decoder::aptos_governance_force_end_epoch),
);
map.insert(
"aptos_governance_force_end_epoch_by_admin".to_string(),
Box::new(decoder::aptos_governance_force_end_epoch_by_admin),
"aptos_governance_force_end_epoch_test_only".to_string(),
Box::new(decoder::aptos_governance_force_end_epoch_test_only),
);
map.insert(
"aptos_governance_partial_vote".to_string(),
Expand Down
4 changes: 2 additions & 2 deletions execution/executor-test-helpers/src/integration_test_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub fn test_execution_with_storage_impl_inner(
account1.sign_with_transaction_builder(txn_factory.transfer(account3.address(), 70 * B));

let reconfig1 = core_resources_account.sign_with_transaction_builder(
txn_factory.payload(aptos_stdlib::aptos_governance_force_end_epoch_by_admin()),
txn_factory.payload(aptos_stdlib::aptos_governance_force_end_epoch_test_only()),
);

let block1: Vec<_> = into_signature_verified_block(vec![
Expand Down Expand Up @@ -158,7 +158,7 @@ pub fn test_execution_with_storage_impl_inner(
2,
));
let reconfig2 = core_resources_account.sign_with_transaction_builder(
txn_factory.payload(aptos_stdlib::aptos_governance_force_end_epoch_by_admin()),
txn_factory.payload(aptos_stdlib::aptos_governance_force_end_epoch_test_only()),
);
let block2 = vec![block2_meta, UserTransaction(reconfig2)];

Expand Down
2 changes: 1 addition & 1 deletion execution/executor/tests/storage_integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fn test_reconfiguration() {
2,
genesis_key.clone(),
genesis_key.public_key(),
Some(aptos_stdlib::aptos_governance_force_end_epoch_by_admin()),
Some(aptos_stdlib::aptos_governance_force_end_epoch_test_only()),
);

let txn_block = into_signature_verified_block(vec![txn1, txn2, txn3, txn4]);
Expand Down
2 changes: 1 addition & 1 deletion testsuite/forge/src/interface/aptos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ pub async fn reconfig(
root_account.sign_with_transaction_builder(
transaction_factory
.clone()
.payload(aptos_stdlib::aptos_governance_force_end_epoch_by_admin()),
.payload(aptos_stdlib::aptos_governance_force_end_epoch_test_only()),
),
];

Expand Down

0 comments on commit c5f6317

Please sign in to comment.