feat: add support for Batch amendment
High Level Overview of Change
This PR:
- Adds models for the
Batchtransactions - Updates definitions.json to handle the new field types
- Adds support to the binary codec to properly sign multi-account
Batchtransactions - Adds helper functions for signing and combining multi-account
Batchtransactions - Adds support to
autofillfor filling in theBatchTxnandTxIDsfields - Adds support for Batchnet to the faucets
Context of Change
https://github.com/XRPLF/rippled/pull/5060
Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Refactor (non-breaking change that only restructures code)
- [x] Tests (You added tests for code that already exists, or your new feature included in this PR)
- [ ] Documentation Updates
- [ ] Release
Did you update HISTORY.md?
- [x] Yes
- [ ] No, this change does not impact library users
Test Plan
Added tests for the new features.
Walkthrough
This update introduces full support for the Batch (XLS-56) transaction type across the XRPL codebase. It adds new models, validation, encoding/decoding, signing, autofill logic, and comprehensive tests for Batch transactions. The changes also enhance flag handling, fee calculation, and multisigning utilities, and update documentation and configuration for the new amendment.
Changes
| Files/Groups | Change Summary |
|---|---|
.vscode/settings.json |
Spellchecker words updated: "autofills" (lowercase), added "bignumber", "MPToken", "xrplf". |
.ci-config/rippled.cfg |
Added Batch and other amendments to protocol features list. |
packages/ripple-binary-codec/src/binary.ts, src/hash-prefixes.ts, src/index.ts, test/signing-data-encoding.test.ts |
Added Batch object interface, batch signing serialization, hash prefix, and tests. |
packages/ripple-binary-codec/HISTORY.md |
Documented Batch support and minor punctuation fixes. |
packages/ripple-binary-codec/src/types/hash.ts |
Added hex string validation in Hash.from. |
packages/xrpl/HISTORY.md |
Documented Batch amendment support. |
packages/xrpl/package.json |
Simplified Jest unit test script. |
packages/xrpl/src/Wallet/batchSigner.ts |
New: Batch signing and signature combination utilities. |
packages/xrpl/src/Wallet/index.ts |
Prevented signing of batch inner txns; simplified multisign logic. |
packages/xrpl/src/Wallet/signer.ts, src/Wallet/utils.ts |
Refactored: Extracted signer comparison and transaction decoding utilities. |
packages/xrpl/src/client/index.ts |
Integrated batch and DeliverMax autofill logic. |
packages/xrpl/src/models/transactions/batch.ts |
New: Batch transaction types, flags, validation. |
packages/xrpl/src/models/transactions/common.ts |
Added global flag support, improved validation, exported type guards. |
packages/xrpl/src/models/transactions/delegateSet.ts |
Disallowed Batch as a delegatable transaction type. |
packages/xrpl/src/models/transactions/index.ts |
Exported Batch and PermissionedDomain* transaction types. |
packages/xrpl/src/models/transactions/metadata.ts |
Added Batch metadata support. |
packages/xrpl/src/models/transactions/transaction.ts |
Integrated Batch into transaction validation and type unions. |
packages/xrpl/src/models/utils/flags.ts |
Enhanced flag conversion: supports global and batch flags, stricter validation. |
packages/xrpl/src/models/utils/index.ts |
Added hasFlag utility for flag checking. |
packages/xrpl/src/sugar/autofill.ts |
Added batch autofill, improved fee calculation, DeliverMax handler, refactored helpers. |
packages/xrpl/src/utils/hashes/hashLedger.ts |
Allowed batch inner transactions to bypass signature check. |
packages/xrpl/src/models/ledger/XChainOwnedClaimID.ts |
Simplified imports. |
packages/xrpl/test/client/autofill.test.ts |
Added tests for batch autofill. |
packages/xrpl/test/integration/transactions/batch.test.ts |
New: Integration tests for batch transaction submission and verification. |
packages/xrpl/test/models/batch.test.ts |
New: Batch transaction validation tests. |
packages/xrpl/test/models/utils.test.ts |
Extended tests for global flag handling and flag conversion. |
packages/xrpl/test/utils/hashes.test.ts |
Added hash test for batch inner transaction. |
packages/xrpl/test/wallet/batchSigner.test.ts |
New: Tests for batch signing and signature combination. |
packages/xrpl/test/wallet/authorizeChannel.test.ts |
Grouped tests under a describe block. |
packages/xrpl/test/models/Credential*.test.ts, depositPreauth.test.ts, oracleSet.test.ts, permissionedDomainSet.test.ts |
Updated stringToHex import paths. |
packages/xrpl/test/integration/transactions/nftokenModify.test.ts |
Updated import paths for NFT-related types. |
Possibly related issues
-
XRPLF/xrpl.js#2823: This PR directly addresses improvements to
convertTxFlagsToNumberand global flag handling, as requested in the issue.
Suggested reviewers
- ckeshava
Poem
π
A batch of changes, crisp and neat,
With flags and hashes, oh so fleet!
Transactions bundled, signed with care,
Multisigners everywhere.
Tests abound, the code refinedβ
Now Batch is live, robust, aligned!
π₯β¨
π Recent review details
Configuration used: .coderabbit.yaml Review profile: CHILL Plan: Pro
π₯ Commits
Reviewing files that changed from the base of the PR and between 7bf7730d6a379c9b9b9b26dd3db0c6da61c17a71 and e433d6b417254817719b53e8ce8ba4ae539ba56d.
π Files selected for processing (1)
-
packages/xrpl/HISTORY.md(1 hunks)
β Files skipped from review due to trivial changes (1)
- packages/xrpl/HISTORY.md
β° Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: generate-documentation (22.x)
- GitHub Check: integration (22.x)
- GitHub Check: integration (20.x)
- GitHub Check: unit (22.x)
- GitHub Check: unit (20.x)
- GitHub Check: browser (22.x)
- GitHub Check: Analyze (javascript)
- GitHub Check: build-and-lint (22.x)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
πͺ§ Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Explain this complex logic. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai explain this code block. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and explain its main purpose. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
cc @dangell7 @tequdev
@coderabbitai full review
:white_check_mark: Actions performed
Full review triggered.
We should think about adding the ability to generate the index/hash for all objects especially NFTokenID.
We should think about adding the ability to generate the index/hash for all objects especially NFTokenID.
Agreed, but I think that can be a separate PR.
Integration tests are expected to fail, since there is an integration test for Batch (which is not in the Docker container yet).
I will go through the rest of the files/comments once the cpp code is finalized and this PR is ready for review.
The develop Docker container needs to be updated before integration tests will pass. They do pass locally.
@khancode I had to make some changes to resolve a dependency cycle, you might want to do a quick re-review