Skip to content

Commit

Permalink
github test
Browse files Browse the repository at this point in the history
  • Loading branch information
so-kkroy22 committed May 10, 2024
1 parent 19dfc03 commit 08b268c
Show file tree
Hide file tree
Showing 87 changed files with 863 additions and 1,091 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/move.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Move

on:
push:
branches: [ ]
pull_request:
branches: [ ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest
22 changes: 22 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Rust

on:
push:
branches: [ ]
pull_request:
branches: [ ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
13 changes: 3 additions & 10 deletions aptos-move/e2e-move-tests/src/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use crate::harness::MoveHarness;
use aptos_cached_packages::aptos_stdlib;
use aptos_crypto::{bls12381, PrivateKey, Uniform};
use aptos_crypto::{ed25519, PrivateKey, Uniform};
use aptos_language_e2e_tests::account::Account;
use aptos_types::{
account_address::AccountAddress, account_config::CORE_CODE_ADDRESS,
Expand Down Expand Up @@ -76,18 +76,11 @@ pub fn rotate_consensus_key(
account: &Account,
pool_address: AccountAddress,
) -> TransactionStatus {
let consensus_key = bls12381::PrivateKey::generate_for_testing();
let consensus_key = ed25519::PrivateKey::generate_for_testing();
let consensus_pubkey = consensus_key.public_key().to_bytes().to_vec();
let proof_of_possession = bls12381::ProofOfPossession::create(&consensus_key)
.to_bytes()
.to_vec();
harness.run_transaction_payload(
account,
aptos_stdlib::stake_rotate_consensus_key(
pool_address,
consensus_pubkey,
proof_of_possession,
),
aptos_stdlib::stake_rotate_consensus_key(pool_address, consensus_pubkey),
)
}

Expand Down
13 changes: 3 additions & 10 deletions aptos-move/e2e-move-tests/src/tests/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
MoveHarness,
};
use aptos_cached_packages::{aptos_stdlib, aptos_token_sdk_builder};
use aptos_crypto::{bls12381, PrivateKey, Uniform};
use aptos_crypto::{ed25519, PrivateKey, Uniform};
use aptos_gas_profiling::TransactionGasLog;
use aptos_types::{
account_address::{default_stake_pool_address, AccountAddress},
Expand Down Expand Up @@ -145,20 +145,13 @@ fn test_gas() {
),
);
let pool_address = default_stake_pool_address(account_1_address, account_2_address);
let consensus_key = bls12381::PrivateKey::generate_for_testing();
let consensus_key = ed25519::PrivateKey::generate_for_testing();
let consensus_pubkey = consensus_key.public_key().to_bytes().to_vec();
let proof_of_possession = bls12381::ProofOfPossession::create(&consensus_key)
.to_bytes()
.to_vec();
run(
&mut harness,
"RotateConsensusKey",
account_2,
aptos_stdlib::stake_rotate_consensus_key(
pool_address,
consensus_pubkey,
proof_of_possession,
),
aptos_stdlib::stake_rotate_consensus_key(pool_address, consensus_pubkey),
);
run(
&mut harness,
Expand Down
7 changes: 0 additions & 7 deletions aptos-move/framework/aptos-framework/doc/genesis.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,6 @@
</dt>
<dd>

</dd>
<dt>
<code>proof_of_possession: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;</code>
</dt>
<dd>

</dd>
<dt>
<code>network_addresses: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;</code>
Expand Down Expand Up @@ -779,7 +773,6 @@ encoded in a single BCS byte array.
operator,
pool_address,
validator.consensus_pubkey,
validator.proof_of_possession,
);
<a href="stake.md#0x1_stake_update_network_and_fullnode_addresses">stake::update_network_and_fullnode_addresses</a>(
operator,
Expand Down
391 changes: 189 additions & 202 deletions aptos-move/framework/aptos-framework/doc/stake.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1023,9 +1023,9 @@ module aptos_framework::aptos_governance {
vector::push_back(&mut active_validators, signer::address_of(proposer));
vector::push_back(&mut active_validators, signer::address_of(yes_voter));
vector::push_back(&mut active_validators, signer::address_of(no_voter));
let (_sk_1, pk_1, _pop_1) = stake::generate_identity();
let (_sk_2, pk_2, _pop_2) = stake::generate_identity();
let (_sk_3, pk_3, _pop_3) = stake::generate_identity();
let (_sk_1, pk_1) = stake::generate_identity();
let (_sk_2, pk_2) = stake::generate_identity();
let (_sk_3, pk_3) = stake::generate_identity();
let pks = vector[pk_1, pk_2, pk_3];
stake::create_validator_set(aptos_framework, active_validators, pks);

Expand Down Expand Up @@ -1081,14 +1081,14 @@ module aptos_framework::aptos_governance {
coin::register<AptosCoin>(no_voter);
coin::deposit(signer::address_of(no_voter), stake::mint_coins(10));

let (_sk_1, pk_1, pop_1) = stake::generate_identity();
let (_sk_2, pk_2, pop_2) = stake::generate_identity();
let (_sk_3, pk_3, pop_3) = stake::generate_identity();
stake::initialize_test_validator(&pk_2, &pop_2, yes_voter, 20, true, false);
stake::initialize_test_validator(&pk_3, &pop_3, no_voter, 10, true, false);
let (_sk_1, pk_1) = stake::generate_identity();
let (_sk_2, pk_2) = stake::generate_identity();
let (_sk_3, pk_3) = stake::generate_identity();
stake::initialize_test_validator(&pk_2, yes_voter, 20, true, false);
stake::initialize_test_validator(&pk_3, no_voter, 10, true, false);
stake::end_epoch();
timestamp::fast_forward_seconds(1440);
stake::initialize_test_validator(&pk_1, &pop_1, proposer, 100, true, false);
stake::initialize_test_validator(&pk_1, proposer, 100, true, false);
stake::end_epoch();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ module aptos_framework::delegation_pool {
use aptos_framework::timestamp::fast_forward_seconds;

#[test_only]
const CONSENSUS_KEY_1: vector<u8> = x"8a54b92288d4ba5073d3a52e80cc00ae9fbbc1cc5b433b46089b7804c38a76f00fc64746c7685ee628fc2d0b929c2294";
const CONSENSUS_KEY_1: vector<u8> = x"1a";
#[test_only]
const CONSENSUS_POP_1: vector<u8> = x"a9d6c1f1270f2d1454c89a83a4099f813a56dc7db55591d46aa4e6ccae7898b234029ba7052f18755e6fa5e6b73e235f14efc4e2eb402ca2b8f56bad69f965fc11b7b25eb1c95a06f83ddfd023eac4559b6582696cfea97b227f4ce5bdfdfed0";

Expand Down Expand Up @@ -1899,7 +1899,7 @@ module aptos_framework::delegation_pool {
initialize_delegation_pool(validator, commission_percentage, vector::empty<u8>());
let pool_address = get_owned_pool_address(validator_address);

stake::rotate_consensus_key(validator, pool_address, CONSENSUS_KEY_1, CONSENSUS_POP_1);
stake::rotate_consensus_key(validator, pool_address, CONSENSUS_KEY_1);

if (amount > 0) {
stake::mint(validator, amount);
Expand Down Expand Up @@ -2058,7 +2058,7 @@ module aptos_framework::delegation_pool {
initialize_delegation_pool(validator, 3735, vector::empty<u8>());
let pool_address = get_owned_pool_address(validator_address);

stake::rotate_consensus_key(validator, pool_address, CONSENSUS_KEY_1, CONSENSUS_POP_1);
stake::rotate_consensus_key(validator, pool_address, CONSENSUS_KEY_1);

// zero `add_stake` fee as validator is not producing rewards this epoch
assert!(get_add_stake_fee(pool_address, 1000000 * ONE_APT) == 0, 0);
Expand Down Expand Up @@ -3226,7 +3226,7 @@ module aptos_framework::delegation_pool {
assert_delegation(validator_address, pool_address, 0, 0, 0);

// activate validator
stake::rotate_consensus_key(validator, pool_address, CONSENSUS_KEY_1, CONSENSUS_POP_1);
stake::rotate_consensus_key(validator, pool_address, CONSENSUS_KEY_1);
stake::join_validator_set(validator, pool_address);
end_aptos_epoch();

Expand Down Expand Up @@ -3363,7 +3363,7 @@ module aptos_framework::delegation_pool {
unlock(delegator, pool_address, 100 * ONE_APT);

// activate validator
stake::rotate_consensus_key(old_operator, pool_address, CONSENSUS_KEY_1, CONSENSUS_POP_1);
stake::rotate_consensus_key(old_operator, pool_address, CONSENSUS_KEY_1);
stake::join_validator_set(old_operator, pool_address);
end_aptos_epoch();

Expand Down Expand Up @@ -3430,7 +3430,7 @@ module aptos_framework::delegation_pool {
unlock(delegator, pool_address, 1000000 * ONE_APT);

// activate validator
stake::rotate_consensus_key(operator1, pool_address, CONSENSUS_KEY_1, CONSENSUS_POP_1);
stake::rotate_consensus_key(operator1, pool_address, CONSENSUS_KEY_1);
stake::join_validator_set(operator1, pool_address);
end_aptos_epoch();

Expand Down Expand Up @@ -3495,7 +3495,7 @@ module aptos_framework::delegation_pool {
unlock(delegator, pool_address, 100 * ONE_APT);

// activate validator
stake::rotate_consensus_key(operator, pool_address, CONSENSUS_KEY_1, CONSENSUS_POP_1);
stake::rotate_consensus_key(operator, pool_address, CONSENSUS_KEY_1);
stake::join_validator_set(operator, pool_address);
end_aptos_epoch();

Expand Down Expand Up @@ -3557,7 +3557,7 @@ module aptos_framework::delegation_pool {
unlock(delegator, pool_address, 100 * ONE_APT);

// activate validator
stake::rotate_consensus_key(operator, pool_address, CONSENSUS_KEY_1, CONSENSUS_POP_1);
stake::rotate_consensus_key(operator, pool_address, CONSENSUS_KEY_1);
stake::join_validator_set(operator, pool_address);
end_aptos_epoch();

Expand Down
2 changes: 0 additions & 2 deletions aptos-move/framework/aptos-framework/sources/genesis.move
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ module aptos_framework::genesis {
voter_address: address,
stake_amount: u64,
consensus_pubkey: vector<u8>,
proof_of_possession: vector<u8>,
network_addresses: vector<u8>,
full_node_network_addresses: vector<u8>,
}
Expand Down Expand Up @@ -365,7 +364,6 @@ module aptos_framework::genesis {
operator,
pool_address,
validator.consensus_pubkey,
validator.proof_of_possession,
);
stake::update_network_and_fullnode_addresses(
operator,
Expand Down
Loading

0 comments on commit 08b268c

Please sign in to comment.