Skip to content

Commit

Permalink
WIP layered accounts
Browse files Browse the repository at this point in the history
[WIP] Updating frameworks

[WIP] Layering prologues/epilogues

[WIP] prologue layering with chain-specific account info

Closes: #10017
  • Loading branch information
Tim Zakian authored and bors-libra committed Jan 5, 2022
1 parent 0fa566c commit ebca3d5
Show file tree
Hide file tree
Showing 681 changed files with 10,005 additions and 57,702 deletions.
5 changes: 3 additions & 2 deletions api/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,12 @@ impl Account {
}

pub fn account(self) -> Result<impl Reply, Error> {
let account: AccountData = self
.account_state()?
let account_state = self.account_state()?;
let account: AccountData = account_state
.get_account_resource()?
.ok_or_else(|| self.resource_not_found(&AccountResource::struct_tag()))?
.into();

Response::new(self.latest_ledger_info, &account)
}

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion diem-move/diem-events-fetcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl DiemEventsFetcher {
account: AccountAddress,
) -> Result<Option<(EventHandle, EventHandle)>> {
match self.get_account_state(account).await? {
Some(account_state) => Ok(account_state.get_account_resource()?.map(|resource| {
Some(account_state) => Ok(account_state.get_diem_account_resource()?.map(|resource| {
(
resource.sent_events().clone(),
resource.received_events().clone(),
Expand Down
10 changes: 9 additions & 1 deletion diem-move/diem-framework/DPN/Move.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
name = "DPNFramework"
version = "1.5.0"

[addresses]
Std = "0x1"
DiemFramework = "0x1"
DiemRoot = "0xA550C18"
TreasuryCompliance = "0xB1E55ED"
CurrencyInfo = "0xA550C18"
VMReserved = "0x0"

[dependencies]
DiemCoreFramework = { local = "../core" }
MoveStdlib = { local = "../../../language/move-stdlib" }
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
compiled_package_info:
package_name: DPNFramework
address_alias_instantiation:
CoreFramework: "00000000000000000000000000000001"
CurrencyInfo: 0000000000000000000000000a550c18
DiemFramework: "00000000000000000000000000000001"
DiemRoot: 0000000000000000000000000a550c18
Expand Down Expand Up @@ -166,7 +165,7 @@ compiled_package_info:
? address: "00000000000000000000000000000001"
name: XUS
: DiemFramework
source_digest: 7DA6FB50576D6D1C277228DD430480010DCE130D7E1F2CFDC35AF0135D8E4F06
source_digest: E694069728C7C632DF6E917D1CB6CD108C696B90EC9BB22798FAEAB81CE4922F
build_flags:
dev_mode: false
test_mode: false
Expand All @@ -177,4 +176,3 @@ compiled_package_info:
additional_named_addresses: {}
dependencies:
- MoveStdlib
- DiemCoreFramework
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ already have a <code><a href="DiemAccount.md#0x1_DiemAccount_Balance">DiemAccoun

<pre><code><b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_TransactionChecks">DiemAccount::TransactionChecks</a>{sender: account};
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_AddCurrencyAbortsIf">DiemAccount::AddCurrencyAbortsIf</a>&lt;Currency&gt;;
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_AddCurrencyEnsures">DiemAccount::AddCurrencyEnsures</a>&lt;Currency&gt;{addr: <a href="../../../../../../../experimental/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account)};
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_AddCurrencyEnsures">DiemAccount::AddCurrencyEnsures</a>&lt;Currency&gt;{addr: <a href="../../../../../../../DPN/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account)};
<b>aborts_with</b> [check]
Errors::NOT_PUBLISHED,
Errors::INVALID_ARGUMENT,
Expand Down Expand Up @@ -289,7 +289,7 @@ resource stored under the account at <code>recovery_address</code>.
<pre><code><b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_TransactionChecks">DiemAccount::TransactionChecks</a>{sender: to_recover_account};
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_ExtractKeyRotationCapabilityAbortsIf">DiemAccount::ExtractKeyRotationCapabilityAbortsIf</a>{account: to_recover_account};
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_ExtractKeyRotationCapabilityEnsures">DiemAccount::ExtractKeyRotationCapabilityEnsures</a>{account: to_recover_account};
<b>let</b> addr = <a href="../../../../../../../experimental/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(to_recover_account);
<b>let</b> addr = <a href="../../../../../../../DPN/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(to_recover_account);
<b>let</b> rotation_cap = <a href="DiemAccount.md#0x1_DiemAccount_spec_get_key_rotation_cap">DiemAccount::spec_get_key_rotation_cap</a>(addr);
<b>include</b> <a href="RecoveryAddress.md#0x1_RecoveryAddress_AddRotationCapabilityAbortsIf">RecoveryAddress::AddRotationCapabilityAbortsIf</a>{
to_recover: rotation_cap
Expand Down Expand Up @@ -473,7 +473,7 @@ and <code>account</code> must not have previously delegated its <code><a href="D


<pre><code><b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_TransactionChecks">DiemAccount::TransactionChecks</a>{sender: account};
<b>let</b> account_addr = <a href="../../../../../../../experimental/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>let</b> account_addr = <a href="../../../../../../../DPN/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_ExtractKeyRotationCapabilityAbortsIf">DiemAccount::ExtractKeyRotationCapabilityAbortsIf</a>;
<b>let</b> key_rotation_capability = <a href="DiemAccount.md#0x1_DiemAccount_spec_get_key_rotation_cap">DiemAccount::spec_get_key_rotation_cap</a>(account_addr);
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_RotateAuthenticationKeyAbortsIf">DiemAccount::RotateAuthenticationKeyAbortsIf</a>{cap: key_rotation_capability, new_authentication_key: new_key};
Expand Down Expand Up @@ -587,7 +587,7 @@ and <code>account</code> must not have previously delegated its <code><a href="D


<pre><code><b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_TransactionChecks">DiemAccount::TransactionChecks</a>{sender: account};
<b>let</b> account_addr = <a href="../../../../../../../experimental/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>let</b> account_addr = <a href="../../../../../../../DPN/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>include</b> <a href="SlidingNonce.md#0x1_SlidingNonce_RecordNonceAbortsIf">SlidingNonce::RecordNonceAbortsIf</a>{ seq_nonce: sliding_nonce };
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_ExtractKeyRotationCapabilityAbortsIf">DiemAccount::ExtractKeyRotationCapabilityAbortsIf</a>;
<b>let</b> key_rotation_capability = <a href="DiemAccount.md#0x1_DiemAccount_spec_get_key_rotation_cap">DiemAccount::spec_get_key_rotation_cap</a>(account_addr);
Expand Down Expand Up @@ -703,7 +703,7 @@ and <code>account</code> must not have previously delegated its <code><a href="D


<pre><code><b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_TransactionChecks">DiemAccount::TransactionChecks</a>{sender: account};
<b>let</b> account_addr = <a href="../../../../../../../experimental/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>let</b> account_addr = <a href="../../../../../../../DPN/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>include</b> <a href="SlidingNonce.md#0x1_SlidingNonce_RecordNonceAbortsIf">SlidingNonce::RecordNonceAbortsIf</a>{ account: dr_account, seq_nonce: sliding_nonce };
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_ExtractKeyRotationCapabilityAbortsIf">DiemAccount::ExtractKeyRotationCapabilityAbortsIf</a>;
<b>let</b> key_rotation_capability = <a href="DiemAccount.md#0x1_DiemAccount_spec_get_key_rotation_cap">DiemAccount::spec_get_key_rotation_cap</a>(account_addr);
Expand Down Expand Up @@ -844,7 +844,7 @@ the address to recover. The address of the transaction signer has to be either
the delegatee's address or the address to recover [[H18]][PERMISSION][[J18]][PERMISSION].


<pre><code><b>let</b> account_addr = <a href="../../../../../../../experimental/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<pre><code><b>let</b> account_addr = <a href="../../../../../../../DPN/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>aborts_if</b> !<a href="RecoveryAddress.md#0x1_RecoveryAddress_spec_holds_key_rotation_cap_for">RecoveryAddress::spec_holds_key_rotation_cap_for</a>(recovery_address, to_recover) <b>with</b> Errors::INVALID_ARGUMENT;
<b>aborts_if</b> !(account_addr == recovery_address || account_addr == to_recover) <b>with</b> Errors::INVALID_ARGUMENT;
</code></pre>
Expand Down Expand Up @@ -961,7 +961,7 @@ Only the account having Credential can rotate the info.
Credential is granted to either a Parent VASP or a designated dealer [[H17]][PERMISSION].


<pre><code><b>include</b> <a href="DualAttestation.md#0x1_DualAttestation_AbortsIfNoCredential">DualAttestation::AbortsIfNoCredential</a>{addr: <a href="../../../../../../../experimental/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account)};
<pre><code><b>include</b> <a href="DualAttestation.md#0x1_DualAttestation_AbortsIfNoCredential">DualAttestation::AbortsIfNoCredential</a>{addr: <a href="../../../../../../../DPN/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account)};
</code></pre>


Expand Down Expand Up @@ -1137,7 +1137,7 @@ may be used as a recovery account for those accounts.
<pre><code><b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_TransactionChecks">DiemAccount::TransactionChecks</a>{sender: account};
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_ExtractKeyRotationCapabilityAbortsIf">DiemAccount::ExtractKeyRotationCapabilityAbortsIf</a>;
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_ExtractKeyRotationCapabilityEnsures">DiemAccount::ExtractKeyRotationCapabilityEnsures</a>;
<b>let</b> account_addr = <a href="../../../../../../../experimental/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>let</b> account_addr = <a href="../../../../../../../DPN/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>let</b> rotation_cap = <a href="DiemAccount.md#0x1_DiemAccount_spec_get_key_rotation_cap">DiemAccount::spec_get_key_rotation_cap</a>(account_addr);
<b>include</b> <a href="RecoveryAddress.md#0x1_RecoveryAddress_PublishAbortsIf">RecoveryAddress::PublishAbortsIf</a>{
recovery_account: account,
Expand Down Expand Up @@ -1220,7 +1220,7 @@ of VASPDomain, and will be empty on at the end of processing this transaction.



<pre><code><b>let</b> vasp_addr = <a href="../../../../../../../experimental/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<pre><code><b>let</b> vasp_addr = <a href="../../../../../../../DPN/releases/artifacts/current/build/MoveStdlib/docs/Signer.md#0x1_Signer_address_of">Signer::address_of</a>(account);
<b>include</b> <a href="DiemAccount.md#0x1_DiemAccount_TransactionChecks">DiemAccount::TransactionChecks</a>{sender: account};
<b>include</b> <a href="Roles.md#0x1_Roles_AbortsIfNotParentVasp">Roles::AbortsIfNotParentVasp</a>;
<b>include</b> <a href="VASPDomain.md#0x1_VASPDomain_PublishVASPDomainsAbortsIf">VASPDomain::PublishVASPDomainsAbortsIf</a> { vasp_addr };
Expand Down
Loading

0 comments on commit ebca3d5

Please sign in to comment.