Skip to content

feat(fees): emulate descendant grants of balance-funded messages - #1785

Merged
kp2pml30 merged 7 commits into
v0.123-devfrom
feat/genvm-descendant-grants
Oct 14, 2026
Merged

kp2pml30 merged 7 commits into
v0.123-devfrom
feat/genvm-descendant-grants

Conversation

@kp2pml30

@kp2pml30 kp2pml30 commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Delivery context

Depends-On: genlayerlabs/genvm-manager#59

Hub: genlayerlabs/genlayer-node#2189 (stack-wide E2E runs from there)

What

  • Pin GenVM to v0.6.0-rc9 (release of genvm-manager#59 at 7c3fcb32) and refresh the py-genlayer / py-genlayer-multi runner hashes in examples and tests
  • Emulate descendant grants of balance-funded messages: decode the canonical grant envelope GenVM puts in the emitted subtree (Closed / Open / Pinned), keep the receipt subtree bytes exact, reserve P + D from the emitting contract, install D as the child's descendant bucket with the grant's policy, keep any surplus as primary custody
  • Read the emission budget from the manager's message_fee; Studio read declaredBudget, a key the manager never sends, so every balance-funded child was declared with budget 0

Why

genvm-manager#59 lets a balance-funded message fund its descendants (gl.contract.UseBalanceParams(fee_params, descendants=...)); Studio mirrors the consensus semantics of genlayer-consensus#1811

Testing done

  • Unit suite: 1663 passed, 7 skipped (before the re-pin to v0.6.0-rc9)
  • Grant codec checked against GenVM's portable vectors (decode, re-encode, rejections)
  • Local docker stack with the source-built GenVM: storage, payable escrow, upgrade (28/28) integration tests pass; the descendant-grant integration test was fixed after that run and is not yet re-run locally
  • Integration test tests/integration/icontracts/tests/test_descendant_grants.py added (Closed / Open / Pinned)

Decisions made

  • GenVM is pinned to the release tag v0.6.0-rc9, so test_release_backend_builds_use_an_immutable_genvm_release passes once that release is published
  • Like node, Studio appends the exhausted external guard (UNMATCHED_EXTERNAL_GUARD_ALLOC, now in GenVM's origin) to pinned trees and sends it alone for closed trees, so an unmatched external fails in GenVM instead of being refused by consensus
  • No-allocation transactions get node-shaped synthetic wildcards with concrete fee params: this GenVM rejects zero-budget internal messages
  • The nix_netrc build secret defaults to the empty docker/empty.netrc instead of /dev/null: buildx 0.38 bake refuses to read a file outside the project without --allow=fs.read, which compose cannot pass, and E2E runners now ship buildx 0.38

Checks

  • I have tested this code
  • I have reviewed my own PR
  • I have created an issue for this PR
  • I have set a descriptive PR title compliant with conventional commits

@kp2pml30 kp2pml30 self-assigned this Oct 7, 2026
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a90af55f-15cd-4db6-bb96-aac1a0c90e43

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kp2pml30
kp2pml30 force-pushed the feat/genvm-descendant-grants branch 2 times, most recently from c618981 to 685e305 Compare October 8, 2026 10:46
@kp2pml30
kp2pml30 changed the base branch from v0.123-dev to chore/genvm-webdriver-0.0.12 October 8, 2026 10:46
@kp2pml30
kp2pml30 added this pull request to stack #1787 October 8, 2026 10:46
@kp2pml30

kp2pml30 commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

/run-e2e

@ci-core-e2e-runner

Copy link
Copy Markdown
Contributor

E2E status was updated. Follow the current E2E and merge checks on this PR. Detailed diagnostics are available internally.

Base automatically changed from chore/genvm-webdriver-0.0.12 to v0.123-dev October 8, 2026 11:46
Studio also read the emission budget from `declaredBudget`, a key the manager never sends (`message_fee`), so every balance-funded child was declared with budget 0.
@kp2pml30
kp2pml30 force-pushed the feat/genvm-descendant-grants branch from 685e305 to b6f5295 Compare October 8, 2026 11:46
@kp2pml30
kp2pml30 marked this pull request as ready for review October 9, 2026 06:10
@kp2pml30
kp2pml30 force-pushed the feat/genvm-descendant-grants branch from b6f5295 to 1a8fe64 Compare October 9, 2026 07:44
@kp2pml30
kp2pml30 requested a review from MuncleUscles October 9, 2026 07:50

@MuncleUscles MuncleUscles left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found two fee-accounting issues and one integration-test race in the descendant-grant path. The refund finding is the known consensus REP-4 case, but Studio's separate accounting still needs the corresponding fix. The focused fee/grant unit suites passed locally (507 tests); I could not run the Docker integration suite locally.

Comment thread backend/consensus/base.py
Comment thread backend/protocol_rpc/fees.py Outdated
Comment thread tests/integration/icontracts/tests/test_descendant_grants.py
Inherit the parent fee depositor and admitted grant rules when materializing descendants. Preserve metering for zero-budget grant descendants and wait through all triggered transaction levels in the integration test.

Validation: 1669 unit tests passed, 7 skipped; Black and diff checks passed. Live integration was not rerun.
Remove the legacy grant flag and its permissive fee validation and rotation rules. Omitted grants now use the same validation and accounting as explicit Closed grants, with surplus retained in primary escrow.

Validation: 1674 unit tests passed, 7 skipped; Black and diff checks passed. Independent review found no actionable issues.

kp2pml30 commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

Removed grant.legacy in c5a7768: omitted grants now behave exactly like explicit Closed grants, with budget 0, the same fee validation, and surplus retained in primary escrow

Validation: 1674 unit tests passed, 7 skipped; live integration was not rerun

@kp2pml30
kp2pml30 requested a review from MuncleUscles October 12, 2026 09:17
It imports the integration module, which needs gltest; the unit job does not install it

Claude-Session: https://claude.ai/code/session_01N97Hvs14ckrioBoYJTD4Te
buildx bake refuses to read /dev/null without --allow=fs.read=/dev/null, which compose cannot pass, so builds with buildx 0.38 failed

Claude-Session: https://claude.ai/code/session_01N97Hvs14ckrioBoYJTD4Te
@kp2pml30

Copy link
Copy Markdown
Member Author

@MuncleUscles please re-review

@kp2pml30
kp2pml30 merged commit c54dd45 into v0.123-dev Oct 14, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants