Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add draft for DIP 169: Multi-agent Transactions #159

Merged
merged 12 commits into from
May 15, 2021
Merged

Conversation

emmazzz
Copy link
Contributor

@emmazzz emmazzz commented Apr 6, 2021

This PR adds draft for DIP 169: muli-agent transactions.
Issue for discussion is here: #169

@emmazzz emmazzz marked this pull request as ready for review April 6, 2021 00:08
@emmazzz emmazzz changed the title Add draft for DIP 14 Add draft for DIP 14: Multi-agent Transactions Apr 6, 2021
Copy link
Contributor

@bob-wilson bob-wilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a few trivial suggestions (e.g., blank space before parenthesis) and also suggested a few spots where it might help to further clarify the description.

dips/dip-14.md Outdated Show resolved Hide resolved
dips/dip-14.md Outdated Show resolved Hide resolved
dips/dip-14.md Outdated Show resolved Hide resolved
dips/dip-14.md Outdated Show resolved Hide resolved
dips/dip-14.md Outdated Show resolved Hide resolved
dips/dip-14.md Outdated Show resolved Hide resolved
dips/dip-14.md Outdated Show resolved Hide resolved
dips/dip-14.md Outdated Show resolved Hide resolved
@emmazzz emmazzz changed the title Add draft for DIP 14: Multi-agent Transactions Add draft for DIP 169: Multi-agent Transactions Apr 21, 2021
dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated Show resolved Hide resolved

Previously each transaction can only have one signer, which is the sender of the transaction. In the multi-agent scheme, with the ability to have multiple signers, the transaction can potentially have multiple authenticators from different accounts and of different schemes. An `AccountAuthenticator` serves as the authenticator for one account. And a `TransactionAuthenticator` can contain multiple `AccountAuthenticator`s, as shown in the next subsection.

Notice that `AccountAuthenticator` has a multi-signature variant `MultiEd25519`. `MultiEd25519` is a signature scheme an account uses to generate signatures. This is different from multi-agent, which is a new type of transaction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that an account using MultiEd25519 can't be part of a MultiAgentTransaction?

I don't know much about which accounts use MultiEd25519, though. Is there a reference on that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. I think it would be useful to explain how to reconcile MultiAgent and MultiEd25519 if one is a sig scheme and another a txn scheme and why they are both variants of TransactionAuthenticator?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the difference is that MultiAgent does not require to combine signatures off-chain, and the combined signature is a single signature corresponding to a single account

Copy link
Contributor

@sblackshear sblackshear May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, the addition of the multi-agent feature wouldn't give an attacker any more DDOS power, but I think we will need to tweak the rules/code a bit to ensure that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A check has been added to allow no more than 32 signatures. DIP has also been updated to talk about this check in section Additional Checks During Transaction Validation.

@aching
Copy link
Contributor

aching commented May 3, 2021

This is really well written and thoughtful @emmazzz, thanks!

dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated Show resolved Hide resolved

Previously each transaction can only have one signer, which is the sender of the transaction. In the multi-agent scheme, with the ability to have multiple signers, the transaction can potentially have multiple authenticators from different accounts and of different schemes. An `AccountAuthenticator` serves as the authenticator for one account. And a `TransactionAuthenticator` can contain multiple `AccountAuthenticator`s, as shown in the next subsection.

Notice that `AccountAuthenticator` has a multi-signature variant `MultiEd25519`. `MultiEd25519` is a signature scheme an account uses to generate signatures. This is different from multi-agent, which is a new type of transaction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. I think it would be useful to explain how to reconcile MultiAgent and MultiEd25519 if one is a sig scheme and another a txn scheme and why they are both variants of TransactionAuthenticator?

dips/dip-169.md Outdated Show resolved Hide resolved
emmazzz and others added 2 commits May 5, 2021 15:12
Copy link
Contributor

@dahliamalkhi dahliamalkhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very cool proposal.

dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Show resolved Hide resolved
dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated
* Extensibility: In the current scheme, our dual attestation protocol is very specific to travel rule payments. And extending this protocol to dual attestation on a different type of action would require another ad-hoc data format and signature scheme. The multi-agent transaction scheme generalizes this by allowing dual attestation on any action encodable by a Move script without having to define new data formats or signature schemes.
* Security: Multi-agent scheme closes two security loopholes of our current protocol:
* Replayability: Since the payee only signs over the payer and the amount of the payment, today the payer can replay the transaction using old payee approvals. In the new scheme, this wouldn’t be possible since the payee has to sign over the sequence number of the transaction as well, disallowing any replay of the transaction.
* Currency: Today’s protocol does not let the payee commit to the currency type so the payer can reuse a payee approval for payment in one currency for payment in another with the same amount. Again, since the payee has to sign over the entire transaction including the currency type, this scenario would be impossible with the multi-agent scheme.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approval message does not contain the currency, so this is indeed also a problem with the current scheme.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated Show resolved Hide resolved

Previously each transaction can only have one signer, which is the sender of the transaction. In the multi-agent scheme, with the ability to have multiple signers, the transaction can potentially have multiple authenticators from different accounts and of different schemes. An `AccountAuthenticator` serves as the authenticator for one account. And a `TransactionAuthenticator` can contain multiple `AccountAuthenticator`s, as shown in the next subsection.

Notice that `AccountAuthenticator` has a multi-signature variant `MultiEd25519`. `MultiEd25519` is a signature scheme an account uses to generate signatures. This is different from multi-agent, which is a new type of transaction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the difference is that MultiAgent does not require to combine signatures off-chain, and the combined signature is a single signature corresponding to a single account




### Add a New Variant to `TransactionAuthenticator`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a New Variant or a new field?

Copy link
Contributor

@sblackshear sblackshear May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Variant" is the right technical term for one of the potential values of a sum type like TransactionAuthenticator.

dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated
## Terminology:

* Primary signer: This is the account that the transaction is sent from. This account’s sequence number is incremented, and is the account that pays gas. There is precisely one of these for every transaction.
* Secondary signer: This is any account that participates in a multi-agent transaction that isn’t the primary sender. There can be 0-N of these. The 0 case is a normal transaction today.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we put a max on N in the code? We do this for multisig and should probably do the same + specify it here. Perhaps we can use the same limit as multisig so that an attacker has the same number of "free" signature checks in each option?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't put a max on N here. Yes we should put a limit same as for multisig. Will work on that.

dips/dip-169.md Show resolved Hide resolved
dips/dip-169.md Outdated

* Extensibility: In the current scheme, our dual attestation protocol is very specific to travel rule payments. And extending this protocol to dual attestation on a different type of action would require another ad-hoc data format and signature scheme. The multi-agent transaction scheme generalizes this by allowing dual attestation on any action encodable by a Move script without having to define new data formats or signature schemes.
* Security: Multi-agent scheme closes two security loopholes of our current protocol:
* Replayability: Since the payee only signs over the payer and the amount of the payment, today the payer can replay the transaction using old payee approvals. In the new scheme, this wouldn’t be possible since the payee has to sign over the sequence number of the transaction as well, disallowing any replay of the transaction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no protection against this. The recipient does not sign the full transaction, only an (amount, sender_address, metdata) approval message. This approval message can be replayed an arbitrary number of times.

dips/dip-169.md Outdated
* Extensibility: In the current scheme, our dual attestation protocol is very specific to travel rule payments. And extending this protocol to dual attestation on a different type of action would require another ad-hoc data format and signature scheme. The multi-agent transaction scheme generalizes this by allowing dual attestation on any action encodable by a Move script without having to define new data formats or signature schemes.
* Security: Multi-agent scheme closes two security loopholes of our current protocol:
* Replayability: Since the payee only signs over the payer and the amount of the payment, today the payer can replay the transaction using old payee approvals. In the new scheme, this wouldn’t be possible since the payee has to sign over the sequence number of the transaction as well, disallowing any replay of the transaction.
* Currency: Today’s protocol does not let the payee commit to the currency type so the payer can reuse a payee approval for payment in one currency for payment in another with the same amount. Again, since the payee has to sign over the entire transaction including the currency type, this scenario would be impossible with the multi-agent scheme.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approval message does not contain the currency, so this is indeed also a problem with the current scheme.


