Skip to content

Commit

Permalink
[language] move diem-framework to diem/diem-move
Browse files Browse the repository at this point in the history
Closes: #9623
  • Loading branch information
vgao1996 authored and bors-libra committed Nov 3, 2021
1 parent 5e27240 commit 0cdde0d
Show file tree
Hide file tree
Showing 1,005 changed files with 265 additions and 257 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ build/

# Do not ignore the Move build output under the releases for DPN, core, and
# experimental -- these are the release code.
!language/diem-framework/DPN/releases/artifacts/**
!language/diem-framework/experimental/releases/artifacts/**
!diem-move/diem-framework/DPN/releases/artifacts/**
!diem-move/diem-framework/experimental/releases/artifacts/**

# Docker incremental build temporary files and directories
target-out-docker
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ members = [
"devtools/x-lint",
"diem-move/df-cli",
"diem-move/diem-events-fetcher",
"diem-move/diem-framework",
"diem-move/diem-framework/DPN/releases",
"diem-move/diem-framework/releases",
"diem-move/diem-keygen",
"diem-move/diem-resource-viewer",
"diem-move/diem-validator-interface",
Expand Down Expand Up @@ -82,9 +85,6 @@ members = [
"language/compiler/bytecode-source-map",
"language/compiler/ir-to-bytecode",
"language/compiler/ir-to-bytecode/syntax",
"language/diem-framework",
"language/diem-framework/DPN/releases",
"language/diem-framework/releases",
"language/diem-transaction-benchmarks",
"language/e2e-testsuite",
"language/ir-testsuite",
Expand Down Expand Up @@ -215,10 +215,10 @@ default-members = [
"client/assets-proof",
"client/faucet",
"client/swiss-knife",
"diem-move/diem-framework",
"execution/db-bootstrapper",
"execution/execution-correctness",
"language/compiler",
"language/diem-framework",
"language/move-analyzer",
"language/move-prover",
"language/move-prover/lab",
Expand Down
2 changes: 1 addition & 1 deletion api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ diem-mempool = { path = "../mempool", features = ["fuzzing"] }
diem-secure-storage = { path = "../secure/storage" }
diem-temppath = { path = "../common/temppath" }
diem-genesis-tool = {path = "../config/management/genesis", features = ["testing"] }
diem-framework-releases = { path = "../language/diem-framework/DPN/releases" }
diem-framework-releases = { path = "../diem-move/diem-framework/DPN/releases" }
diem-sdk = { path = "../sdk" }
vm-validator = { path = "../vm-validator" }
diem-vm = { path = "../diem-move/diem-vm" }
Expand Down
2 changes: 1 addition & 1 deletion config/management/genesis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ generate-key = { path = "../../generate-key" }
bcs = "0.1.2"
diem-config = { path = "../.."}
diem-crypto = { path = "../../../crypto/crypto" }
diem-framework-releases = { path = "../../../language/diem-framework/DPN/releases"}
diem-framework-releases = { path = "../../../diem-move/diem-framework/DPN/releases"}
diem-global-constants = { path = "../../global-constants" }
diem-management = { path = ".." }
diem-network-address-encryption = {path = "../network-address-encryption"}
Expand Down
8 changes: 4 additions & 4 deletions developers.diem.com/docs/basics/basics-accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ Creating a K-of-N multisig authentication key is similar to creating a single si

Every account on the DPN is created with at least two resources:

* [RoleId](https://github.com/diem/diem/blob/main/language/diem-framework/core/doc/Roles.md#resource-roleid), which grants the account a single, immutable [role](basics-accounts.md#account-roles) for [access control](https://github.com/diem/dip/blob/main/dips/dip-2.md).
* [DiemAccount](https://github.com/diem/diem/blob/main/language/diem-framework/core/doc/DiemAccount.md#resource-diemaccount), which holds the account’s [sequence number](../reference/glossary#sequence-number), authentication key, and event handles.
* [RoleId](https://github.com/diem/diem/blob/main/diem-move/diem-framework/core/doc/Roles.md#resource-roleid), which grants the account a single, immutable [role](basics-accounts.md#account-roles) for [access control](https://github.com/diem/dip/blob/main/dips/dip-2.md).
* [DiemAccount](https://github.com/diem/diem/blob/main/diem-move/diem-framework/core/doc/DiemAccount.md#resource-diemaccount), which holds the account’s [sequence number](../reference/glossary#sequence-number), authentication key, and event handles.

### Currencies

The DPN supports an account transacting in different currencies.

From a standards perspective, [`Diem<CoinType>`](https://github.com/diem/diem/blob/main/language/diem-framework/core/doc/Diem.md#resource-diem) is the Diem Blockchain equivalent of [ERC20](https://eips.ethereum.org/EIPS/eip-20). At the Move level, these are different generic instantiations of the same Diem resource type (e.g., `Diem<Coin1>`, `Diem<XUS>`).
From a standards perspective, [`Diem<CoinType>`](https://github.com/diem/diem/blob/main/diem-move/diem-framework/core/doc/Diem.md#resource-diem) is the Diem Blockchain equivalent of [ERC20](https://eips.ethereum.org/EIPS/eip-20). At the Move level, these are different generic instantiations of the same Diem resource type (e.g., `Diem<Coin1>`, `Diem<XUS>`).

`Diem<XUS>` will be the currency type available at launch.

### Balances

A zero balance of `Diem<CoinType>` is added whenever `Diem<CoinType>` currency is authorized for an account.

Each non-administrative account stores one or more [Balance`<CoinType>`](https://github.com/diem/diem/blob/main/language/diem-framework/core/doc/DiemAccount.md#resource-balance) resources. For each currency type that the account holds such as `Diem<Coin1>` or `Diem<XUS>`, there will be a separate Balance resource such as Balance`<Diem<Coin1>>` or Balance`<Diem<XUS>>`.
Each non-administrative account stores one or more [Balance`<CoinType>`](https://github.com/diem/diem/blob/main/diem-move/diem-framework/core/doc/DiemAccount.md#resource-balance) resources. For each currency type that the account holds such as `Diem<Coin1>` or `Diem<XUS>`, there will be a separate Balance resource such as Balance`<Diem<Coin1>>` or Balance`<Diem<XUS>>`.

When a client sends funds of type CoinType to an account, they should:
* check if the account address exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ If you are a Regulated VASP, and have been approved by Diem Networks as a partic

Once Diem Networks creates your ParentVASP account (let’s call it Account **A**), you can create a [ChildVASP account](../reference/glossary#childvasp-account) if you wish.

To create a ChildVASP account, send the [create_child_vasp_account](https://github.com/diem/diem/blob/main/language/diem-framework/script_documentation/script_documentation.md#script-create_child_vasp_account) transaction script from your **Account A** (your ParentVASP account).
To create a ChildVASP account, send the [create_child_vasp_account](https://github.com/diem/diem/blob/main/diem-move/diem-framework/script_documentation/script_documentation.md#script-create_child_vasp_account) transaction script from your **Account A** (your ParentVASP account).

With a single ParentVASP account, you can create up to 256 ChildVASP accounts. This transaction script allows you to specify:
* Which currency the new account should hold, or if it should hold all known currencies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ Once an account has been created, you can use different types of transactions to

## Create a recovery address account

If you are a Regulated VASP, you can designate one of your accounts as a recovery address account. The recovery address account should be a cold account (i.e., no transactions should be planned to be sent from that account). Use the recovery address account only for rotating the authentication key of an account that has registered itself with it and whose private key has been lost.
If you are a Regulated VASP, you can designate one of your accounts as a recovery address account. The recovery address account should be a cold account (i.e., no transactions should be planned to be sent from that account). Use the recovery address account only for rotating the authentication key of an account that has registered itself with it and whose private key has been lost.

For this example, let's call this account **R**. To create recovery address account **R**, send a [create_recovery_address](https://github.com/diem/diem/blob/main/language/diem-framework/script_documentation/script_documentation.md#function-create_recovery_address) transaction from account **R**.
For this example, let's call this account **R**. To create recovery address account **R**, send a [create_recovery_address](https://github.com/diem/diem/blob/main/diem-move/diem-framework/script_documentation/script_documentation.md#function-create_recovery_address) transaction from account **R**.

After the recovery address **R** has been created, other accounts that belong to the VASP can register themselves with R by sending a [add_recovery_rotation_capability](https://github.com/diem/diem/blob/main/language/diem-framework/script_documentation/script_documentation.md#function-add_recovery_rotation_capability) transaction and specifying the recovery address as **R**.
After the recovery address **R** has been created, other accounts that belong to the VASP can register themselves with R by sending a [add_recovery_rotation_capability](https://github.com/diem/diem/blob/main/diem-move/diem-framework/script_documentation/script_documentation.md#function-add_recovery_rotation_capability) transaction and specifying the recovery address as **R**.


## Rotate authentication key

If an account **A** wishes to update the authentication key needed to access it, it can do so by sending one of two transactions, depending on whether A has been registered with, or is, an account recovery address.

* If **A** has not registered itself with a recovery address, it can change its authentication key by sending a [rotate_authentication_key](https://github.com/diem/diem/blob/main/language/diem-framework/script_documentation/script_documentation.md#function-rotate_authentication_key) transaction with its new auth key.
* If **A** is part of a recovery address, then it can rotate its key by sending a [rotate_authentication_key_with_recovery_address](https://github.com/diem/diem/blob/main/language/diem-framework/script_documentation/script_documentation.md#function-rotate_authentication_key_with_recovery_address) transaction with its new authentication key, and itself as the `to_recover` address.
* If **A** has not registered itself with a recovery address, it can change its authentication key by sending a [rotate_authentication_key](https://github.com/diem/diem/blob/main/diem-move/diem-framework/script_documentation/script_documentation.md#function-rotate_authentication_key) transaction with its new auth key.
* If **A** is part of a recovery address, then it can rotate its key by sending a [rotate_authentication_key_with_recovery_address](https://github.com/diem/diem/blob/main/diem-move/diem-framework/script_documentation/script_documentation.md#function-rotate_authentication_key_with_recovery_address) transaction with its new authentication key, and itself as the `to_recover` address.


## Add a currency to an account
## Add a currency to an account

If an account **A** wants to hold a balance of Diem Coins in a currency **C** that it currently doesn’t hold, it can add a balance for **C** by sending an [add_currency_to_account](https://github.com/diem/diem/blob/main/language/diem-framework/script_documentation/script_documentation.md#0x1_AccountAdministrationScripts_add_currency_to_account) transaction specifying **C** as the currency, from **A**.
If an account **A** wants to hold a balance of Diem Coins in a currency **C** that it currently doesn’t hold, it can add a balance for **C** by sending an [add_currency_to_account](https://github.com/diem/diem/blob/main/diem-move/diem-framework/script_documentation/script_documentation.md#0x1_AccountAdministrationScripts_add_currency_to_account) transaction specifying **C** as the currency, from **A**.

It’s important to note that **C** must be a recognized currency on-chain, and **A** cannot hold a balance in **C** already; otherwise, this transaction will fail to execute.
It’s important to note that **C** must be a recognized currency on-chain, and **A** cannot hold a balance in **C** already; otherwise, this transaction will fail to execute.
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ title: "Send a payment"
slug: "txns-send-payment"
hidden: false
---
An account can send a payment to another account by sending a transaction.
An account can send a payment to another account by sending a transaction.

## Introduction

If an account **A** wishes to send a payment to another account **B,** it can do so by sending a [peer_to_peer_with_metadata](https://github.com/diem/diem/blob/main/language/diem-framework/script_documentation/script_documentation.md#script-peer_to_peer_with_metadata) script transaction.
If an account **A** wishes to send a payment to another account **B,** it can do so by sending a [peer_to_peer_with_metadata](https://github.com/diem/diem/blob/main/diem-move/diem-framework/script_documentation/script_documentation.md#script-peer_to_peer_with_metadata) script transaction.

When a payment is made, the sender must specify:
* The currency the payment is being made in
* The amount to send
* The account the payment is being made to, which in this example is account **B**.
* The account the payment is being made to, which in this example is account **B**.

When constructing a transaction, account **A** can also specify the metadata parameter. This parameter can be of any form as long as **A** and **B** agree on it, subject to certain rules specified in the agreement between a [Regulated VASP](../reference/glossary# and Diem Networks, and a `metadata_signature` used for dual attestation.

## Dual attestation

Every transaction sending payments between two distinct Regulated VASP accounts must perform dual attestation whenever the amount sent exceeds a certain threshold (which is currently $1,000) in order to comply with the Travel Rule.
Every transaction sending payments between two distinct Regulated VASP accounts must perform dual attestation whenever the amount sent exceeds a certain threshold (which is currently $1,000) in order to comply with the Travel Rule.

"Dual attestation" means the VASP sending the transaction (sending VASP) must send the VASP receiving (receiving VASP) the transaction certain data.
* This data is sent to the endpoint given by the recipient’s `base_url`.
* The receiving VASP performs checks on this data.
* Once the checks are completed, the receiving VASP then signs the data with the compliance private key that corresponds to their `compliance_public_key` held on-chain, and sends it back to the sending VASP.
"Dual attestation" means the VASP sending the transaction (sending VASP) must send the VASP receiving (receiving VASP) the transaction certain data.
* This data is sent to the endpoint given by the recipient’s `base_url`.
* The receiving VASP performs checks on this data.
* Once the checks are completed, the receiving VASP then signs the data with the compliance private key that corresponds to their `compliance_public_key` held on-chain, and sends it back to the sending VASP.
* The sending VASP must then include this signed data in the payment transaction and the signature will be checked on-chain.

### Update dual attestation information

If a Regulated VASP wishes to update their `base_url` or `compliance_public_key`, it can do so by sending a [rotate_dual_attestation_info](https://github.com/diem/diem/blob/main/language/diem-framework/script_documentation/script_documentation.md#script-rotate_dual_attestation_info) transaction. The Regulated VASP has to send this transaction from their ParentVASP account (this is the account that holds dual attestation data). For example, if a Regulated VASP wishes to change the private key they use to sign metadata for dual attestation, they can send this transaction to do so.
If a Regulated VASP wishes to update their `base_url` or `compliance_public_key`, it can do so by sending a [rotate_dual_attestation_info](https://github.com/diem/diem/blob/main/diem-move/diem-framework/script_documentation/script_documentation.md#script-rotate_dual_attestation_info) transaction. The Regulated VASP has to send this transaction from their ParentVASP account (this is the account that holds dual attestation data). For example, if a Regulated VASP wishes to change the private key they use to sign metadata for dual attestation, they can send this transaction to do so.

Once this transaction is executed, all transactions subject to dual attestation will be checked using the new `compliance_public_key`. Because of this, Regulated VASPs should be careful to communicate this change and ensure that there are no outstanding payment transactions that they have previously signed but that have not yet been committed on-chain, since these will be rejected if the `compliance_public_key` has changed.
Once this transaction is executed, all transactions subject to dual attestation will be checked using the new `compliance_public_key`. Because of this, Regulated VASPs should be careful to communicate this change and ensure that there are no outstanding payment transactions that they have previously signed but that have not yet been committed on-chain, since these will be rejected if the `compliance_public_key` has changed.
Loading

0 comments on commit 0cdde0d

Please sign in to comment.