Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
CPS-0004? | Spending Script Redundant Execution #418
CPS-0004? | Spending Script Redundant Execution #418
Changes from 29 commits
5504768
803e0bf
3a04f25
f4a519f
d632850
7816bf8
823fb16
c8d916d
7b142f8
e4010db
acd3162
9ffb99e
57235ea
3f9cb9d
59135d2
9939892
0fd5b1a
60be8b5
068bbd8
cd657fd
6a7f67a
40b37c4
fd604a3
f9cc61c
808c528
0618887
b4946f2
6571789
64f1061
7f9f238
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's clearer to say that they don't depend on any details of which UTXO is being spent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fallen-icarus what technique can be used already to minimise this drawback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matiwinnetou The Current Alternative lays it out. In a nut shell, since you can make a plutus staking script execute only once for a given transaction, you off-load the heavy computation to that script. Then the spending plutus script just checks if the staking script was executed in the tx.
The idea is similar to what is being discussed in #309.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean "script context"? The script context does change, in that it contains information about which script is executing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I specifically mean the
TxInfo
part of theScriptContext
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure you've quite argued that it's a significant handicap :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the explanation for why this works is wrong. Staking scripts do get information about what script is running and do get redeemers.
The reason this works is because you get all your spending scripts to coordinate on delegating to a single other script execution. You could do exactly this trick with another spending script: spend an additional UTXO locked with a script that does the "real work", and have all the other UTXO spending scripts just assert that that script is being spent in the transaction. Same effect!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your reason does not account for everything in the actual implementation. Using another spending script was discussed here. It is not a viable solution because it creates a bottleneck problem: you are only as concurrent as the number of utxos available at the spending script being delegated to. This bottleneck problem does not exist for staking scripts since no utxos are needed to force execution of the script.
Edit: wrong comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said here, I do not believe having a redeemer or info about what script is running is an issue. In fact, I think removing access about which script is currently running is a major problem because it is a major part of securing certain dapp designs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is not that it's a workaround, my point is that your explanation for why it works is wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's quite likely that it does affect them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see a lot more detail here, of the level that there is for the swap example. At the moment it looks to me like there is one convincing usecase, which isn't much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be fair to ask for a more detailed explanation of the P2P Atomic Swaps use case? This may be naïve (and I'm not technically capable of joining the debate of the proposal particulars) but if a treatment of this issue is helpful in implementing atomic swaps on Cardano, then I believe this use case should be covered in detail in the document... to progress this CPS and any CIP that facilitates that treatment.
I'm trying to get more reviewers based on interest in the Atomic Swap idea as you've described it on GitHub. If in agreement with what I've said above, I also think this repository should be linked from the CPS itself. Here is what I posted about fallen-icarus/cardano-swaps (please correct me if I've described the issue inaccurately or naïvely) in the Cardano MBO on Matrix:
https://matrix.to/#/!QvtUklhUfmEuCBIexz:matrix.org/$lU0OwYOAQXpNYVFJl1I33YPhhQ_wH14Jzu5etQP9Drk?via=matrix.adamantium.online&via=matrix.org&via=forum.balanceanalytics.io
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fully intend to do this. However, I believe these redundant executions impact all distributed dapp designs, not just atomic swaps. In addition to this, I think people are underestimating the usefulness of atomic swaps; I believe you can slightly alter the logic from cardano-swaps to create a distributed p2p lending protocol. To prove it, I am currently working on a p2p lending proof-of-concept that does this. I have already finished the on-chain code for it; I just need to finish the helper cli program and the documentation. I hope to be done with it within a week or two. After that, I have an idea of how to create a distributed DAO where users maintain custody and delegation control while still enabling the DAO to spend funds from user wallets when certain conditions are met (such as a multisig). Again, it uses a similar design to cardano-swaps. The DAO design is pretty simple and I should hopefully finish it within a week or two of starting it.
All of the proof-of-concepts are impacted by the redundant executions. I would like to finish both the p2p lending and the distributed DAO implementations so that I can really emphasize why this problem should be fixed. I intend to link all three proof-of-concepts in the CPS once done. I appreciate your helping to spread the word and I agree that (until zhekson1's recent tweet) the design was not being taken seriously enough, although, I understand why since this idea is coming from an unknown community member. If there is enough of a demand, I can look to rewrite the CPS before finishing the other proof-of-concepts. I could possibly still explain the p2p lending design and the DAO design, just without being able to point to working prototypes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is far too loose. It seems false for many examples that I can think of? In particular, any application that relies on the script knowing its own address relies on the ability to know which script is executing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The answer to both of these questions is almost certainly yes.