Skip to content

Commit eed29be

Browse files
authored
Merge branch 'main' into fix/wallet-seed-rng-osrng-286
2 parents b56c0f3 + bbaef35 commit eed29be

154 files changed

Lines changed: 5248 additions & 513 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_and_lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
push:
33
branches:
4-
- dev
4+
- main
55
pull_request:
66
branches:
77
- main

.github/workflows/integration_test.yml

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ on:
22
push:
33
branches:
44
- main
5-
- dev
65
pull_request:
76
branches:
87
- main
@@ -14,6 +13,10 @@ env:
1413
# rippled binary was renamed to xrpld; use the new image name.
1514
# Tracks xrpl.js PR #3270 (https://github.com/XRPLF/xrpl.js/pull/3270).
1615
XRPLD_DOCKER_IMAGE: rippleci/xrpld:develop
16+
# Files measured by the integration coverage gate are the inverse of this regex.
17+
# Unit-test territory (models, core, utils, _serde) is excluded; integration territory
18+
# (CLI, asynch::clients, account/, ledger/, transaction/, faucet) is what remains.
19+
COVERAGE_IGNORE_REGEX: '(_serde|core|models|utils)/|constants\.rs$|macros\.rs$|lib\.rs$|wallet/(mod|exceptions)\.rs$|tests/'
1720

1821
jobs:
1922
integration_test:
@@ -31,12 +34,17 @@ jobs:
3134
--rm \
3235
--publish 5005:5005 \
3336
--publish 6006:6006 \
34-
--volume "${{ github.workspace }}/.ci-config/":"/etc/opt/xrpld/" \
37+
--volume "${{ github.workspace }}/.ci-config/":"/etc/xrpld/" \
3538
--name xrpld-service \
3639
${{ env.XRPLD_DOCKER_IMAGE }} --standalone
3740
3841
- uses: dtolnay/rust-toolchain@stable
3942

43+
- name: Install cargo-llvm-cov
44+
uses: taiki-e/install-action@65851e10cd6c377f11a60e600abc07cb08643468 # v2.79.3
45+
with:
46+
tool: cargo-llvm-cov
47+
4048
- name: Cache cargo registry
4149
uses: actions/cache@v4
4250
with:
@@ -48,11 +56,40 @@ jobs:
4856
restore-keys: |
4957
${{ runner.os }}-cargo-integration-
5058
51-
- name: Run integration tests
52-
run: cargo test --release --features std,json-rpc,helpers,integration --test integration_test -- --test-threads=1
59+
- name: Run integration tests under coverage
60+
run: |
61+
cargo llvm-cov --no-report --release \
62+
--features std,json-rpc,helpers,cli,websocket,integration \
63+
--test integration_test \
64+
--test cli_integration \
65+
--test funding \
66+
--test utils \
67+
--test test_utils \
68+
-- --test-threads=1
5369
env:
5470
RUST_BACKTRACE: 1
5571

72+
- name: Generate lcov report (scoped to integration territory)
73+
run: |
74+
cargo llvm-cov report --release \
75+
--lcov --output-path lcov.info \
76+
--ignore-filename-regex '${{ env.COVERAGE_IGNORE_REGEX }}'
77+
78+
- name: Upload coverage to Codecov
79+
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
80+
with:
81+
token: ${{ secrets.CODECOV_TOKEN }}
82+
files: lcov.info
83+
flags: integration
84+
fail_ci_if_error: true
85+
86+
- name: Upload coverage report
87+
if: always()
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: integration-lcov-report
91+
path: lcov.info
92+
5693
- name: Dump xrpld logs and stop container
5794
if: always()
5895
run: |

.github/workflows/quality_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
on:
22
push:
33
branches:
4-
- dev
4+
- main
55
pull_request:
66
branches:
77
- main
88
- dev
99
schedule:
10-
- cron: '0 0 * * *'
10+
- cron: "0 0 * * *"
1111

1212
name: Quality Check
1313

.github/workflows/unit_test.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
push:
33
branches:
4-
- dev
4+
- main
55
pull_request:
66
branches:
77
- main
@@ -34,22 +34,44 @@ jobs:
3434
RUST_BACKTRACE: 1
3535

3636
- name: Test for no_std
37-
run: cargo test --release --no-default-features --features embassy-rt,core,utils,wallet,models,helpers,websocket,json-rpc
37+
run: cargo test --release --no-default-features --features
38+
embassy-rt,core,utils,wallet,models,helpers,websocket,json-rpc
3839
env:
3940
RUST_BACKTRACE: 1
4041

4142
- name: Install cargo-llvm-cov
4243
uses: taiki-e/install-action@cargo-llvm-cov
4344

45+
# Unit-test coverage is scoped via Cargo features rather than path
46+
# exclusion. The minimal feature set (`std,core,utils,wallet,models`)
47+
# compiles only the pure-logic modules — pure crypto, codec, address
48+
# codec, transaction models, and the `signing` module. Integration-
49+
# territory code (CLI, async network clients, sync wrappers around
50+
# network calls, faucet client) is gated behind `helpers`/`json-rpc`/
51+
# `websocket`/`cli` features, so it simply isn't compiled here and
52+
# doesn't appear in the coverage report. Those files are exercised by
53+
# the integration-test workflow against a live rippled.
4454
- name: Generate coverage report
45-
run: cargo llvm-cov --lcov --output-path lcov.info
55+
run: |
56+
cargo llvm-cov \
57+
--no-default-features --features std,core,utils,wallet,models \
58+
--lcov --output-path lcov.info
4659
4760
- name: Check coverage thresholds
4861
run: |
4962
cargo llvm-cov --summary-only \
50-
--fail-under-lines 73 \
51-
--fail-under-regions 75 \
52-
--fail-under-functions 67
63+
--no-default-features --features std,core,utils,wallet,models \
64+
--fail-under-lines 83 \
65+
--fail-under-regions 85 \
66+
--fail-under-functions 73
67+
68+
- name: Upload coverage to Codecov
69+
uses: codecov/codecov-action@v5
70+
with:
71+
token: ${{ secrets.CODECOV_TOKEN }}
72+
files: lcov.info
73+
flags: unit
74+
fail_ci_if_error: true
5375

5476
- name: Upload coverage report
5577
uses: actions/upload-artifact@v4

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414

1515
### Added
1616

17+
- New `xrpl::signing` module containing the pure-crypto signing helpers (`sign`, `multisign`, `prepare_transaction`) extracted from `asynch::transaction` and `transaction`. Available with just `core + models + wallet` features (no `helpers`/runtime/client dependency). The legacy paths `asynch::transaction::sign` and `transaction::multisign` are preserved as re-exports for backward compatibility.
18+
- Expanded unit-test coverage and raised CI thresholds: lines `73 → 83`, regions `75 → 85`, functions `67 → 73`.
19+
- Codecov integration with per-PR project (≥83%) and patch (≥80% on new/modified lines) gates.
20+
- Integration-test coverage gate: a CI workflow runs all five integration test binaries under `cargo-llvm-cov`, uploads to codecov under an `integration` flag, and gates the project at ≥65%.
21+
22+
### Changed
23+
24+
- Unit-test and integration-test coverage are now scoped via Cargo feature flags rather than path regex. The unit-test workflow builds with `--no-default-features --features std,core,utils,wallet,models`, so integration-territory code (CLI, async clients, sync wrappers, faucet) simply isn't compiled and doesn't appear in the unit coverage report.
25+
- Network-dependent inline tests in `src/asynch/transaction/` and `src/asynch/wallet/` (`test_autofill_txn`, `test_autofill_and_sign`, `test_submit_and_wait`, `test_generate_faucet_wallet`) are now gated behind `feature = "integration"` so `cargo test --release` is hermetic by default.
26+
- Codecov **patch** coverage is now gated per flag (separate `unit` and `integration` sections) rather than a single combined gate.
27+
1728
### Fixed
1829

