257 Commits

Author SHA1 Message Date
Louis Singer
02542c3634 Support forfeit with CHECKLOCKTIMEVERIFY (#389)
* explicit Timelock struct

* support & test CLTV forfeit path

* fix wasm pkg

* fix wasm

* fix liquid GetCurrentBlockTime

* cleaning

* move esplora URL check
2024-11-28 14:51:06 +01:00
altafan
a4ae439341 [Docker] Use default go proxy 2024-11-28 14:18:23 +01:00
altafan
693f97333f [SDK] Fix return values in rest SubmitRedeemTx 2024-11-28 12:27:28 +01:00
Pietralberto Mazza
7f937e8418 Vars and fields renaming (#387)
* Rename asp > server

* Rename pool > round

* Consolidate naming for pubkey/prvkey vars and types

* Fix

* Fix

* Fix wasm

* Rename congestionTree > vtxoTree

* Fix wasm

* Rename payment > request

* Rename congestionTree > vtxoTree after syncing with master

* Fix Send API in SDK

* Fix wasm

* Fix wasm

* Fixes

* Fixes after review

* Fix

* Fix naming

* Fix

* Fix e2e tests
2024-11-26 15:57:16 +01:00
Louis Singer
12d666bfdf Move redeem transactions creation client-side (#388)
* move OOR transaction creation client-side

* robust redeem tx checks

* optimize GetVtxos db call

* rename CompleteAsyncPayment --> SubmitRedeemTx

* fix permissions.go
2024-11-25 13:38:04 +01:00
Dusan Sekulic
d184fc0f41 [SDK] E2E test for WASM wrapper (#378)
* wasm e2e test

* Remove ark-sdk.wasm.gz from repository

* pr review

* exclude test files from linting

* fix

* test fix

* go work sync

* gha fix

* gha fix

* wasm e2e test

* kill webserver

* Fix nonce encoding/decoding & Fix pop from queue of payment requests (#375)

* bug fix - paymentMap pop input traversal

* bug fix - nonce encode/decode

* pr review

* pr review

* Fix trivy gh action (#381)

* Update trivy gha

* Update tryvy gha

* Fix

* merge

* Panic recovery in app svc (#372)

* panic recovery

* pr review

* Support connecting to bitcoind via ZMQ (#286)

* add ZMQ env vars

* consolidate config and app-config naming

* [Server] Validate forfeit txs without re-building them (#382)

* compute forfeit partial tx client-side first

* fix conflict

* go work sync

* move verify sig in VerifyForfeits

* move check after len(inputs)

* Hotfix: Prevent ZMQ-based bitcoin wallet to panic  (#383)

* Hotfix bct embedded wallet w/ ZMQ

* Fixes

* Rename vtxo is_oor to is_pending (#385)

* Rename vtxo is_oor > is_pending

* Clean swaggers

* Change representation of taproot trees & Internal fixes (#384)

* migrate descriptors --> tapscripts

* fix covenantless

* dynamic boarding exit delay

* remove duplicates in tree and bitcointree

* agnostic signatures validation

* revert GetInfo change

* renaming VtxoScript var

* Agnostic script server (#6)

* Hotfix: Prevent ZMQ-based bitcoin wallet to panic  (#383)

* Hotfix bct embedded wallet w/ ZMQ

* Fixes

* Rename vtxo is_oor to is_pending (#385)

* Rename vtxo is_oor > is_pending

* Clean swaggers

* Revert changes to client and sdk

* descriptor in oneof

* support CHECKSIG_ADD in MultisigClosure

* use right witness size in OOR tx fee estimation

* Revert changes

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>

* fix unit test

* fix unit test

* fix unit test

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Co-authored-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
Co-authored-by: Louis Singer <41042567+louisinger@users.noreply.github.com>
2024-11-22 15:31:20 +01:00
Dusan Sekulic
ae3ccb3579 Add support for announcing market hours (#380)
* feat: add market hour configuration for optimal payment timing

This commit adds market hour configuration to help users determine optimal
times for making payments with lower fees. The configuration is managed
through environment variables and exposed via the GetInfo RPC.

Changes:
- Add MarketHour message type to protobuf service definition
- Add market hour configuration fields to Config struct
- Update covenant and covenantless services to handle market hour data
- Extend GetInfo RPC response to include market hour information
- Set default market hour period to 24 hours
- Initialize market hour fields after other service fields

Configuration:
- ARK_FIRST_MARKET_HOUR: Initial market hour timestamp
  (default: current server start time)
- ARK_MARKET_HOUR_PERIOD: Time between market hours in seconds
  (default: 86400)
- ARK_MARKET_HOUR_ROUND_LIFETIME: Round lifetime for market hours
  (default: 0, falls back to ARK_ROUND_LIFETIME)

* feat: add admin RPC for updating market hour configuration

Add new UpdateMarketHour RPC to AdminService for configuring market hour parameters:
- Add request/response messages to admin.proto
- Add UpdateMarketHour method to Service interface
- Implement market hour updates in covenant and covenantless services
- Add validation for market hour parameters
- Implement admin gRPC handler

The RPC allows updating:
- First market hour timestamp
- Market hour period
- Market hour round lifetime (optional, defaults to round lifetime

* feat: add market hour persistence with sqlite

- Add MarketHourRepo interface in domain layer
- Implement market hour persistence using SQLite
- Add market hour queries to sqlc/query.sql
- Update service initialization to load market hours from DB
- Add fallback to config values if no DB entry exists
- Update RepoManager interface with new MarketHourRepo method
2024-11-22 10:36:51 +01:00
Louis Singer
d6b8508f6d ListVtxos: validate address's server public key (#386)
* ListVtxos: check server public key

* Update server/internal/core/application/covenant.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* Update server/internal/core/application/covenantless.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

---------

Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>
Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-11-21 13:58:13 +01:00
Louis Singer
06dd01ecb1 Change representation of taproot trees & Internal fixes (#384)
* migrate descriptors --> tapscripts

* fix covenantless

* dynamic boarding exit delay

* remove duplicates in tree and bitcointree

* agnostic signatures validation

* revert GetInfo change

* renaming VtxoScript var

* Agnostic script server (#6)

* Hotfix: Prevent ZMQ-based bitcoin wallet to panic  (#383)

* Hotfix bct embedded wallet w/ ZMQ

* Fixes

* Rename vtxo is_oor to is_pending (#385)

* Rename vtxo is_oor > is_pending

* Clean swaggers

* Revert changes to client and sdk

* descriptor in oneof

* support CHECKSIG_ADD in MultisigClosure

* use right witness size in OOR tx fee estimation

* Revert changes

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-11-20 18:51:03 +01:00
Pietralberto Mazza
403a82e25e Rename vtxo is_oor to is_pending (#385)
* Rename vtxo is_oor > is_pending

* Clean swaggers
2024-11-20 02:36:35 +01:00
Pietralberto Mazza
247c8bcadf Hotfix: Prevent ZMQ-based bitcoin wallet to panic (#383)
* Hotfix bct embedded wallet w/ ZMQ

* Fixes
2024-11-19 14:13:17 +01:00
Louis Singer
0d2db92173 [Server] Validate forfeit txs without re-building them (#382)
* compute forfeit partial tx client-side first

* fix conflict

* go work sync

* move verify sig in VerifyForfeits

* move check after len(inputs)
2024-11-18 19:08:10 +01:00
Marco Argentieri
6ed4e30b6d Support connecting to bitcoind via ZMQ (#286)
* add ZMQ env vars

* consolidate config and app-config naming
2024-11-18 18:49:00 +01:00
Dusan Sekulic
acb54436dd Panic recovery in app svc (#372)
* panic recovery

* pr review
2024-11-18 12:29:23 +01:00
Louis Singer
ff96524f22 Ark Notes (#379)
* ark credits

* rename "ecash" --> "ark credit"

* rework note_test.go

* NewFromString

* create several notes

* note repo: rename "push" to "add"

* RegisterInputsForNextRoundRequest: move "notes" to field #3

* use uint64 as note ID

* rename to voucher

* add nostr notification

* nostr notification test and fixes

* bump badger to 4.3

* allow npub to be registered

* rename poolTxID

* add default relays

* Update server/internal/config/config.go

Co-authored-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>

* fix RedeemVouchers test

* notification = voucher

* WASM wrappers

* fix arkd voucher cmd

* test_utils.go ignore gosec rule G101

* fix permissions

* rename ALL to notes

* add URI prefix

* note.go : fix signature encoding

* fix decode note.Data

* Update server/internal/infrastructure/notifier/nostr/nostr.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>

* Update pkg/client-sdk/wasm/browser/wrappers.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>

* Update server/internal/infrastructure/notifier/nostr/nostr.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>

* rework note and entity db + sqlite implementations

* NOTIFICATION_PREFIX -> NOTE_URI_PREFIX

* validate NOTE_URI_PREFIX

* Update defaults to convenant-less mainnet (#2)

* config: defaults to convenant-less tx builder

* Drop env var for blockchain scanner

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>

* add // before URI prefix

* add URI prefix in admin CreateNote

* Fixes

* rework nonces encoding (#4)

* rework nonces encoding

* add a check in Musig2Nonce decode function

* musig2_test: increase number of signers to 20

* musig2.json: add a test case with a 35 leaves tree

* GetEventStream REST rework

* fix round phases time intervals

* [SDK] Use server-side streams in rest client

* Fix history

* make the URI optional

* Updates

* Fix settled txs in history

* fix e2e test

* go work sync in sdk unit test

* fix signMessage in btc and liquid sdk wallets

---------

Co-authored-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-11-15 19:07:33 +01:00
Pietralberto Mazza
963f5d89e6 Fix trivy gh action (#381)
* Update trivy gha

* Update tryvy gha

* Fix
2024-11-15 18:12:56 +01:00
Dusan Sekulic
698ba4bf02 Fix nonce encoding/decoding & Fix pop from queue of payment requests (#375)
* bug fix - paymentMap pop input traversal

* bug fix - nonce encode/decode

* pr review

* pr review
2024-11-14 15:09:10 +01:00
Pietralberto Mazza
cd502f3dac [SDK] Improve REST JSON streaming (#374)
* Fixes

* GetEventStream REST rework

* fix round phases time intervals

* [SDK] Use server-side streams in rest client

* Fix history

* Fix

* Drop data in ping response

* Polish

---------

Co-authored-by: louisinger <louis@vulpem.com>
2024-11-11 15:43:57 +01:00
Louis Singer
11b23e15c4 Decrease time for nonces registration (#368) 2024-11-05 15:32:49 +01:00
Louis Singer
04e57f8179 [CLI] Add --rest optional flag to init command (#363) 2024-10-31 18:01:19 +01:00
João Bordalo
786a69da7d [SDK] Fix tx history & Update WASM (#353)
* bugfix on detecting pending vtxos

* bugfix: don't return on error from previous round

* bugfix on wasm browser storage

* implements listVtxos on SDK

* Bug fix

Co-authored-by: Pietralberto Mazza <altafan@users.noreply.github.com>

* bug fix

* Fixes

* revert RedeemTx check

* Fix after merge

* bug fix on wasm wrapper

* Fix static tx history (without tx feed)

* add createAt timestamp in Vtxo domain

* Fixes

* Fixes

* Polish

* Fix

* Fix

---------

Co-authored-by: Pietralberto Mazza <altafan@users.noreply.github.com>
Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
Co-authored-by: louisinger <louis@vulpem.com>
2024-10-31 17:58:39 +01:00
Marco Argentieri
79bb474dd2 Update README.md 2024-10-26 01:51:40 +02:00
Louis Singer
bcb2b2075f Add support for Out Of Round txs (#359)
* [common] rework address encoding

* new address encoding

* replace offchain address by vtxo output key in DB

* merge migrations files into init one

* fix txbuilder fixtures

* fix transaction events

* OOR scheme

* fix conflicts

* [sdk] OOR

* update WASM wrappers

* revert renaming

* revert API changes

* update parser.go

* fix vtxosToTxsCovenantless

* add settled and spent in Utxo and Transaction

* Fixes (#5)

* Revert unneeded changes and rename claim to settle

* Revert changes to wasm and rename claim to settle

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-10-24 17:43:27 +02:00
Louis Singer
b536a9e652 New address encoding (#356)
* [common] rework address encoding

* new address encoding

* replace offchain address by vtxo output key in DB

* merge migrations files into init one

* fix txbuilder fixtures

* fix transaction events
2024-10-18 16:50:07 +02:00
Dusan Sekulic
b1c9261f14 [SDK] Persist tx history, vtxos & Provide transaction feed (#354)
* SDK - GetTransactionsStream add to rest/grpc

no session, pattern or user messages provided

* SDK - AppDataRepository added, store refactor

This patch introduces a significant refactor of the Ark SDK codebase. The primary changes involve:

1. **Domain Package Introduction**: A new `domain` package has been created under `store`, encapsulating core data structures and interfaces such as `ConfigData`, `Transaction`, `SdkRepository`, and various repository interfaces. This enhances modularity and separation of concerns.

2. **Replacement of Store with Domain Objects**: All references to the `store` package's `StoreData` have been replaced with `domain.ConfigData`. This change reflects a shift towards using domain-driven design, where the core business logic is represented by domain objects.

3. **Repository Pattern Implementation**: The code has been refactored to use repositories for accessing and managing data. `ConfigRepository` and `TransactionRepository` interfaces are introduced, providing methods for managing configuration data and transactions, respectively.

4. **New Storage Implementations**: New storage implementations using BadgerDB are introduced for persisting transactions (`transaction_repository.go`). This change indicates a move towards more robust and scalable data storage solutions.

5. **Service Layer Introduction**: A service layer (`service.go`) is introduced, which acts as a facade for the underlying data repositories. This layer abstracts the data access logic and provides a unified interface for interacting with configuration and transaction data.

6. **Code Simplification and Cleanup**: The patch removes redundant code and simplifies the existing codebase by consolidating store-related logic and enhancing the overall structure of the code.

7. **Testing Enhancements**: Test cases are updated to reflect the changes in the data access layer, ensuring that the new repository pattern and domain objects are properly tested.

Overall, this refactor aims to improve the maintainability, scalability, and testability of the codebase by adopting best practices such as domain-driven design, repository pattern, and separation of concerns.

* 'SDK listen for tx stream

This diff represents a substantial refactor and enhancement of the `ark-sdk` client, which involves modifications to multiple files, primarily in the `pkg/client-sdk` and `server/internal/core/application` directories. Here's a summary of the key changes:

1. **Configuration and Initialization**:
   - Refactor to replace file-based configuration store with a domain-based approach.
   - Introduced `ListenTransactionStream` configuration to allow real-time transaction event listening.

2. **Client SDK Enhancements**:
   - The client SDK now supports asynchronous transaction streaming and handling.
   - Introduced methods to get transaction event channels and stop the client gracefully.
   - Expanded the `ArkClient` interface to include these new functionalities.

3. **Transaction Handling**:
   - Added support for listening to and processing transaction events in real-time.
   - Implemented methods to handle different types of transactions, including boarding, redeem, and round transactions.
   - Expanded the `Transaction` struct to include more metadata, such as `BoardingVOut`.

4. **Repository Changes**:
   - Introduced `VtxoRepository` for managing VTXO-related operations.
   - Modified `AppDataRepository` to include `VtxoRepository`.

5. **Example and Test Adjustments**:
   - Updated example code to utilize the new transaction streaming capabilities.
   - Adjusted tests to reflect changes in client initialization and configuration handling.

6. **Dependency Updates**:
   - Updated `go.mod` and `go.sum` to include new dependencies such as `badger` for data storage and potentially updated versions of existing packages.

These changes collectively enhance the functionality of the `ark-sdk` client by enabling real-time transaction handling, improving configuration management, and providing a more robust and scalable client architecture. This update seems to be aimed at improving the efficiency and responsiveness of the client application, likely in response to increased demands for real-time data processing and analysis.'

* merge

* go work sync

* test fix

* Tiny refactor (#2)

* tiny refactor

* renaming

* Renamings

* Fixes (#3)

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-10-17 17:36:48 +02:00
Pietralberto Mazza
03670c9c4b Move btc wallet syncing in background (#352)
* Move btc wallet syncing in bg

* Fix

* Fix e2e test

* Use neutrino in regtest for e2e

* Revert

* Fix
2024-10-17 16:09:19 +02:00
João Bordalo
ea5fa22023 [SDK] Add sendAsync & dump to wasm (#346)
* use bitcoin receivers

* add sendAsync to wasm

* add dump() to wasm
2024-10-09 17:53:58 +02:00
Pietralberto Mazza
bc8df6802e Add env unlocker (#350) 2024-10-05 16:33:55 +02:00
Louis Singer
0d39bb6b9f Add integration tests for sweeping rounds (#339)
* add "block" scheduler type + sweep integration test

* increase timeout in integrationtests

* remove config logs

* rename scheduler package name

* rename package

* rename packages
2024-10-05 16:12:46 +02:00
Louis Singer
7606b4cd00 Drop unconditional forfeits txs in offline payment (#344)
* remove unconditionnal forfeit tx

* fix sqlite vtxo repo

* remove pendingData struct

* delete uncond_forfeits_tx table
2024-10-04 18:06:00 +02:00
Pietralberto Mazza
1d40892196 Add auto-unlocker (#347)
* Add auto-unlocker

* Fixes
2024-10-04 17:08:43 +02:00
Dusan Sekulic
d37af7daf5 Add GetTransactionsStream RPC (#345)
* RPC GetPaymentsStream

This introduces a new feature to the ArkService API that allows clients to subscribe to payment events. Here's a breakdown of the changes:

1. **OpenAPI Specification (`service.swagger.json`):**
   - A new endpoint `/v1/payments` is added to the API, supporting a `GET` operation for streaming payment events.
   - New definitions `v1GetPaymentsStreamResponse`, `v1RoundPayment`, and `v1AsyncPayment` are added to describe the structure of the streaming responses.

2. **Protobuf Definition (`service.proto`):**
   - Added a new RPC method `GetPaymentsStream` that streams `GetPaymentsStreamResponse` messages.
   - Defined new message types: `GetPaymentsStreamRequest`, `GetPaymentsStreamResponse`, `RoundPayment`, and `AsyncPayment`.

3. **Generated Protobuf Code (`service.pb.go`, `service.pb.gw.go`, `service_grpc.pb.go`):**
   - The generated code is updated to include the new RPC method and message types.
   - The gateway code includes functions to handle HTTP requests and responses for the new streaming endpoint.

4. **Application Logic (`covenant.go`, `covenantless.go`):**
   - New payment events channels are introduced (`paymentEventsCh`).
   - Payment events are propagated to these channels when a round is finalized or an async payment is completed.
   - New event types `RoundPaymentEvent` and `AsyncPaymentEvent` are defined, implementing a `PaymentEvent` interface.

5. **gRPC Handlers (`arkservice.go`):**
   - Added logic to handle `GetPaymentsStream` requests and manage payment listeners.
   - A new goroutine is started to listen to payment events and forward them to active listeners.

Overall, this patch extends the ArkService to support real-time streaming of payment events, allowing clients to receive updates on both round payments and async payments as they occur.

* Move emit events in updateVtxoSet & Use generics and parsers (#1)

* Move sending event to updateVtxoSet

* Use generics and parsers

* pr review refactor

* pr review refactor

* fix

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-10-04 12:23:16 +02:00
Pietralberto Mazza
26bcbc8163 [SDK] Fix rest client and wasm (#341)
* Fixes

Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>

* Fixes to rest client

* Fixes to wasm

---------

Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>
2024-10-01 19:00:25 +02:00
altafan
a3deb2d596 [SDK] Hotfix tx history order 2024-09-27 17:50:16 +02:00
Louis Singer
72e31d839a Fix btc wallet restore (covenantless asp) (#332)
* first account = default btcwallet account (account index 0)

* Update server/internal/infrastructure/wallet/btc-embedded/wallet.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* fix restoration

* increase arkd timeout

* fix connector signature

---------

Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>
Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-09-27 17:47:42 +02:00
Louis Singer
ab6ae36eb5 [covenantless] Fix coin selection to build round tx (#336)
* rework createPoolTx

* change address getter

* rename BuildPoolTx --> BuildRoundTx
2024-09-27 16:09:37 +02:00
Pietralberto Mazza
3271776954 Rename API fields (#337)
* Update api-spec

* Update ASP (also domain to drop "pool" completely)

* Update sdk

* Update protos

* Update asp

* Update sdk

* Fixes
2024-09-27 15:35:31 +02:00
Pietralberto Mazza
f36a747c59 API Renaming (#334)
* Update service.proto

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>

* Update buf.yaml

* Fix API order and naming

* Update server

* Update sdk

* Revert update to buf.yaml

* Fix permissions

---------

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
Co-authored-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
2024-09-26 19:21:41 +02:00
Pietralberto Mazza
7676b3ddd2 [Btc embedded wallet] Ignore logs below warning level (#333) 2024-09-26 18:56:19 +02:00
Pietralberto Mazza
b15c0868b2 Drop PendingChange field (#331)
* Drop pending_change

* Fixes

* Polish

* Fallback to psbt string
2024-09-26 14:56:20 +02:00
Louis Singer
2be78b0115 Add forfeit address in GetInfo (#326)
* keep track of forfeit transaction funds

* [btc-embedded] use p2wpkh address

* [sdk] fix clients

* use script as argument of BuildForfeitTxs
2024-09-25 13:15:44 +02:00
Louis Singer
877b7d38cd Support parsing multiple levels descriptors (#325)
* [descriptor] fix parser to support multiple levels descriptors

* add andTokenSize constant
2024-09-20 15:20:57 +02:00
Louis Singer
9e3d667b51 Fix: "tree signing session not found" error (#323)
* failing test

* fix duplicate input register

* fix btc-embedded coin selection

* rename test

* add checks in failing test case

* fixes GetEventStream

* add TODO comment in createPoolTx

* update with master changes

* fix server unit test

* increase liquidity of testing ASP

* simplify AliceSeveralPaymentsBob test
2024-09-20 12:03:12 +02:00
Pietralberto Mazza
5c2065ad47 Make change of async payment spendable (#324)
* Drop unused ComputeOutputScript & use ParseTaprootScript internally

* Add pending field to vtxo domain

* Add check to handle async change as claimed vtxo & Move check to prevent spending penidng vtxos to app level

* Rename utils.go to parser.go & Fixes

* Ignore sent-and-reversible vtxos in ListVtxos

* Fixes

Co-authored-by: Louis Singer <louisinger@users.noreply.github.com>

* Fix e2e test

Co-authored-by: Louis Singer <louisinger@users.noreply.github.com>
Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>

* Fix

* Add PendingChange field to vtxo

* Add PendingChange field to Transaction

* Fixes

* Remove logs

---------

Co-authored-by: Louis Singer <louisinger@users.noreply.github.com>
Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>
2024-09-19 19:44:22 +02:00
Louis Singer
10ef0dbffa Add reversible policy to pending vtxos (#311)
* [server] descriptor-based vtxo script

* [server] fix unit tests

* [sdk] descriptor based vtxo

* empty config check & version flag support

* fix: empty config check & version flag support (#309)

* fix

* [sdk] several fixes

* [sdk][server] several fixes

* [common][sdk] add reversible VtxoScript type, use it in async payment

* [common] improve parser

* [common] fix reversible vtxo parser

* [sdk] remove logs

* fix forfeit map

* remove debug log

* [sdk] do not allow reversible vtxo script in case of self-transfer

* remove signing pubkey

* remove signer public key, craft forfeit txs client side

* go work sync

* fix linter errors

* rename MakeForfeitTxs to BuildForfeitTxs

* fix conflicts

* fix tests

* comment VtxoScript type

* revert ROUND_INTERVAL value

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Co-authored-by: sekulicd <sekula87@gmail.com>
2024-09-19 10:01:33 +02:00
Dusan Sekulic
7a83f9957e [CLI] Fix init checks (#314)
* empty config check & version flag support

* fix: empty config check & version flag support (#309)

* fix

* cli init check
Prevent execution without initialization by checking cfgData and returning error if not initialized

* merge with master

* Replace errors.New with fmt.Errorf

Signed-off-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>

---------

Signed-off-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-09-17 15:42:09 +02:00
João Bordalo
0fe52386e8 [SDK] Add RoundInterval to StoreData (#283)
Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
2024-09-16 17:26:32 +02:00
Louis Singer
3782793431 Add tests for adversarial scenarios (#300)
* fix and test cheating scenario (malicious double spend)

* test and fix async vtxo cheating cases

* add replace statement in go.mod

* Update server/internal/core/application/covenantless.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* Update server/internal/infrastructure/wallet/btc-embedded/psbt.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* Update server/test/e2e/covenant/e2e_test.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* Update server/test/e2e/covenantless/e2e_test.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* Update server/test/e2e/covenantless/e2e_test.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* remove unused

* [btc-embedded] fix GetNotificationChannel

* [tx-builder] fix redeem transaction fee estimator

* close grpc client in tests

* [application] rework listentoscannerNotification

* [application][covenant] fix getConnectorAmount

* [tx-builder][covenant] get connector amount from wallet

* e2e test sleep time

* [liquid-standalone] ListConnectorUtxos: filter by script client side

* fix Makefile integrationtest

* do not use cache in integration tests

* use VtxoKey as argument of findForfeitTxBitcoin

* wrap adversarial test in t.Run

* increaste test timeout

* CI: setup go 1.23.1

* CI: revert go version

* add replace in server/go.mod

* Update server/internal/core/application/covenant.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* remove replace

* readd replace statement

* fixes

* go work sync

* fix CI

---------

Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>
Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-09-16 17:03:43 +02:00
Pietralberto Mazza
4c8c5c06ed Tidy up workspace (#317)
* go work sync

* Clean go.sum files
2024-09-16 15:40:10 +02:00
altafan
4883e692cd [Client] Fixes (#310)
* merge

* fix

* fix: empty config check & version flag support (#309)

* empty config check & version flag support
2024-09-16 11:26:07 +02:00