Skip to content

Commit

Permalink
makefie, stdlib build
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Oct 13, 2021
1 parent 088ebb5 commit 685e228
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 24 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ mv-bin:
reset:
onboard val --skip-mining --upstream-peer http://167.172.248.37/ --source-path ~/libra

reset-safety:
jq -r '.["${ACC}-oper/safety_data"].value = { "epoch": 0, "last_voted_round": 0, "preferred_round": 0, "last_vote": null }' ${DATA_PATH}/key_store.json > ${DATA_PATH}/temp_key_store && mv ${DATA_PATH}/temp_key_store ${DATA_PATH}/key_store.json



backup:
Expand All @@ -143,8 +142,10 @@ backup:
clear-prod-db:
@echo WIPING DB
rm -rf ${DATA_PATH}/db | true
@echo BACKING UP KEYSTORE FILE
mv ${DATA_PATH}/key_store.json ${DATA_PATH}/key_store.json.bak | true

reset-safety:
@echo CLEARING SAFETY RULES IN KEY_STORE.JSON
jq -r '.["${ACC}-oper/safety_data"].value = { "epoch": 0, "last_voted_round": 0, "preferred_round": 0, "last_vote": null }' ${DATA_PATH}/key_store.json > ${DATA_PATH}/temp_key_store && mv ${DATA_PATH}/temp_key_store ${DATA_PATH}/key_store.json

#### GENESIS BACKEND SETUP ####
init-backend:
Expand Down
8 changes: 4 additions & 4 deletions language/diem-framework/modules/doc/Globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ Get the constants for the current network
subsidy_ceiling_gas: 296 * coin_scale,
vdf_difficulty: 100,
epoch_mining_thres_lower: 1,
epoch_mining_thres_upper: 1000,
epoch_mining_thres_upper: 240, // upper bound enforced at 6 mins per proof.
epoch_slow_wallet_unlock: 10,
}
};
Expand All @@ -317,7 +317,7 @@ Get the constants for the current network
subsidy_ceiling_gas: 8640000 * coin_scale,
vdf_difficulty: 5000000,
epoch_mining_thres_lower: 1,
epoch_mining_thres_upper: 1000,
epoch_mining_thres_upper: 240, // upper bound enforced at 6 mins per proof.
epoch_slow_wallet_unlock: 10000000,
}
} <b>else</b> {
Expand All @@ -330,9 +330,9 @@ Get the constants for the current network
// target transaction per sec max gas: 20
// uses "scaled representation", since there are no decimals.
subsidy_ceiling_gas: 8640000 * coin_scale, // subsidy amount assumes 24 hour epoch lengths. Also needs <b>to</b> be adjusted for coin_scale the onchain representation of human readable value.
vdf_difficulty: 5000000, //10 mins on macbook pro 2.5 ghz quadcore
vdf_difficulty: 5000000, // FYI approx 10 mins per proof on 2020 macbook pro 2.5 ghz quadcore
epoch_mining_thres_lower: 20,
epoch_mining_thres_upper: 1000,
epoch_mining_thres_upper: 240, // upper bound enforced at 6 mins per proof.
epoch_slow_wallet_unlock: 1000 * coin_scale, // approx 10 years for largest accounts in genesis.
}
}
Expand Down
18 changes: 13 additions & 5 deletions language/diem-framework/modules/doc/TowerState.md
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,19 @@ Permissions: PUBLIC, ANYONE
) <b>acquires</b> <a href="TowerState.md#0x1_TowerState_TowerProofHistory">TowerProofHistory</a>, <a href="TowerState.md#0x1_TowerState_TowerList">TowerList</a>, <a href="TowerState.md#0x1_TowerState_TowerStats">TowerStats</a> {
<b>let</b> miner_history = borrow_global&lt;<a href="TowerState.md#0x1_TowerState_TowerProofHistory">TowerProofHistory</a>&gt;(miner_addr);

// <b>return</b> early <b>if</b> the miner is running too fast, no advantage <b>to</b> asics
<b>assert</b>(
miner_history.count_proofs_in_epoch &lt; <a href="Globals.md#0x1_Globals_get_epoch_mining_thres_upper">Globals::get_epoch_mining_thres_upper</a>(),
<a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_invalid_state">Errors::invalid_state</a>(130106)
);
<b>let</b> epoch = <a href="DiemConfig.md#0x1_DiemConfig_get_current_epoch">DiemConfig::get_current_epoch</a>();
<b>if</b> (epoch &lt; 60) { // network is bootstrapping
<b>assert</b>(
miner_history.count_proofs_in_epoch &lt; 1000,
<a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_invalid_state">Errors::invalid_state</a>(130106)
);
} <b>else</b> { // steady state, <b>return</b> early <b>if</b> a miner is running too fast, no advantage <b>to</b> asics
<b>assert</b>(
miner_history.count_proofs_in_epoch &lt; <a href="Globals.md#0x1_Globals_get_epoch_mining_thres_upper">Globals::get_epoch_mining_thres_upper</a>(),
<a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_invalid_state">Errors::invalid_state</a>(130106)
);
};


// If not genesis proof, check hash <b>to</b> ensure the proof continues the chain
<b>if</b> (steady_state) {
Expand Down
2 changes: 1 addition & 1 deletion language/diem-framework/modules/doc/ol_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
);

// Check the account <b>exists</b> and the balance is 0
<b>assert</b>(<a href="DiemAccount.md#0x1_DiemAccount_balance">DiemAccount::balance</a>&lt;<a href="GAS.md#0x1_GAS">GAS</a>&gt;(new_account_address) == 0, 01);
<b>assert</b>(<a href="DiemAccount.md#0x1_DiemAccount_balance">DiemAccount::balance</a>&lt;<a href="GAS.md#0x1_GAS">GAS</a>&gt;(new_account_address) &gt; 0, 01);
}
</code></pre>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ Get the constants for the current network
subsidy_ceiling_gas: 296 * coin_scale,
vdf_difficulty: 100,
epoch_mining_thres_lower: 1,
epoch_mining_thres_upper: 1000,
epoch_mining_thres_upper: 240, // upper bound enforced at 6 mins per proof.
epoch_slow_wallet_unlock: 10,
}
};
Expand All @@ -317,7 +317,7 @@ Get the constants for the current network
subsidy_ceiling_gas: 8640000 * coin_scale,
vdf_difficulty: 5000000,
epoch_mining_thres_lower: 1,
epoch_mining_thres_upper: 1000,
epoch_mining_thres_upper: 240, // upper bound enforced at 6 mins per proof.
epoch_slow_wallet_unlock: 10000000,
}
} <b>else</b> {
Expand All @@ -330,9 +330,9 @@ Get the constants for the current network
// target transaction per sec max gas: 20
// uses "scaled representation", since there are no decimals.
subsidy_ceiling_gas: 8640000 * coin_scale, // subsidy amount assumes 24 hour epoch lengths. Also needs <b>to</b> be adjusted for coin_scale the onchain representation of human readable value.
vdf_difficulty: 5000000, //10 mins on macbook pro 2.5 ghz quadcore
vdf_difficulty: 5000000, // FYI approx 10 mins per proof on 2020 macbook pro 2.5 ghz quadcore
epoch_mining_thres_lower: 20,
epoch_mining_thres_upper: 1000,
epoch_mining_thres_upper: 240, // upper bound enforced at 6 mins per proof.
epoch_slow_wallet_unlock: 1000 * coin_scale, // approx 10 years for largest accounts in genesis.
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,19 @@ Permissions: PUBLIC, ANYONE
) <b>acquires</b> <a href="TowerState.md#0x1_TowerState_TowerProofHistory">TowerProofHistory</a>, <a href="TowerState.md#0x1_TowerState_TowerList">TowerList</a>, <a href="TowerState.md#0x1_TowerState_TowerStats">TowerStats</a> {
<b>let</b> miner_history = borrow_global&lt;<a href="TowerState.md#0x1_TowerState_TowerProofHistory">TowerProofHistory</a>&gt;(miner_addr);

// <b>return</b> early <b>if</b> the miner is running too fast, no advantage <b>to</b> asics
<b>assert</b>(
miner_history.count_proofs_in_epoch &lt; <a href="Globals.md#0x1_Globals_get_epoch_mining_thres_upper">Globals::get_epoch_mining_thres_upper</a>(),
<a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_invalid_state">Errors::invalid_state</a>(130106)
);
<b>let</b> epoch = <a href="DiemConfig.md#0x1_DiemConfig_get_current_epoch">DiemConfig::get_current_epoch</a>();
<b>if</b> (epoch &lt; 60) { // network is bootstrapping
<b>assert</b>(
miner_history.count_proofs_in_epoch &lt; 1000,
<a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_invalid_state">Errors::invalid_state</a>(130106)
);
} <b>else</b> { // steady state, <b>return</b> early <b>if</b> a miner is running too fast, no advantage <b>to</b> asics
<b>assert</b>(
miner_history.count_proofs_in_epoch &lt; <a href="Globals.md#0x1_Globals_get_epoch_mining_thres_upper">Globals::get_epoch_mining_thres_upper</a>(),
<a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_invalid_state">Errors::invalid_state</a>(130106)
);
};


// If not genesis proof, check hash <b>to</b> ensure the proof continues the chain
<b>if</b> (steady_state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
);

// Check the account <b>exists</b> and the balance is 0
<b>assert</b>(<a href="DiemAccount.md#0x1_DiemAccount_balance">DiemAccount::balance</a>&lt;<a href="GAS.md#0x1_GAS">GAS</a>&gt;(new_account_address) == 0, 01);
<b>assert</b>(<a href="DiemAccount.md#0x1_DiemAccount_balance">DiemAccount::balance</a>&lt;<a href="GAS.md#0x1_GAS">GAS</a>&gt;(new_account_address) &gt; 0, 01);
}
</code></pre>

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified language/diem-framework/staged/stdlib.mv
Binary file not shown.

0 comments on commit 685e228

Please sign in to comment.