Skip to content

Conversation

@yilmazbahadir
Copy link
Collaborator

Summary

This PR revives the stale E2E test suite and hardens it to run reliably with the Lattice simulator.

Key Changes

  • Test Setup: Refactor tests to use beforeAll for consistent client pairing
  • CI Compatibility: Skip SafeCard-dependent tests in CI where physical cards aren't available
  • Signing & API: Support raw transaction inputs and improve reliability
  • Bug Fixes:
    • Normalize legacy KV transactions
    • Fix SafeCard non-exportable test hash
    • Improve contract test stability

Testing

All E2E tests now pass with the simulator.

CI=1 DEBUG_SIGNING=1 baseUrl=http://127.0.0.1:3000 DEVICE_ID=SD0001 PASSWORD=12345678 PAIRING_SECRET=12345678 ENC_PW=12345678 APP_NAME=lattice-manager pnpm vitest run --silent --reporter=basic
image

- Fix EIP712 integer type handling with proper bit-width calculation
- Enhance BigInt precision preservation in ethereum.ts
- Improve parseGenericSigningResponse with digest support and better offset tracking
- Add computeMessageHash helper for robust hash computation
- Fix test descriptions and error message expectations
- Better two's complement handling for signed integers

These changes improve the reliability of EIP712 message signing
and generic signing operations, particularly for large integer values.
- Change test('pair') to beforeAll() for proper test setup
- Ensures client is initialized before running Bitcoin tests
- Prevents test isolation issues with client setup
Coerce hex nonce values and default empty data so legacy transaction payloads continue to parse after the viem schema tightenings.

Also bounds the kv cleanup helper in the e2e test to avoid reissuing the same getKvRecords request indefinitely.
- Allow sign to accept pre-serialized hex/buffer payloads while preserving EIP-7702 encoding detection and decoder enrichment
- Auto-detect EIP-712 message payloads in signMessage so callers only supply the typed data structure
- Stabilise API e2e tests by mocking decoder calls, suppressing noisy logs, reusing the paired client, and exercising address-tag flows against the simulator after a connectivity probe
- Add forge CLI availability check to conditionally skip tests
- Replace static import with dynamic artifact loading from forge output
- Improve error handling and logging for missing forge dependencies
- Make contract tests more robust in CI environments
- Add xpub test for Bitcoin extended public key derivation
- Refactor test setup to use beforeAll for consistent pairing
- Skip SafeCard-dependent tests in CI environment
- Remove redundant pairing checks from wallet-jobs tests
Add explicit type annotations for encodingType variable to include EIP7702
encoding types and add type assertion for basePayload to improve type safety
and IDE support.
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 29, 2025

Open in StackBlitz

npm i https://pkg.pr.new/GridPlus/gridplus-sdk@622

commit: db879e2

@yilmazbahadir yilmazbahadir marked this pull request as ready for review October 29, 2025 13:00
Remove CI skip condition to allow the test to run in continuous integration
environments.
Move signature validation utilities from non-exportable.test.ts to helpers.ts
to improve code reusability and reduce duplication.

Changes:
- Extract toBuffer, toUint8Array, ensureHash32, and validateSig to helpers.ts
- Enhance validateSig to properly handle compressed/uncompressed public keys
- Remove duplicate helper functions from test file
- Update imports to use shared utilities
@netbonus netbonus merged commit e0549ed into dev Oct 29, 2025
4 checks passed
@yilmazbahadir yilmazbahadir mentioned this pull request Dec 2, 2025
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.

3 participants