Skip to content

Commit

Permalink
delete Refund
Browse files Browse the repository at this point in the history
  • Loading branch information
CapCap authored and aptos-bot committed Mar 13, 2022
1 parent 8d46830 commit 9bb6320
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 90 deletions.
8 changes: 0 additions & 8 deletions documentation/specifications/transactions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ When a transaction is submitted to the blockchain it is evaluated many times bot

Users do not have direct ability to send and receive payments on the Diem network and must do so through VASPs. One method to do so, is to store potentially personally identifiable information in a transaction metadata, Diem also supports an off-chain framework that can negotiate one-time use transaction identifiers called `reference_id`s. The off-chain framework is also used by support travel rule compliance.

### Refunds

Diem defines refunds as part of the transaction framework. The refund includes a pointer to the transaction that is being refunded and the reason for the refund, for example, an errant transaction to a non-existent destination as well as user-driven refunds. However, use of the refund type is optional.

## Common Flows

### Transfer with Subaddresses
Expand All @@ -47,10 +43,6 @@ In the case that Bob would send Alice an amount that exceeds the travel rule lim
* Upon successful completion of the exchange, Alice and Bob's VASP would have agreed on a `reference_id` and Alice's VASP would have provided a signature for the transaction metadata that Bob's VASP will submit to the chain
* Bob's VASP will submit a transaction metadata that contains the `reference_id` instead of the subaddresses

### Refunds

There are two cases for refunds, those initiated by the recipient and those that have no valid recipient. In practice, those initiated by a recipient can be sent back as a transfer to the originating VASP and subaddress. Diem also provides for native refunds that contain a reason for the refund, so that VASPs need not speculate or confer off-chain on the reason why funds were returned, e.g., a purchase refund or an invalid subaddress.

## Transactions Overview

The rest of this specification contains the following components:
Expand Down
28 changes: 0 additions & 28 deletions documentation/specifications/transactions/onchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,6 @@ Lifetime of subaddresses:

Subaddresses should be used with great care to not accidentally leak personally identifiable information (PII). However, implementors must be mindful of the permissive nature of subaddresses as outlined in this specification.

## Refunds Using RefundMetadata

```
enum RefundMetadata {
RefundMetadataV0(Refund),
}
struct Refund {
transaction_version: u64,
reason: RefundReason,
}
enum RefundReason {
OtherReason = 0,
InvalidSubaddress = 1,
UserInitiatedPartialRefund = 2,
UserInitiatedFullRefund = 3,
InvalidReferenceId = 4,
}
```

Diem supports refund transactions, as defined in [DIP-4](https://dip.aptoslabs.com/dip-4/). The refund includes the `transaction_version`, a globally unique value, for the transaction that is being refunded as well as the reason for the refund. For example, an errant transaction to a non-existent destination as well as user-driven refunds. However, use of the refund type is optional.

Participants can be configured to automatically refund invalid transactions but in order to prevent ping-pong or recursive refunds, only a single transaction should be sent per peer per transaction stream. That is if a payment is followed by a invalid refund no follow up refund should be issued. Instead this should be surfaced to directly to the other party as this is an implementation bug.

All other transactions, may use the refund transaction but are not strictly required to do so. Usage of the refund transaction, however, makes it clear what is a refund and the intent or reason for it.

## Dual Attestation Credentials

Diem defines a [DualAttestation::Credential](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/core/sources/DualAttestation.move) resource to support off-chain protocols. This resource contains the `human_name`, `base_url`, and `compliance_public_key` for a VASP. The `base_url` specifies where the VASP hosts its off-chain API and the `compliance_public_key` is used to verify signed transaction metadata and establish authentication in off-chain communication. The values can be set and updated via the [rotate_dual_attestation_info](https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/transaction_scripts/rotate_dual_attestation_info.move) script.
2 changes: 0 additions & 2 deletions testsuite/generate-format/src/aptos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ pub fn get_registry() -> Result<Registry> {
tracer.trace_type::<language_storage::TypeTag>(&samples)?;
tracer.trace_type::<transaction::metadata::Metadata>(&samples)?;
tracer.trace_type::<transaction::metadata::GeneralMetadata>(&samples)?;
tracer.trace_type::<transaction::metadata::RefundMetadata>(&samples)?;
tracer.trace_type::<transaction::metadata::RefundReason>(&samples)?;
tracer.trace_type::<transaction::Transaction>(&samples)?;
tracer.trace_type::<transaction::TransactionArgument>(&samples)?;
tracer.trace_type::<transaction::VecBytes>(&samples)?;
Expand Down
27 changes: 0 additions & 27 deletions testsuite/generate-format/tests/staged/aptos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ Metadata:
UnstructuredBytesMetadata:
NEWTYPE:
TYPENAME: UnstructuredBytesMetadata
3:
RefundMetadata:
NEWTYPE:
TYPENAME: RefundMetadata
Module:
STRUCT:
- code: BYTES
Expand Down Expand Up @@ -130,29 +126,6 @@ RawTransaction:
- expiration_timestamp_secs: U64
- chain_id:
TYPENAME: ChainId
RefundMetadata:
ENUM:
0:
RefundMetadataV0:
NEWTYPE:
TYPENAME: RefundMetadataV0
RefundMetadataV0:
STRUCT:
- transaction_version: U64
- reason:
TYPENAME: RefundReason
RefundReason:
ENUM:
0:
OtherReason: UNIT
1:
InvalidSubaddress: UNIT
2:
UserInitiatedPartialRefund: UNIT
3:
UserInitiatedFullRefund: UNIT
4:
InvalidReferenceId: UNIT
Script:
STRUCT:
- code: BYTES
Expand Down
25 changes: 0 additions & 25 deletions types/src/transaction/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub enum Metadata {
Undefined,
GeneralMetadata(GeneralMetadata),
UnstructuredBytesMetadata(UnstructuredBytesMetadata),
RefundMetadata(RefundMetadata),
}

/// List of supported transaction metadata format versions for regular
Expand Down Expand Up @@ -75,27 +74,3 @@ pub struct UnstructuredBytesMetadata {
#[serde(with = "serde_bytes")]
pub metadata: Option<Vec<u8>>,
}

/// List of supported transaction metadata format versions for refund transaction
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum RefundMetadata {
RefundMetadataV0(RefundMetadataV0),
}

/// Transaction metadata format for transactions subject to refund transaction
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct RefundMetadataV0 {
/// Transaction version that is refunded
pub transaction_version: u64,
/// The reason of the refund
pub reason: RefundReason,
}

#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum RefundReason {
OtherReason,
InvalidSubaddress,
UserInitiatedPartialRefund,
UserInitiatedFullRefund,
InvalidReferenceId,
}

0 comments on commit 9bb6320

Please sign in to comment.