Skip to content

feat: add offline one-sided transaction signing cucumber test#7743

Open
0xPepeSilvia wants to merge 1 commit intotari-project:developmentfrom
0xPepeSilvia:feat/offline-signing-cucumber-7736
Open

feat: add offline one-sided transaction signing cucumber test#7743
0xPepeSilvia wants to merge 1 commit intotari-project:developmentfrom
0xPepeSilvia:feat/offline-signing-cucumber-7736

Conversation

@0xPepeSilvia
Copy link
Copy Markdown

Summary

  • Add complete cucumber integration test for the offline one-sided transaction signing gRPC flow
  • Test creates a view-only wallet from exported keys, prepares a transaction via PrepareOneSidedTransactionForSigning, signs offline using sign_locked_transaction with the exported spend key, broadcasts via BroadcastSignedOneSidedTransaction, and verifies the receiver has confirmed funds
  • New step definitions cover the three core offline signing operations: prepare, sign, broadcast

Closes #7736

Test plan

  • OfflineSigning.feature scenario passes end-to-end
  • View-only wallet successfully discovers UTXOs and prepares transaction
  • Offline signing with exported spend key produces valid signed transaction
  • Broadcast via view-only wallet succeeds and receiver confirms funds

🤖 Generated with Claude Code

Add a complete integration test covering the full offline signing gRPC
flow: create a view-only wallet, prepare a one-sided transaction for
offline signing via gRPC, sign the transaction using exported spend
keys (simulating an air-gapped signing device), broadcast the signed
transaction via the view-only wallet, and verify the receiving wallet
confirms the funds.

New files:
- OfflineSigning.feature: Cucumber scenario for the full flow
- offline_signing_steps.rs: Step definitions for prepare, sign, broadcast

Modified:
- world.rs: Add offline_signing_prepared/signed state fields
- steps/mod.rs: Register new step module

Closes tari-project#7736

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces integration tests for the offline one-sided transaction signing flow. It adds new fields to the TariWorld struct to store transaction state, a Cucumber feature file outlining the full signing process, and the necessary step definitions to handle gRPC-based preparation, offline signing, and broadcasting. The review feedback suggests updating the Debug implementation for TariWorld to include the new fields for better observability and replacing a magic number with an enum variant in the gRPC request for improved readability.

Comment on lines +102 to +104
// Used for offline signing integration test — stores prepared and signed transaction JSON between steps.
pub offline_signing_prepared: Option<String>,
pub offline_signing_signed: Option<String>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Debug implementation for TariWorld (lines 117-138) should be updated to include the new offline_signing_prepared and offline_signing_signed fields. This ensures that the state of offline signing is visible when the world is printed for debugging purposes.

address: receiver_wallet_address,
amount,
fee_per_gram: fee,
payment_type: 2, // ONE_SIDED_TO_STEALTH_ADDRESS
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using the raw integer 2 for payment_type is a magic number. It is better to use the generated enum variant for improved readability and maintainability.

Suggested change
payment_type: 2, // ONE_SIDED_TO_STEALTH_ADDRESS
payment_type: grpc::payment_recipient::PaymentType::OneSidedToStealthAddress as i32,

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.

create offline singing cucumber test

1 participant