Commit Graph
448 Commits
Author SHA1 Message Date
jwinterm 4fcb6053d5 Make contract slatepack encryption optional
--encrypt-for is no longer required. `contract new` without it produces an
unencrypted slatepack; `contract sign` without it replies to the incoming slate's
sender when known, otherwise unencrypted. Passing --encrypt-for is unchanged. The
slatepack layer already produced plaintext for an empty recipient list — this only
removes the CLI-side requirement.
2026-06-04 07:40:03 -04:00
jwinterm b7b7a6d21d Merge upstream staging into contracts
Bring the branch current with upstream staging (= master + #748). The earlier
"Merge branch master into contracts" used a stale local master snapshot, which
left the branch ~41 commits behind; this merges the current tip, including the
grin 5.4.0 dependency bump (#745) and the tx-delete / retrieve_txs fixes.

Only Cargo.lock conflicted (regenerated). Full cargo test --workspace green
(52 binaries / 185 tests).
2026-06-03 15:27:43 -04:00
jwinterm 3fcf3b7816 De-panic output_amounts(): fallible make-outputs parsing
OutputSelectionArgs::output_amounts() unwrap()'d the float parse of each
make-outputs value, panicking on bad input via the API path (the CLI now
validates earlier). Return Result instead; sum_output_amounts() propagates.
num_custom_outputs() now counts CSV entries without parsing, so it stays
infallible and the debug! macros that use it are unaffected.
2026-06-03 13:56:32 -04:00
jwinterm 2e3b04498c De-panic and validate contract CLI input handling
Bad input to the contract CLI could abort the process:
- a non-numeric --make-outputs value reached output_amounts(), which
  unwrap()s the float parse;
- `contract new` with neither --send nor --receive hit a panic in
  get_net_change;
- `contract sign` panicked ("No address to encrypt for") when given no
  --encrypt-for and an incoming slate with no embedded sender.

Validate --make-outputs and require exactly one of --send/--receive at
parse time (ParseError, before reaching the panicking paths), and return a
typed error instead of panicking when there is no address to encrypt for.
Verified at runtime: each now yields a clean "Invalid Arguments" error.
2026-06-03 09:33:11 -04:00
jwinterm 9d040b40f1 Harden the contract signing-context forget invariant
Remove the broken, commented-out SEC_KEY_FAKE key-scrubbing: a zero secret
key is rejected by secp, and the scrubbing was redundant. The signing
context holding sec_key/sec_nonce is forgotten by deleting the private
context in save_step once signed (retained only at step2 for safe cancel),
and contexts are keyed by slate.id so a nonce is never reused across
messages.

Make that guarantee enforced rather than assumed: after a signed,
non-step2 save_step, verify the private context was actually removed and
error otherwise. Document the invariant at the sign site.
2026-06-03 08:03:35 -04:00
jwinterm 3a86bb4fce Replace reachable panics in contract flow with typed errors
Contract setup/sign and output selection used panic! on
protocol-reachable invariant violations: receiver fee exceeding
net_change, net_change / num_participants mismatch between the setup and
sign phases, a negative change output, conflicting selection args, and a
failed kernel-excess computation. A crafted or inconsistent counterparty
slate could abort the wallet. Return Error::GenericError (or propagate the
underlying error) instead; build_output_amount_list now returns Result.
2026-06-03 07:29:04 -04:00
jwinterm 311140f6f6 De-panic contract CLI argument parsing
The contract new/sign/revoke parsers panicked or unwrapped on user input:
conflicting --no-payjoin/--use-inputs, and unparseable receive / send /
num-participants / tx-id values would abort the process. Return
ParseError instead, and add a parse_grin_amount helper for the
Grin->nanogram conversion.
2026-06-02 21:02:24 -04:00
jwinterm 25dab9fe5b Harden v5 payment-proof deserialization against malformed input
ProofWrap::read unwrapped on the sender/receiver address, promise
signature, and memo_type while parsing untrusted slatepack bytes, so a
malformed payment proof would panic the wallet. Propagate CorruptedData
instead, matching the timestamp path already in this function.
2026-06-02 20:58:22 -04:00
jwinterm 46999ce9f5 Make payment proofs opt-in to fix #729
Default ProofArgs.suppress_proof to true. With it false, the receiver's
`contract sign` unconditionally built an invoice promise, but the sender
address is never plumbed through, so a bare send/receive failed with
NoSenderAddressProvided (#729). The CLI never sets this field, so every
default `contract sign --receive` hit the broken path; the basic tests
passed only because they set suppress_proof = true by hand.

Drop those workarounds from contract_srs/contract_rsr so they now exercise
the default path, and opt the proof-using tests (contract_early_proofs_srs,
contract_early_proofs_rsr, contract_accounts) into proofs explicitly.
2026-06-02 20:25:48 -04:00
jwinterm 475db1d289 Fix contract_srs_mwmixnet test import after merge
master's mwixnet (#726) keeps the `types` submodule private and re-exports
its items, so use the public `mwixnet::MixnetReqCreationParams` path. The
merge missed this because `cargo check --workspace` does not build test
targets.
2026-06-02 20:15:03 -04:00
jwinterm 79a403127b Fix VersionedSlate::version() misreporting V5 slates as V4
version() returned SlateVersion::V4 for the V5 variant, so any
version-aware logic downstream would misidentify a V5 slate as V4.
Return V5 for V5.
2026-06-02 18:27:12 -04: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
129ad2f5fb Save last scanned block info for wallet scanning (#748)
* scan: save last scanned block info for initial wallet scanning

* scan: save start height at scanned block info on outputs collecting

* scan: 10k blocks batches

* fix: include last height into batch on scan

* scan: save hash of last block

* scan: add larger window (2880 blocks) to scan outputs when updating wallet state

* add test batched scan and resume, add scan doc

* rename corrupted restore test

---------

Co-authored-by: Joerg <wiesche89@googlemail.com>
2026-06-02 20:09:50 +02:00
ardocratandGitHub 602d79e868 Update rust edition to 2021 (#749)
* build: update rust edition 2021

* cargo: format all

* build: fix tests and warnings
2026-05-14 12:58:22 +02:00
David BurkettandGitHub a3e71a8b2d Merge pull request #732 from Anynomouss/master
Ready for review: Fix for many wallet config errors including solution for -h and -t wrongly setting the node path
2026-05-07 10:06:26 -04:00
AnynomoussandGitHub c337a7aad6 Update default.rs
removed 2fA code 😅
2026-05-07 16:05:16 +02:00
AnynomoussandGitHub 555469fb75 Merge pull request #1 from mimblewimble/master
Trying to merge master 9 commits into my branch. All checks passed.
2026-04-14 10:29:22 +02:00
David BurkettandGitHub e732cbdc44 Merge pull request #745 from ardocrat/grin_5.4.0
Grin 5.4.0 update
2026-03-23 15:54:57 -04:00
David BurkettandGitHub f72784a578 Merge pull request #746 from GetGrin/tx_delete
Ability to delete transaction from database
2026-03-23 15:52:46 -04:00
ardocrat c4f473568f tx: ability to delete transaction from database 2026-03-21 22:48:52 +03:00
ardocrat d2edbe12d3 build: update deps to grin 5.4.0 and hyper 0.14 2026-03-10 03:32:20 +03:00
David BurkettandGitHub 5aa02fdea3 Merge pull request #743 from GetGrin/retrieve_txs_account
Retrieve txs for an account with custom query arguments
2026-03-05 08:28:42 -05:00
David BurkettandGitHub 63a3f5aabf Merge pull request #744 from GetGrin/ci_fix
Github CI Windows tests fix
2026-03-05 08:28:27 -05:00
ardocrat a099078f31 build: update built lib 2026-03-04 20:07:15 +03:00
ardocrat b49e2dfecd fix: retrieve txs for an account with custom query arguments 2026-03-04 18:43:04 +03:00
Anynomouss a6ba9c9781 Implemented all feedback from aglkm 2025-10-09 09:18:00 +02:00
AnynomoussandGitHub cb245d6ed1 Update transaction.rs - no real changes, revert small fromat change 2025-09-19 09:36:17 +02:00
AnynomoussandGitHub a51121ce2a Update command.rs cleaning up irrelevant changes 2 2025-09-19 09:34:14 +02:00
AnynomoussandGitHub 8b93f2a616 Update Cargo.toml
cleaning up files that are essentially unchanged
2025-09-19 09:30:41 +02:00
Anynomous ea1d68fd03 Normalize line endings, attempt 2 2025-09-18 14:56:43 +02:00
Anynomous 86de7c6bcd Normalize line endings 2025-09-18 14:51:29 +02:00
Anynomous aed932726c Committing, changed git setings for core.autocrlf to false to avoid LF to CRLF conversion, hope it works 2025-09-18 13:56:05 +02:00
Anynomous 6d99a431dd Wallet init -t and -h working, as well as with info, always detect grin-wallet.toml in working dir, same as old wallet 2025-09-18 11:42:04 +02:00
Anynomous 2bea5b6826 Same as previous fixes to absoluet path and more, apperently forgot to save a file 2025-09-13 15:49:26 +02:00
Anynomous 34b1d0c665 Fixed issue with top-dir without init, better absolut e path and more cleanup 2025-09-12 16:41:41 +02:00
Anynomouss e05aefa135 Preparing to merge with Pull 734, not fully ready yet 2025-06-30 21:40:47 +02:00
ardocratandGitHub 930a44d456 http: provide proxy on node client creation (#738) 2025-06-18 16:01:06 +01:00
Anynomouss d3625a6faf Added auto detection of wallet-dir in current directory, fix for loading config in current dir 2025-05-23 16:08:57 +02:00
Anynomouss da0050172b Some last fixes to format directory paths using OS seperator everwhere in all warning messages 2025-04-11 17:21:52 +02:00
Anynomouss a37aa09f9f Smart config loading, initializing, normal and template works, do some last tests on Linux 2025-04-10 17:16:45 +02:00
Anynomouss 39f00fe8b7 Fix for top dir with backlashes to work on Linux and to properly format the path in the seed generation message 2025-04-08 11:04:12 +02:00
Anynomouss cd2f64c234 Third attempt to make a workaround for the Linux specific bug in the fs crate, to make it support backslashess in top_dir path 2025-04-06 21:59:36 +02:00
Anynomouss 004c46958b Second attempt to fix double path generation bug present in the original grin-wallet code, probably by an inherent bug in fs::create_dir_all 2025-04-04 15:32:23 +02:00
Anynomouss 21188555c6 Additional fix for double path generation bug present in the original grin-wallet code, test on Linux if it works 2025-04-04 14:37:30 +02:00
Anynomouss 37715f189f Fixes config node_dir problems, all logic for config creation moved grin-wallet.rs -> config::initial_setup_wallet, requires more testing! 2025-04-04 12:20:46 +02:00
AnynomoussandGitHub 38aa2f5c10 Merge branch 'mimblewimble:master' into master 2025-03-13 19:04:12 +01:00
Yeastplume b1ffe86a55 Revert "Fix for many wallet config errors (#731)"
This reverts commit 7ceade4449.
2025-03-08 13:28:27 +00:00
AnynomoussandGitHub 7ceade4449 Fix for many wallet config errors (#731)
* Added an extra warning message when failing to reach the node, work in progress on changing default dir for node api ssecret 'foreign_api_secret'

* In the middle of debugging hell, default overwrite any updates to the config made earlier, its never written to a file when running init

* More debugging, next trace the overwrite of the config

* Added get get_node_path function, seperating wallet dir and node_dir -compiling but some  warnings

* Tested wallet config creation fix for Issues: #728 #3394 Pull 3420, partial fix for 3002

* Removed some debugging code

* Fixed passing config to create_config function, some more test needed before pulling to main

* All test succeed: a) normal, b) top-dir, c) here, d) with default config template in working dir

* Cleaning up

* Fixed a single test for config that needed adjusting
2025-03-08 12:22:59 +00:00
Anynomouss c5b8c3413c Fixed a single test for config that needed adjusting 2025-03-03 20:58:27 +01:00
Anynomouss fe86c7a7e5 Cleaning up 2025-03-01 14:23:39 +01:00