feat(calldata)!: migrate method-call key "method" -> "" (v0.6 genvm ABI)#96
Draft
MuncleUscles wants to merge 2 commits into
Draft
feat(calldata)!: migrate method-call key "method" -> "" (v0.6 genvm ABI)#96MuncleUscles wants to merge 2 commits into
MuncleUscles wants to merge 2 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Jul 8, 2026
The GenVM v0.6 calldata ABI renames the method-call key from "method" to
"" (empty string). Because the calldata encoder sorts map keys ascending,
"" sorts first, so the method name becomes the binary prefix of the encoded
calldata. genvm-manager auto-remaps "method" -> "" but logs an error on every
call; SDKs must migrate to stop the error and match the canonical wire format.
- make_calldata_object (genlayer_py/contracts/utils.py) is the sole producer
of the method key; it now emits ret[""] = method. This flows through every
method-call path (write/read/sim/estimate + encode_tx_data_call).
- The calldata encoder/decoder are key-agnostic and unchanged; the decoder
round-trips whatever key is present, so decoding auto-adapts.
- Updated consensus/smoke round-trip assertions to read call_data[""] and
added test_method_key_is_empty_string_binary_prefix, which asserts the ""
key is present, "method" is absent, and the method name precedes the "args"
key bytes in the raw calldata (proving "" sorts first). This test fails
under the old key.
- Regenerated the raw / base64 / readable calldata fixtures to the new wire
format ({"": "ask_for_coin", ...}) across the write sample-data files and
conftest. Deploy (constructor) fixtures are unaffected — they carry no
method key.
No back-compat toggle: the codebase has no calldata versioning mechanism and
none is introduced.
BREAKING CHANGE: method-call calldata now keys the method name under "" (empty
string) instead of "method", per the v0.6 GenVM calldata ABI. Calldata built by
this SDK is incompatible with pre-v0.6 GenVM, and decoded calldata exposes the
method name under the "" key.
3e6e87f to
57fd841
Compare
The tests/e2e/contracts fixtures used the v0.2.x SDK idiom and fail under GenVM v0.6 with NameError (from genlayer import * no longer binds gl). Migrate all 15 to v0.3: - from genlayer import * -> import genlayer as gl + from genlayer.types import * - gl.Contract -> gl.contract.Contract; gl.ContractAt -> gl.contract.get_at; gl.deploy_contract -> gl.contract.deploy - gl.DynArray/TreeMap -> gl.storage.*; @allow_storage -> @gl.storage.allow - gl.eq_principle_* -> gl.eq_principle.*; gl.exec_prompt -> gl.nondet.exec_prompt; gl.get_webpage -> gl.nondet.web.render - drop callable u256(x) wrapping (aliases are Annotated[int], not callable) multi_tenant_storage.py additionally dropped the removed emit(gas=...) kwarg (v0.3 emit takes value/on/use_balance/fee_params; a normal internal message's fee comes from the sender's prefunded pool, no per-emit gas limit). The py-genlayer:test Depends placeholder is unchanged.
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.
Migrates genlayer-py to the GenVM v0.6 calldata ABI, which renames the
method-call key from
"method"to""(empty string). Because the calldataencoder sorts map keys ascending,
""sorts first — the method name becomesthe binary prefix of the encoded calldata. genvm-manager auto-remaps
"method"->""but logs an error on every call, so the SDK must migrate.SDK-side counterpart of the wire-format change already merged in genlayer-node
(#1502) and genlayer-studio (#1697).
Wire-format change
Before:
calldata.encode({"args": [...], "method": "foo"})After:
calldata.encode({"args": [...], "": "foo"})The empty key sorts first in canonical calldata encoding, so for a call to
ask_for_coin(...)the raw calldata now begins with the method-name bytes:What changed
genlayer_py/contracts/utils.py—make_calldata_object, the soleproducer of the method key, now emits
ret[""] = method. This is the onlysource change; it flows through every method-call path (write / read / sim /
estimate +
encode_tx_data_call).round-trips whatever key is present, so decoded calldata now exposes the
method name under
""with no decoder change.call_data[""];new
test_method_key_is_empty_string_binary_prefixasserts the""key ispresent,
"method"is absent, and the method-name bytes precede the"args"key bytes in the raw calldata (proving
""sorts first). This test failsunder the old key.
(
{"": "ask_for_coin", ...}) in the write sample-data files and conftest.Deploy (constructor) fixtures are unaffected — they carry no method key.
Compatibility
No back-compat toggle: genlayer-py has no calldata versioning mechanism, and
none is introduced (matching node/studio). Calldata built by this SDK is
incompatible with pre-v0.6 GenVM.
BREAKING CHANGE: method-call calldata now keys the method name under
""instead of
"method".Testing
uv run --python 3.13 pytest tests/unit -m "not testnet"-> 91 passed, 17deselected (testnet-marked tests need live RPC). Verified the new property
test fails when reverted to the old
"method"key.Depends-On: genlayerlabs/genvm-manager#1
Depends-On: https://github.com/genlayerlabs/genlayer-node/pull/1502
Depends-On: https://github.com/genlayerlabs/genlayer-dev-env/pull/95
Depends-On: https://github.com/genlayerlabs/genlayer-e2e/pull/619
Depends-On: genlayerlabs/genlayer-studio#1697
Depends-On: #96
Depends-On: genlayerlabs/genlayer-js#192
Depends-On: genlayerlabs/genlayer-testing-suite#98