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

Feat/add is unique implementation for request packages #888

Conversation

Jiloc
Copy link
Collaborator

@Jiloc Jiloc commented Nov 19, 2024

Description

Add is_unique logic for validating request packages

Changes

  • Added an error for redundant requests

Testing Information

  • added unit tests

Checklist:

  • I have performed a self-review of my code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

@Jiloc Jiloc requested review from djordon and cylewitruk November 19, 2024 12:52
@Jiloc Jiloc self-assigned this Nov 19, 2024
signer/src/bitcoin/validation.rs Outdated Show resolved Hide resolved
@djordon djordon added this to the sBTC: Deposit ready milestone Nov 21, 2024
…s-unique-implementation-for-request-packages
Copy link
Collaborator

@djordon djordon 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 ✅

@Jiloc Jiloc merged commit 869b4d3 into 798-signers-create-bitcoin-sighashes-2 Nov 22, 2024
4 checks passed
@Jiloc Jiloc deleted the feat/add-is-unique-implementation-for-request-packages branch November 22, 2024 09:48
Jiloc added a commit that referenced this pull request Nov 25, 2024
* WIP

* Add an outpoint type

* WIP

* WIP

* Rename the enum

* Change the validation output

* More refactoring

* fake docs

* Add documentation

* This is unnecessary

* Fix up more comments

* Add todos for more work for validation

* add sighashes tables

* fix enum name

* add bitcoin_withdrawals_outputs table and new queries

* fix tests. add new batch queries

* add integration tests. fix prevout_type type in the query

* add block_hash to bitcoin_withdrawals_outputs primary key

* address review comments

* Comment update

* Remove unnecessary cruft

* Add a will sign field in case we want to
make the query super simple

* add prevout_type back

* Add some more comments, cargo fmt

* Remove the withdrawal check in the
prevalidation function

* Make sure the people cannot have fees
assessments that are greater than the deposit amount

* Allow the max-fee to be configurable

* Simplify the block observer

* fix typo

* Remove the construction version

* Add integration tests and test fixtures

* fix validation tests

* update schemas to remove version

* test the amount fee thingy

* bump the timeout

* fix test that was randomly failing

* Add another test

* Another test

* Finish adding tests

* That was silly

* fix typo

* get_bitcoin_tx_sighash -> will_sign_bitcoin_tx_sighas

* change queries signature to accept slices

* address review comments

