Skip to content

Commit

Permalink
Updates to Genesis Transaction encoding functions for PBO (#43)
Browse files Browse the repository at this point in the history
* refactor(genesis): remove employees pool initialization

* refactor(genesis_tx): adapt encode mainnet tx function to Supra

* impl Hash and Eq traits for AccountBalance type

* feat(genesis_tx): add delegation and vesting pools to testnet genesis tx encoder

* fix(genesis): add creation of accounts to testnet genesis tx

* remove salt from seed creation

* add rest option

* fix(delegation_pools): enable MODULE_SALT for resource account seed creation

- also fixes execution order of ValidatorSet activation at genesis end

* fix(genesis): genesis block timestamp to be read from Move state

* fix(pbo_delegation): do not serialize ModuleSalt for seed creation

* fix(genesis): avoid calling reconfig on create_initialize_validators

---------

Co-authored-by: supra-yoga <[email protected]>
  • Loading branch information
so-kkroy22 and supra-yoga authored Aug 9, 2024
1 parent fb4f90b commit 2aeaa52
Show file tree
Hide file tree
Showing 12 changed files with 600 additions and 191 deletions.
4 changes: 2 additions & 2 deletions aptos-move/framework/supra-framework/doc/block.md
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ reconfiguration event.
previous_block_votes_bitvec: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_empty">vector::empty</a>(),
proposer: @vm_reserved,
failed_proposer_indices: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_empty">vector::empty</a>(),
time_microseconds: 0,
time_microseconds: <a href="timestamp.md#0x1_timestamp_now_microseconds">timestamp::now_microseconds</a>(),
},
<a href="block.md#0x1_block_NewBlock">NewBlock</a> {
<a href="../../aptos-stdlib/../move-stdlib/doc/hash.md#0x1_hash">hash</a>: genesis_id,
Expand All @@ -843,7 +843,7 @@ reconfiguration event.
previous_block_votes_bitvec: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_empty">vector::empty</a>(),
proposer: @vm_reserved,
failed_proposer_indices: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_empty">vector::empty</a>(),
time_microseconds: 0,
time_microseconds: <a href="timestamp.md#0x1_timestamp_now_microseconds">timestamp::now_microseconds</a>(),
}
);
}
Expand Down
3 changes: 1 addition & 2 deletions aptos-move/framework/supra-framework/doc/genesis.md
Original file line number Diff line number Diff line change
Expand Up @@ -889,8 +889,6 @@ If it exists, it just returns the signer.
// Destroy the aptos framework <a href="account.md#0x1_account">account</a>'s ability <b>to</b> mint coins now that we're done <b>with</b> setting up the initial
// validators.
<a href="supra_coin.md#0x1_supra_coin_destroy_mint_cap">supra_coin::destroy_mint_cap</a>(supra_framework);

<a href="stake.md#0x1_stake_on_new_epoch">stake::on_new_epoch</a>();
}
</code></pre>

Expand Down Expand Up @@ -1367,6 +1365,7 @@ The last step of genesis.


<pre><code><b>fun</b> <a href="genesis.md#0x1_genesis_set_genesis_end">set_genesis_end</a>(supra_framework: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>) {
<a href="stake.md#0x1_stake_on_new_epoch">stake::on_new_epoch</a>();
<a href="chain_status.md#0x1_chain_status_set_genesis_end">chain_status::set_genesis_end</a>(supra_framework);
}
</code></pre>
Expand Down
4 changes: 2 additions & 2 deletions aptos-move/framework/supra-framework/sources/block.move
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ module supra_framework::block {
previous_block_votes_bitvec: vector::empty(),
proposer: @vm_reserved,
failed_proposer_indices: vector::empty(),
time_microseconds: 0,
time_microseconds: timestamp::now_microseconds(),
},
NewBlock {
hash: genesis_id,
Expand All @@ -329,7 +329,7 @@ module supra_framework::block {
previous_block_votes_bitvec: vector::empty(),
proposer: @vm_reserved,
failed_proposer_indices: vector::empty(),
time_microseconds: 0,
time_microseconds: timestamp::now_microseconds(),
}
);
}
Expand Down
6 changes: 2 additions & 4 deletions aptos-move/framework/supra-framework/sources/genesis.move
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ module supra_framework::genesis {
vpool_locking_percentage : u8,
vesting_numerators : vector<u64>,
vesting_denominator : u64,
//Withdrawal address for the pool
// Withdrawal address for the pool
withdrawal_address: address,
// Shareholders in the vesting pool
shareholders : vector<address>,
//Cliff duration in seconds
// Cliff duration in seconds
cliff_period_in_seconds: u64,
// Each vesting period duration in seconds
period_duration_in_seconds: u64,
Expand Down Expand Up @@ -341,8 +341,6 @@ module supra_framework::genesis {
// Destroy the aptos framework account's ability to mint coins now that we're done with setting up the initial
// validators.
supra_coin::destroy_mint_cap(supra_framework);

stake::on_new_epoch();
}

/// Sets up the initial validator set for the network.
Expand Down
Loading

0 comments on commit 2aeaa52

Please sign in to comment.