Skip to content

Commit

Permalink
Testnet bridge architecture (#254)
Browse files Browse the repository at this point in the history
* Set rpc endpoints and impl operator new deposit

* Impl verifier new_deposit

* Impl operator_kickoffs_generated

* impl more verifier functions

* Merge MuSig2 functions into ekrem/new-architecture (#206)

* Add some musig2 functionalities

* Some changes in general and in MuSig2

* Change musig2 functions

* Add one small test

* Added three more simple tests

* Add test with dummy_tx key_spend

* Add test with dummy_tx script_spend

* Add rpc tests for key_spend and script_spend

* Add wrappers for aggregate_nonces and aggregate_partial_signatures, formatting

* Cargo fmt

* Small change for config file

* Some refactor

* (WIP) Change XOnlyPublicKeys to PublicKeys in config files

* Fix errors from pk-xonlypk change

* More refactor

* Remove code duplication

* More refactor

* Commentation + more refactor

* Trying something

* Removed Cargo.lock + add to .gitignore

* Create XOnlyPublicKeys from PublicKeys using an extension trait (#216)

Reduces code duplication and isolates the reponsibility to a dedicated function

* Finalize new architecture for deposit except db operations (#211)

* WIP

* Fix some errors

* WIP

* Merge ozan/new-architecture-improvments into ekrem/new-architecture-improvments (#218)

* WIP Impl. new endpoints

* WIP Impl. new endpoints

* nits

* Implement move txs partial sig

* WIP db nonce

* Use UTXO instead of PsbtOutpoint

* remove redundant db funcs

---------

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

* Update DB for New Architecture (#222)

* Change the db file for the new architecture

* Change some UTXOs to OutPoints, add some checks

* WIP Fix inconsistencies

* WIP Impl database wrappers

* Update schema

* Fix some db

* WIP

* nits

* Fix error for a wrapper, add some example db trait impl. and db func.

* nits

* WIP Impl. database functions

---------

Co-authored-by: Ekrem BAL <[email protected]>

* Merge DB changes to ekrem/new-architecture (#227)

* Update config files and impl. some db tests

* WIP Fix checks and tests

* (WIP) Add test for nonce table, fix small errors

* (WIP) Add more tests for nonces table

* (WIP) Add tests for get_pub_nonce

* (WIP) Add test for deposit_utxo

* Change operator new_deposit with new schema

* WIP

* DecodeRow inside the function

* Current tests work

* WIP

* Fix Json issue with UTXODB

* Clean wrapper.rs and formatting

* Add tests for deposit_kickoff_generator_txs table

* Apply review

---------

Co-authored-by: Ekrem BAL <[email protected]>

* Remove code duplication (#228)

* Merge withdrawal into ekrem/new-architecture (#234)

* WIP

* nits

* Add sig check for withdrawal (#229)

* Add sig check for withdrawal

* Use tx.verify

---------

Co-authored-by: Ekrem BAL <[email protected]>

* Impl operator paying withdrawal

* Merge ozan/withdrawal-endpoint-test into ekrem-new-architecture (#230)

* wip

* WIP: created operators and verifiers

* Add steps for the flow

* Add withdrawal endpoint test,organize configs

* Flaky but ok

* Fix flakiness

* Remove unnecessary serialization

---------

Co-authored-by: lemonpartee <[email protected]>
Co-authored-by: Ekrem BAL <[email protected]>

* Merge ozan/kickoff-root-operations into withdrawal (#231)

* WIP Implement endpoints with db operations and tests

* wip

* WIP

* WIP

* Implement changes

* Apply review changes

* Refactor the binaries

* Rename, refactor

---------

Co-authored-by: Ekrem BAL <[email protected]>

---------

Co-authored-by: Ekrem BAL <[email protected]>
Co-authored-by: lemonpartee <[email protected]>

* Implement sig_agg helpers (#237)

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

* Deposit test (#232)

* wip

* WIP: created operators and verifiers

* Add steps for the flow

* wip

* Test e2e deposit flow

* Undo unrelated changes

* Fix agg nonces and use same deposit

* Adjust test flow after rebase to withdrawal

* Use create verifiers and operators func

* Works until set_operator_funding_utxo_rpc

* Fix create operators and verifiers

* Fix sig aggregation

* nits

* WIP

* WIP MuSig2VerifyError(BadSignature)

* Debug

* Fix error

* Send move_tx + refactor

---------

Co-authored-by: Ekrem BAL <[email protected]>
Co-authored-by: ozankaymak <[email protected]>

* Apply review + refactor (#243)

* Remove unused dependencies (#238)

* Remove unused utils (#239)

* Add docker compose with database (#245)

* Introduce dockerized PostgresSQL database compatible with integration tests

* refactor compose

* Full withdrawal flow (#253)

* Save operator take and slash or take sigs

* Operator can find kickoff utxo

* Operator can send kickoff tx onchain

* WIP verifiers and operators should use same db missing

* Fix bugs

* WIP Boths sigs verified but operator_take_tx fails

* WIP MuSig2 fix

* Fix withdrawal happy part test

* nits

* Fix musig test

* Use key aggregator trait

---------

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

* get rid of basic workflow

* Workflow improvements (#251) (#255)

* workflow: Add all-targets flag to clippy.

* workflow: Add the new build_and_test workflow.

* workflow: Remove all features and move services.

* workflow: Remove old basic workflow.

* workflow: Add cache warm ups for build and test.

* workflow: Add all features flag to build and test.

* workflow: Lower healt-retries to 5.

Co-authored-by: Ceyhun Şen <[email protected]>

* workflow: remove all features.

* Merge "clippy" into "ekrem/new-architecture"

* Fix CI config toml

* Change CI config + remove warnings

* Apply clippy suggestions for all

* nits

* Fix duplication

* Fix CI error

* Apply more clippy suggestions (#256)

* cargo: Update mock_rpc.

* workflow: Re-add --all-features.

* workflow: Upgrade 4 cores to 16 cores.

* perf: Insert nonces in a single batch (#248)

* Cargo upgrade

* minimize op_return usage

* fmt

---------

Co-authored-by: ozankaymak <[email protected]>
Co-authored-by: lemonpartee <[email protected]>
Co-authored-by: ozankaymak <[email protected]>
Co-authored-by: Ceyhun Şen <[email protected]>
  • Loading branch information
5 people authored Aug 29, 2024
1 parent 658b106 commit 7391928
Show file tree
Hide file tree
Showing 47 changed files with 4,344 additions and 6,435 deletions.
5 changes: 5 additions & 0 deletions .docker/db/init.d/test-database-and-users.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE ROLE citrea WITH LOGIN CREATEDB;
CREATE DATABASE citrea;

CREATE ROLE clementine WITH LOGIN CREATEDB;
CREATE DATABASE clementine;
54 changes: 40 additions & 14 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
jobs:
debug_mode_build:
name: Compile code in debug mode
runs-on: ubicloud-standard-4
runs-on: ubicloud-standard-16

steps:
- uses: actions/checkout@v4
Expand All @@ -32,7 +32,7 @@ jobs:

release_mode_build:
name: Compile code in release mode
runs-on: ubicloud-standard-4
runs-on: ubicloud-standard-16

steps:
- uses: actions/checkout@v4
Expand All @@ -53,7 +53,7 @@ jobs:

debug_mode_test:
name: Test code in debug mode
runs-on: ubicloud-standard-4
runs-on: ubicloud-standard-16
needs: debug_mode_build

services:
Expand Down Expand Up @@ -105,22 +105,35 @@ jobs:
port = 3000
secret_key = "5555555555555555555555555555555555555555555555555555555555555555"
verifiers_public_keys = [
"034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa",
"02466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27",
"023c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1",
"032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",
"029ac20335eb38768d2052be1dbbc3c8f6178407458e51e6b4ad22f1d91758895b",
]
num_verifiers = 5
operators_xonly_pks = [
"4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa",
"466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27",
"3c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1",
"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",
"9ac20335eb38768d2052be1dbbc3c8f6178407458e51e6b4ad22f1d91758895b",
]
num_operators = 5
db_file_path = "database"
num_verifiers = 4
min_relay_fee = 305
user_takes_after = 200
confirmation_treshold = 1
confirmation_threshold = 1
network = "regtest"
bitcoin_rpc_url = "http://127.0.0.1:18443"
bitcoin_rpc_user = "admin"
bitcoin_rpc_password = "admin"
all_secret_keys = [
all_verifiers_secret_keys = [
"1111111111111111111111111111111111111111111111111111111111111111",
"2222222222222222222222222222222222222222222222222222222222222222",
"3333333333333333333333333333333333333333333333333333333333333333",
"4444444444444444444444444444444444444444444444444444444444444444",
"5555555555555555555555555555555555555555555555555555555555555555",
]
all_operators_secret_keys = [
"1111111111111111111111111111111111111111111111111111111111111111",
"2222222222222222222222222222222222222222222222222222222222222222",
"3333333333333333333333333333333333333333333333333333333333333333",
Expand All @@ -145,7 +158,7 @@ jobs:

release_mode_test:
name: Test code in release mode
runs-on: ubicloud-standard-4
runs-on: ubicloud-standard-16
needs: release_mode_build

services:
Expand Down Expand Up @@ -197,22 +210,35 @@ jobs:
port = 3000
secret_key = "5555555555555555555555555555555555555555555555555555555555555555"
verifiers_public_keys = [
"034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa",
"02466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27",
"023c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1",
"032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",
"029ac20335eb38768d2052be1dbbc3c8f6178407458e51e6b4ad22f1d91758895b",
]
num_verifiers = 5
operators_xonly_pks = [
"4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa",
"466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27",
"3c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1",
"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",
"9ac20335eb38768d2052be1dbbc3c8f6178407458e51e6b4ad22f1d91758895b",
]
num_operators = 5
db_file_path = "database"
num_verifiers = 4
min_relay_fee = 305
user_takes_after = 200
confirmation_treshold = 1
confirmation_threshold = 1
network = "regtest"
bitcoin_rpc_url = "http://127.0.0.1:18443"
bitcoin_rpc_user = "admin"
bitcoin_rpc_password = "admin"
all_secret_keys = [
all_verifiers_secret_keys = [
"1111111111111111111111111111111111111111111111111111111111111111",
"2222222222222222222222222222222222222222222222222222222222222222",
"3333333333333333333333333333333333333333333333333333333333333333",
"4444444444444444444444444444444444444444444444444444444444444444",
"5555555555555555555555555555555555555555555555555555555555555555",
]
all_operators_secret_keys = [
"1111111111111111111111111111111111111111111111111111111111111111",
"2222222222222222222222222222222222222222222222222222222222222222",
"3333333333333333333333333333333333333333333333333333333333333333",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
jobs:
formatting:
name: Check formatting
runs-on: ubicloud-standard-4
runs-on: ubicloud-standard-16

steps:
- uses: actions/checkout@v4
Expand All @@ -17,7 +17,7 @@ jobs:

linting:
name: Check linting
runs-on: ubicloud-standard-4
runs-on: ubicloud-standard-16

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.DS_Store
Cargo.lock
risc0-guests/operator/guest/Cargo.lock
risc0-guests/verifier/guest/Cargo.lock
target/
.env
configs
./database
.vscode
.docker/db/data/
Loading

0 comments on commit 7391928

Please sign in to comment.