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

Latest kzg-wasm Release 0.5.0 Breaks ethers API #4841

Open
pcaversaccio opened this issue Sep 21, 2024 · 4 comments
Open

Latest kzg-wasm Release 0.5.0 Breaks ethers API #4841

pcaversaccio opened this issue Sep 21, 2024 · 4 comments
Assignees
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6

Comments

@pcaversaccio
Copy link

Ethers Version

6.13.2

Search Terms

kzg-wasm

Describe the Problem

kzg-wasm released their latest 0.5.0 version with the major changeset coming from this PR: ethereumjs/kzg-wasm#17. You can see how the renamed e.g. blobToKzgCommitmentWasm to blobToKZGCommitmentWasm and thus if you do something like that tx.kzg = kzg;, there will be a TypeScript compilation error:

return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
scripts/sign-eip4844.ts:66:5 - error TS2739: Type '{ loadTrustedSetup: (trustedSetup?: TrustedSetup | undefined) => number; freeTrustedSetup: () => void; blobToKZGCommitment: (blob: string) => string; computeBlobKZGProof: (blob: string, commitment: string) => string; verifyBlobKZGProofBatch: (blobs: string[], commitments: string[], proofs: string[]) => boolean; veri...' is missing the following properties from type 'KzgLibrary': blobToKzgCommitment, computeBlobKzgProof

66     tx.kzg = kzg;

Code Snippet

You can use my repo here: https://github.com/pcaversaccio/raw-tx

1. `pnpm install`
2. `pnpm upgrade --latest` (will upgrade `kzg-wasm` to version `0.5.0`)
3. `pnpm generate:eip4844`

Contract ABI

No response

Errors

No response

Environment

No response

Environment (Other)

No response

@pcaversaccio pcaversaccio added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Sep 21, 2024
@pcaversaccio pcaversaccio changed the title Latest kzg-wasm Release 0.5.0 Breaks ethers Latest kzg-wasm Release 0.5.0 Breaks ethers API Sep 21, 2024
@ricmoo
Copy link
Member

ricmoo commented Sep 21, 2024

Aiya. I will look into what makes the most sense to do; I suppose just allow that field to be either and pick the one at runtime that exists?

@pcaversaccio
Copy link
Author

Aiya. I will look into what makes the most sense to do; I suppose just allow that field to be either and pick the one at runtime that exists?

Sounds reasonable to me.

@ricmoo
Copy link
Member

ricmoo commented Sep 23, 2024

@pcaversaccio

Can you please check out the above commit? I've made changes that should fix it (in a backwards compatible way), but it was far more involved than expected. I've tested on 0.3.1 and 0.5.0, but would love extra eyes on it as it changes some signatures and would also love for you to try it out in your TypeScript environment to make sure the types are all happy.

@pcaversaccio
Copy link
Author

@pcaversaccio

Can you please check out the above commit? I've made changes that should fix it (in a backwards compatible way), but it was far more involved than expected. I've tested on 0.3.1 and 0.5.0, but would love extra eyes on it as it changes some signatures and would also love for you to try it out in your TypeScript environment to make sure the types are all happy.

Left a review here: e5036e7#commitcomment-147131361. The types are not happy yet :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

2 participants