From f54fc4311866816d3505a82e322a0f9047d214eb Mon Sep 17 00:00:00 2001 From: Hendrik Hofstadt Date: Mon, 10 Aug 2020 08:48:25 +0200 Subject: [PATCH] update claimed vaa doc --- docs/solana_program.md | 26 +++++++++----------------- solana/bridge/src/instruction.rs | 4 ++-- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/docs/solana_program.md b/docs/solana_program.md index 10beed3f..ddf8da67 100644 --- a/docs/solana_program.md +++ b/docs/solana_program.md @@ -63,16 +63,16 @@ Deletes a `proposal` after the `VAA_EXPIRATION_TIME` to free up space on chain. | 2 | bridge | BridgeConfig | | | | | | 3 | proposal | TransferOutProposal | | ✅ | | ✅ | -#### EvictExecutedVAA +#### EvictClaimedVAA -Deletes a `ExecutedVAA` after the `VAA_EXPIRATION_TIME` to free up space on chain. This returns the rent to `guardian`. +Deletes a `ClaimedVAA` after the `VAA_EXPIRATION_TIME` to free up space on chain. This returns the rent to `guardian`. | Index | Name | Type | signer | writeable | empty | derived | | ----- | -------- | ------------------- | ------ | --------- | ----- | ------- | | 0 | guardian | Account | ✅ | | | | | 1 | clock | Sysvar | | | ️ | ✅ | | 2 | bridge | BridgeConfig | | | | | -| 3 | proposal | ExecutedVAA | | ✅ | | ✅ | +| 3 | claim | ClaimedVAA | | ✅ | | ✅ | #### CreateWrappedAsset @@ -152,15 +152,17 @@ This account tracks the configuration of the transfer bridge. The program own the following types of accounts: -#### _ExecutedVAA_ Account +#### _ClaimedVAA_ Account -> Seed derivation: `executedvaa_` +> Seed derivation: `claim || || ` > -> **vaa_hash**: Hash of the VAA +> **bridge**: Pubkey of the bridge +> +> **hash**: signing hash of the VAA This account is created when a VAA is executed/consumed on Solana (i.e. not when a TransferOutProposal is approved). It tracks a used VAA to protect from replay attacks where a VAA is executed multiple times. This account stays active -until the `VAA_EXPIRATION_TIME` has passed and can then be evicted using `IEvictExecutedVAA`. +until the `VAA_EXPIRATION_TIME` has passed and can then be evicted using `IEvictClaimedVAA`. #### _GuardianSet_ Account @@ -234,13 +236,3 @@ This account tracks the metadata about a wrapped asset to allow reverse lookups. This account is an instance of `spl-token/TokenAccount` and holds spl tokens in custody that have been transferred to a foreign chain. - -#### _ClaimedVAA_ Account - -> Seed derivation: `claim || || ` -> -> **bridge**: Pubkey of the bridge -> -> **hash**: signing hash of the VAA - -This account tracks a claimed VAA to prevent replay attacks. diff --git a/solana/bridge/src/instruction.rs b/solana/bridge/src/instruction.rs index df99e3c4..53fe0bcc 100644 --- a/solana/bridge/src/instruction.rs +++ b/solana/bridge/src/instruction.rs @@ -103,7 +103,7 @@ pub enum BridgeInstruction { /// Deletes a `ExecutedVAA` after the `VAA_EXPIRATION_TIME` is over to free up space on chain. /// This returns the rent to the sender. - EvictExecutedVAA(), + EvictClaimedVAA(), /// Creates a new wrapped asset CreateWrapped(AssetMeta), @@ -171,7 +171,7 @@ impl BridgeInstruction { Self::EvictTransferOut() => { output[0] = 3; } - Self::EvictExecutedVAA() => { + Self::EvictClaimedVAA() => { output[0] = 4; } Self::CreateWrapped(meta) => {