30+
- `RipplePathFind::destination_amount` changed from `Currency<'a>` to `Amount<'a>` to match the XRPL wire format.
31+
- `NoRippleCheckRole` no longer serializes with the `#[serde(tag = "role")]` discriminator; now emits a plain `snake_case` string matching the XRPL wire format.
32+
- `is_success()` now reports success correctly for responses deserialized into typed `XRPLResult` variants (e.g. `ServerInfo`); it consults the preserved raw result JSON instead of the re-serialized typed value.
33+
- `get_latest_open_ledger_sequence` now uses the `ledger_current` request; it previously sent `ledger { ledger_index: "open" }`, which rippled rejects with `invalidParams`.
34+
1935
## [[v1.1.0]]
2036

2137
### Added

CONTRIBUTING.md

Lines changed: 68 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,33 @@ From the `xrpl-rust` folder, run the following commands:
7474
```bash
7575
# Sets up the xrpld standalone Docker container — skip if you already have it running
7676
docker run -p 5005:5005 -p 6006:6006 --rm -it --name xrpld_standalone \
77-
--volume "$PWD/.ci-config/:/etc/opt/xrpld/" \
77+
--volume "$PWD/.ci-config/:/etc/xrpld/" \
7878
rippleci/xrpld:develop --standalone
79-
cargo test --release --features integration,std,json-rpc,helpers
79+
cargo test --release \
80+
--features std,json-rpc,helpers,cli,websocket,integration \
81+
-- --test-threads=1
8082
```
8183

8284
To run a specific group of tests (e.g. escrow):
8385

8486
```bash
85-
cargo test --release --features integration,std,json-rpc,helpers escrow
87+
cargo test --release \
88+
--features std,json-rpc,helpers,cli,websocket,integration \
89+
escrow -- --test-threads=1
8690
```
8791

92+
The feature set matches `.github/workflows/integration_test.yml`; `cli` and
93+
`websocket` are required for `cli_integration.rs` and the websocket tests in
94+
`utils.rs` to compile. `--test-threads=1` matches CI and prevents concurrent
95+
tests from racing on the shared `xrpld` container.
96+
8897
Breaking down the `docker run` command:
8998

9099
- `-p 5005:5005 -p 6006:6006` exposes the HTTP JSON-RPC and WebSocket admin ports.
91100
- `--rm` closes the container automatically when it exits.
92101
- `-it` keeps stdin open so you can stop the node with Ctrl-C.
93102
- `--name xrpld_standalone` is an instance name for clarity.
94-
- `--volume $PWD/.ci-config/:/etc/opt/xrpld/`: bind-mounts the host directory (left side) into the container (right side). `xrpld.cfg` lives in `$PWD/.ci-config/`, and this command is intended to be run from the root of the `xrpl-rust` project. The `xrpld` binary searches for its configuration file inside `/etc/opt/xrpld/`. An absolute path is required, so we use `$PWD` instead of `./`.
103+
- `--volume $PWD/.ci-config/:/etc/xrpld/`: bind-mounts the host directory (left side) into the container (right side). `xrpld.cfg` lives in `$PWD/.ci-config/`, and this command is intended to be run from the root of the `xrpl-rust` project. The `xrpld` binary searches for its configuration file inside `/etc/xrpld/`. An absolute path is required, so we use `$PWD` instead of `./`.
95104
- `rippleci/xrpld` is an image that is regularly updated with the latest `xrpld` releases (the binary formerly known as `rippled`; see xrpl.js PR #3270).
96105
- `--standalone` starts `xrpld` in standalone mode, where ledgers only close on demand.
97106

@@ -102,24 +111,69 @@ Breaking down the `docker run` command:
102111

103112
### Coverage
104113

105-
Coverage is measured with [`cargo-llvm-cov`](https://github.com/taiki-e/cargo-llvm-cov).
114+
Coverage is measured with [`cargo-llvm-cov`](https://github.com/taiki-e/cargo-llvm-cov)
115+
and uploaded to codecov under two separate flags:
116+
117+
- **unit** — pure-logic code (models, core, utils, `_serde`, signing). Built
118+
with a minimal feature set so network-bound modules are not compiled.
119+
- **integration** — network-bound code (CLI, async clients, faucet, helpers
120+
under `account/`, `ledger/`, `transaction/`). Scoped via
121+
`--ignore-filename-regex` so unit-territory files do not dilute the
122+
integration metric.
106123

107-
Install the tool and run a coverage report locally:
124+
Install the tool once:
108125

109126
```bash
110127
cargo install cargo-llvm-cov --locked
111-
cargo llvm-cov --summary-only
112128
```
113129

114-
The CI enforces the following minimum thresholds (current baseline is ~78% lines / ~68% regions / ~75% functions, measured with default features only — integration tests are excluded from coverage):
130+
#### Unit coverage
131+
132+
Matches `.github/workflows/unit_test.yml`:
133+
134+
```bash
135+
cargo llvm-cov \
136+
--no-default-features --features std,core,utils,wallet,models \
137+
--summary-only \
138+
--fail-under-lines 83 \
139+
--fail-under-regions 85 \
140+
--fail-under-functions 73
141+
```
142+
143+
The `--fail-under-*` flags mirror the thresholds CI enforces:
144+
145+
| Metric | Threshold |
146+
| --------- | --------- |
147+
| Lines | 83% |
148+
| Regions | 85% |
149+
| Functions | 73% |
150+
151+
#### Integration coverage
152+
153+
Requires the standalone `xrpld` container running (see [Integration Tests](#integration-tests)).
154+
Matches `.github/workflows/integration_test.yml`:
155+
156+
```bash
157+
# Collect coverage from the integration suite (writes raw profile data)
158+
cargo llvm-cov --no-report --release \
159+
--features std,json-rpc,helpers,cli,websocket,integration \
160+
--test integration_test --test cli_integration --test funding \
161+
--test utils --test test_utils \
162+
-- --test-threads=1
163+
164+
# Generate lcov scoped to integration territory
165+
cargo llvm-cov report --release --lcov --output-path lcov.info \
166+
--ignore-filename-regex '(_serde|core|models|utils)/|constants\.rs$|macros\.rs$|lib\.rs$|wallet/(mod|exceptions)\.rs$|tests/'
167+
```
168+
169+
The codecov integration target is 65%. The `--ignore-filename-regex` value
170+
mirrors `COVERAGE_IGNORE_REGEX` in the workflow; without it the integration
171+
metric would be dominated by unit-territory files the integration suite is
172+
not designed to exercise.
115173

116-
| Metric | Minimum |
117-
|-----------|---------|
118-
| Lines | 75% |
119-
| Regions | 65% |
120-
| Functions | 72% |
174+
#### HTML report
121175

122-
To generate an HTML report and open it in a browser:
176+
For local exploration:
123177

124178
```bash
125179
cargo llvm-cov --open

codecov.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: 83%
6+
threshold: 1%
7+
flags:
8+
- unit
9+
integration:
10+
target: 65%
11+
threshold: 1%
12+
flags:
13+
- integration
14+
patch:
15+
default:
16+
target: 80%
17+
threshold: 1%
18+
flags:
19+
- unit
20+
integration:
21+
target: 80%
22+
threshold: 1%
23+
flags:
24+
- integration
25+
26+
comment:
27+
layout: "reach, diff, flags, files"
28+
require_changes: false
29+
30+
flags:
31+
unit:
32+
paths:
33+
- src/
34+
integration:
35+
paths:
36+
- src/

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
xrpld:
55
image: rippleci/xrpld:develop
66
volumes:
7-
- ./.ci-config:/etc/opt/xrpld
7+
- ./.ci-config:/etc/xrpld
88
ports:
99
- "5005:5005"
1010
- "6006:6006"

0 commit comments

Comments
 (0)