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

Allow transactions to explicitly specify mutual exclusion. #349

Merged
merged 7 commits into from Sep 25, 2019

Conversation

@derbear
Copy link
Collaborator

derbear commented Sep 24, 2019

It is oftentimes nice to leave the fee field unconstrained (but capped at some
max value) so that a transaction submitter can later pick a fee appropriately at
submission time. However, for contracts that don't close accounts, this leaves
the possibility of replay open.

This commit adds a new msgpack field, "lock" (called Excludes in the
implementation), which allows transactions to specify that they are mutually
exclusive with other transactions. If this field is nonzero in a transaction,
then once the transaction is confirmed, it acquires the lock identified by
the (Sender, Excludes) pair of the transaction until the LastValid round passes.
While this transaction possesses the lock, no other transaction specifying this
lock can be confirmed.

This PR implements #337 and corresponds to the spec PR algorandfoundation/specs#11.

Test Plan

A new unit test was added to ledger_test.go.

It is oftentimes nice to leave the fee field unconstrained (but capped at some
max value) so that a transaction submitter can later pick a fee appropriately at
submission time.  However, for contracts that don't close accounts, this leaves
the possibility of replay open.

This commit adds a new msgpack field, "lock" (called Excludes in the
implementation), which allows transactions to specify that they are mutually
exclusive with other transactions.  If this field is nonzero in a transaction,
then once the transaction is confirmed, it acquires the lock identified by
the (Sender, Excludes) pair of the transaction until the LastValid round passes.
While this transaction possesses the lock, no other transaction specifying this
lock can be confirmed.
@derbear derbear marked this pull request as ready for review Sep 24, 2019
Copy link
Contributor

tsachiherman left a comment

Code looks good to me. I wish you could add few more functional test that demonstrate that the feature truly works.

@derbear derbear dismissed stale reviews from tsachiherman and zeldovich via c291a84 Sep 25, 2019
@derbear derbear requested review from zeldovich and tsachiherman Sep 25, 2019
@derbear

This comment has been minimized.

Copy link
Collaborator Author

derbear commented Sep 25, 2019

@tsachiherman I think I'll add goal bindings and end-to-end tests later after merging--will optimistically merge first, for now, so that I can start using this in TEAL contracts. I'll open up a couple of issues for this.

@derbear derbear merged commit dad58c7 into algorand:master Sep 25, 2019
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
Details
license/cla Contributor License Agreement is signed.
Details
@derbear derbear deleted the derbear:tx-mutex branch Sep 25, 2019
@derbear

This comment has been minimized.

Copy link
Collaborator Author

derbear commented Sep 25, 2019

Issue created at #352 for bindings and end-to-end tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.