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

fix: determine entry point version from light account version #632

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

dphilipson
Copy link
Contributor

@dphilipson dphilipson commented Apr 30, 2024

PR-Codex overview

This PR updates the entryPoint initialization in the account.ts file to include the version from AccountVersionRegistry.

Detailed summary

  • Updated entryPoint initialization to include version from AccountVersionRegistry
  • Utilized AccountVersionRegistry to fetch version and address information for LightAccount

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

entryPoint = getEntryPoint(chain),
entryPoint = getEntryPoint(chain, {
version: AccountVersionRegistry["LightAccount"][version]
.entryPointVersion as any,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't think of a way to do this without the any cast. TypeScript can't infer that this type matches the type for the light account version in version.

Copy link
Collaborator

Choose a reason for hiding this comment

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

is GetLightAccountVersion generic on entrypoint version? it could take in the TEntryPointVersion which might strongly type them

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh wait:

TEntryPointVersion extends GetEntryPointForLightAccountVersion<
    "LightAccount",
    TLightAccountVersion
  > = GetEntryPointForLightAccountVersion<"LightAccount", TLightAccountVersion>

weird. I'd expect this to allow the inference

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'm not quite sure why either, but the error message is a bit too complicated to easily decipher 😞.

Copy link
Collaborator

@moldy530 moldy530 left a comment

Choose a reason for hiding this comment

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

approving to unblock, might need to revisit this and see why the version can't be tied to the ep version.

I ran into some other typing weirdness with the getEntryPoint method so there's def some edge cases to resolve

@dphilipson dphilipson merged commit 7813de0 into main Apr 30, 2024
3 checks passed
@dphilipson dphilipson deleted the dp/light-account-to-entry-point-version branch April 30, 2024 03:46
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.

2 participants