Skip to content
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

Sc 68969 immutable stark error #477

Merged
merged 6 commits into from
Mar 20, 2023
Merged

Conversation

mattupham
Copy link
Contributor

@mattupham mattupham commented Mar 20, 2023

📦 Why? (Required)

Immutable tested this line of code with 3 providers

  • magic provider
  • alchemy provider
  • json rpc provider
    await contract.connect(PROVIDER).isRegistered(userPublicStarkKey);

The error from Ethers using the Magic Provider was different than the Alchemy / JSON RPC Providers
This fix makes the error from the Magic Provider consistent with the other providers

Ethers expects a data key to be present in the RPC error - if data is present from bubbled up error, we now map this in the MagicRPCError - see here https://www.jsonrpc.org/specification#response_object

How was it tested? (Required)

How did you test/validate correctness of changes?

  1. Recreate the error in a 3rd party app (example)
  2. Set breakpoints in the ethers library to figure out where the error was called, and what data was missing
  3. Modified phantom locally to map the missing data
  4. Modified magic-sdk locally, linked changes to the 3rd party app using the magic-sdk
  5. Verified that the error from the Magic Provider is consistent now with the other providers
  6. Create the canary version of magic-sdk, push to npm, test the canary version in a 3rd party app

Screenshots (Optional)

Previous issue - inconsistent errors from Magic (top) and JSON RPC Provider / Alchemy provider (expected - middle, bottom)
3 errors - issue

success.magic.sdk.mov

3 consistent errors (after fixes) - Magic, JSON RPC, and Alchemy
3 errrors

Reviewer Notes (Optional)

For this to pass, the magic-sdk PR should be merged in first (type from magic-sdk now expects the data key)

PR Description Guide

⚠️ Don't forget to add a semver label!

Please only add one label:

  • patch: Bug Fix?
  • minor: New Feature?
  • major: Breaking Change?
  • skip-release: It's unnecessary to publish this change.

@shortcut-integration
Copy link

@mattupham mattupham added the patch Increment the patch version when merged label Mar 20, 2023
Copy link
Contributor

@Ariflo Ariflo left a comment

Choose a reason for hiding this comment

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

LGTM

@mattupham mattupham merged commit 4c47993 into master Mar 20, 2023
@mattupham mattupham deleted the sc-68969-immutable-stark-error branch March 20, 2023 20:48
@magiclabsFE magiclabsFE added the released This issue/pull request has been released. label Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants