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

SDK update 3.1.8 broke estimateL1GasCost for type 0 txs #9293

Closed
shanefontaine opened this issue Jan 31, 2024 · 7 comments
Closed

SDK update 3.1.8 broke estimateL1GasCost for type 0 txs #9293

shanefontaine opened this issue Jan 31, 2024 · 7 comments
Labels
A-pkg-sdk Area: packages/sdk C-bug Category: bugs S-confirmed Status: A confirmed bug

Comments

@shanefontaine
Copy link

Describe the bug

The fix in #8902 explicitly defines values to be serialized by ethers.

For type 0 txs, ethers will accept the input and check the property keys. Since type 2 properties now exist on the tx object (even if undefined), they fail the check.

To Reproduce

Call estimateL1GasCost() with type 0 params on ethers 5.7.2.

Expected behavior

Return estimated l1 gas cost.

@shanefontaine shanefontaine changed the title SDK update 3.1.8 broke estimateL1GasCost for type 1 txs SDK update 3.1.8 broke estimateL1GasCost for type 0 txs Jan 31, 2024
@roninjin10
Copy link
Contributor

I see. We are on an old version of ethers so we can't really fix this issue with ethers directly. As a quick fix my suggestion is we use serializeTransaction from viem as a one off here. Viem should also be moved from devDeps to deps if it it isn't already a regular dep

I won't be able to get to this pr this week but happy to review a pr if you want to make this change in meantime

@shanefontaine
Copy link
Author

shanefontaine commented Feb 1, 2024

Thanks for the reply @roninjin10

This is actually how I would expect ethers to behave. I don't think txs should have both type 0 and type 2 values present since then the intention of the caller would be unclear and it is left up to the lib to determine, which is not ideal. In this case, the consumer of the Optimism SDK has no power since both types are forced upon the call in all cases.

Is it possible for you to handle it prior to serialization with ethers? I'm not exactly sure where, but I would think ethers has a utility function somewhere that handles this.

@roninjin10
Copy link
Contributor

Yes @shanefontaine. What you can do is filter out the undefined values. Viem will work without doing this because they check the value instead of the key. ('key' in value) vs (value.key !== undefined). Only downside to filtering out the keys is it's more code than using viem but upside is you aren't mixing viem and ethersv5.

@shanefontaine
Copy link
Author

@roninjin10 sorry I might not be clear. I believe there is nothing I can do because the Optimism SDK is what adds the values no matter what I pass in (including undefined values). No matter what filtering I do, any type 0 tx will always fail because of this. Let me know if that helps!

@roninjin10
Copy link
Contributor

@shanefontaine Right sorry I'm the one that is not clear. I'm talking about fixing the sdk not your repo. I worded it confusing because I said What you can do is which meant what one can do is or what whoever picks up this ticket can do is

@roninjin10 roninjin10 added C-bug Category: bugs S-confirmed Status: A confirmed bug A-pkg-sdk Area: packages/sdk labels Feb 1, 2024
@tynes
Copy link
Contributor

tynes commented Feb 2, 2024

The sdk is very fragile, it seems like every change that happens with it breaks something. There isn't good test coverage for it right now, the real main test for it is it runs both an eth and erc20 withdrawal against the docker compose devnet

@tynes
Copy link
Contributor

tynes commented Jun 17, 2024

The sdk is deprecated

@tynes tynes closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pkg-sdk Area: packages/sdk C-bug Category: bugs S-confirmed Status: A confirmed bug
Projects
None yet
Development

No branches or pull requests

3 participants