Commit Graph
100 Commits
Author SHA1 Message Date
wiesche edb0660ea3 merge staging 2026-09-15 22:30:41 +02:00
wiescheandGitHub 991ba1a1f7 use current header version in new slates (#804)
* use current header version

* flip header version check and bump min node version
2026-09-15 19:42:56 +02:00
wiesche dd92ecd898 reuse slate version helper 2026-09-12 15:18:03 +02:00
wiesche 4c84962bc1 unify proof json, breaking older experimental data 2026-09-12 10:38:57 +02:00
wiesche 3db8fdd554 update contract documentation 2026-09-08 18:29:15 +02:00
wiesche 05aaf260bd document contract APIs 2026-09-08 09:08:55 +02:00
wiesche c613d82daf respect slate version 2026-09-07 18:53:36 +02:00
wiesche 7f0c43dfdf decoded slate version 2026-09-06 20:06:49 +02:00
wiesche 39ba6c4ff2 run owner rpc doctests on windows 2026-09-02 20:37:44 +02:00
wiesche dc46cbe73a clean up contract review findings 2026-08-31 23:43:58 +02:00
wiesche 0116bcf74b merge upstream staging into contracts 2026-08-31 18:40:03 +02:00
ardocratandwiesche c0245a03ea Optimize outputs scan and selection (#780) 2026-08-09 19:49:29 +02:00
ardocratandwiesche a3fb40caac Wrong Slatepack address fix (#773) 2026-08-09 19:49:29 +02:00
ardocratandwiesche 9e3ec0ed5b Global config instance (#769)
* config: global instance

* fix: cli tests

* fix: owner api tests

* config: save tor config

* fix: owner rpc tests

* fix: set config file path on init and owner api call

* tor: store launched services, get global config at command loop, remove unused listen args, check for empty global config to set default, do not save empty tor config at owner

* api: update config in memory after successful file write

* arti: restart proxy in loop

* fix: comment for tor config save

* config: set or init, update without error

* config: scoped tor config

* build: update lock file

* config: ability to store multiple configurations at memory from config path

* tor: restart service on config change

* fix: owner api test

* foreign: pass tor config from args, stop service, error handling

* arti: move runtime wrapper to single file

* config: read existing config from file at create_config

* config: handle error on read

* arti: single dir for cache

* foreign: register config listener before launch

* config: save temp

* config: remove unused error type

* config: make path and members not optional, return an error on config creation if it exists, pass default tor config to send if not set

* arti: non public runtime wrapper

* config: migrate comments

* fix: rpc tests

* config: return from cache if exists

* config: save disabled tor config when null provided at owner and tor section was not set

* config: update tor with args at listener

* config: pass pathbuf directly on creation

* config: unique tmp file name, setting permissions and providing config version

* fix global config handling

* fix config persistence

* fix tor service restart

* fix config synchronization

* require wallet close before changing data directory

* unify global config updates

---------

Co-authored-by: wiesche <wiesche89@googlemail.com>
2026-08-09 19:49:29 +02:00
ardocratandwiesche 308f0a8458 Update lmdb (#755)
* wallet: update lmdb from store crate, migrate single backend from trait to struct, update tests cargo deps and design doc

* backend: do not panic on iter and directory creation

* return  iterator errors

* build: update to last node revision

* fix: height selection for scan, remove unused mutability for wallet

* wallet: remove unused mutability conversion

* tx: store slate state at database

* build: cargo fmt

* fix: do not return error when slate not found on tx slate state update

* lmdb: do not collect all tx log records at iterator, show read errors at log

* fix: save slate state, return error if slate not found

* tx: specify amount of bad txs on slate state update error

---------

Co-authored-by: Joerg <wiesche89@googlemail.com>
2026-08-09 19:48:39 +02:00
jwinterm 4883c91d53 Merge upstream staging into contracts
Catches up with #773, #779 and #781. Only the import blocks in
command.rs and api/foreign.rs conflicted.
2026-07-28 16:27:22 -04:00
jwinterm 6d6e19832c Contracts: wire up the contract view command
contract view was in the CLI help but the command returned Not
implemented, and there was no owner API entry point for the existing
libwallet implementation. Add owner::contract_view through to the CLI
and the owner RPC, with a display for the result.

The slate is taken from --input or prompted for, as receive does.

is_executed was hardcoded to false. Derive it from our own tx log entry
for the slate, which is confirmed once the contract has executed.
2026-07-28 11:13:53 -04:00
jwinterm 80e1c29739 Contracts: emit the lowest slate version that fits the payment proof
A legacy send proof uses no V5 field: V4 carries the sender and receiver
addresses and the signature, and only the timestamp and memo need V5.
Sending those as V5 stopped V4-only wallets from reading the slate.

Add SlateVersion::lowest_for and use it from create_slatepack and from
the contract owner API methods, which returned V4 unconditionally and so
dropped the timestamp and memo that an early proof's promise signature
binds. contract_sign keeps the version the counterparty sent when the
slate does not need more.
2026-07-26 14:24:32 -04:00
jwinterm 5397cef9b0 Slate: validate the declared version when deserializing
VersionedSlate and VersionedBinSlate are untagged and try V5 first, so
without a version check a V4 slate parses as V5. Only visible without a
payment proof; with one the V4 and V5 proof shapes differ enough for
serde to pick the right variant by chance.

Reject a mismatched version in the V4 and V5 deserializers, for both the
JSON and binary encodings, and set the declared version from the
conversion so it always matches the structure emitted. Add V4/V5 round
trip tests over both encodings, with and without a proof.

The V3 API examples showed V4 slates declaring version 5; they now
declare 4.
2026-07-26 13:51:36 -04:00
ardocratandGitHub cd6285f8c0 Wrong Slatepack address fix (#773) 2026-07-26 18:07:53 +02:00
jwinterm 894023a863 Merge upstream staging into contracts
Brings the branch current with staging for review.

- ed25519-dalek 1.0.0-pre.4 to 2: PublicKey is now VerifyingKey, Keypair
  is replaced by SigningKey, and from_bytes takes a fixed-size array.
  Ported the contract proof code and the V5 slate serializers, following
  the pattern staging already uses in v4_bin.
- owner_single_use and foreign_single_use now take the wallet instance
  and a config path rather than an optional API handle. Updated the
  contract call sites in command.rs and the contract tests.
- update_tx_slate_state moved to api_impl::types; dropped the local copy.
- Took staging's fixed-size-array form of the slate signature guards; it
  is equivalent to 25a5434 and keeps the file in sync with upstream.
- The grin node is now a submodule, so a build needs
  git submodule update --init.
2026-07-26 07:14:23 -04:00
d2fe2b90f6 Global config instance (#769)
* config: global instance

* fix: cli tests

* fix: owner api tests

* config: save tor config

* fix: owner rpc tests

* fix: set config file path on init and owner api call

* tor: store launched services, get global config at command loop, remove unused listen args, check for empty global config to set default, do not save empty tor config at owner

* api: update config in memory after successful file write

* arti: restart proxy in loop

* fix: comment for tor config save

* config: set or init, update without error

* config: scoped tor config

* build: update lock file

* config: ability to store multiple configurations at memory from config path

* tor: restart service on config change

* fix: owner api test

* foreign: pass tor config from args, stop service, error handling

* arti: move runtime wrapper to single file

* config: read existing config from file at create_config

* config: handle error on read

* arti: single dir for cache

* foreign: register config listener before launch

* config: save temp

* config: remove unused error type

* config: make path and members not optional, return an error on config creation if it exists, pass default tor config to send if not set

* arti: non public runtime wrapper

* config: migrate comments

* fix: rpc tests

* config: return from cache if exists

* config: save disabled tor config when null provided at owner and tor section was not set

* config: update tor with args at listener

* config: pass pathbuf directly on creation

* config: unique tmp file name, setting permissions and providing config version

* fix global config handling

* fix config persistence

* fix tor service restart

* fix config synchronization

* require wallet close before changing data directory

* unify global config updates

---------

Co-authored-by: wiesche <wiesche89@googlemail.com>
2026-07-24 22:15:19 +02:00
jwinterm 178deac700 Contracts: remove the stale contract_setup RPC stubs and tidy the README
The separate contract_setup API was dropped in favor of contract_new/contract_sign.
Remove the two commented-out contract_setup stubs left in the owner RPC trait and
impl, and drop the README action-list items they (and earlier fixes) resolved: the
'remove setup API/CLI' item, the make_outputs-nanogrins item (now done), and the
move-test-utilities item (the per-scenario contract_*.rs tests already cover it).

Addresses PR #754 review (owner_rpc.rs, README.md).
2026-06-10 17:55:56 -04:00
jwinterm 3fba1319fb Merge upstream staging (#755 multi-LMDB backend) into contracts
Reconcile the contract feature with #755, which replaced the WalletBackend
trait with a concrete WalletBackend<C,K> struct (libwallet/src/backend.rs) and
removed impls/src/backends/lmdb.rs.

- Port the contract module and contract API entry points from the trait form
  (T: WalletBackend<'a,C,K>) to the concrete struct.
- Re-home next_child_for and a parent_id+log_id get_tx_log_entry onto backend.rs.
- Re-apply the self-spend tx-log filters, cancel-loop, v5 payment-proof fields,
  and Context contract fields onto staging's rewritten files.
- Adapt to fallible iter()/tx_log_iter() and self-consuming batch commit.

Full suite green (53 binaries / 191 tests).
2026-06-10 13:48:34 -04:00
06ab92a619 Update lmdb (#755)
* wallet: update lmdb from store crate, migrate single backend from trait to struct, update tests cargo deps and design doc

* backend: do not panic on iter and directory creation

* return  iterator errors

* build: update to last node revision

* fix: height selection for scan, remove unused mutability for wallet

* wallet: remove unused mutability conversion

* tx: store slate state at database

* build: cargo fmt

* fix: do not return error when slate not found on tx slate state update

* lmdb: do not collect all tx log records at iterator, show read errors at log

* fix: save slate state, return error if slate not found

* tx: specify amount of bad txs on slate state update error

---------

Co-authored-by: Joerg <wiesche89@googlemail.com>
2026-06-09 13:54:51 +02:00
jwinterm f7d3692ee8 Merge branch 'master' into contracts
Bring the contracts feature branch up to current master, which has since
landed rust 1.80 support (#722), the canonical mwixnet onion code (#726),
and node-client proxy support (#738).

Conflict resolution:
- libwallet/src/mwixnet/*: take master's (#726), dropping the contracts
  branch's older divergent copy. owner.rs::create_mwixnet_req updated to
  master's API (use_test_rng) and master's flat re-export imports.
- Cargo manifests/lock/.cargo: master's deps & version; re-add serde_with
  for Slate v5; keep contracts' .cargo/config.toml (Windows static-CRT).
- lib.rs: keep serde_derive AND serde_with macro_use; single mwixnet decl.
- error.rs: union of master + contracts variants; flat mwixnet re-exports.
- api/libwallet owner.rs: master's #738 + create_mwixnet_req plus the
  contract_* entry points; drop duplicate older create_mwixnet_req method.
- slatepack/armor.rs, node_clients/resp_types.rs: take master's.

Workspace builds; libwallet lib tests pass (34/34). The Slate version()
bug, issue #729 fix, and de-panicking follow in subsequent commits.
2026-06-02 18:26:08 -04:00
YeastplumeandGitHub 6566fc184e Add mwixnet code to master (#726)
* add all comsig code, update to master branch

* refactor code into libwallet, remove some redundancy and update type exports

* added api calls and unit test for comsig request creation

* Addition of JSON-RPC mwixnet function call

* attempt to debug invalid params

* additions to support json doctesting for comsig creation

* tweaks to testing and documentation updates

* dependencies for tests
2024-11-01 10:45:09 +00:00
yeastplume 7ac35f134b Revert "[CONTRACTS] Contracts branch update for 1.80 (#718)"
This reverts commit cdd63fb565.
2024-09-19 09:05:44 +00:00
cdd63fb565 [CONTRACTS] Contracts branch update for 1.80 (#718)
* Simple contracts restructured v3 (#675)

* Add prototype contract implementation

Lacks:
- Payment proofs (add early payment proofs)
- Tests
- Better structure

* Separate contract utilities

* Simplify the main setup/sign code flow

* Remove commented initial_sec_key assignment

* Simplify sign::compute function

* Add logic for "removal" of secret keys from the context

* Further simplify a bit sign and setup

* No need for mutable context when adding outputs

* Refactor the commented code (lol)

* Refactor a bit

* tmp

---------

Co-authored-by: oryhp <gtrphyro@gmail.com>

* contract test fixes (#676)

* [Contracts] Experimental Slate v5 (#677)

* beginning to add and modify slate version 5

* completion of conversions from V5 to V4 Slate

* timestamp and memo fields

* upgrade/downgrade serialization of v5 slates

* add v5 binary slate versions + start of tests

* add bin slate ser/deser to tests

* ensure serialization of timestamp always excludes milliseconds

* start to update v5 tests, update v5 documentation

* add fn to generate populated internal slate for conversion testing

* add basic tests to convert all slate versions

* update

* commit cargo.lock

* [WIP] [Contracts] Early payment proofs (#681)

* add types and beginnings of signature utils

* add proof serialization

* serialisation of proof data + signature operation

* add serialization type for invoice proof + separate bin wrapper version

* add witness data + serializion to invoice payment proof, insert verfication functions in place in order to begin verification testing

* tests and infrastructure in place for validation

* verification of promise sig

* added verification of promise signature, infrastructure up to the point where a signature must be subtracted

* attempting to figure out differences between recipient nonce that's getting stored and calculated recipient nonce

* implementation of witness verification function, retrieve relevant values and re-validate derived recipient partial signature

* move stored portion of invoice proof into core types for storage, need to rename invoice proof

* define/refine the stored portion of payment proofs type 2?

* Folding all proof data into tx log entry storage

* back to importing master

* remove cargo files from diffs

* remove a lot of extra debug output

* return proof witness as part of proof retrieval, define json serialization of invoice proof + witness fields

* finish adding verification steps to foreign API

* remove redundant promise sig field

* move lcation of sign/verify calls

* Replace Azure Pipelines with Github Actions (#688)

* Update CI Badge on README.MD (#690)

* Trigger CI on push and pull request (#693)

* Update versioning to 5.2.0-beta.1 against grin 5.2.0-beta.3 (#691)

* update versioning to 5.2.0-beta.1 against grin 5.2.0-beta.3

* tweak for CI trigger

---------

Co-authored-by: Quentin Le Sceller <q.lesceller@gmail.com>

---------

Co-authored-by: Quentin Le Sceller <q.lesceller@gmail.com>

* fix Cargo.lock

* Contracts - Test fixes + warning cleanups (#694)

* clean up warnings in libwallet crate

* clean up warnings in controller crate

* update all contract tests with awareness of new proof structure

* added explicit payment proof tests for both rsr and srs (#695)

* Basic mwmixnet send (#696)

* integrating onion library

* updates and changes to support newly included mwmixnet types

* add (incorrect) owner api function

* turn off test for now

* switch working grin branch to master

* fix doctests for build

* update cargo lock in attempt to fix croaring build on CI server

* update cargo lock with upstream thiserror crate

* update test dependency for croaring

* [Contracts] Add self spend transaction state (#697)

* Add self spend transaction state

* subtle errors with output states and tx lookups - fixes

* [Contracts] Slatepack v5 Deserialization fix (#698)

* add V5 deserialization test + fixes

* clarify comment

* upwrap fix during v4 deserialization

* further unwrap removal

* update cargo lock, use latest grin packages

* addition of self-spend cancel + tests (#699)

* add tests + legacy self send cancel (#702)

* [Contracts] Cancel self-spend TX Pt. 2 (#703)

* add tests + legacy self send cancel

* add missing file

* Update grin to latest master, change versioning label to include contracts (#712)

* Add owner_api_listen_interface as hidden configuration field (#714)

* updates for rust 1.80

* updates for rust 1.80

---------

Co-authored-by: oryhp <gtrphyro@gmail.com>
Co-authored-by: Quentin Le Sceller <q.lesceller@gmail.com>
2024-08-27 12:30:22 +01:00
YeastplumeandGitHub fa78d72d35 Contracts - Test fixes + warning cleanups (#694)
* clean up warnings in libwallet crate

* clean up warnings in controller crate

* update all contract tests with awareness of new proof structure
2023-08-10 13:24:25 +01:00
YeastplumeandGitHub 063e91d5e5 [Contracts] Experimental Slate v5 (#677)
* beginning to add and modify slate version 5

* completion of conversions from V5 to V4 Slate

* timestamp and memo fields

* upgrade/downgrade serialization of v5 slates

* add v5 binary slate versions + start of tests

* add bin slate ser/deser to tests

* ensure serialization of timestamp always excludes milliseconds

* start to update v5 tests, update v5 documentation

* add fn to generate populated internal slate for conversion testing

* add basic tests to convert all slate versions
2023-04-18 09:57:38 +01:00
f0cf8b0a7d Simple contracts restructured v3 (#675)
* Add prototype contract implementation

Lacks:
- Payment proofs (add early payment proofs)
- Tests
- Better structure

* Separate contract utilities

* Simplify the main setup/sign code flow

* Remove commented initial_sec_key assignment

* Simplify sign::compute function

* Add logic for "removal" of secret keys from the context

* Further simplify a bit sign and setup

* No need for mutable context when adding outputs

* Refactor the commented code (lol)

* Refactor a bit

* tmp

---------

Co-authored-by: oryhp <gtrphyro@gmail.com>
2023-03-20 10:09:17 +00:00
Yeastplume b1beca4206 remove _inc from field names 2022-12-01 09:44:51 +00:00
Yeastplume ae7145029b revert test change 2022-11-29 11:28:49 +00:00
Yeastplume 17edec25c8 split JSON api functions into existing retrieve_tx and new query_txs functions 2022-11-29 10:43:10 +00:00
Yeastplume 1188f3287d add doctest exercising advanced query JSON API 2022-11-29 09:30:45 +00:00
Yeastplume cd3203be23 update transaction
api calls throughout
2022-11-22 13:25:44 +00:00
YeastplumeandGitHub 8384a3ebb0 Remove grin lib re-exports from util crate (#661)
* updated util and libwallet with thiserror

* update impl crate to thiserror

* api crate converted to thiserror

* update of controller crate to thiserror

* update final bin + tests to thiserror

* update unused import

* remove failure derive

* reset import of grin to master

* update cargo lock

* update from master

* remove grin libs re-export from util crate :(

* temp local

* point code at bleeding edge grin master branch
2022-08-08 12:08:25 +01:00
YeastplumeandGitHub 64cab53b1b Replace failure with thiserror (#654)
* updated util and libwallet with thiserror

* update impl crate to thiserror

* api crate converted to thiserror

* update of controller crate to thiserror

* update final bin + tests to thiserror

* update unused import

* remove failure derive

* reset import of grin to master

* update cargo lock

* update from master
2022-07-28 10:21:45 +01:00
67f0e2b0e0 Remove method from grin-wallet.yml and keybase.rs from adapters (#658)
* Remove method from grin-wallet.yml and keybase.rs from adapters

* Remove keybase_notify_ttl from config

* Remove keybase_notify_ttl from config

* Fix tests

Co-authored-by: rstetsurin <rstetsurin@coinloan.io>
2022-07-26 10:19:46 +01:00
scilioandGitHub 2924a0ddb2 Add 'build_output' endpoint to owner api (#641)
* add 'build_output' endpoint to owner api

* merge fix
2022-02-18 10:06:04 +00:00
deevopeandGitHub d70423af57 View Wallet - fn rewind_hash & scan_rewind_hash (#632)
* fn rewind_hash & scan_rewind_hash

* update comments

* update doctest
2021-12-14 12:23:17 +00:00
Quentin Le ScellerandGitHub 4e4880be8e Update copyright license year to 2021 (#587) 2021-03-05 13:30:51 -05:00
Quentin Le ScellerandGitHub b4abb5921e [5.0.x] Fix doctest (#578) (#592)
* Temp fix for CI
2021-03-05 12:13:19 -05:00
8334304c16 fixfees on grin-wallet (#526)
* change fee to fee_fields in various structs and fix tests for new fee calculation

* set up accept_fee_base param in grin-wallet.toml

* fix bug and adopt new tx_fee interface

* Fix doctests

* Remove left over debug statement

* revert field name feef to fee to remain slate compatible

* use into() for some literal fee_fields

* add height arguments to FeeFields methods where necessary

* Fix tests

* Rename fee_fields -> fee on Context

* Rename fee_fields -> fee on TxLogEntry

* Update to grin master

* replace fee(0) by fee(2*YEAR_HEIGHT) to get fee masking

* Fix compilation error and revert Cargo lock

* fix wrong height passed into next_difficulty

Co-authored-by: Jasper van der Maarel <j@sper.dev>
2020-11-26 20:46:03 +01:00
jaspervdmandGitHub a83f92dfd3 Late locking (experimental) (#530)
* Late locking (experimental)

* Error on fee change

* Improve comments

* Fix typo in comment

* Add late locking flag to CLI command
2020-11-19 12:54:49 +01:00
Quentin Le ScellerandGitHub 0d512114a3 Fix API doc typo (#449)
* Fix API doc typo
2020-07-20 14:55:20 -04:00
YeastplumeandGitHub 354b8e46a6 Change base64 serialization back to hex in JSON slate output (#457)
* Change base64 serialization back to hex in JSON slate output

* update V4 slate change description
2020-06-26 12:37:54 +01:00
YeastplumeandGitHub f8ea76732b Modify get_stored_tx functions + tests (#454) 2020-06-25 10:06:04 +01:00
YeastplumeandGitHub 040b28f35a rework decode_slatepack function to accept decryption key indices (#445) 2020-06-15 14:39:52 +01:00