Thomas Eizinger
57fe104d9c
Selectively depend on bdk features
3 years ago
Thomas Eizinger
a219d90dd0
Update to bdk 0.12
3 years ago
Lucas Soriano del Pino
d168b07065
Fix MAX_PRICE_DEC
2^20 is 21 bits long, _not_ 20 bits long. If we allow a bound equal to
2^20 we would need 21 bits to represent it, past our limit of 20.
3 years ago
Lucas Soriano del Pino
366c415314
Introduce monitor actor
3 years ago
Lucas Soriano del Pino
7eae0271b0
Add TxInExt trait with find_map_signature method
3 years ago
Lucas Soriano del Pino
8e4d3254f2
Add close_transaction API to cfd_protocol lib
3 years ago
Lucas Soriano del Pino
e879b36304
Document create_cfd_transactions
3 years ago
Lucas Soriano del Pino
1eb237faaa
Take RangeInclusive<u64> as argument to Payout constructor
3 years ago
Lucas Soriano del Pino
7e646461c5
Remove unnecessary newlines around imports
3 years ago
Lucas Soriano del Pino
e395876cc1
Prefer pub(crate) over pub(super)
It does the same job for us and it makes it easier to move things
around later.
3 years ago
Lucas Soriano del Pino
d3440f9733
Use Oracle::MAX_DIGITS where possible in tests
3 years ago
Lucas Soriano del Pino
d2c8c9191c
Use impl Trait shorthand wherever possible
3 years ago
Lucas Soriano del Pino
4fdbe89898
Refactor cfd_protocol crate
3 years ago
Lucas Soriano del Pino
c4d34ae443
Remove Interval from public API
3 years ago
Lucas Soriano del Pino
4e2e3914cb
Reorganize modules
3 years ago
Lucas Soriano del Pino
b8ce7fac35
Expose APIs that are needed
And move the protocol to a `protocol` sub-module.
3 years ago
Lucas Soriano del Pino
8122cd7b79
Prove that signing a price works
And fix bugs along the way.
3 years ago
Lucas Soriano del Pino
000b64818e
Simplify test oracle attest API
3 years ago
Lucas Soriano del Pino
0939aba57e
Remove rand_chacha
We don't need to use seedable RNG in our tests.
3 years ago
Lucas Soriano del Pino
ea3a54ff36
Introduce oracle module
3 years ago
Lucas Soriano del Pino
b49dc137fe
Construct payouts from intervals
3 years ago
Lucas Soriano del Pino
aedce9b4b6
Handle multiple (message, nonce) pairs
3 years ago
Lucas Soriano del Pino
0b6336c13d
Add interval module
3 years ago
Daniel Karzel
17471c9196
Remove `AdaptorSignature` wrapper in favor of latest `rust-secp256k1-zkp`
`EcdsaAdaptorSignature` implements `Serialize` and `Deserialize` on latest master of `rust-secp256k1-zkp` so we can remove the wrapper.
3 years ago
Daniel Karzel
a8a8076887
Rename offer to order. Everywhere!!!
3 years ago
Thomas Eizinger
d459af14d1
Integrate CFD protocol into the maker and taker
- Add wallet to maker and taker.
For now we have different, static descriptors with a hardcoded DB
path. We also only operate on testnet and use sled as a database.
- Associate each CET with a unique nonce_pk
Eventually a set of `(message, nonce_pk)`.
- Share transactions with maker
- Add serialisation support to adaptor signature
Co-authored-by: Mariusz Klochowicz <mariusz@klochowicz.com>
Co-authored-by: Lucas Soriano del Pino <l.soriano.del.pino@gmail.com>
3 years ago
Lucas Soriano del Pino
585d000694
Move nonce_pk to Payout type
It makes sense to put the `nonce_pk` together with the `message`,
since they're both used to generate the attestation (signature) point.
We also remove the `OracleParams` type since it would only have one
field after this change.
3 years ago
Lucas Soriano del Pino
a693f19976
Do not destructure CfdKeys type
3 years ago
Lucas Soriano del Pino
bffe4c603e
Refactor cfd tests
In order to reuse code and to make it easier to add new tests (e.g.
negative tests) in the future.
3 years ago
Lucas Soriano del Pino
31f1a87d3a
Rename finalize_spend_transaction arguments
To convey that the order in which these pairs of arguments are passed
in is irrelevant.
3 years ago
Lucas Soriano del Pino
a24dd67f20
Add create test helper
3 years ago
Lucas Soriano del Pino
66c4c58a2d
Define and implement TransactionExt::outpoint
3 years ago
Lucas Soriano del Pino
d95eeda49f
Use iter::chain and iter::once
Instead of `vec![vec![]].concat()`.
3 years ago
Lucas Soriano del Pino
641faceb8a
Add renew_cfd_transactions API
3 years ago
Thomas Eizinger
8993492543
Track bdk's rev in lockfile
3 years ago
Lucas Soriano del Pino
6a21f4e31a
Increase ContractExecutionTransaction::SIGNED_VBYTES constant
We were only testing against CETs with a single output, so the
`SIGNED_VBYTES` constant was based on a smaller transaction than
usual.
We could use a different constant for the case when the CET has a
single output, but it's just an edge case and the transaction fees are
very small.
3 years ago
Lucas Soriano del Pino
b654172b80
Rename tests file
3 years ago
Lucas Soriano del Pino
2a9e49ca9a
Take raw lock transaction in CommitTransaction constructor
We remove the `LockTransaction` type accordingly.
3 years ago
Thomas Eizinger
080e1d6364
Extract script from descriptor directly
No need to do a round-trip to an address and back!
3 years ago
Lucas Soriano del Pino
ab7dfe2fd6
Remove redundant anyhow::context
3 years ago
Lucas Soriano del Pino
5e6f6b4d5a
Use byte strings in tests
3 years ago
Lucas Soriano del Pino
e3607c0734
Get rid of unnecessary and unwanted Message type
3 years ago
Lucas Soriano del Pino
658e0cf21f
Fix name of Payout private method
And also take self by value since it's a type that implements `Copy`.
3 years ago
Lucas Soriano del Pino
c299c2cdb4
Construct satisfiers using HashMap::from_iter
3 years ago
Lucas Soriano del Pino
7a61e50e07
Use parse instead of FromStr in unit tests
3 years ago
Lucas Soriano del Pino
53e1056c8e
Do not hard-code network in library
3 years ago
Lucas Soriano del Pino
7f21d3b24a
Remove use of bitcoin::PrivateKey type
3 years ago
Lucas Soriano del Pino
5f58be55c7
Simplify imports
3 years ago
Lucas Soriano del Pino
862cf66e66
Convert sighashes to messages non-fallibly
3 years ago
Philipp Hoenisch
d0bd25832a
Move library test into tests folder
3 years ago