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

Batched Transactions #8

Merged
merged 11 commits into from
Sep 16, 2019
Merged

Batched Transactions #8

merged 11 commits into from
Sep 16, 2019

Conversation

evgenykuzyakov
Copy link
Contributor

@evgenykuzyakov evgenykuzyakov commented Jul 24, 2019

Ready for review. I'll start implementing it in a meantime.

text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
Co-Authored-By: Maksym Zavershynskyi <35039879+nearmax@users.noreply.github.com>
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
text/0000-transaction-refactoring.md Outdated Show resolved Hide resolved
@evgenykuzyakov evgenykuzyakov changed the title [WIP] Batched Transactions Batched Transactions Jul 29, 2019
@ilblackdragon ilblackdragon mentioned this pull request Jul 30, 2019
6 tasks
@evgenykuzyakov
Copy link
Contributor Author

Implementation branch in progress: https://github.com/nearprotocol/nearcore/tree/batched-tx-1

@DanielRX
Copy link

DanielRX commented Aug 1, 2019

Something I noticed with this, does this not violate some basic logical cases?

If I can run tx1, tx2, tx3 and tx4 as a batch, it should be possible to run them all on their own, in sequence (assuming no txs interrupt them)? This will not hold for batched transactions, since if tx1 is a deleteKey op, tx2 could then fail?

If I add a key in tx1 and perform tx2 which needs the key to work, would this be valid? If so, the addKey must be changing the state, but the deleteKey is not.

@k06a
Copy link
Contributor

k06a commented Sep 3, 2019

Wish wallet to use this kind of transaction after bunch of transactions were "staked/collected" instead of "signed and sent". So wallet should allow grouping even for dapps that not initially support it.

@evgenykuzyakov
Copy link
Contributor Author

@DanielRX

So we actually batching actions instead of transactions. The batched actions form a transaction which is signed. Once the transaction is authorized (e.g. with a full access key), all actions are executed and they don't require public key to be present. So the first action can be delete the access key and the 2nd action is something else, e.g. a function call.

This is done to support operations like deploy+migrate_call, or deploy+init.

@k06a
All Batched Actions are from one signer to one receiver. It's not always makes sense to batch actions, e.g. 2 function calls might need to go in a parallel or fail independently

@k06a
Copy link
Contributor

k06a commented Sep 3, 2019

@evgenykuzyakov but we need at least cover approve+transferFrom ERC20 flow. Approve should be called on token smart contract and second tx should be to receiver, which will internally make transferFrom call.

@evgenykuzyakov
Copy link
Contributor Author

@k06a As we discussed in other channel, it should be done with something like approveThen, which approves and locks the token for contract_x, then calls given method on contract_x with a callback on itself to unlock a token if the contract_x doesn't act.

@k06a
Copy link
Contributor

k06a commented Sep 4, 2019

@evgenykuzyakov, hope both calls will be performed from account, not from token smart contract. Else this would behave like ERC827.

@evgenykuzyakov
Copy link
Contributor Author

Ready to be merged

@k06a
Copy link
Contributor

k06a commented Sep 14, 2019

@evgenykuzyakov can you point to the locks implementation example?

@evgenykuzyakov
Copy link
Contributor Author

@k06a I think locks are for the different NEP.

@evgenykuzyakov evgenykuzyakov merged commit 9e6a038 into master Sep 16, 2019
@evgenykuzyakov evgenykuzyakov deleted the transaction-refactoring branch September 16, 2019 22:41
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.

5 participants