Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.

Proof Zero Preimage #778

Merged
merged 94 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
77b7582
makefile
0o-de-lally Oct 11, 2021
9d5d4a0
move safety rules file out of key_store.json
0o-de-lally Oct 11, 2021
526adfd
makefile
0o-de-lally Oct 11, 2021
d57f529
makefile
0o-de-lally Oct 11, 2021
ed7ff44
refresh seed peers
0o-de-lally Oct 16, 2021
193a13d
catch state tree error and handle
0o-de-lally Oct 16, 2021
652daab
merge
0o-de-lally Oct 17, 2021
f6fa30b
refactor block execution to reduce calls.
0o-de-lally Oct 18, 2021
9d58ee4
format doc
0o-de-lally Oct 18, 2021
e5b577d
patch setting upstream connection on client
0o-de-lally Oct 18, 2021
c856f5b
remove deprecated args in tower start
0o-de-lally Oct 18, 2021
81ad100
make log levels in ureq go away
0o-de-lally Oct 18, 2021
a0208f0
patch toml
0o-de-lally Oct 18, 2021
686dd63
clean up debug prints
0o-de-lally Oct 18, 2021
1a42855
benchmarking vdf
0o-de-lally Oct 18, 2021
027702c
make vdf delay and verify receive params.
0o-de-lally Oct 18, 2021
b78ac7a
make all tower apis receive difficulty and security params
0o-de-lally Oct 19, 2021
ad7c4e9
change transaction api for tower and account creation.
0o-de-lally Oct 19, 2021
adb6195
more benches
0o-de-lally Oct 19, 2021
b72d42b
patch tests
0o-de-lally Oct 19, 2021
e6452bb
patch tower tests
0o-de-lally Oct 19, 2021
76dff69
patch native function arg parsing
0o-de-lally Oct 19, 2021
181cedb
patch vdf tests
0o-de-lally Oct 19, 2021
2880c02
patch miner and vdf tests
0o-de-lally Oct 19, 2021
3703a75
patch tests
0o-de-lally Oct 19, 2021
d8d4e5e
consolidate names challenge/solution
0o-de-lally Oct 19, 2021
4c6b220
patch test build errors
0o-de-lally Oct 19, 2021
c10595f
cleanup
0o-de-lally Oct 19, 2021
5b48446
patch e2e build
0o-de-lally Oct 19, 2021
acb297e
build stdlib
0o-de-lally Oct 19, 2021
211895f
patch e2e reconfig test.
0o-de-lally Oct 19, 2021
841c91d
rebuild upgarde fixtures
0o-de-lally Oct 19, 2021
0fc63bd
patch autopay integration tests
0o-de-lally Oct 19, 2021
a19054f
Merge branch 'patch-integration' into genesis
0o-de-lally Oct 19, 2021
6c6a859
Merge branch 'genesis' into vdf-security
0o-de-lally Oct 19, 2021
cc35e1e
get toml file from fixtures
0o-de-lally Oct 19, 2021
ba6252c
change VDF scheme BREAKING CHANGE
0o-de-lally Oct 19, 2021
e1ee132
set new vdf parameters
0o-de-lally Oct 19, 2021
37e6741
change native function
0o-de-lally Oct 19, 2021
f176ba0
created test fixtures
0o-de-lally Oct 19, 2021
394f375
fixtures makefile
0o-de-lally Oct 20, 2021
21cc09c
make test mode only TEST=y
0o-de-lally Oct 20, 2021
f83da01
patch
0o-de-lally Oct 20, 2021
7170a4d
create prod fixtures
0o-de-lally Oct 20, 2021
31c357d
updating move test fixtures
0o-de-lally Oct 20, 2021
d92bfb6
build stdlib
0o-de-lally Oct 20, 2021
6c137ab
get blocks from fixtures
0o-de-lally Oct 20, 2021
7ae2291
get block fixtures from files
0o-de-lally Oct 20, 2021
3ca15c8
wip patching miner tests
0o-de-lally Oct 20, 2021
21dd291
cleanup
0o-de-lally Oct 20, 2021
816bcdd
patch build
0o-de-lally Oct 20, 2021
584c315
remove mentions of 2048
0o-de-lally Oct 20, 2021
a958fc9
fix imports in genesis
0o-de-lally Oct 20, 2021
eb181ea
wip patch vdf proofs
0o-de-lally Oct 20, 2021
e36fdb7
vdf tets passing
0o-de-lally Oct 20, 2021
0f502f2
add block 1 fixtures
0o-de-lally Oct 20, 2021
33f9d8c
add eve block 1 fixtures
0o-de-lally Oct 20, 2021
4cb18a9
complete move fixtures
0o-de-lally Oct 20, 2021
ca5b406
patch miner tests
0o-de-lally Oct 20, 2021
9ab66ac
all tests passing.
0o-de-lally Oct 20, 2021
e20ab39
tower tests passing
0o-de-lally Oct 20, 2021
3dc0ebd
add tower link to genesis preimage, make preimage a fixed 1024 size
0o-de-lally Oct 20, 2021
7eff167
add wizard to add a tower link
0o-de-lally Oct 20, 2021
3805f2c
patching e2e tests and tools tests
0o-de-lally Oct 20, 2021
f9a0487
more sane fixtures managment for e2e tests
0o-de-lally Oct 21, 2021
990e9eb
Merge branch 'main' into vdf-security
0o-de-lally Oct 21, 2021
2097130
Merge branch 'vdf-security' into genesis-vdf
0o-de-lally Oct 21, 2021
289280f
update makefile
0o-de-lally Oct 21, 2021
202fea4
Merge branch 'vdf-security' into genesis-vdf
0o-de-lally Oct 21, 2021
d44f46d
patch merge
0o-de-lally Oct 21, 2021
009447b
patch fixtures helpers locations
0o-de-lally Oct 21, 2021
c4f9ac0
remove duplicate fixtures helper
0o-de-lally Oct 21, 2021
cf6e54f
Merge branch 'vdf-security' into genesis-vdf
0o-de-lally Oct 21, 2021
d4b3c47
makefile recipe to backup 0L folder
0o-de-lally Oct 21, 2021
44a2566
documentation
0o-de-lally Oct 21, 2021
95bd3d3
makefile genesis
0o-de-lally Oct 21, 2021
653d632
makefile for sync
0o-de-lally Oct 21, 2021
6cc7ebd
nodefiles to use key_store only
0o-de-lally Oct 21, 2021
2dd2ccc
Merge branch 'main' into genesis-vdf
0o-de-lally Oct 21, 2021
4d9aaa2
build stdlib
0o-de-lally Oct 21, 2021
3cdf11d
bring back info prints
0o-de-lally Oct 21, 2021
34d39e5
staging net epoch
0o-de-lally Oct 21, 2021
d7ed4df
delay difficulty for stage was off.
0o-de-lally Oct 21, 2021
184a52d
prints
0o-de-lally Oct 21, 2021
0023672
looking for wrong filename
0o-de-lally Oct 21, 2021
b84c160
Merge branch 'main' into vdf-security
0o-de-lally Oct 21, 2021
926ff14
Merge branch 'vdf-security' of https://github.com/OLSF/libra into vdf…
0o-de-lally Oct 21, 2021
d8dbb6f
Merge branch 'vdf-security' into genesis-vdf
0o-de-lally Oct 21, 2021
f3828a0
build stdlib
0o-de-lally Oct 22, 2021
ca3abe7
Merge branch 'main' into genesis-vdf
0o-de-lally Oct 22, 2021
98f19e9
patch globals for vdf difficulty
0o-de-lally Oct 22, 2021
ee860c1
rename block_0.json throughout
0o-de-lally Oct 22, 2021
bd6d9be
skip add_tower when in test mode for onboarding
0o-de-lally Oct 22, 2021
e10554c
patch build
0o-de-lally Oct 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

