Skip to content

[TA-5091]: batch transaction integration tests#150

Merged
GuillemGarciaDev merged 6 commits intov0.1.xfrom
xrpl/feat/batch-integration-tests
Jul 11, 2025
Merged

[TA-5091]: batch transaction integration tests#150
GuillemGarciaDev merged 6 commits intov0.1.xfrom
xrpl/feat/batch-integration-tests

Conversation

@GuillemGarciaDev
Copy link
Collaborator

@GuillemGarciaDev GuillemGarciaDev commented Jul 10, 2025

[TA-5091]: batch transaction integration tests

Description

This PR aims to add integration tests for Batch transactions.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where needed
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes

Changes

  • New batch_test integration tests for websocket

Notes (optional)

Describe any additional notes here.

Summary by CodeRabbit

  • New Features

    • Added integration tests for batch transactions, including multisignature scenarios, over the XRPL websocket client.
  • Bug Fixes

    • Improved transaction signing to prevent unintended modification of original transaction data.
    • Enhanced error handling and validation when processing batch transactions.
  • Refactor

    • Streamlined type handling for batch transactions and fee calculations, simplifying code and improving reliability.
    • Updated batch signing to operate on flattened transactions for consistency.
  • Tests

    • Updated and expanded test coverage for batch transactions, multisignature batches, and fee calculation logic.
    • Adjusted test utilities to support new transaction processing options.

@coderabbitai
Copy link

coderabbitai bot commented Jul 10, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This set of changes introduces and tests support for batch transactions and multisigned batch transactions in the XRPL integration suite. It refactors fee calculation and signing logic for batch transactions, updates type assertions for transaction fields, and modifies the integration runner and test cases to support new options and signatures. New integration tests for batch transactions are added.

Changes

