Conversation
liqdmetal
force-pushed
the
feature/dvm-c6-callsc
branch
2 times, most recently
from
August 25, 2026 02:06
ccc7453 to
6c0bd12
Compare
Author
|
Folded local maturity: call_sc now forwards incoming DERO/asset via reserved args value/assetvalue/asset. Callee sees DEROVALUE()==forwarded amount; insufficient funds returns 2 and rolls back. TestC6_ValueForward. Branch is flat on community-dev (no intrinsic dep). |
Rebuilt on DEROFDN community-dev (post-DEROFDN#129 func_table refactor). call_sc(scid, entrypoint, name, val, ...): nested cross-contract call sharing one tx/gas/commit. Value-forward via reserved args value / assetvalue / asset (callee sees DEROVALUE()==forwarded). Recursion cap 8. Wargame locks: R1 write isolation, R2 back-call sees committed-only, R3 scoped rollback; nonzero callee return = failure (data crosses via STORE). Tests: TestC6_*, TestWargameC6_*, full dvm suite green.
liqdmetal
force-pushed
the
feature/dvm-c6-callsc
branch
from
August 31, 2026 12:16
13479cf to
be185d9
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
C6 from the improvement agenda — cross-contract calls:
call_sc.The single biggest DeFi gap in DERO's DVM is closed: a contract can now call another contract. No more monolithic dApps.
The primitive
call_sc(scid_hex String, entrypoint String, name1, val1, name2, val2, ...) -> Uint64entrypointin a nested DVM invocation sharing the same tx: one gas budget, one commit point, deferred transfers intactValue-forward (folded in)
Reserved args
value/assetvalue/assetmove incoming funds into the callee for the nested run:call_sc(scid, "Deposit", "value", 100)— the callee seesDEROVALUE() == 100call_sc(scid, "Deposit", "assetvalue", N, "asset", asset_scid)— same for a named assetExecution semantics
SCIDSELF+Chain_inputs.SCIDto the target and resolves/executes against the target's own treeverify_sig(K0 Fix C) — never trusts "who called me"call_scbase 10,000 + the callee's execution on the shared budgetCross-call state rules (wargame, folded in)
TestWargameC6_*locks three rules for contract authors:STORE("count", x)never clobbers the caller's same-named key.Key finding: a nonzero callee RETURN is a failure, so data crosses calls via STORE, never via return value.
Deliberately NOT in v1
Tests (
dvm/call_sc_test.go+dvm/wargame_c6_reentrancy_test.go)TestC6_NestedSuccessInc(7)→ count persisted = 7TestC6_FailureRollbackpoison) discardedTestC6_RecursionCapTestC6_ValueForwardvalue=100forwarded → calleeDEROVALUE()= 100; over-forward fails and rolls backTestWargameC6_WriteIsolationTestWargameC6_BackcallSeesCommittedOnlyTestWargameC6_RollbackScopedFull dvm suite green; whole tree builds.
Why this matters
Router, escrow, and token can now be separate audited contracts calling each other instead of one giant contract where a bug in any piece compromises all of it. Standard interfaces become possible. This is the composability primitive that a settlement rail — atomic swaps, DEX, confidential AMM, perpDEX — is built on.
Relationship
research-docs/cross-contract-calls.md(issue Cross-contract calls (CALL_SC) — design proposal #87).community-dev— no intrinsic dependency. Composes with v9 intrinsics for callee auth.Branch:
feature/dvm-c6-callscin the forkliqdmetal/derohe-improvements-by-liqdmetal. Carries the build fixes. Flat oncommunity-dev.