81 changes: 49 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,42 @@ 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:
cd ~ && rsync -av --exclude db/ --exclude logs/ ~/.0L ~/0L_backup_$(shell date +"%m-%d-%y")
cd ~ && rsync -av --exclude db/ --exclude logs/ ~/.0L ~/0L_backup_$(shell date +"%m-%d-%y-%T")

confirm:
@read -p "Continue (y/n)?" CONT; \
if [ "$$CONT" = "y" ]; then \
echo "deleting...."; \
else \
exit 1; \
fi \

danger-delete-all:
@echo THIS WILL WIPE ALL YOUR FILES in ${HOME}/.0L
@echo it will also make a backup at ${HOME}/backup_0L/
@echo the files github_token.txt, autopay_batch.json, set_layout, ./vdf_proofs/ and ./blocks/ will be returned to ${HOME}/.0L/
make confirm
make backup
rm -rf ${HOME}/.0L | true
mkdir ${HOME}/.0L/
make danger-restore

danger-restore:
cp ${HOME}/backup_0L/github_token.txt ${HOME}/.0L/ | true
cp ${HOME}/backup_0L/autopay_batch.json ${HOME}/.0L/ | true
rsync -rtv ${HOME}/backup_0L/blocks/ ${HOME}/.0L/blocks | true
rsync -rtv ${HOME}/backup_0L/vdf_proofs/ ${HOME}/.0L/vdf_proofs | true
rsync -rtv ${HOME}/backup_0L/set_layout.toml ${HOME}/.0L/ | true





