Skip to main content
After you read this page, you can read the commit of an account, check a commit attestation, and decode each event and error of the DSL registry. AnafiDslRegistry stores one commit for each account: a 32-byte hash of the rule document and a version counter. It runs behind an ERC-1967 proxy with UUPS upgrades. It has no owner of its own. Its admin is AnafiRegistry.owner(). The contract does not read the rule document and does not run rules. The hash is opaque to it. Each commit names the adapter that the document is committed against.

The commit value

The account address is always msg.sender. The contract writes the commit under the address that calls it:
  • A Safe calls the DSL registry in a Safe transaction, so the Safe is msg.sender.
  • An ERC20Allow account calls the DSL registry from its own address.
The SDK computes the hash with dslCommitment(salt, yaml):
The contract accepts any bytes32. See Documents for the salt and the document text.

Functions for the account

commitDsl

Records a commit that the engine attested. This is the call that the SDK sends for both account kinds. The engine signs this digest, with no EIP-191 prefix and no EIP-712 domain:
The checks run in this order:
  1. block.timestamp > validUntil reverts AttestationExpired(). A call at validUntil passes.
  2. A malformed signature reverts with an OpenZeppelin ECDSA error. A signer other than AnafiRegistry.engineSigKey() reverts InvalidEngineSignature().
Effects: stores (hash, newVersion) for msg.sender and emits DslCommitted(msg.sender, hash, newVersion, adapter). Because the digest holds newVersion, an attestation is valid for one version only. If another commit of the same account lands first, the version moves and the old attestation fails with InvalidEngineSignature(). The digest also holds the account, the chain, the DSL registry and the adapter, so a relay cannot change any of them. The contract does not check that adapter is listed in the registry, or that the account granted it a permission.

commitDslDirect

Records a commit with no engine attestation. The account publishes the sealed document itself, in the event. Reverts VersionMismatch() when expectedVersion is not the next version. This check stops a stale commit. A stale commit cannot replace a newer one. Effects: stores (dslHash, newVersion) for msg.sender and emits DslCommittedDirect(msg.sender, newVersion, dslHash, sealedDsl, adapter). commitDsl and commitDslDirect share one version counter. The public SDK flows send commitDsl.

Admin

Only AnafiRegistry.owner() can upgrade. Another caller gets CallerNotRegistryOwner(). The OpenZeppelin UUPS errors also apply: UUPSUnauthorizedCallContext(), UUPSUnsupportedProxiableUUID(bytes32), ERC1967InvalidImplementation(address), ERC1967NonPayable().
The deployment calls initialize once. It reverts RegistryNotUsable(address registry) when the registry has no code or its owner() is zero, and InvalidInitialization() on a second call.

Views

Events

To list the commit history of one account, filter both events on the indexed aaWallet topic.

Errors

Test vector

Use this vector to check your own computation of the commitDsl digest.

Invariants

  • The commit of an account changes only in a call that the account sends itself.
  • The version of an account goes up by exactly 1 on each commit, and never goes down.
  • A commit through commitDsl exists only if the engine key of that moment signed the exact account, version, hash, deadline and adapter.

Storage

All state is in one ERC-7201 namespace, anafi.storage.AnafiDslRegistry, at slot 0x9ab5bf54f06b29ee85846e1165ef6b3afdd7211c6fe5730f2fc7a89773778500.