* Feat/add is unique implementation for request packages (#888)

* add is_unique logic

* fix lint warning

* add missing import

* fix test

* move new tables into new migration file

* Fix up the new tables

---------

Co-authored-by: djordon <[email protected]>
Jiloc added a commit that referenced this pull request Nov 25, 2024
#905)

* Remove locking and just use an ID for
keeping track of the signer in the new WanNetwork

* Add some more comments

* Fix up after changes

* Add code to transform the TerminationHandle
into a BroadcastStream.

* Add a new function to the MessageTransfer trait,
implement it for the types that implement the trait

* Add a new function to the Context trait that
has a default implementation that combines
all streams that a signer may be interested in

* Use the new streams in our event loops

* Add in an enum variant

* Fix up after using the new types

* updates after using the new stream

* Temporarily ignore some tests

* Minor changes in the TxSigner

* minor test update

* Fix the WSTS bug

* Ignore tests that are ignored in later updates

* unnecessary

* Ignore another test

* fix the test

* This one can be fixed now

* No more aborting

* this test is already fixed

* Add a new request decider event loop

* Add a new signer event type

* Make sure to use the right events

* Small refactor

* Move the sleep to before the chain tip lookup

* move it back

* revert

* cargo fmt

* Add in the new event loop and remove
unnecessary field from the tx-signer

* wip

* save txs sighashes on db

* recreate wstscoordinato at each sign round

* rename BitcoinBlockSbtcRequests, reuse signers_key

* add fees to the BitcoinBlockSbtcRequests

* update function name

* add wait timer after sending requests context

* re-create coordinator state machine at each signing round

* rename SbtcRequestsContextMessage

* fix linter warning

* fix function naming

* add test

* update test

* address review comments

* fix test. address comments. make sighash the pk

* wait for signers acks after sending bitcoin pre request

* fix: demo branch fixes (#920)

* update logging so we know what wsts messages came from where
* remove duplicate multisig addr check in sbtc-registry
* explicitly add/remove peers to kademlia
* strip p2p info from peer addresses for kademlia
* more logging
* periodically log p2p peers
* use autonat v2
* Smarter filtering of messages in the tx-signer.
* Add an optional sleep after receiving DkgBegin messages

---------

Co-authored-by: Joey Yandle <[email protected]>
Co-authored-by: Cyle Witruk <[email protected]>

* Revert "wait for signers acks after sending bitcoin pre request"

This reverts commit 468153f.

* drop the database at the end

* feat: add back the target field in our logs (#950)

* add back the target

* 794 save bitcoin sighashes to db (#877)

* WIP

* Add an outpoint type

* WIP

* WIP

* Rename the enum

* Change the validation output

* More refactoring

* fake docs

* Add documentation

* This is unnecessary

* Fix up more comments

* Add todos for more work for validation

* add sighashes tables

* fix enum name

* add bitcoin_withdrawals_outputs table and new queries

* fix tests. add new batch queries

* add integration tests. fix prevout_type type in the query

* add block_hash to bitcoin_withdrawals_outputs primary key

* address review comments

* Comment update

* Remove unnecessary cruft

* Add a will sign field in case we want to
make the query super simple

* add prevout_type back

* Add some more comments, cargo fmt

* Remove the withdrawal check in the
prevalidation function

* Make sure the people cannot have fees
assessments that are greater than the deposit amount

* Allow the max-fee to be configurable

* Simplify the block observer

* fix typo

* Remove the construction version

* Add integration tests and test fixtures

* fix validation tests

* update schemas to remove version

* test the amount fee thingy

* bump the timeout

* fix test that was randomly failing

* Add another test

* Another test

* Finish adding tests

* That was silly

* fix typo

* get_bitcoin_tx_sighash -> will_sign_bitcoin_tx_sighas

* change queries signature to accept slices

* address review comments

* Feat/add is unique implementation for request packages (#888)

* add is_unique logic

* fix lint warning

* add missing import

* fix test

* move new tables into new migration file

* Fix up the new tables

---------

Co-authored-by: djordon <[email protected]>

---------

Co-authored-by: djordon <[email protected]>
Co-authored-by: Matteo Almanza <[email protected]>
Co-authored-by: Joey Yandle <[email protected]>
Co-authored-by: Cyle Witruk <[email protected]>
Co-authored-by: Daniel Jordon <[email protected]>
Jiloc added a commit that referenced this pull request Nov 25, 2024
…954)

* WIP

* Add an outpoint type

* WIP

* WIP

* Rename the enum

* Change the validation output

* More refactoring

* fake docs

* Add documentation

* This is unnecessary

* Fix up more comments

* Add todos for more work for validation

* add sighashes tables

* fix enum name

* add bitcoin_withdrawals_outputs table and new queries

* fix tests. add new batch queries

* Remove locking and just use an ID for
keeping track of the signer in the new WanNetwork

* Add some more comments

* Fix up after changes

* Add code to transform the TerminationHandle
into a BroadcastStream.

* Add a new function to the MessageTransfer trait,
implement it for the types that implement the trait

* Add a new function to the Context trait that
has a default implementation that combines
all streams that a signer may be interested in

* Use the new streams in our event loops

* Add in an enum variant

* Fix up after using the new types

* updates after using the new stream

* Temporarily ignore some tests

* Minor changes in the TxSigner

* minor test update

* Fix the WSTS bug

* Ignore tests that are ignored in later updates

* unnecessary

* Ignore another test

* fix the test

* This one can be fixed now

* No more aborting

* this test is already fixed

* Add a new request decider event loop

* Add a new signer event type

* Make sure to use the right events

* Small refactor

* Move the sleep to before the chain tip lookup

* move it back

* revert

* cargo fmt

* Add in the new event loop and remove
unnecessary field from the tx-signer

* add integration tests. fix prevout_type type in the query

* add block_hash to bitcoin_withdrawals_outputs primary key

* address review comments

* Comment update

* Remove unnecessary cruft

* Add a will sign field in case we want to
make the query super simple

* add prevout_type back

* Add some more comments, cargo fmt

* Remove the withdrawal check in the
prevalidation function

* Make sure the people cannot have fees
assessments that are greater than the deposit amount

* wip

* Allow the max-fee to be configurable

* Simplify the block observer

* fix typo

* save txs sighashes on db

* recreate wstscoordinato at each sign round

* rename BitcoinBlockSbtcRequests, reuse signers_key

* Remove the construction version

* Add integration tests and test fixtures

* add fees to the BitcoinBlockSbtcRequests

* fix validation tests

* update schemas to remove version

* update function name

* test the amount fee thingy

* bump the timeout

* fix test that was randomly failing

* add wait timer after sending requests context

* re-create coordinator state machine at each signing round

* rename SbtcRequestsContextMessage

* fix linter warning

* fix function naming

* Add another test

* Another test

* Finish adding tests

* That was silly

* add test

* fix typo

* get_bitcoin_tx_sighash -> will_sign_bitcoin_tx_sighas

* update test

* address review comments

* change queries signature to accept slices

* address review comments

* Feat/add is unique implementation for request packages (#888)

* add is_unique logic

* fix lint warning

* add missing import

* fix test. address comments. make sighash the pk

* fix test

* move new tables into new migration file

* wait for signers acks after sending bitcoin pre request

* Revert "wait for signers acks after sending bitcoin pre request"

This reverts commit 468153f.

* Fix up the new tables

* drop the database at the end

* add todo for BitcoinPreSignRequest proto

---------

Co-authored-by: djordon <[email protected]>
Jiloc added a commit that referenced this pull request Dec 1, 2024
* WIP

* Add an outpoint type

* WIP

* WIP

* Rename the enum

* Change the validation output

* More refactoring

* fake docs

* Add documentation

* This is unnecessary

* Fix up more comments

* Add todos for more work for validation

* add sighashes tables

* fix enum name

* add bitcoin_withdrawals_outputs table and new queries

* fix tests. add new batch queries

* Remove locking and just use an ID for
keeping track of the signer in the new WanNetwork

* Add some more comments

* Fix up after changes

* Add code to transform the TerminationHandle
into a BroadcastStream.

* Add a new function to the MessageTransfer trait,
implement it for the types that implement the trait

* Add a new function to the Context trait that
has a default implementation that combines
all streams that a signer may be interested in

* Use the new streams in our event loops

* Add in an enum variant

* Fix up after using the new types

* updates after using the new stream

* Temporarily ignore some tests

* Minor changes in the TxSigner

* minor test update

* Fix the WSTS bug

* Ignore tests that are ignored in later updates

* unnecessary

* Ignore another test

* fix the test

* This one can be fixed now

* No more aborting

* this test is already fixed

* Add a new request decider event loop

* Add a new signer event type

* Make sure to use the right events

* Small refactor

* Move the sleep to before the chain tip lookup

* move it back

* revert

* cargo fmt

* Add in the new event loop and remove
unnecessary field from the tx-signer

* add integration tests. fix prevout_type type in the query

* add block_hash to bitcoin_withdrawals_outputs primary key

* address review comments

* Comment update

* Remove unnecessary cruft

* Add a will sign field in case we want to
make the query super simple

* add prevout_type back

* Add some more comments, cargo fmt

* Remove the withdrawal check in the
prevalidation function

* Make sure the people cannot have fees
assessments that are greater than the deposit amount

* wip

* Allow the max-fee to be configurable

* Simplify the block observer

* fix typo

* save txs sighashes on db

* recreate wstscoordinato at each sign round

* rename BitcoinBlockSbtcRequests, reuse signers_key

* Remove the construction version

* Add integration tests and test fixtures

* add fees to the BitcoinBlockSbtcRequests

* fix validation tests

* update schemas to remove version

* update function name

* test the amount fee thingy

* bump the timeout

* fix test that was randomly failing

* add wait timer after sending requests context

* re-create coordinator state machine at each signing round

* rename SbtcRequestsContextMessage

* fix linter warning

* fix function naming

* Add another test

* Another test

* Finish adding tests

* That was silly

* add test

* fix typo

* get_bitcoin_tx_sighash -> will_sign_bitcoin_tx_sighas

* update test

* address review comments

* change queries signature to accept slices

* address review comments

* Feat/add is unique implementation for request packages (#888)

* add is_unique logic

* fix lint warning

* add missing import

* fix test. address comments. make sighash the pk

* fix test

* move new tables into new migration file

* wait for signers acks after sending bitcoin pre request

* Revert "wait for signers acks after sending bitcoin pre request"

This reverts commit 468153f.

* wait for signers acks after sending bitcoin pre request

* remove function lingering from merge

* remove pre_sign_pause

* implement BitcoinPreSignAck Payload message

* fix clippy warnings

* fix some review comments

* use the right timeout!

* long received acks for a different chain tip

* remove unused import

* capture Shutdown signal

* address review comments

---------

Co-authored-by: djordon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants