Proto commits in stacks-network/sbtc

These 33 commits are when the Protocol Buffers files have changed:

Commit:55c238c
Author:cylewitruk

new branch with backups

Commit:7a49a91
Author:cylewitruk
Committer:cylewitruk

wip

Commit:0808443
Author:djordon

Update the protobufs too

Commit:ac7eddc
Author:Daniel Jordon
Committer:GitHub

feat: update validation logic of accepted withdrawal requests (#1394) * Change the request_id field on the AcceptWithdrawalV1 struct to a qualified id * Fixup the copy * Update the logic of AcceptWithdrawalV1::validate to use the withdrawal report. * Allow large protobuf variants * Update the integration tests * We don't care about rejecting votes * cargo fmt and small clean-ups * Fix the unit test

The documentation is generated from this commit.

Commit:7743548
Author:Joey Yandle
Committer:GitHub

feat: implement validatation of reject-withdrawal-request contract calls (#1336) * sketch out reject-withdrawal-request validation and implement first two checks call iter not into_iter for lint check check that the withdrawal-request is final on the btc chain use corrent block hash in storage requests and errors use proper chain tip errors create withdrawal-reject integration tests based on the withdrawal-accept tests log error since we don't have good error returns yet clean up error handling disable most reject tests but leave in the ones that are analaguous to the accept ones don't clone if you can copy add some temporary logging use block heights to determine if 6 blocks have passed since the withdrawal request failure to get withdrawal signers or request report should map to RequestMissing remove unused tests; use bitmap mismatch test move QualifiedRequestId into common proto; RejectWithdrawalV1 now has a QualifiedRequestId in both code and proto; deal with fallout fix tests to use QualifiedRequestId for RejectWithdrawalV1 map the DB error to the expected type remove stacks/common.proto since the linter complained it wasn't being used check reject threshold use TestSweepSetup2 to try to fix problems with the signer set length address review comments, though they seem to have made things worse use sweep block height not fake data in TestSweepSetup2 hard wire the correct signing threshold into ReqContext add TestSweep2 reject_withdrawal_request and call it from happy path test use Faker for block height if we haven't swept yet remove eprintln remove TODO comment use ctx.config().signer.public_key() not req_ctx.origin wrap comments; remove commented out code don't map errors; set request_id as i64::MAX not u64::MAX so we don't get a SQL error in the conversion pass db into make_withdrawal_reject2 and use it to get the chain tip; use make_withdrawal_reject2 in reject_withdrawal_validation_bitmap_mismatch so it will have the chain tip in req_ctx; use req_ctx to get chain tip in validate split let into two statements for readability remove Withdrawal token from error variants check to see if withdrawal request has expired in validate; add test for expiry check expired with and without rejection cases add test for not_expired_not_rejected, which tests that validate returns RequestNotRejected get the chain tip directly from the db after failing with RequestNotFinal mine an extra block and show that validate now succeeds remove unused error variants simplify validation failure conditions as per #1363 fail validation if the request is not final, i.e. expired * deal with fallout from changes to TestSweepSetup2 * add new_sweep_setup fn * generate more blocks and verify that test now passes

Commit:dc219d7
Author:Cyle Witruk
Committer:GitHub

refactor: wsts-related cleanup (#1287) * some wsts cleanup/refactor * think that's it * add message support for a specific dkg wstsmessageid * add a dkg wstsmessageid variant * fix merge artifacts * tracing fields * storage mut * lovely cascading changes * remove wstsmessage.txid infavor of id * remove save and prefer trait default impls * remove unused trait methods * logging stuff * rename message ids * remove unneeded allow(deprecated)

Commit:5f99a29
Author:cylewitruk

rename message ids

Commit:d22ed61
Author:cylewitruk

remove wstsmessage.txid infavor of id

Commit:347db71
Author:cylewitruk

add message support for a specific dkg wstsmessageid

Commit:c742af2
Author:cylewitruk
Committer:cylewitruk

think that's it

Commit:e867b72
Author:cylewitruk

some wsts cleanup/refactor

Commit:25d214a
Author:cylewitruk

rename wstsmessageid variant

Commit:be05f5e
Author:cylewitruk

seems to work

Commit:2d8e3e6
Author:Daniel Jordon
Committer:GitHub

chore: bump wsts revision (#1262) * Update WSTS dependency * Update the protobufs * Pass in the new DKG threshold parameter

Commit:155f0d4
Author:Daniel Jordon
Committer:GitHub

refactor: remove unused messages (#1128) * Remove the BitcoinTransactionSignAck and BitcoinTransactionSignRequest protobuf messages. Their payload field tags are now reserved. * Remove the internal BitcoinTransactionSignAck and BitcoinTransactionSignRequest structs.

Commit:63fcdb9
Author:Daniel Jordon
Committer:GitHub

fix: remove sweep transaction message (#1060) * Change to a more efficient query in get_swept_deposit_requests * Don't use sweep tables in get_pending_accepted_deposit_requests query * Remove the DB trait functions that read from or write to the sweep tables. Remove now unused code * Update the queries to use the bitcoin_tx_inputs instead of the sweep tables * Remove sweep structs and protobufs :( * Drop the sweep tables * Add some indices

Commit:e72f0ea
Author:Joey Yandle

update protobufs for embedded shares

Commit:53cc756
Author:Daniel Jordon
Committer:GitHub

feat: verify all p2p messages (#958) * Filter messages whose peer ID does not match the one recovered from the signature. * Verify the signature after receiving a message * Decode protobufs in a forward compatible way * Update a field name

Commit:0dd15d3
Author:Daniel Jordon
Committer:GitHub

fix: add integrity protection for all messages (#957) * Add more protobuf conversion, implement ProtoSerializable for SignerMessage * Add a function for verifying ecdsa signatures * Don't go through the wsts::net::Signable trait * Make sign_ecdsa infallible * Tag the messages * No need for OutPointMessage and many Serialize/Deserialize implementations * Don't use regular hashmaps in protobuf structs

Commit:582788c
Author:Jiloc
Committer:GitHub

feat: wait for acks from signers after BitcoinPreSignRequest (#956) * 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 468153f8dcb67255e836ccdfe65d4e449fd63993. * 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 <dan.jordon@gmail.com>

Commit:f48d6fe
Author:Matteo Almanza
Committer:GitHub

Use proto serialization (#880) * feat: add missing proto definitions * chore: buf lint * chore: buf format * feat: add missing proto conversions * chore: remove foresight * feat: use proto serialization * chore: add missing lint directive, nit * chore: nits, add tests placeholder * chore: nit, remove unused encode * fix: sane point conversion * tests: add missing proto conversion tests (#899) * tests: add some proto conversion tests * tests: add missing conversion tests * Add missing proto conversions (#879) * feat: add missing proto conversions * chore: remove foresight * chore: nits, add tests placeholder * fix: sane point conversion * tests: add missing proto conversion tests (#899) * tests: add some proto conversion tests * tests: add missing conversion tests * chore: exchange serialize messages in in_memory network * feat: add missing message, tests * chore: remove recursive error * nit: use derive magic

Commit:423939c
Author:Matteo Almanza
Committer:GitHub

Add missing proto definitions (#878) * feat: add missing proto definitions * chore: buf lint * chore: buf format * chore: add missing lint directive, nit * Add missing proto conversions (#879) * feat: add missing proto conversions * chore: remove foresight * chore: nits, add tests placeholder * fix: sane point conversion * tests: add missing proto conversion tests (#899) * tests: add some proto conversion tests * tests: add missing conversion tests

Commit:5779716
Author:Daniel Jordon
Committer:GitHub

feat: run blocklist client for deposits that we cannot sign for (#838) * Change the name of the is_accepted column in the deposit_signers table * Update the queries * Update the types

Commit:5c85dc6
Author:Daniel Jordon
Committer:GitHub

feat: add protobuf conversion impls (#808) * move stuff out of the mod.rs file * Add conversion impls for crypto module protobufs and some of the id types * Finish the bitcoin types * Finish the conversion for common stacks types * Add tests for conversions * Finish off signer decision types

Commit:94da936
Author:Daniel Jordon
Committer:GitHub

feat: validate the public key embedded in the deposit script (#707) * Rename the new signer_public_key column in the deposit_requests table * Add a new can_sign field, and populate it when handling pending deposit requests * We do not need to create so many databases for our transaction signer tests

Commit:96a665c
Author:Daniel Jordon
Committer:GitHub

feat: add wsts protobufs (#727) * Finish the wsts protobuf messages * Add state protobufs for wsts * Compile the WSTS state.proto file

Commit:6e9feaf
Author:Daniel Jordon
Committer:GitHub

feat: enable validation for contract calls (#694) * Add a signature_share_threshold column to the DKG shares table * Actually do the validation the stacks transactions

Commit:f520f9c
Author:Daniel Jordon
Committer:GitHub

feat: sign and broadcast Stacks transactions (#617) * Add the transaction id to the stacks transaction sign request object * Make the context types static, since they are. * Sign the stacks transaction in the TxSignerEventLoop * Add functions for signing and broadcasting stacks transactions --------- Co-authored-by: Matteo Almanza <matteo.almanza@algorand.com>

Commit:8f35f57
Author:Daniel Jordon
Committer:GitHub

feat: add bitcoin transaction fee validation (#582) * Use from instead of as _ casts for integers more * Use the crate ScriptPubKey in EncryptedDkgShares script_pubkey field * Switch the config for bitcoin core to use the regtest variables * Add a new trait function to DbRead for checking whether a scriptPubKey is related to the signers * Update the function signature on BitcoinTxInfo. Also update a BitcoinTxInfo's subfield and comment * Fix a lurking bug in a query that fetches the last years worth of scriptPubKeys. It now gets at least one scriptPubKey * Update stacks validation functions to use bitcoin core * Add test helper struct for setting up sweep transactions and making them (hopefully) easier to understand

Commit:469e52b
Author:Daniel Jordon
Committer:GitHub

Finish adding the transaction protobuf types (#579)

Commit:9c55459
Author:Daniel Jordon
Committer:GitHub

feat: add more protobuf types part 2 (#577) * Add more common types * Add some request types * Move the bitcoin and generic crypto stuff to their own packages

Commit:b1af2af
Author:Daniel Jordon
Committer:GitHub

feat: start protobuf use for signer communication (#558) * Add a buf yaml * Add some decision protobuf messages * Use buf in CI * Remove the relay stuff * Implement conversion traits for Uint256

Commit:7eacefb
Author:MÃ¥rten Blankfors
Committer:GitHub

feat: Signer network implementation over gRPC with examples (#159)