Previously each transaction can only have one signer, which is the sender of the transaction. In the multi-agent scheme, with the ability to have multiple signers, the transaction can potentially have multiple authenticators from different accounts and of different schemes. An `AccountAuthenticator` serves as the authenticator for one account. And a `TransactionAuthenticator` can contain multiple `AccountAuthenticator`s, as shown in the next subsection.

Notice that `AccountAuthenticator` has a multi-signature variant `MultiEd25519`. `MultiEd25519` is a signature scheme an account uses to generate signatures. This is different from multi-agent, which is a new type of transaction.
Copy link
Contributor

@sblackshear sblackshear May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, the addition of the multi-agent feature wouldn't give an attacker any more DDOS power, but I think we will need to tweak the rules/code a bit to ensure that.

dips/dip-169.md Outdated Show resolved Hide resolved
dips/dip-169.md Outdated Show resolved Hide resolved



### Add a New Variant to `TransactionAuthenticator`
Copy link
Contributor

@sblackshear sblackshear May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Variant" is the right technical term for one of the potential values of a sum type like TransactionAuthenticator.

dips/dip-169.md Show resolved Hide resolved
@sblackshear
Copy link
Contributor

@emmazzz, one question for you: does multi-agent imply any changes to the "script signature requirements" here? I can update that DIP proposal if so.

emmazzz and others added 2 commits May 6, 2021 22:38
dips/dip-169.md Outdated

* Extensibility: In the current scheme, our dual attestation protocol is very specific to travel rule payments. And extending this protocol to dual attestation on a different type of action would require another ad-hoc data format and signature scheme. The multi-agent transaction scheme generalizes this by allowing dual attestation on any action encodable by a Move script without having to define new data formats or signature schemes.
* Security: Multi-agent scheme closes two security loopholes of our current protocol:
* Replayability: Since the payee only signs over the payer and the amount of the payment, today the payer can replay the transaction using old payee approvals. In the new scheme, this wouldn’t be possible since the payee has to sign over the sequence number of the transaction as well, disallowing any replay of the transaction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. This is not an issue with single-agent transactions, it is a problem with DIP-1 which could be fixed there, right? I would prefer to tone this down and mention the issue with DIP-1.

Here, how about:
The Multi-agent natively leads to robust and secure dual-attestation protocols, since both parties sign the entire transaction.

dips/dip-169.md Outdated
* Extensibility: In the current scheme, our dual attestation protocol is very specific to travel rule payments. And extending this protocol to dual attestation on a different type of action would require another ad-hoc data format and signature scheme. The multi-agent transaction scheme generalizes this by allowing dual attestation on any action encodable by a Move script without having to define new data formats or signature schemes.
* Security: Multi-agent scheme closes two security loopholes of our current protocol:
* Replayability: Since the payee only signs over the payer and the amount of the payment, today the payer can replay the transaction using old payee approvals. In the new scheme, this wouldn’t be possible since the payee has to sign over the sequence number of the transaction as well, disallowing any replay of the transaction.
* Currency: Today’s protocol does not let the payee commit to the currency type so the payer can reuse a payee approval for payment in one currency for payment in another with the same amount. Again, since the payee has to sign over the entire transaction including the currency type, this scenario would be impossible with the multi-agent scheme.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@emmazzz emmazzz requested a review from dahliamalkhi May 13, 2021 18:51
Copy link
Contributor

@dahliamalkhi dahliamalkhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aching aching merged commit 815ce5f into diem:main May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants