Skip to content

refactor(models): unify TransactionMetadata into single strongly-typed model#153

Open
e-desouza wants to merge 4 commits intomainfrom
refactor/unify-transaction-metadata
Open

refactor(models): unify TransactionMetadata into single strongly-typed model#153
e-desouza wants to merge 4 commits intomainfrom
refactor/unify-transaction-metadata

Conversation

@e-desouza
Copy link
Copy Markdown
Collaborator

@e-desouza e-desouza commented Mar 28, 2026

Summary

There were two TransactionMetadata structs — one in results/metadata.rs, one in transactions/metadata.rs. This removes the duplicate and keeps everything in transactions/metadata.rs.

While I was in there, fixed and extended the model:

  • transaction_result was typed as Amount but it's a result code string like "tesSUCCESS" — now Cow<str>
  • DeliveredAmount is now an enum that handles both real amounts and the literal "unavailable" string (pre-2014 partial payments)
  • AffectedNode is a proper enum (CreatedNode/ModifiedNode/DeletedNode) instead of raw JSON
  • Added NFToken, offer, and MPToken metadata fields (nftoken_id, nftoken_ids, offer_id, mpt_issuance_id)

Supersedes #110. Resolves #152.

Test plan

  • 17 tests — node types, delivered amount variants, NFToken fields, trait impls, Default
  • 99.7% line coverage (cargo-llvm-cov)
  • 609 tests pass (default features), 480 pass (no_std)
  • clippy clean, fmt clean

…d model

Remove duplicate TransactionMetadata from results/metadata.rs and consolidate
into transactions/metadata.rs with strongly-typed fields:

- Add DeliveredAmount enum handling "unavailable" string vs Amount
- Add strongly-typed AffectedNode enum (Created/Modified/Deleted)
- Add strongly-typed Fields struct with all known ledger fields
- Fix transaction_result type from Amount to Cow<str>
- Add NFToken, offer, and MPToken metadata fields
- Add comprehensive test suite (99.7% line coverage)

Resolves #152
Preserve the pre-existing public import path
`xrpl::models::results::metadata::TransactionMetadata` as a
`#[deprecated]` re-export so downstream crates compiled against 1.1.0
keep building. New code should import from
`xrpl::models::transactions::metadata` directly.

Bump crate version to 1.2.0 (additive public surface, no removals) and
document the move in CHANGELOG.md.
The rippleci/rippled:develop image updated after 2026-04-01 and broke
integration tests across all PRs (container exits before becoming healthy,
causing Connection refused on localhost:5005).

Pin to the last known-good digest and replace the simple until loop with
a bounded retry that checks container liveness, prints status per attempt,
and dumps container logs on failure.
pdp2121 pushed a commit that referenced this pull request Apr 21, 2026
… #3270) (#291)

## Summary

The `rippled` binary was renamed to `xrpld` upstream, and the
`rippleci/rippled` image stopped receiving updates. Our integration
tests across every open PR started failing because the published
`develop` image exited before becoming healthy (`Connection refused` on
`localhost:5005`, **0 passed / 41 failed**).

This PR mirrors the upstream fix in xrpl.js:
[XRPLF/xrpl.js#3270](XRPLF/xrpl.js#3270).
Switching to `rippleci/xrpld:develop` is the **actual root-cause fix**
rather than pinning an old digest of the deprecated image.

## Changes

`.github/workflows/integration_test.yml`:
- `RIPPLED_DOCKER_IMAGE` -> `XRPLD_DOCKER_IMAGE:
rippleci/xrpld:develop`.
- `docker run` simplified to `${IMAGE} --standalone` (the `xrpld` image
handles `mkdir` + launch internally; no more `bash -c "mkdir -p
/var/lib/rippled/db/ && rippled -a"` wrapper).
- Volume mount changed from `/etc/opt/ripple/` to `/etc/opt/xrpld/`.
- Container name: `rippled-service` -> `xrpld-service`.
- Removed the docker `--health-cmd` (which shelled out to the renamed
`rippled` CLI and always failed) in favour of a direct JSON-RPC poll
against `http://localhost:5005/`.
- Always dump container logs on the stop step for post-mortem
visibility.

`.ci-config/rippled.cfg` -> `.ci-config/xrpld.cfg`:
- `path=/var/lib/rippled/db/nudb` -> `path=/var/lib/xrpld/db/nudb`.
- `[database_path] /var/lib/rippled/db` -> `/var/lib/xrpld/db`.
- `[debug_logfile] /var/log/rippled/debug.log` ->
`/var/log/xrpld/debug.log`.

## Verification

Validated on throwaway PR #292 (now closed): **Integration Test green in
2m53s** on this exact workflow. Unit tests, Build & Lint, Quality Check
also pass.

## Related follow-up

The 7 in-flight PRs (#130, #131, #151, #153, #156, #157, #158) currently
carry a stopgap commit pinning `rippleci/rippled:develop` to a specific
digest. After this PR merges to `main`, those branches should:
1. Rebase on `main` to pick up the xrpld switch, or
2. Cherry-pick this commit and drop the stopgap digest pin.

## Test plan

- [x] Validated end-to-end on PR #292
- [x] Build & Lint, Unit Test, Integration Test, Quality Check all pass
- [ ] Merge and confirm subsequent PRs inherit the fix without manual
cherry-pick

## Credit

Approach lifted from @ckeshava's
[xrpl.js#3270](XRPLF/xrpl.js#3270).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(models): change signing_pub_key from Option<Cow<str>> to Cow<str> with serde default

1 participant