feat(evm-wallet-experiment): Add delegator exos#882
Draft
Conversation
Contributor
…handler Vat rejections propagate through the kernel as CapData objects. The queueMessage RPC handler was passing these through undeserialized, causing callers to receive a generic 'Internal error' instead of the original rejection message. Apply the same isCapData/kunser pattern already used in SubclusterManager to deserialize CapData rejections into Errors before rethrowing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…JSON requests JSON.stringify drops BigInt fields silently; replace with a replacer that coerces BigInt to string so numeric values survive the wire. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…llowedMethods, and ERC20TransferAmount These enforcers expect tightly-packed bytes, not ABI head/tail encoding. Switch encodeAllowedTargets/encodeAllowedMethods to encodePacked and encodeErc20TransferAmount likewise. Update explainDelegationMatch to decode packed terms the same way, and update the caveat encoding tests to assert packed layout directly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…and enforcer key map Add registerChainContracts() / customChainContracts so devnet chains (e.g. Anvil at 31337) can be registered at runtime without touching the static CHAIN_CONTRACTS table. Add ENFORCER_CONTRACT_KEY_MAP to translate PascalCase enforcer keys in contracts.json to camelCase CaveatType names. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Represent delegations as discoverable exo objects ("twins") so an agent
can call E(twin).transfer(to, amount) instead of manually building
Execution structs. Adds a method catalog, grant builder, twin factory
with cumulative spend tracking, and wires them into the delegation and
coordinator vats.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…wins Build typed method guards from METHOD_CATALOG entries and pass them to makeDiscoverableExo, enabling arg-count/type validation at the exo boundary. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… generation generateSalt accepts an optional entropy hex string that is mixed into the counter hash when crypto.getRandomValues is unavailable. Thread the same entropy option through makeDelegation and all three buildDelegationGrant overloads (transfer, approve, call) so callers can supply per-run entropy to avoid salt collisions across fresh vat instances. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…win method args Add valueLte to CaveatSpecStruct so call twins can carry a per-call ETH value limit that is checked locally before submission. In makeDelegationTwin, normalize args[1] to BigInt on entry (required when values arrive as hex strings over the daemon JSON-RPC boundary), apply the valueLte check, and pass normalizedArgs to buildExecution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… caveat Integrate with the delegation framework's AllowedCalldataEnforcer to pin the first argument (recipient/spender) of transfer/approve at both the on-chain enforcer level and the local exo interface guard. - Add `allowedCalldata` to CaveatTypeValues and CaveatSpec - Add `encodeAllowedCalldata` helper and deployed enforcer address - Wire optional `recipient`/`spender` through grant builders - Twin derives address restriction from caveatSpecs, not a standalone field Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Accepts a full DelegationGrant and persists only the delegation to baggage. Used by coordinator-vat's provisionTwin, where redeemFn/readFn closures must stay in the coordinator scope and cannot cross the CapTP vat boundary. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ransaction - setup-wallets: provision delegation twin via provisionTwin (not receiveDelegation) so the away coordinator holds an active twin with a cumulativeSpend caveat spec (1000 ETH, native token) - coordinator-vat: store twins created by provisionTwin in a local coordinatorTwins map keyed by delegation ID - coordinator-vat: sendTransaction routes through the twin when one is registered for the matched delegation, so local caveat checks (e.g. cumulativeSpend budget) fire before the UserOp hits the chain Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Script invoked by the docker e2e suite to test local cumulativeSpend enforcement and chain-side rejection of an expired timestamp caveat. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Runs run-delegation-twin-e2e.mjs inside the away container as part of the Docker E2E suite. Covers local cumulativeSpend enforcement and chain-side rejection of an expired timestamp delegation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-20 grant builders - Export FIRST_ARG_OFFSET from erc20.ts; remove local copies in delegation-grant.ts and delegation-twin.ts - Extract buildErc20Grant helper from the near-identical buildTransferGrant/buildApproveGrant (~90 lines removed) - Strengthen delegation twin method guards: M.any() -> M.string() for Hex returns, M.bigint() for getBalance - Clarify cast: as keyof typeof METHOD_CATALOG -> as CatalogMethodName Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Explains the grant → twin → discoverable capability layering: - Delegation grants as serializable describable delegations (redeemable bytestring + readable caveat specs) - Delegation twins as local capabilities that mirror on-chain stateful caveats (latently; on-chain is authoritative) - M.* patterns as the mechanism for discoverability and pre-validation Reorganizes the enforcer mapping table around this model and preserves the existing M.*/Gator overlap reference content. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… message directly With the queueMessage RPC fix in @MetaMask/ocap-kernel, vat rejections now surface as response.error with the actual message rather than a generic 'Internal error'. Update callVatExpectError in both the docker e2e helper and the integration test runner to return response.error.message directly and throw on unexpected success, replacing the dead response.result.body path.
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.
WIP