Skip to content

Conversation

@lmcmz
Copy link
Contributor

@lmcmz lmcmz commented Dec 11, 2025

Standardizes Ethereum transaction hash calculation to use keccak256 of the signed/encoded transaction, removing previous logic that returned preHash. Updates related Android and iOS tests and wallet code to match this behavior, clarifies distinction between signing hash and transaction hash, and improves cache deserialization robustness.

Standardizes Ethereum transaction hash calculation to use keccak256 of the signed/encoded transaction, removing previous logic that returned preHash. Updates related Android and iOS tests and wallet code to match this behavior, clarifies distinction between signing hash and transaction hash, and improves cache deserialization robustness.
@github-actions
Copy link

github-actions bot commented Dec 11, 2025

PR Summary

Standardized Ethereum transaction hash calculation to use keccak256 of the signed/encoded transaction instead of returning preHash. Updated Android and iOS tests to reflect the distinction between signing hash (preHash) and transaction hash (txId). Improved cache deserialization robustness by ignoring unknown JSON fields and simplified SeedPhraseKey constructor by removing deprecated parameters.

Changes

File Summary
Android/wallet/src/androidTest/java/com/flow/wallet/keys/EthereumKeyTests.kt Removed the deprecated keyPair = null parameter from SeedPhraseKey constructor call in test setup.
Android/wallet/src/androidTest/java/com/flow/wallet/keys/SeedPhraseKeyProviderTest.kt Added comprehensive test suite for SeedPhraseKeyProvider covering key derivation, storage, retrieval, signing, verification, and legacy data compatibility. Includes tests for error scenarios and backward compatibility with old JSON format containing length field.
Android/wallet/src/androidTest/java/com/flow/wallet/wallet/EthereumWalletTests.kt Updated expected Ethereum address, clarified distinction between signing hash (preHash) and transaction hash (txId), and simplified test setup by removing deprecated constructor parameters.
Android/wallet/src/androidTest/java/com/flow/wallet/wallet/WalletInstrumentedTest.kt Updated mock Signer implementation to match new interface signature with Transaction parameter and proper method overrides.
Android/wallet/src/main/java/com/flow/wallet/keys/SeedPhraseKey.kt Removed deprecated seedPhraseLength parameter, added default values for constructor parameters, improved JSON deserialization with ignoreUnknownKeys = true for backward compatibility, and removed unused helper classes.
Android/wallet/src/main/java/com/flow/wallet/storage/Cacheable.kt Added lenient JSON configuration with ignoreUnknownKeys = true to prevent cache deserialization failures when new fields are added to cached data structures.
Android/wallet/src/main/java/com/flow/wallet/wallet/EthereumSigningOutputExtensions.kt Simplified txId() function to always return keccak256 of the encoded transaction, removing previous logic that returned preHash when available.
Android/wallet/src/test/java/com/flow/wallet/keys/SeedPhraseKeyProviderTest.kt Removed old unit test file that was replaced by the new instrumented test version with more comprehensive coverage.
iOS/FlowWalletKit/Sources/Wallet/EthereumSigningOutput+TxID.swift Updated txId() function to always return keccak256 of encoded data, removing conditional logic that checked for empty preHash.
iOS/FlowWalletKit/Sources/Wallet/Wallet+EOA.swift Removed code that manually set output.preHash to transaction hash, allowing WalletCore to handle the distinction between signing hash and transaction hash properly.
iOS/FlowWalletKit/Tests/FlowWalletKitTests/EOATests.swift Updated test to use correct private key, clarified expected values for signing hash vs transaction hash, and verified that preHash contains signing hash while txId() returns transaction hash.

autogenerated by presubmit.ai

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🚨 Pull request needs attention.

Review Summary

Commits Considered (1)
  • 59b4bcd: Refactor Ethereum txId logic and update tests

Standardizes Ethereum transaction hash calculation to use keccak256 of the signed/encoded transaction, removing previous logic that returned preHash. Updates related Android and iOS tests and wallet code to match this behavior, clarifies distinction between signing hash and transaction hash, and improves cache deserialization robustness.

Files Processed (11)
  • Android/wallet/src/androidTest/java/com/flow/wallet/keys/EthereumKeyTests.kt (1 hunk)
  • Android/wallet/src/androidTest/java/com/flow/wallet/keys/SeedPhraseKeyProviderTest.kt (1 hunk)
  • Android/wallet/src/androidTest/java/com/flow/wallet/wallet/EthereumWalletTests.kt (4 hunks)
  • Android/wallet/src/androidTest/java/com/flow/wallet/wallet/WalletInstrumentedTest.kt (2 hunks)
  • Android/wallet/src/main/java/com/flow/wallet/keys/SeedPhraseKey.kt (6 hunks)
  • Android/wallet/src/main/java/com/flow/wallet/storage/Cacheable.kt (4 hunks)
  • Android/wallet/src/main/java/com/flow/wallet/wallet/EthereumSigningOutputExtensions.kt (1 hunk)
  • Android/wallet/src/test/java/com/flow/wallet/keys/SeedPhraseKeyProviderTest.kt (1 hunk)
  • iOS/FlowWalletKit/Sources/Wallet/EthereumSigningOutput+TxID.swift (2 hunks)
  • iOS/FlowWalletKit/Sources/Wallet/Wallet+EOA.swift (1 hunk)
  • iOS/FlowWalletKit/Tests/FlowWalletKitTests/EOATests.swift (2 hunks)
Actionable Comments (1)
  • Android/wallet/src/androidTest/java/com/flow/wallet/wallet/WalletInstrumentedTest.kt [54-55]

    possible bug: "TODO implementation returns invalid data"

Skipped Comments (3)
  • Android/wallet/src/androidTest/java/com/flow/wallet/wallet/WalletInstrumentedTest.kt [56-57]

    possible issue: "Unreachable code after TODO exception"

  • Android/wallet/src/main/java/com/flow/wallet/keys/SeedPhraseKey.kt [270-278]

    maintainability: "Unused method with hardcoded values"

  • iOS/FlowWalletKit/Tests/FlowWalletKitTests/EOATests.swift [165-165]

    maintainability: "Hardcoded private key lacks documentation"

Comment on lines +54 to +55
return ByteArray(1)
}

Choose a reason for hiding this comment

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

The TODO implementation should not return a hardcoded ByteArray(1). This could cause runtime issues if this method is actually called during testing.

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