Skip to content

chore(immutable-x): Add console.logs for debugging issues during starkex gen #2596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

brayansdt
Copy link
Contributor

Summary

Added logging to debug Stark key generation and message signing issues, particularly focusing on UTF-8 encoding of messages. This is for alpha release only and contains no sensitive information.

Detail and impact of the change

Changed

  • Modified signRaw function to use toUtf8Bytes for message signing
  • Added logging for payload and UTF-8 bytes in message signing process
  • Added logging for raw messages and UTF-8 bytes in ImxSigner
  • Added logging for connection messages and UTF-8 encoding in imxWallet
  • Added logging for signer addresses in metaMaskWrapper

Anything else worth calling out?

  • The changes focus on debugging the Stark signature verification failures by adding comprehensive logging around message encoding and signing
  • Added logging for both the raw messages and their UTF-8 encoded versions to help identify any encoding mismatches
  • Added address logging to help track potential signer mismatches between MetaMask and IMX signers
  • The changes are primarily diagnostic and don't modify the core functionality, making them safe to deploy
  • All logging is alpha-only and will be removed before production release
  • No private keys or sensitive data are logged
  • Only public addresses and encoded message data are logged for debugging purposes

This PR should help identify the root cause of the Stark signature verification failures by providing visibility into the message encoding and signing process. The logging is intended for alpha testing only and will be removed before any production release.

@brayansdt brayansdt requested a review from a team as a code owner March 24, 2025 02:00
@brayansdt brayansdt changed the title Add console.logs for debugging issues during starkex gen chore(immutable-x) Add console.logs for debugging issues during starkex gen Mar 24, 2025
Copy link

nx-cloud bot commented Mar 24, 2025

View your CI Pipeline Execution ↗ for commit faae51e.

Command Status Duration Result
nx release publish --tag alpha ✅ Succeeded 50s View ↗
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 2m 3s View ↗

☁️ Nx Cloud last updated this comment at 2025-03-27 23:49:39 UTC

@brayansdt brayansdt changed the title chore(immutable-x) Add console.logs for debugging issues during starkex gen chore(immutable-x): Add console.logs for debugging issues during starkex gen Mar 24, 2025
@brayansdt brayansdt force-pushed the fix/add-logs-for-encoding-stark-key-gen branch 2 times, most recently from 8f08c0f to 21a3c93 Compare March 26, 2025 05:10
Replaces string-based signature message with raw bytes in stark
key generation to prevent encoding issues in non-English systems.

This aligns with the fix for wallet connection message encoding.
- Add debug logs to track utf-8 byte encoding/decoding
- Compare utf-8 bytes between TextEncoder/TextDecoder and ethers.toUtf8Bytes
- Attempt to fix encoding issue by using ethers.toUtf8Bytes directly for signing
- Add validation that encoded bytes match expected connection string
@brayansdt brayansdt force-pushed the fix/add-logs-for-encoding-stark-key-gen branch from 00b71b7 to 9e19a78 Compare March 27, 2025 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant