Fix weight_limit auto-fill encoding error after gas estimation#43
Merged
Fix weight_limit auto-fill encoding error after gas estimation#43
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #43 +/- ##
==========================================
+ Coverage 48.79% 48.84% +0.05%
==========================================
Files 181 181
Lines 23014 23004 -10
Branches 1237 1235 -2
==========================================
+ Hits 11229 11236 +7
+ Misses 11737 11720 -17
Partials 48 48 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ff1fe0e to
fcc286c
Compare
Dedot's SCALE codec normalizes struct field names to camelCase via stringCamelCase (ref_time -> refTime, proof_size -> proofSize). Our codec and auto-fill code was using raw metadata names (snake_case), causing 'Cannot mix BigInt and other types' encoding errors in the Information Pane after gas estimation. Fix at the shared layer: - Add normalizeFieldName() to lib/codec.ts matching Dedot's convention - Use it in decomposeArgHex for struct and enum field value lookups - Simplify gas estimation auto-fill to use camelCase directly - Add regression tests: normalizeFieldName unit tests (4), snake_case struct decomposition with camelCase values (1), already-camelCase struct decomposition (1)
fcc286c to
8024ee1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the "Cannot mix BigInt and other types" error in the Information Pane when gas estimation auto-fills the
weight_limitfield forrevive.instantiateWithCode.Root Cause
The auto-fill code was reading struct field names from metadata, which returns snake_case (
ref_time,proof_size). But Dedot's SCALE codec normalizes field access to camelCase (refTime,proofSize). When the codec tried to encode{ ref_time: BigInt(117234441), proof_size: BigInt(0) }, it didn't match the expected struct shape and threw a BigInt type mixing error.Fix
Simplified the auto-fill to always use camelCase keys matching Dedot's convention. Removed the metadata field name resolution that was producing the wrong casing.
Test plan
0xwith error)yarn testpasses