Files/Groups Change Summary
xrpl/transaction/integration/batch_test.go Added integration tests for batch and multisigned batch transactions over websocket.
xrpl/wallet/types/batch_signable.go Added FromFlatBatchTransaction; improved error handling and type assertions for batch signable construction.
xrpl/wallet/batch.go, xrpl/wallet/batch_test.go Refactored batch signing to operate on flattened transactions; added helper for parsing batch signers from flat transactions.
xrpl/websocket/client.go, xrpl/rpc/helpers.go Simplified and unified type assertions for batch fee calculation; switched to string-based transaction type checks.
xrpl/websocket/client_test.go Updated tests to use map[string]any and []map[string]any for batch transaction fields.
xrpl/wallet/wallet.go Modified wallet signing to avoid mutating original transaction maps.
xrpl/testutil/integration/runner.go Added TestTransactionOptions to allow skipping autofill; updated method signatures accordingly.
xrpl/testutil/integration/faucet.go, xrpl/transaction/integration/*_test.go Updated all calls to TestTransaction to pass new options parameter (added nil as fourth argument where needed).

Sequence Diagram(s)

sequenceDiagram
    participant Test as Integration Test
    participant Runner as Runner
    participant Client as Websocket Client
    participant Wallet as Wallet

    Test->>Runner: TestTransaction(flatTx, signer, expectedResult, opts)
    Runner->>Runner: processTransaction(flatTx, signer, opts)
    alt opts.SkipAutofill == false
        Runner->>Client: Autofill(flatTx)
    end
    Runner->>Wallet: Sign(flatTx)
    Runner->>Client: Submit(flatTx)
    Client-->>Runner: SubmitResponse
    Runner-->>Test: SubmitResponse
Loading
sequenceDiagram
    participant Test as Batch Test
    participant Runner as Runner
    participant Wallet as Wallet

    Test->>Runner: TestTransaction(batchTx, signer, "tesSUCCESS", opts)
    Runner->>Wallet: SignMultiBatch(wallet, batchTx, opts)
    Wallet->>Wallet: FromFlatBatchTransaction(batchTx)
    Wallet->>Wallet: Sign each inner transaction
    Wallet-->>Runner: Signed batchTx
    Runner->>Client: Submit(signed batchTx)
Loading

Possibly related PRs

Suggested labels

feature, xrpl

Suggested reviewers

  • banasa44

🪧 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 @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@notion-workspace
Copy link

Base automatically changed from xrpl/feat/batch-tx-autofill to v0.1.x July 11, 2025 07:19
@GuillemGarciaDev
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jul 11, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
xrpl/transaction/integration/batch_test.go (1)

49-83: Consider expanding test coverage.

The test only covers the happy path. Consider adding test cases for:

  • Invalid batch transactions (e.g., exceeding the 8-transaction limit per batch)
  • Batch transactions with failing inner transactions
  • Batch transactions without the "all or nothing" flag

Would you like me to generate additional test cases to improve coverage?

xrpl/websocket/client.go (1)

140-159: Type assertion can be simplified using comma-ok pattern.

The type assertion and comparison can be combined for cleaner code.

-if txType, ok := (*tx)["TransactionType"].(string); ok {
-	if acc, ok := (*tx)["Account"].(types.Address); txType == transaction.AccountDeleteTx.String() && ok {
+if txType, ok := (*tx)["TransactionType"].(string); ok {
+	if txType == transaction.AccountDeleteTx.String() {
+		if acc, ok := (*tx)["Account"].(types.Address); ok {
 			err := c.checkAccountDeleteBlockers(acc)
 			if err != nil {
 				return err
 			}
+		}
 	}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a0610d and 775f661.

📒 Files selected for processing (14)
  • xrpl/rpc/helpers.go (1 hunks)
  • xrpl/testutil/integration/faucet.go (1 hunks)
  • xrpl/testutil/integration/runner.go (3 hunks)
  • xrpl/transaction/integration/batch_test.go (1 hunks)
  • xrpl/transaction/integration/credential/credential_create_test.go (1 hunks)
  • xrpl/transaction/integration/delegate_set_test.go (6 hunks)
  • xrpl/transaction/integration/nft/nftoken_mint_test.go (1 hunks)
  • xrpl/transaction/integration/payment_test.go (2 hunks)
  • xrpl/wallet/batch.go (5 hunks)
  • xrpl/wallet/batch_test.go (9 hunks)
  • xrpl/wallet/types/batch_signable.go (2 hunks)
  • xrpl/wallet/wallet.go (1 hunks)
  • xrpl/websocket/client.go (2 hunks)
  • xrpl/websocket/client_test.go (4 hunks)
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: banasa44
PR: Peersyst/xrpl-go#145
File: binary-codec/codec.go:0-0
Timestamp: 2025-07-07T11:40:34.738Z
Learning: XRPL batch transactions have a maximum limit of 8 transactions per batch, as defined by the XRPL protocol. This constraint eliminates practical concerns about integer overflow when converting batch length to uint32.
Learnt from: vriveraPeersyst
PR: Peersyst/xrpl-snap#129
File: packages/site/src/domain/transaction/controller/TransactionController.ts:98-111
Timestamp: 2025-05-17T14:29:55.132Z
Learning: In the TransactionController class of the XRPL Snap project, the `...rest` parameter in the `sendIOUTransaction` method does not contain flags from callers, so directly setting `flags: PARTIAL_PAYMENT_FLAG` without merging with existing flags is appropriate.
xrpl/transaction/integration/credential/credential_create_test.go (3)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
xrpl/transaction/integration/payment_test.go (4)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: vriveraPeersyst
PR: Peersyst/xrpl-snap#129
File: packages/site/src/domain/transaction/controller/TransactionController.ts:98-111
Timestamp: 2025-05-17T14:29:55.132Z
Learning: In the TransactionController class of the XRPL Snap project, the `...rest` parameter in the `sendIOUTransaction` method does not contain flags from callers, so directly setting `flags: PARTIAL_PAYMENT_FLAG` without merging with existing flags is appropriate.
xrpl/testutil/integration/faucet.go (2)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/wallet/wallet.go (4)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: GuillemGarciaDev
PR: Peersyst/xrpl-go#131
File: xrpl/rpc/client.go:265-265
Timestamp: 2025-03-31T17:29:49.615Z
Learning: In the XRPL Go codebase, type assertions from maps should always use the two-return pattern (value, ok := map[key].(type)) with proper error handling to avoid potential panics.
xrpl/transaction/integration/nft/nftoken_mint_test.go (4)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: vriveraPeersyst
PR: Peersyst/xrpl-snap#129
File: packages/site/src/domain/transaction/controller/TransactionController.ts:98-111
Timestamp: 2025-05-17T14:29:55.132Z
Learning: In the TransactionController class of the XRPL Snap project, the `...rest` parameter in the `sendIOUTransaction` method does not contain flags from callers, so directly setting `flags: PARTIAL_PAYMENT_FLAG` without merging with existing flags is appropriate.
xrpl/transaction/integration/delegate_set_test.go (4)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: vriveraPeersyst
PR: Peersyst/xrpl-snap#129
File: packages/site/src/domain/transaction/controller/TransactionController.ts:98-111
Timestamp: 2025-05-17T14:29:55.132Z
Learning: In the TransactionController class of the XRPL Snap project, the `...rest` parameter in the `sendIOUTransaction` method does not contain flags from callers, so directly setting `flags: PARTIAL_PAYMENT_FLAG` without merging with existing flags is appropriate.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
xrpl/websocket/client_test.go (5)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: GuillemGarciaDev
PR: Peersyst/xrpl-go#131
File: xrpl/rpc/client.go:265-265
Timestamp: 2025-03-31T17:29:49.615Z
Learning: In the XRPL Go codebase, type assertions from maps should always use the two-return pattern (value, ok := map[key].(type)) with proper error handling to avoid potential panics.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: banasa44
PR: Peersyst/xrpl-go#145
File: binary-codec/codec.go:0-0
Timestamp: 2025-07-07T11:40:34.738Z
Learning: XRPL batch transactions have a maximum limit of 8 transactions per batch, as defined by the XRPL protocol. This constraint eliminates practical concerns about integer overflow when converting batch length to uint32.
Learnt from: AgustinMJ
PR: Peersyst/near-mobile#58
File: packages/shared/blockchain/core/src/signers/signer.ts:26-27
Timestamp: 2025-02-27T10:24:14.276Z
Learning: The Signer interface uses `Record<string, any>` for the transaction parameter in `signTransaction` method to allow implementing classes to add their own specific types extending this base type, providing flexibility for different blockchain implementations.
xrpl/wallet/batch_test.go (1)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/testutil/integration/runner.go (4)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: vriveraPeersyst
PR: Peersyst/xrpl-snap#129
File: packages/site/src/domain/transaction/controller/TransactionController.ts:98-111
Timestamp: 2025-05-17T14:29:55.132Z
Learning: In the TransactionController class of the XRPL Snap project, the `...rest` parameter in the `sendIOUTransaction` method does not contain flags from callers, so directly setting `flags: PARTIAL_PAYMENT_FLAG` without merging with existing flags is appropriate.
xrpl/wallet/types/batch_signable.go (2)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/websocket/client.go (4)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: GuillemGarciaDev
PR: Peersyst/xrpl-go#131
File: xrpl/rpc/client.go:265-265
Timestamp: 2025-03-31T17:29:49.615Z
Learning: In the XRPL Go codebase, type assertions from maps should always use the two-return pattern (value, ok := map[key].(type)) with proper error handling to avoid potential panics.
xrpl/wallet/batch.go (1)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/transaction/integration/batch_test.go (3)
Learnt from: banasa44
PR: Peersyst/xrpl-go#145
File: binary-codec/codec.go:0-0
Timestamp: 2025-07-07T11:40:34.738Z
Learning: XRPL batch transactions have a maximum limit of 8 transactions per batch, as defined by the XRPL protocol. This constraint eliminates practical concerns about integer overflow when converting batch length to uint32.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/rpc/helpers.go (4)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: GuillemGarciaDev
PR: Peersyst/xrpl-go#131
File: xrpl/rpc/client.go:265-265
Timestamp: 2025-03-31T17:29:49.615Z
Learning: In the XRPL Go codebase, type assertions from maps should always use the two-return pattern (value, ok := map[key].(type)) with proper error handling to avoid potential panics.
Learnt from: banasa44
PR: Peersyst/xrpl-go#145
File: binary-codec/codec.go:0-0
Timestamp: 2025-07-07T11:40:34.738Z
Learning: XRPL batch transactions have a maximum limit of 8 transactions per batch, as defined by the XRPL protocol. This constraint eliminates practical concerns about integer overflow when converting batch length to uint32.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
🧬 Code Graph Analysis (4)
xrpl/wallet/wallet.go (1)
binary-codec/codec.go (1)
  • EncodeForSigning (94-103)
xrpl/testutil/integration/runner.go (1)
xrpl/wallet/wallet.go (1)
  • Wallet (28-33)
xrpl/websocket/client.go (1)
xrpl/transaction/tx_type.go (3)
  • AccountDeleteTx (8-8)
  • PaymentTx (48-48)
  • BatchTx (16-16)
xrpl/wallet/batch.go (3)
xrpl/wallet/wallet.go (1)
  • Wallet (28-33)
xrpl/wallet/types/batch_signable.go (2)
  • ErrRawTransactionsFieldIsNotAnArray (18-18)
  • FromFlatBatchTransaction (32-61)
keypairs/keypairs.go (1)
  • Sign (88-94)
🔇 Additional comments (35)
xrpl/transaction/integration/nft/nftoken_mint_test.go (1)

52-52: LGTM! Signature update handled correctly.

The addition of nil as the fourth parameter correctly adapts to the updated TestTransaction signature while maintaining the existing test behavior.

xrpl/transaction/integration/credential/credential_create_test.go (1)

121-121: LGTM! Signature update handled correctly.

The addition of nil as the fourth parameter correctly adapts to the updated TestTransaction signature while maintaining the existing test behavior.

xrpl/testutil/integration/faucet.go (1)

60-60: LGTM! Signature update handled correctly.

The addition of nil as the fourth parameter correctly adapts to the updated TestTransaction signature while maintaining the existing wallet funding behavior.

xrpl/transaction/integration/payment_test.go (1)

61-61: LGTM! Signature updates handled correctly.

The addition of nil as the fourth parameter in both test functions correctly adapts to the updated TestTransaction signature while maintaining the existing test behavior for both websocket and RPC client variants.

Also applies to: 115-115

xrpl/wallet/wallet.go (1)

143-149: Excellent defensive programming practice!

Creating a shallow copy of the transaction map before passing it to EncodeForSigning prevents mutation of the original transaction. This is important since EncodeForSigning (as shown in binary-codec/codec.go) calls removeNonSigningFields which likely modifies the input map. The copy ensures transaction immutability during the signing process.

xrpl/websocket/client_test.go (2)

699-726: LGTM: Type safety improvements in batch transaction test data

The changes from []interface{} to []map[string]any for RawTransactions improve type safety and make the test data structure more explicit. This aligns with the codebase's approach to using specific types rather than generic interfaces.


773-800: LGTM: Consistent type assertions in multisign batch test

The type updates are consistent with the previous batch transaction test case, maintaining uniformity in test data structures.

xrpl/transaction/integration/delegate_set_test.go (6)

136-136: LGTM: Method signature update handled correctly

The addition of nil as the fourth parameter to TestTransaction correctly adapts to the new method signature. This indicates no special test options are needed for this transaction.


234-234: LGTM: Consistent signature update

The method signature update is consistently applied across all test functions.


282-282: LGTM: Consistent signature update in usage tests

The signature update maintains consistency across all TestTransaction calls in the delegate set usage tests.


296-296: LGTM: Final signature update maintains consistency

All TestTransaction calls now use the updated four-parameter signature consistently.


339-339: LGTM: RPC client tests updated consistently

The RPC client integration tests also maintain the same signature consistency.


353-353: LGTM: Complete signature consistency across all tests

All integration tests now use the updated method signature consistently.

xrpl/rpc/helpers.go (5)

606-609: LGTM: Improved type safety with direct assertion

The direct assertion of RawTransactions as []map[string]any eliminates intermediate type conversions and makes the expected data structure more explicit. This improves type safety and aligns with the codebase's preference for specific type assertions.


612-617: LGTM: Simplified iteration with better error handling

The direct iteration over the typed slice is cleaner and the error message is more descriptive. The type assertion for RawTransaction is also more explicit.


620-624: LGTM: Cleaner fee calculation logic

The direct conversion to FlatTransaction and immediate fee calculation is more straightforward than the previous approach.


627-632: LGTM: Better error handling and fee reset

The fee extraction with proper error handling and the reset to "0" for inner transactions is correct for batch transaction processing.


635-638: LGTM: Improved error message formatting

The error message now includes the actual fee value that failed to parse, which will be helpful for debugging.

xrpl/wallet/types/batch_signable.go (6)

12-21: LGTM: Well-defined error variables

The new error variables provide clear, descriptive error messages for different validation failures in batch signable creation.


30-41: LGTM: Proper type assertion with validation

The function signature is clear and the type assertion for Flags uses the two-return pattern with proper error handling, following the established pattern in the XRPL Go codebase.


38-46: LGTM: Structured validation approach

The validation of RawTransactions as []map[string]any is correct and the initialization of the BatchSignable with pre-allocated slice is efficient.


48-58: LGTM: Comprehensive inner transaction validation

The inner loop properly validates each raw transaction structure and generates transaction IDs using the hash function. The error wrapping provides good context for debugging.


66-71: LGTM: Refactored for cleaner iteration

The refactored FromBatchTransaction is cleaner with direct assignment of rawTxs and pre-allocated slice for better performance.


63-63: Fix: Duplicate function comment

The comment on line 63 is identical to the one on line 30-31 and appears to be a duplicate.

-// FromFlatBatchTransaction creates a BatchSignable from a Batch transaction.
+// FromBatchTransaction creates a BatchSignable from a Batch transaction.
⛔ Skipped due to learnings
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/wallet/batch_test.go (9)

15-71: LGTM: Comprehensive helper function for batch signer parsing

The parseBatchSignersFromFlat function correctly handles the complex nested structure of batch signers, including proper parsing of multisign signers. The error handling is appropriate with graceful handling of missing fields.


240-250: LGTM: Proper adaptation to flattened transaction signing

The test correctly adapts to the new signing approach by flattening the transaction before signing and parsing the batch signers back to the original structure. The SetAllOrNothingFlag() call is appropriate for batch transactions.


352-362: LGTM: Consistent test pattern implementation

The SECP256K1 test follows the same pattern as the ED25519 test, maintaining consistency in the test suite.


470-487: LGTM: Complex test case handling

The combine batch signers test correctly handles the more complex scenario with multiple transactions, maintaining the same flattened transaction approach.


507-524: LGTM: Test case maintains verification logic

The sorting test case is properly adapted while maintaining the original verification logic for signer ordering.


567-592: LGTM: Comprehensive test coverage maintained

The submitter removal test case properly handles the complex scenario with multiple wallets and maintains comprehensive verification of the batch signing behavior.


625-635: LGTM: Error case testing preserved

The error case testing is properly maintained with the new flattened transaction approach, ensuring edge cases are still covered.


651-668: LGTM: Complex error scenario testing

The signed inner transaction error case is properly handled, demonstrating that the test suite maintains comprehensive error coverage.


689-706: LGTM: Flag validation testing preserved

The different flags error testing is correctly adapted to the new approach while maintaining the original validation logic.

xrpl/testutil/integration/runner.go (1)

21-24: Well-structured test options implementation.

The addition of TestTransactionOptions provides clean control over transaction processing behavior in tests, with proper nil-safety in the conditional check.

xrpl/websocket/client.go (1)

861-887: Cleaner batch fee calculation implementation.

The simplified type assertions and direct handling of RawTransactions as []map[string]any improve code clarity while maintaining the same functionality.

@GuillemGarciaDev GuillemGarciaDev merged commit 0bc107f into v0.1.x Jul 11, 2025
5 checks passed
@GuillemGarciaDev GuillemGarciaDev deleted the xrpl/feat/batch-integration-tests branch July 11, 2025 08:40
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.

1 participant