-
Notifications
You must be signed in to change notification settings - Fork 25
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
fast-forward #267
fast-forward #267
Conversation
Pull Request Test Coverage Report for Build 6596400357
💛 - Coveralls |
5afc328
to
e610ed4
Compare
e610ed4
to
22b406c
Compare
Interesting, can you explain some use cases that this feature could enable? If puzzle hash can't change, is it mainly for oracle-like coins? |
@trepca yes, it's primarily for oracle-like coins. One of the features it enables is for farmers to fast-forward mempool items and combine multiple spends of the same coin in the same block. |
d465f79
to
3175f6d
Compare
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.
Looks reasonable. I think we should expose ELIGIBLE_FOR_FF
in the wheel and update the PR description to no longer mention CREATE_COIN_ANNOUNCEMENT
as a restriction for instance.
3b178da
to
645297d
Compare
I remain of the opinion that adding code to the core node that is aware of specific spend types is not a good idea. |
This PR doesn't do that though |
It seems strange to me to look for particular condition outputs deep in the "spend condition aggregator". It's a layer violation that gives too much preference to a particular kind of spend. I get that you don't want to have to run the spend again just to examine the output conditions. What if we pass in an optional callback in that's run on each iterator at the appropriate time, and it can do whatever it wants? Wherever it needs to go to identify the magic spends and notate them. |
The time when we need to identify or extract information for some other purpose or puzzle would be the perfect time to introduce such abstraction. I don't think there's much value in trying to predict what it would look like, and introduce additional complexity for a potential future use. That said, I think it would reduce complexity to find a way to pull out this checking into a separate pass. Iterating the output coins ended up being separate pass anyway. |
Much less controversial now. |
this PR is best reviewed one commit at a time.
overview
It introduces a feature I call "fast forward". Perhaps a better name would be "rebase". What it does is to change the coin being spent by a singleton spend. It obviously only work for a small subset of singleton spends:
AGG_SIG_ME
,ASSERT_MY_COIN_ID
,ASSERT_MY_PARENT_ID
, etc.)singleton_top_layer_v1_1.clsp
outer puzzle.In order the change the coin being spent, the singleton top layer solution is altered to include a new parent's parent coin ID.
commits
The change is broken down into the following commits:
fast_forward_singleton()
) that validates that spend as eligible and produces a new solution for the spend on the new coin.Updates to the conditions parsing, identifying traits of spends as (possibly) being eligible for fast forward, setting the flagELIGIBLE_FOR_FF
. This flag does not guarantee that a spend supports fast-forward, but together with thefast_forward_singleton()
function, it's believed to guarantee that the new spend is valid. (However, it's best to validate it by running the new spend). This flag is primarily meant when running a spend bundle to validate whether a spend can be fast-forwarded or not.fast_forward_spend()
and extend thegen-corpus
tool to pick out singletons to seed the corpus withchia-tools
):run-spend
andfast-forward-spend
. These were very helpful in the development of this feature both for manual testing and understanding of the puzzles. My vision forrun-spend
is to extend it to know about more puzzles in the future, to make it a convenient way of inspecting puzzles on the chain.run-spend
Here's an example output from the
run-spend
tool, for a singleton spend: