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

assert not ephemeral #150

Merged
merged 3 commits into from
Mar 16, 2023
Merged

assert not ephemeral #150

merged 3 commits into from
Mar 16, 2023

Conversation

arvidn
Copy link
Contributor

@arvidn arvidn commented Mar 15, 2023

This patch adds a feature flag to disallow relative timelock conditions on ephemeral spends. As relative timelock, we count:

ASSERT_SECONDS_RELATIVE
ASSERT_HEIGHT_RELATIVE
ASSERT_BEFORE_SECONDS_RELATIVE
ASSERT_BEFORE_HEIGHT_RELATIVE
ASSERT_MY_BIRTH_SECONDS
ASSERT_MY_BIRTH_HEIGHT

These are condition that, indirectly, depend on the current block's height and timestamp. Since we're only considering ephemeral spends.

This patch is split up into 3 commits, best reviewed one at a time.

commit 1

The first commit is really a clean-up of the previous ASSERT_EPHEMERAL condition, where instead of recording (parent, puzzle-hash, amount) for coins asserting they're ephemeral, we just record the index of that spend, in the list of spends we're building while parsing. This in the periphery of the core change, but since we'll need to also record coins that are not allowed to be ephemeral, having a simpler and more compact representation helps.

commit 2

This first step records whether a spend contains any relative timelocks. One interesting case is when a condition is automatically true, and dropped. This requires that we record the existence of the condition some other way. We do this with a flag. This affects some tests that currently check the flag, that now need to take into the account that this new flag may be set.

commit 3

This last step also adds the checking that spends with relative timelock conditions are in fact not ephemeral spends. For this we also need a new feature flag to enable this checking, since consensus rules may not be updated immediately, but needs a soft-fork height where it activates. We can activate it immediately in mempool mode however.

arvidn added 3 commits March 15, 2023 09:05
…nd on a spend (even if it was ignored). This will be used to implement the soft-fork behavior or disallowing relative conditions on ephemeral spends
@arvidn arvidn force-pushed the assert-not-ephemeral branch from fad6a6e to b858b7c Compare March 15, 2023 08:08
@arvidn arvidn marked this pull request as ready for review March 15, 2023 08:25
Copy link
Contributor

@AmineKhaldi AmineKhaldi left a comment

Choose a reason for hiding this comment

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

Looks reasonable.

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.

3 participants