clear-prod-db:
@echo WIPING DB
make confirm
rm -rf ${DATA_PATH}/db | true

reset-safety:
Expand Down Expand Up @@ -185,22 +212,14 @@ gen-make-pull:
--shared-backend ${GENESIS_REMOTE} \
--pull-request-user ${GITHUB_USER}

genesis-miner:
cargo run -p tower -- zero


gen-onboard:
cargo run -p onboard ${CARGO_ARGS} -- val --genesis-ceremony
cargo run -p onboard ${CARGO_ARGS} -- val --genesis-ceremony

ceremony: gen-fork-repo gen-onboard
gen-reset:
cargo run -p onboard ${CARGO_ARGS} -- val --genesis-ceremony --skip-mining

# cargo run -p tower ${CARGO_ARGS} -- zero

register:
# export ACC=$(shell toml get ${DATA_PATH}/0L.toml profile.account)
# @echo Initializing from ${DATA_PATH}/0L.toml with account:
# @echo ${ACC}
# make init
gen-register:

@echo the OPER initializes local accounts and submit pubkeys to github
ACC=${ACC}-oper make oper-key
Expand All @@ -214,10 +233,8 @@ register:
@echo OPER send signed transaction with configurations for *OWNER* account
ACC=${ACC}-oper OWNER=${ACC} IP=${IP} make reg

ifeq (${TEST}, y)
@echo Making pull request to genesis coordination repo
make gen-make-pull
endif

init-test:
echo ${MNEM} | head -c -1 | cargo run -p diem-genesis-tool -- init --path=${DATA_PATH} --namespace=${ACC}
Expand All @@ -227,15 +244,15 @@ init:
# OWNER does this
# Submits proofs to shared storage
add-proofs:
cargo run -p diem-genesis-tool ${CARGO_ARGS} -- mining \
--path-to-genesis-pow ${DATA_PATH}/blocks/block_0.json \
cargo run -p diem-genesis-tool ${CARGO_ARGS} -- mining \
--path-to-genesis-pow ${DATA_PATH}/vdf_proofs/proof_0.json \
--path-to-account-json ${DATA_PATH}/account.json \
--shared-backend ${REMOTE}

# OPER does this
# Submits operator key to github, and creates local OPERATOR_ACCOUNT
oper-key:
cargo run -p diem-genesis-tool ${CARGO_ARGS} -- operator-key \
cargo run -p diem-genesis-tool ${CARGO_ARGS} -- operator-key \
--validator-backend ${LOCAL} \
--shared-backend ${REMOTE}

Expand Down Expand Up @@ -291,7 +308,7 @@ genesis:
#### NODE MANAGEMENT ####
start:
# run in foreground. Only for testing, use a daemon for net.
cargo run -p diem-node -- --config ${DATA_PATH}/validator.node.yaml
NODE_ENV=error cargo run -p diem-node -- --config ${DATA_PATH}/validator.node.yaml

# Start a fullnode instead of a validator node
start-full:
Expand Down Expand Up @@ -327,8 +344,8 @@ ifeq (${TEST}, y)
@if test -d ${DATA_PATH}; then \
cd ${DATA_PATH} && rm -rf libradb *.yaml *.blob *.json db *.toml; \
fi
@if test -d ${DATA_PATH}/blocks; then \
rm -f ${DATA_PATH}/blocks/*.json; \
@if test -d ${DATA_PATH}/vdf_proofs; then \
rm -f ${DATA_PATH}/vdf_proofs/*.json; \
fi
endif

Expand Down Expand Up @@ -359,11 +376,11 @@ ifdef TEST
@if test ! -d ${DATA_PATH}; then \
echo Creating Directories \
mkdir ${DATA_PATH}; \
mkdir -p ${DATA_PATH}/blocks/; \
mkdir -p ${DATA_PATH}/vdf_proofs/; \
fi

@if test -f ${DATA_PATH}/blocks/block_0.json; then \
rm ${DATA_PATH}/blocks/block_0.json; \
@if test -f ${DATA_PATH}/vdf_proofs/proof_0.json; then \
rm ${DATA_PATH}/vdf_proofs/proof_0.json; \
fi

@if test -f ${DATA_PATH}/0L.toml; then \
Expand All @@ -373,7 +390,7 @@ ifdef TEST
# skip miner configuration with fixtures
cp ./ol/fixtures/configs/${NS}.toml ${DATA_PATH}/0L.toml
# skip mining proof zero with fixtures
cp ./ol/fixtures/blocks/${NODE_ENV}/${NS}/block_0.json ${DATA_PATH}/blocks/block_0.json
cp ./ol/fixtures/vdf_proofs/${NODE_ENV}/${NS}/proof_0.json ${DATA_PATH}/vdf_proofs/proof_0.json
# place a mock autopay.json in root
cp ./ol/fixtures/autopay/${NS}.autopay_batch.json ${DATA_PATH}/autopay_batch.json
# place a mock account.json in root, used as template for onboarding
Expand Down Expand Up @@ -486,14 +503,14 @@ clean-tags:
git tag -d ${TAG}

nuke-testnet:
@echo WIPING EVERYTHING but keeping: github_token.txt, autopay_batch.json, set_layout.toml, /blocks/block_0.json
@echo WIPING EVERYTHING but keeping: github_token.txt, autopay_batch.json, set_layout.toml, /vdf_proofs/proof_0.json

@if test -d ${DATA_PATH}; then \
cd ${DATA_PATH} && cp github_token.txt autopay_batch.json set_layout.toml blocks/block_0.json ~/; \
cd ${DATA_PATH} && cp github_token.txt autopay_batch.json set_layout.toml vdf_proofs/proof_0.json ~/; \
cd ${DATA_PATH} && rm -rf *; \
cd ~ && cp github_token.txt autopay_batch.json set_layout.toml ${DATA_PATH}; \
cd ${DATA_PATH} && mkdir blocks;\
cd ~ && cp block_0.json ${DATA_PATH}/blocks/; \
cd ${DATA_PATH} && mkdir vdf_proofs;\
cd ~ && cp proof_0.json ${DATA_PATH}/vdf_proofs/; \
fi


Expand Down
9 changes: 4 additions & 5 deletions config/global-constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,16 @@ pub const VDF_SECURITY_PARAM: u16 = 512;
/// Filename for 0L configs
pub const CONFIG_FILE: &str = "0L.toml";


// TODO: make this lazy static.
/// Switch settings between production and testing
pub fn delay_difficulty() -> u64 {
let node_env = match env::var("NODE_ENV") {
Ok(val) => val,
_ => "prod".to_string() // default to "prod" if not set
};
// must explicitly set env to prod to use production difficulty.
if node_env == "prod" {
return 120_000_000
// test settings need to be set explicitly
if node_env == "test" {
return 100 // difficulty for test suites and on local for debugging purposes.
}
return 100 // difficulty for test suites and on local for debugging purposes.
return 120_000_000
}
12 changes: 6 additions & 6 deletions config/management/genesis/src/ol_node_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ pub fn write_node_config_files(
disk_storage.path = output_dir.clone().join("key_store.json");
disk_storage.namespace = Some(namespace.to_owned());

// Write the genesis waypoint without a namespaced storage.
let mut safety_rules_storage = OnDiskStorageConfig::default();
safety_rules_storage.set_data_dir(output_dir.clone());
safety_rules_storage.path = output_dir.clone().join("safety_rules.json");
safety_rules_storage.namespace = Some(namespace.to_owned());
// // Write the genesis waypoint without a namespaced storage.
// let mut safety_rules_storage = OnDiskStorageConfig::default();
// safety_rules_storage.set_data_dir(output_dir.clone());
// safety_rules_storage.path = output_dir.clone().join("safety_rules.json");
// safety_rules_storage.namespace = Some(namespace.to_owned());

// Get node configs template
let mut config = if *fullnode_only {
Expand Down Expand Up @@ -181,7 +181,7 @@ pub fn write_node_config_files(
c.execution.genesis_file_location = genesis_path.clone();

c.consensus.safety_rules.service = SafetyRulesService::Thread;
c.consensus.safety_rules.backend = SecureBackend::OnDiskStorage(safety_rules_storage);
c.consensus.safety_rules.backend = SecureBackend::OnDiskStorage(disk_storage.clone());

c
};
Expand Down
8 changes: 4 additions & 4 deletions language/diem-framework/modules/0L/Globals.move
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,25 @@ module Globals {

if (StagingNet::is_staging_net()) {
return GlobalConstants {
epoch_length: 60 * 20, // 20 mins, enough for a hard miner proof.
epoch_length: 60 * 40, // 20 mins, enough for a hard miner proof.
max_validators_per_set: 100,
subsidy_ceiling_gas: 8640000 * coin_scale,
vdf_difficulty: 5000000,
vdf_difficulty: 120000000,
epoch_mining_thres_lower: 1,
epoch_mining_thres_upper: 72, // upper bound enforced at 20 mins per proof.
epoch_slow_wallet_unlock: 10000000,
}
} else {
return GlobalConstants {
epoch_length: 60 * 60 * 24, // approx 24 hours at 1.4 blocks/sec
epoch_length: 60 * 60 * 24, // approx 24 hours at 1.4 vdf_proofs/sec
max_validators_per_set: 100, // max expected for BFT limits.
// See DiemVMConfig for gas constants:
// Target max gas units per transaction 100000000
// target max block time: 2 secs
// 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 to be adjusted for coin_scale the onchain representation of human readable value.
vdf_difficulty: 5000000, // FYI approx 10 mins per proof on 2020 macbook pro 2.5 ghz quadcore
vdf_difficulty: 120000000, // FYI approx 30 mins per proof on 2020 macbook pro 2.5 ghz quadcore
epoch_mining_thres_lower: 7, // NOTE: bootstrapping, allowance for operator error.
epoch_mining_thres_upper: 72, // upper bound enforced at 20 mins per proof.
epoch_slow_wallet_unlock: 1000 * coin_scale, // approx 10 years for largest accounts in genesis.
Expand Down
3 changes: 1 addition & 2 deletions language/diem-framework/modules/0L/TestFixtures.move
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module TestFixtures{
x"0051dfa4c3341c18197b72f5e5eecc693eb56d408206c206d90f5ec7a75f833b2affb0ea7280d4513ab8351f39362d362203ff3e41882309e7900f470f0a27eeeb7b"
}

//FROM: diem/fixtures/block_0.json.stage.alice
public fun alice_0_easy_chal(): vector<u8> {
assert(Testnet::is_testnet(), 130102014010);
x"87515d94a244235a1433d7117bc0cb154c613c2f4b1e67ca8d98a542ee3f59f5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006578706572696d656e74616c6400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000074657374"
Expand All @@ -42,7 +41,7 @@ module TestFixtures{
x"00639237baac2348608e1e6dbcee015a2a628780d97f865f17c6e9f99d325ecb120052b0be3b0578af20cf0c4304ab14cbe7635a4247ed4ff3fcbd488bc66eb88cb7"
}

//FROM: diem/fixtures/block_1.json.stage.alice
//FROM: ol/fixtures/proof_1.json.stage.alice

public fun alice_1_easy_chal(): vector<u8> {
assert(Testnet::is_testnet(), 130102014010);
Expand Down
75 changes: 1 addition & 74 deletions language/diem-framework/modules/doc/DiemAccount.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ before and after every transaction.
- [Function `preburn`](#0x1_DiemAccount_preburn)
- [Function `extract_withdraw_capability`](#0x1_DiemAccount_extract_withdraw_capability)
- [Function `restore_withdraw_capability`](#0x1_DiemAccount_restore_withdraw_capability)
- [Function `vm_make_payment`](#0x1_DiemAccount_vm_make_payment)
- [Function `process_community_wallets`](#0x1_DiemAccount_process_community_wallets)
- [Function `vm_make_payment_no_limit`](#0x1_DiemAccount_vm_make_payment_no_limit)
- [Function `vm_burn_from_balance`](#0x1_DiemAccount_vm_burn_from_balance)
Expand Down Expand Up @@ -2694,79 +2693,6 @@ Return the withdraw capability to the account it originally came from



</details>

<a name="0x1_DiemAccount_vm_make_payment"></a>

## Function `vm_make_payment`



<pre><code><b>public</b> <b>fun</b> <a href="DiemAccount.md#0x1_DiemAccount_vm_make_payment">vm_make_payment</a>&lt;Token: store&gt;(payer: address, payee: address, amount: u64, metadata: vector&lt;u8&gt;, metadata_signature: vector&lt;u8&gt;, vm: &signer)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="DiemAccount.md#0x1_DiemAccount_vm_make_payment">vm_make_payment</a>&lt;Token: store&gt;(
payer : address,
payee: address,
amount: u64,
metadata: vector&lt;u8&gt;,
metadata_signature: vector&lt;u8&gt;,
vm: &signer
) <b>acquires</b> <a href="DiemAccount.md#0x1_DiemAccount">DiemAccount</a> , <a href="DiemAccount.md#0x1_DiemAccount_Balance">Balance</a>, <a href="DiemAccount.md#0x1_DiemAccount_AccountOperationsCapability">AccountOperationsCapability</a>, <a href="DiemAccount.md#0x1_DiemAccount_AutopayEscrow">AutopayEscrow</a>, <a href="DiemAccount.md#0x1_DiemAccount_CumulativeDeposits">CumulativeDeposits</a>, <a href="DiemAccount.md#0x1_DiemAccount_SlowWallet">SlowWallet</a> { //////// 0L ////////
<b>if</b> (<a href="../../../../../../move-stdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(vm) != <a href="CoreAddresses.md#0x1_CoreAddresses_DIEM_ROOT_ADDRESS">CoreAddresses::DIEM_ROOT_ADDRESS</a>()) <b>return</b>;
<b>if</b> (amount == 0) <b>return</b>;

// Check payee can receive funds in this currency.
<b>if</b> (!<b>exists</b>&lt;<a href="DiemAccount.md#0x1_DiemAccount_Balance">Balance</a>&lt;Token&gt;&gt;(payee)) <b>return</b>;
// <b>assert</b>(<b>exists</b>&lt;<a href="DiemAccount.md#0x1_DiemAccount_Balance">Balance</a>&lt;Token&gt;&gt;(payee), <a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_not_published">Errors::not_published</a>(<a href="DiemAccount.md#0x1_DiemAccount_EROLE_CANT_STORE_BALANCE">EROLE_CANT_STORE_BALANCE</a>));

// Check there is a payer
<b>if</b> (!<a href="DiemAccount.md#0x1_DiemAccount_exists_at">exists_at</a>(payer)) <b>return</b>;
// <b>assert</b>(<a href="DiemAccount.md#0x1_DiemAccount_exists_at">exists_at</a>(payer), <a href="../../../../../../move-stdlib/docs/Errors.md#0x1_Errors_not_published">Errors::not_published</a>(<a href="DiemAccount.md#0x1_DiemAccount_EACCOUNT">EACCOUNT</a>));

// Check the payer is in possession of withdraw token.
<b>if</b> (<a href="DiemAccount.md#0x1_DiemAccount_delegated_withdraw_capability">delegated_withdraw_capability</a>(payer)) <b>return</b>;

<b>let</b> (max_withdraw, withdrawal_allowed) = <a href="AccountLimits.md#0x1_AccountLimits_max_withdrawal">AccountLimits::max_withdrawal</a>&lt;Token&gt;(payer);
<b>if</b> (!withdrawal_allowed) <b>return</b>;

// VM can extract the withdraw token.
<b>let</b> account = borrow_global_mut&lt;<a href="DiemAccount.md#0x1_DiemAccount">DiemAccount</a>&gt;(payer);
<b>let</b> cap = <a href="../../../../../../move-stdlib/docs/Option.md#0x1_Option_extract">Option::extract</a>(&<b>mut</b> account.withdraw_capability);

<b>let</b> transfer_now =
<b>if</b> (max_withdraw &gt;= amount) {
amount
} <b>else</b> {
max_withdraw
};
<b>let</b> transfer_later = amount - transfer_now;
<b>if</b> (transfer_now &gt; 0) {
<a href="DiemAccount.md#0x1_DiemAccount_pay_from">pay_from</a>&lt;Token&gt;(
&cap,
payee,
transfer_now,
metadata,
metadata_signature
);
};

<b>if</b> (transfer_later &gt; 0) {
<a href="DiemAccount.md#0x1_DiemAccount_new_escrow">new_escrow</a>&lt;Token&gt;(vm, payer, payee, transfer_later);
};

<a href="DiemAccount.md#0x1_DiemAccount_restore_withdraw_capability">restore_withdraw_capability</a>(cap);
}
</code></pre>



</details>

<a name="0x1_DiemAccount_process_community_wallets"></a>
Expand Down Expand Up @@ -3583,6 +3509,7 @@ Creating an account at address 0x0 will abort as it is a reserved address for th
}
);

<a href="Receipts.md#0x1_Receipts_init">Receipts::init</a>(&new_account);
//////// 0L ////////
// NOTE: <b>if</b> all accounts are <b>to</b> be slow set this
// <a href="DiemAccount.md#0x1_DiemAccount_set_slow">set_slow</a>(&new_account);
Expand Down
2 changes: 1 addition & 1 deletion language/diem-framework/modules/doc/Globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ Get the constants for the current network

<b>if</b> (<a href="Testnet.md#0x1_StagingNet_is_staging_net">StagingNet::is_staging_net</a>()) {
<b>return</b> <a href="Globals.md#0x1_Globals_GlobalConstants">GlobalConstants</a> {
epoch_length: 60 * 20, // 20 mins, enough for a hard miner proof.
epoch_length: 60 * 40, // 20 mins, enough for a hard miner proof.
max_validators_per_set: 100,
subsidy_ceiling_gas: 8640000 * coin_scale,
vdf_difficulty: 5000000,
Expand Down
Loading