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

GasEstimator issue triggered by changing U128 serialization #11324

Open
benesjan opened this issue Jan 17, 2025 · 0 comments
Open

GasEstimator issue triggered by changing U128 serialization #11324

benesjan opened this issue Jan 17, 2025 · 0 comments
Assignees

Comments

@benesjan
Copy link
Contributor

benesjan commented Jan 17, 2025

In this PR I've changed U128 serialization such that it serializes to 2 fields and not 1. This then makes it possible to use as contract function arg as the resulting serialization format matches intrinsic serialization of Noir (U128 struct contains 2 limbs and that's what Noir assigns the values to when matching the witness with the function args).

But for whatever reason this has caused gas_estimation.test.ts to fail (specifically the second and third test case).

Palla helped me with debugging and he thinks this is an issue with the estimator. There is a workaround - if I set estimatedGasPadding to a larger value the tests passes.

The plan is that I will revisit this once I implement Packable trait because once that is done U128 will be once again stored as 1 field in storage. This will help us determine whether the issue is storage related as the storage costs should get to values before this PR was made.

Look for "TODO(#11324)" in the codebase to find where the workaround was placed.

Here are gas estimation values I obtained for different paddings in the estimates gas with public payment method test case and info whether the test passed (F - fail, P -pass):

F padding 0: Estimated gas limits for tx: DA=8192 L2=454967 teardownDA=2048 teardownL2=97792
F padding 0.0005859375: Estimated gas limits for tx: DA=8197 L2=455234 teardownDA=2050 teardownL2=97850
P padding 0.00068359375: Estimated gas limits for tx: DA=8198 L2=455279 teardownDA=2050 teardownL2=97859

Saving them here as they might be useful later on.

@benesjan benesjan changed the title GasEstimator issue triggered by changing U128 serialization GasEstimator issue triggered by changing U128 serialization Jan 17, 2025
@benesjan benesjan self-assigned this Jan 17, 2025
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

No branches or pull requests

1 participant