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

Implement retroactive IS locking of transactions first seen in blocks instead of mempool #2770

Merged
merged 11 commits into from
Mar 19, 2019

Conversation

codablock
Copy link

This implements "retroactive signing" of TXs which were not known before a block appears that contains the TX. This implicitly enables retroactive signing of CLSIGs when included transactions were previously considered "unsafe".

The PR also includes a few fixes for issues I encountered while implementing/testing this.

src/llmq/quorums_chainlocks.cpp Outdated Show resolved Hide resolved
src/llmq/quorums_chainlocks.cpp Outdated Show resolved Hide resolved
@codablock codablock force-pushed the pr_llmq_instantsend_retroactive branch from b397947 to c6c27f8 Compare March 14, 2019 12:53
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK, I don't see anything wrong with it. As long as good testing is done, I am happy :)

@UdjinM6 UdjinM6 added this to the 14.0 milestone Mar 14, 2019
UdjinM6
UdjinM6 previously approved these changes Mar 14, 2019
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK

@codablock
Copy link
Author

Please wait with merging, I'd like to do a rebase first after #2774 is merged (I hope this fixes test failures here)

@UdjinM6 UdjinM6 dismissed their stale review March 15, 2019 09:18

waiting for rebase

@codablock codablock force-pushed the pr_llmq_instantsend_retroactive branch 2 times, most recently from f8eb94c to 72f0748 Compare March 18, 2019 05:03
@codablock
Copy link
Author

Rebased this PR on #2776 and added a fix for test failures. Will rebase on develop after #2776 is merged.

@codablock
Copy link
Author

Tests are finally green, ready for merge after re-ACK

@UdjinM6
Copy link

UdjinM6 commented Mar 18, 2019

I'm still not sure if I like the idea tbh 🙈

Also, can we split this PR into two - one for the fixes and the other one for the actual retroactive signing implementation?

@codablock
Copy link
Author

Ok, I'll do some PR splitting tomorrow.

@codablock
Copy link
Author

@UdjinM6 PR with only fixes/refactorings created in #2779

@codablock codablock force-pushed the pr_llmq_instantsend_retroactive branch from 70d939d to 598d789 Compare March 19, 2019 05:24
@codablock
Copy link
Author

I've also rebased this PR on top of #2779 so that the ordering and conflict resolution is already in-place. I also added a commit on top to fix an issue with NewPoWValidBlock

The UTXO set only works for TXs in the mempool and won't work when we try
to retroactively lock unlocked TXs from blocks.

This is safe as ProcessTx is only called when a TX was accepted into the
mempool or connected in a block, which means that all input checks were
good.
… cases

SyncTransaction is called from AcceptToMemoryPool and when transactions got
connected in a block. So this is the time we want to run TXs through
ProcessTx. This also enables retroactive signing of TXs that were unknown
before a new block appeared.
NewPoWValidBlock is not guaranteed to be called when blocks come in fast.
When a block is accepted in AcceptBlock, NewPoWValidBlock is only called
when the new block is a successor of the currently active tip. This is not
the case when after the first block a second block is accepted immediately
as the first block is not connected yet.

This might be a bug actually in the handling of NewPoWValidBlock, so we
might need to check/fix this later, but currently I prefer to not touch
that part.

Instead, we now use SyncTransaction to gather TXs for blockTxs. This works
because SyncTransaction is called for all transactions in a freshly
connected block in one go. The call also happens before UpdatedBlockTip is
called, so it's fine with the existing logic.
@codablock codablock force-pushed the pr_llmq_instantsend_retroactive branch from 598d789 to 633f64b Compare March 19, 2019 08:38
@codablock
Copy link
Author

Rebased on develop and force-pushed. PR now only contains commits related to the PR.

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Just a couple small suggestions.

src/llmq/quorums_instantsend.cpp Outdated Show resolved Hide resolved
src/llmq/quorums_instantsend.cpp Show resolved Hide resolved
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK

@UdjinM6 UdjinM6 merged commit c360237 into dashpay:develop Mar 19, 2019
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.

None yet

3 participants