Conversation
This was referenced Jun 11, 2026
Celo-style "token duality" - an ERC20-shaped token whose balances ARE native account balances (balanceOf == address.balance, transfers move native value without executing recipient code) - cannot be implemented in pure EVM: moving another account's native balance requires a protocol-level native-transfer precompile, plus a predeploy token and prover support. That protocol work does not exist on DogeOS yet. This PR ships what contracts development needs in the meantime: - src/dogeos/INativeDoge.sol: the interface payment/intent contracts should code against, with the production semantics specified (native balances, no recipient-code execution on transfer, storage allowances) and the protocol prerequisites documented. - src/test/mocks/DualityDogeShim.sol: TEST-ONLY functional shim implementing the interface inside Foundry via vm.deal (the in-test stand-in for the future precompile). Faithful to production semantics including the no-recipient-hooks property; explicitly NOT faithful for gas. Lives under src/test/mocks so hardhat (which cannot resolve forge-std) never compiles it and slither/coverage exclude it. - src/test/dogeos/DualityDogeShim.t.sol: 11 tests covering native balance mirroring, transfer/transferFrom/allowance semantics (incl. infinite-allowance no-decrement), insufficient balance and allowance reverts, the reverting-receive()-cannot-block-transfer property, and a conservation fuzz. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dghelm
force-pushed
the
experiment/duality-test-shim
branch
from
July 7, 2026 04:43
216989d to
2da450c
Compare
dghelm
marked this pull request as ready for review
July 7, 2026 04:49
Author
|
Superseded by #51 |
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
Groundwork for using Celo-style token duality (an ERC20-shaped token whose balances are native account balances) in DogeOS contracts — specifically so the upcoming payment/intent-ledger work can be developed and tested against duality semantics now, before the protocol pieces exist.
True duality cannot be implemented in pure EVM: moving another account's native balance requires a protocol-level native-transfer precompile (Celo's CELO/GoldToken model). Enabling it for real on DogeOS needs, tracked separately:
DogeOSPredeployaddress calling that precompile;What this PR ships
src/dogeos/INativeDoge.sol— the interface contracts should code against, with production semantics specified:balanceOf(a) == a.balance(no storage balances), transfers move native value without executing recipient code (noreceive()/fallback()hooks — matching Celo's precompile behavior), storage allowances.src/test/mocks/DualityDogeShim.sol— TEST-ONLY functional shim implementing the interface in Foundry viavm.deal(the in-test stand-in for the future precompile). Semantically faithful, including the no-recipient-hooks property; explicitly not valid for gas measurement. Placed undersrc/test/mocks/so hardhat never compiles it (it imports forge-std) and slither/coverage exclude it.src/test/dogeos/DualityDogeShim.t.sol— 11 tests: native-balance mirroring, transfer/transferFrom/allowance semantics (incl. infinite-allowance no-decrement), insufficient balance/allowance reverts with exact errors, reverting-receive()cannot block a transfer, conservation fuzz.Test plan
forge test --evm-version cancun— 432 tests pass (11 new)npx hardhat compile— clean (interface compiles; shim correctly excluded)Relation to other work
experiment/payment-contract) will build on both.DualityDogevalue-call emulation) — that mock answers "what does it cost," this shim answers "does my contract behave correctly against it."🤖 Generated with Claude Code