Skip to content

Commit

Permalink
Release v5.0.9 (#940)
Browse files Browse the repository at this point in the history
* don't error if there's no vfn_ip

* patch display IP address

* ol whoami subcommand

* patch ol init update-waypoint

* make consistent implementation of operator namespace

* patch namespaces of init

* bump version numbers

* include current stdlib compile
  • Loading branch information
0o-de-lally authored Jan 12, 2022
1 parent 5f61e5e commit e5a78ca
Show file tree
Hide file tree
Showing 77 changed files with 1,771 additions and 603 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "diem-config"
version = "5.0.8"
version = "5.0.9"
authors = ["Diem Association <[email protected]>"]
description = "Diem diem-config"
repository = "https://github.com/diem/diem"
Expand Down
2 changes: 1 addition & 1 deletion config/management/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "diem-management"
version = "5.0.8"
version = "5.0.9"
authors = ["Diem Association <[email protected]>"]
description = "Diem Management is a tool used to manage the configuration of a Diem Node"
repository = "https://github.com/diem/diem"
Expand Down
11 changes: 5 additions & 6 deletions config/management/genesis/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,20 @@ pub fn set_operator_key(path: &PathBuf, namespace: &str) {
OnDiskStorage::new(path.join("key_store.json").to_owned())
);
// TODO: Remove hard coded field
let field = format!("{}-oper/operator", namespace);
let field = format!("{}/operator", namespace);
let key = storage.get_public_key(&field).unwrap().public_key;
let peer_id = diem_types::account_address::from_public_key(&key);
storage.set(OPERATOR_ACCOUNT, peer_id).unwrap();
}

//////// 0L /////////
pub fn set_owner_key(path: &PathBuf, namespace: &str) {
pub fn set_owner_key(path: &PathBuf, namespace: &str, account: AccountAddress) {
let mut storage = diem_secure_storage::Storage::OnDiskStorage(
OnDiskStorage::new(path.join("key_store.json").to_owned())
);
// let authkey: AuthenticationKey = namespace.parse().unwrap();
// let account = authkey.derived_address();
let account = namespace.parse::<AccountAddress>().unwrap();
storage.set(&format!("{}-oper/{}", namespace, OWNER_ACCOUNT), account).unwrap();
storage.set(&format!("{}/{}", namespace, OWNER_ACCOUNT), account).unwrap();
// storage.set(&format!("{}/{}", namespace, OWNER_ACCOUNT), account).unwrap();

}
Expand All @@ -98,15 +97,15 @@ pub fn set_waypoint(path: &PathBuf, namespace: &str, waypoint: Waypoint) {
let mut storage = diem_secure_storage::Storage::OnDiskStorage(
OnDiskStorage::new(path.join("key_store.json").to_owned())
);
storage.set(&format!("{}-oper/{}", namespace, WAYPOINT), waypoint).unwrap();
storage.set(&format!("{}/{}", namespace, WAYPOINT), waypoint).unwrap();
}

//////// 0L /////////
pub fn set_genesis_waypoint(path: &PathBuf, namespace: &str, waypoint: Waypoint) {
let mut storage = diem_secure_storage::Storage::OnDiskStorage(
OnDiskStorage::new(path.join("key_store.json").to_owned())
);
storage.set(&format!("{}-oper/{}", namespace, GENESIS_WAYPOINT), waypoint).unwrap();
storage.set(&format!("{}/{}", namespace, GENESIS_WAYPOINT), waypoint).unwrap();
}

#[derive(Debug, StructOpt)]
Expand Down
3 changes: 1 addition & 2 deletions config/management/genesis/src/storage_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl StorageHelper {
&self, namespace: String, keys: KeyScheme, is_genesis: bool
) {
let mut storage_owner = self.storage(namespace.clone());
let mut storage_oper = self.storage(namespace.clone() + "-oper");
let mut storage_oper = self.storage(namespace.clone());

if is_genesis {
// Data needed for testnet, swarm, and genesis ceremony.
Expand All @@ -138,7 +138,6 @@ impl StorageHelper {
.import_private_key(OWNER_KEY, keys.child_0_owner.get_private_key())
.unwrap();
}
// storage_oper.set(OWNER_ACCOUNT, peer_id).unwrap();

storage_oper
.import_private_key(OPERATOR_KEY, keys.child_1_operator.get_private_key())
Expand Down
2 changes: 1 addition & 1 deletion diem-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "diem-node"
version = "5.0.8"
version = "5.0.9"
authors = ["Diem Association <[email protected]>"]
description = "Diem node"
repository = "https://github.com/diem/diem"
Expand Down
3 changes: 1 addition & 2 deletions language/diem-framework/modules/doc/Audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<pre><code><b>use</b> <a href="AutoPay.md#0x1_AutoPay">0x1::AutoPay</a>;
<b>use</b> <a href="DiemAccount.md#0x1_DiemAccount">0x1::DiemAccount</a>;
<b>use</b> <a href="GAS.md#0x1_GAS">0x1::GAS</a>;
<b>use</b> <a href="Testnet.md#0x1_Testnet">0x1::Testnet</a>;
<b>use</b> <a href="TowerState.md#0x1_TowerState">0x1::TowerState</a>;
<b>use</b> <a href="ValidatorConfig.md#0x1_ValidatorConfig">0x1::ValidatorConfig</a>;
Expand Down Expand Up @@ -41,7 +40,7 @@
<b>let</b> oper = <a href="ValidatorConfig.md#0x1_ValidatorConfig_get_operator">ValidatorConfig::get_operator</a>(val);
<b>if</b> (oper == val) <b>return</b> <b>false</b>;
// operator account has balance
<b>if</b> (<a href="DiemAccount.md#0x1_DiemAccount_balance">DiemAccount::balance</a>&lt;<a href="GAS.md#0x1_GAS">GAS</a>&gt;(oper) &lt; 50000 && !<a href="Testnet.md#0x1_Testnet_is_testnet">Testnet::is_testnet</a>()) <b>return</b> <b>false</b>;
// <b>if</b> (<a href="DiemAccount.md#0x1_DiemAccount_balance">DiemAccount::balance</a>&lt;<a href="GAS.md#0x1_GAS">GAS</a>&gt;(oper) &lt; 50000 && !<a href="Testnet.md#0x1_Testnet_is_testnet">Testnet::is_testnet</a>()) <b>return</b> <b>false</b>;
// has autopay enabled
<b>if</b> (!<a href="AutoPay.md#0x1_AutoPay_is_enabled">AutoPay::is_enabled</a>(val)) <b>return</b> <b>false</b>;
// has mining state
Expand Down
33 changes: 17 additions & 16 deletions language/diem-framework/modules/doc/DiemAccount.md
Original file line number Diff line number Diff line change
Expand Up @@ -935,39 +935,39 @@ Tried to create a balance for an account whose role does not allow holding balan



<a name="0x1_DiemAccount_EWITHDRAWAL_EXCEEDS_LIMITS"></a>
<a name="0x1_DiemAccount_ESLOW_WALLET_TRANSFERS_DISABLED_SYSTEMWIDE"></a>

The withdrawal of funds would have exceeded the the account's limits


<pre><code><b>const</b> <a href="DiemAccount.md#0x1_DiemAccount_EWITHDRAWAL_EXCEEDS_LIMITS">EWITHDRAWAL_EXCEEDS_LIMITS</a>: u64 = 12016;
<pre><code><b>const</b> <a href="DiemAccount.md#0x1_DiemAccount_ESLOW_WALLET_TRANSFERS_DISABLED_SYSTEMWIDE">ESLOW_WALLET_TRANSFERS_DISABLED_SYSTEMWIDE</a>: u64 = 120127;
</code></pre>



<a name="0x1_DiemAccount_EWITHDRAWAL_NOT_FOR_COMMUNITY_WALLET"></a>
<a name="0x1_DiemAccount_EWITHDRAWAL_EXCEEDS_LIMITS"></a>

The withdrawal of funds would have exceeded the the account's limits


<pre><code><b>const</b> <a href="DiemAccount.md#0x1_DiemAccount_EWITHDRAWAL_NOT_FOR_COMMUNITY_WALLET">EWITHDRAWAL_NOT_FOR_COMMUNITY_WALLET</a>: u64 = 120126;
<pre><code><b>const</b> <a href="DiemAccount.md#0x1_DiemAccount_EWITHDRAWAL_EXCEEDS_LIMITS">EWITHDRAWAL_EXCEEDS_LIMITS</a>: u64 = 12016;
</code></pre>



<a name="0x1_DiemAccount_EWITHDRAWAL_SLOW_WAL_EXCEEDS_UNLOCKED_LIMIT"></a>
<a name="0x1_DiemAccount_EWITHDRAWAL_NOT_FOR_COMMUNITY_WALLET"></a>



<pre><code><b>const</b> <a href="DiemAccount.md#0x1_DiemAccount_EWITHDRAWAL_SLOW_WAL_EXCEEDS_UNLOCKED_LIMIT">EWITHDRAWAL_SLOW_WAL_EXCEEDS_UNLOCKED_LIMIT</a>: u64 = 120128;
<pre><code><b>const</b> <a href="DiemAccount.md#0x1_DiemAccount_EWITHDRAWAL_NOT_FOR_COMMUNITY_WALLET">EWITHDRAWAL_NOT_FOR_COMMUNITY_WALLET</a>: u64 = 120126;
</code></pre>



<a name="0x1_DiemAccount_EWITHDRAWAL_TRANSFERS_DISABLED_SYSTEMWIDE"></a>
<a name="0x1_DiemAccount_EWITHDRAWAL_SLOW_WAL_EXCEEDS_UNLOCKED_LIMIT"></a>



<pre><code><b>const</b> <a href="DiemAccount.md#0x1_DiemAccount_EWITHDRAWAL_TRANSFERS_DISABLED_SYSTEMWIDE">EWITHDRAWAL_TRANSFERS_DISABLED_SYSTEMWIDE</a>: u64 = 120127;
<pre><code><b>const</b> <a href="DiemAccount.md#0x1_DiemAccount_EWITHDRAWAL_SLOW_WAL_EXCEEDS_UNLOCKED_LIMIT">EWITHDRAWAL_SLOW_WAL_EXCEEDS_UNLOCKED_LIMIT</a>: u64 = 120128;
</code></pre>


Expand Down Expand Up @@ -2657,9 +2657,7 @@ the sender's account balance.
<pre><code><b>public</b> <b>fun</b> <a href="DiemAccount.md#0x1_DiemAccount_extract_withdraw_capability">extract_withdraw_capability</a>(
sender: &signer
): <a href="DiemAccount.md#0x1_DiemAccount_WithdrawCapability">WithdrawCapability</a> <b>acquires</b> <a href="DiemAccount.md#0x1_DiemAccount">DiemAccount</a> {
//////// 0L //////// Transfers disabled by default
//////// 0L //////// Transfers of 10 <a href="GAS.md#0x1_GAS">GAS</a>
//////// 0L //////// enabled when epoch is 1000

<b>let</b> sender_addr = <a href="../../../../../../move-stdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(sender);

/////// 0L /////////
Expand All @@ -2670,11 +2668,14 @@ the sender's account balance.
<a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_limit_exceeded">Errors::limit_exceeded</a>(<a href="DiemAccount.md#0x1_DiemAccount_EWITHDRAWAL_NOT_FOR_COMMUNITY_WALLET">EWITHDRAWAL_NOT_FOR_COMMUNITY_WALLET</a>)
);
/////// 0L /////////
<b>if</b> (!<a href="DiemConfig.md#0x1_DiemConfig_check_transfer_enabled">DiemConfig::check_transfer_enabled</a>()) {
// only VM can make TXs <b>if</b> transfers are not enabled.
// Slow wallet transfers disabled by default, enabled when epoch is 1000
// At that point slow wallets receive 1,000 coins unlocked per day.
<b>if</b> (<a href="DiemAccount.md#0x1_DiemAccount_is_slow">is_slow</a>(sender_addr) && !<a href="DiemConfig.md#0x1_DiemConfig_check_transfer_enabled">DiemConfig::check_transfer_enabled</a>() ) {
// <b>if</b> transfers are not enabled for slow wallets
// then the tx should fail
<b>assert</b>(
sender_addr == <a href="CoreAddresses.md#0x1_CoreAddresses_DIEM_ROOT_ADDRESS">CoreAddresses::DIEM_ROOT_ADDRESS</a>(),
<a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_limit_exceeded">Errors::limit_exceeded</a>(<a href="DiemAccount.md#0x1_DiemAccount_EWITHDRAWAL_TRANSFERS_DISABLED_SYSTEMWIDE">EWITHDRAWAL_TRANSFERS_DISABLED_SYSTEMWIDE</a>)
<b>false</b>,
<a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_limit_exceeded">Errors::limit_exceeded</a>(<a href="DiemAccount.md#0x1_DiemAccount_ESLOW_WALLET_TRANSFERS_DISABLED_SYSTEMWIDE">ESLOW_WALLET_TRANSFERS_DISABLED_SYSTEMWIDE</a>)
);
};
// Abort <b>if</b> we already extracted the unique withdraw capability for this account.
Expand Down
21 changes: 16 additions & 5 deletions language/diem-framework/modules/doc/DiemBlock.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Module `0x1::DiemBlock`

This module defines a struct storing the metadata of the block and new block events.
it also contains all of the block prologue logic which is called from the Rust executor.
For 0L the following changes are applied to the block prologue


- [Resource `BlockMetadata`](#0x1_DiemBlock_BlockMetadata)
Expand All @@ -23,10 +25,11 @@ This module defines a struct storing the metadata of the block and new block eve
<b>use</b> <a href="DiemSystem.md#0x1_DiemSystem">0x1::DiemSystem</a>;
<b>use</b> <a href="DiemTimestamp.md#0x1_DiemTimestamp">0x1::DiemTimestamp</a>;
<b>use</b> <a href="Epoch.md#0x1_Epoch">0x1::Epoch</a>;
<b>use</b> <a href="Reconfigure.md#0x1_EpochBoundary">0x1::EpochBoundary</a>;
<b>use</b> <a href="EpochBoundary.md#0x1_EpochBoundary">0x1::EpochBoundary</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors">0x1::Errors</a>;
<b>use</b> <a href="../../../../../../move-stdlib/docs/Event.md#0x1_Event">0x1::Event</a>;
<b>use</b> <a href="GAS.md#0x1_GAS">0x1::GAS</a>;
<b>use</b> <a href="Migrations.md#0x1_MigrateTowerCounter">0x1::MigrateTowerCounter</a>;
<b>use</b> <a href="Migrations.md#0x1_Migrations">0x1::Migrations</a>;
<b>use</b> <a href="Stats.md#0x1_Stats">0x1::Stats</a>;
</code></pre>
Expand Down Expand Up @@ -241,12 +244,12 @@ The runtime always runs this before executing the transactions in a block.
<a href="DiemTimestamp.md#0x1_DiemTimestamp_assert_operating">DiemTimestamp::assert_operating</a>();
// Operational constraint: can only be invoked by the VM.
<a href="CoreAddresses.md#0x1_CoreAddresses_assert_vm">CoreAddresses::assert_vm</a>(&vm);

// Authorization
<b>assert</b>(
proposer == <a href="CoreAddresses.md#0x1_CoreAddresses_VM_RESERVED_ADDRESS">CoreAddresses::VM_RESERVED_ADDRESS</a>() || <a href="DiemSystem.md#0x1_DiemSystem_is_validator">DiemSystem::is_validator</a>(proposer),
<a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_requires_address">Errors::requires_address</a>(<a href="DiemBlock.md#0x1_DiemBlock_EVM_OR_VALIDATOR">EVM_OR_VALIDATOR</a>)
);

//////// 0L ////////
// increment stats
<a href="Stats.md#0x1_Stats_process_set_votes">Stats::process_set_votes</a>(&vm, &previous_block_votes);
Expand All @@ -259,6 +262,15 @@ The runtime always runs this before executing the transactions in a block.
<a href="AutoPay.md#0x1_AutoPay_process_autopay">AutoPay::process_autopay</a>(&vm);
};

// Do any pending migrations
// TODO: should this be round 2 (when upgrade writeset happens). May be a on off-by-one.
<b>if</b> (round == 3){
// safety. Maybe init Migration <b>struct</b>
<a href="Migrations.md#0x1_Migrations_init">Migrations::init</a>(&vm);
// Migration UID 1
<a href="Migrations.md#0x1_MigrateTowerCounter_migrate_tower_counter">MigrateTowerCounter::migrate_tower_counter</a>(&vm);
};

<b>let</b> block_metadata_ref = borrow_global_mut&lt;<a href="DiemBlock.md#0x1_DiemBlock_BlockMetadata">BlockMetadata</a>&gt;(<a href="CoreAddresses.md#0x1_CoreAddresses_DIEM_ROOT_ADDRESS">CoreAddresses::DIEM_ROOT_ADDRESS</a>());
<a href="DiemTimestamp.md#0x1_DiemTimestamp_update_global_time">DiemTimestamp::update_global_time</a>(&vm, proposer, timestamp);
block_metadata_ref.height = block_metadata_ref.height + 1;
Expand All @@ -275,12 +287,11 @@ The runtime always runs this before executing the transactions in a block.
//////// 0L ////////
// EPOCH BOUNDARY
<b>if</b> (<a href="Epoch.md#0x1_Epoch_epoch_finished">Epoch::epoch_finished</a>()) {
// Run migrations
<a href="Migrations.md#0x1_Migrations_init">Migrations::init</a>(&vm);

// TODO: We don't need <b>to</b> pass block height <b>to</b> EpochBoundaryOL.
// It should <b>use</b> the <a href="DiemBlock.md#0x1_DiemBlock_BlockMetadata">BlockMetadata</a>. But there's a circular reference
// there when we try.
<a href="Reconfigure.md#0x1_EpochBoundary_reconfigure">EpochBoundary::reconfigure</a>(&vm, <a href="DiemBlock.md#0x1_DiemBlock_get_current_block_height">get_current_block_height</a>());
<a href="EpochBoundary.md#0x1_EpochBoundary_reconfigure">EpochBoundary::reconfigure</a>(&vm, <a href="DiemBlock.md#0x1_DiemBlock_get_current_block_height">get_current_block_height</a>());
};
}
</code></pre>
Expand Down
8 changes: 6 additions & 2 deletions language/diem-framework/modules/doc/FullnodeSubsidy.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@


<pre><code><b>public</b> <b>fun</b> <a href="FullnodeSubsidy.md#0x1_FullnodeSubsidy_get_proof_price">get_proof_price</a>(one_val_subsidy: u64): u64 {
<b>let</b> global_proofs = <a href="TowerState.md#0x1_TowerState_get_fullnode_proofs">TowerState::get_fullnode_proofs</a>();

<b>let</b> global_proofs = <a href="TowerState.md#0x1_TowerState_get_fullnode_proofs_in_epoch_above_thresh">TowerState::get_fullnode_proofs_in_epoch_above_thresh</a>();

// proof price is simple, miners divide the equivalent of one compliant
// validator's subsidy.
Expand All @@ -44,8 +45,11 @@
// Note <b>to</b> rascals: I know what you're thinking, but for the same effort
// you'll put into that idea, it would be more profitable <b>to</b> just run
// a validator node.
<b>if</b> (global_proofs &gt; 0) {
<b>return</b> one_val_subsidy/global_proofs
};

one_val_subsidy/global_proofs
0
}
</code></pre>

Expand Down
4 changes: 2 additions & 2 deletions language/diem-framework/modules/doc/Globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ Get the constants for the current network
max_validators_per_set: 100,
subsidy_ceiling_gas: 296 * <a href="Globals.md#0x1_Globals_COIN_SCALING_FACTOR">COIN_SCALING_FACTOR</a>,
vdf_difficulty: 100,
epoch_mining_thres_lower: 1,
epoch_mining_thres_lower: 2, //many tests depend on two proofs because the test harness already gives one at genesis <b>to</b> validators
epoch_mining_thres_upper: 1000, // upper bound unlimited
epoch_slow_wallet_unlock: 10,
}
Expand All @@ -383,7 +383,7 @@ Get the constants for the current network
max_validators_per_set: 100,
subsidy_ceiling_gas: 8640000 * <a href="Globals.md#0x1_Globals_COIN_SCALING_FACTOR">COIN_SCALING_FACTOR</a>,
vdf_difficulty: 120000000,
epoch_mining_thres_lower: 1,
epoch_mining_thres_lower: 1, // in testnet, staging, we don't want <b>to</b> wait too long between proofs.
epoch_mining_thres_upper: 72, // upper bound enforced at 20 mins per proof.
epoch_slow_wallet_unlock: 10000000,
}
Expand Down
Loading

0 comments on commit e5a78ca

Please sign in to comment.