--- eip: 8507 title: Agent Allowlist Framework description: Scoped allow and deny lists for agents and other objects, with stated grounds, adoption by consumers and uniform results author: Gary Yang (@garyyang-finchip) discussions-to: https://ethereum-magicians.org/t/erc-8507-agent-allowlist-framework-aaf/30456 status: Draft type: Standards Track category: ERC created: 2026-11-20 requires: 165 --- ## Abstract This proposal defines the Agent Allowlist Framework (AAF), a framework in which one or more parties state, within a declared activity, which agents and other objects they admit and which they refuse, on which grounds, and with what effect. It defines allowlists and denylists together: both are lists of one kind that differ only in polarity, `ALLOW` or `DENY`. AAF defines four objects of a list (Scope, List, Criteria, Entry), a Binding by which a consumer adopts lists for its own actions, and one standard result. A list has typed members, which may be accounts, registered agent identities, groups, runtime instances, artefacts such as a model or tool version, or named services. Members are written by the list's manager, shown by proofs against a committed set, computed from criteria by an evaluator, or derived from another list. A list has no effect on anybody until a consumer binds it. A binding names the actions it governs, the lists it uses on each side, what happens when both sides match, when neither does, and when something cannot be determined, and whether a decision may be used again. AAF fixes how admission and refusal are expressed, checked and given effect. It does not fix whom to admit, which evidence to require or what makes an agent good or bad: those are chosen by whoever maintains a list and whoever adopts it. ## Motivation Whether to work with an agent is decided wherever agents meet: a task board admitting bidders, a group admitting members, a service admitting callers, a runtime deciding which tools it will run. Today each of these keeps a private mapping of addresses and a private rule for filling it. Several problems repeat: 1. **Admission is decided everywhere and stated nowhere.** A counterparty cannot see which rule admitted or refused it, on what ground, or since when. Two parties that want to rely on the same list have no common way to refer to it. 2. **Identity and reputation do not answer the question.** Identity registries say who an agent is. Assertion and reputation systems say what is known or claimed about it. Neither says whether this party admits this agent for this action now. That is a relation between parties, scoped to an activity, and it needs its own record. 3. **A list without a scope becomes a verdict.** A refusal that one group decided for its own tasks is read by others as a statement about the agent. A list needs to say what it is for, and it should bind only those who chose to use it. 4. **The unknown is treated as a pass.** A requester that presents no proof of being on a denylist has not shown that it is absent from it. An evaluator that cannot read its source has not found the agent clean. Systems that fold these cases into "allowed" are open exactly where they were meant to be closed. 5. **Standing is borrowed and refusals are evaded.** Naming an admitted identity is not the same as being entitled to act for it. An identity that changes hands, or an operator that moves to a new address, raises the question of what an earlier admission or refusal still attaches to. 6. **Grounds are heterogeneous.** A wallet, a registered identity, a profile, a credential, a runtime history, inference usage, completed tasks, counterparties, a verified person or company behind the agent, on-chain activity: any of these may be the ground for admitting or refusing. No single schema fits them, and no list should be forced to use any of them. 7. **Not only agents are admitted or refused.** The same question is asked of a tool version, a model, a service endpoint or a contract. AAF addresses these by making every admission and refusal answer one question in full: who adopts, in what scope, for which object and which action, under which version of which rules and evidence, with what result. ## Specification The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119) and [RFC 8174](https://www.rfc-editor.org/rfc/rfc8174). ### 1. Terms and scope | Term | Meaning | | --- | --- | | Subject | The object a list entry or a request is about, given by a typed reference | | List | A set of subjects with a polarity, maintained by a manager | | Polarity | `ALLOW` or `DENY`. An `ALLOW` list is an allowlist, also called a whitelist; a `DENY` list is a denylist, also called a blacklist | | Manager | The account that maintains a list | | Criteria | One immutable version of the rules a list applies | | Module | A contract that criteria name: an evaluator, or a relation source | | Entry | The record of one subject in an enumerated list | | Scope | Where a rule is meant to apply: an anchor, a context and a document | | Consumer | The contract or account whose actions are decided | | Adopter | The consumer itself, or the account the consumer named to write its bindings | | Binding | What an adopter declares when it puts lists to use for a consumer | | Request | One action, in one context, about one subject | | Presenter | The account that invokes the subject's standing in a request | | Controller | The account that controls a subject | | Match result | What one list says about one subject: `MATCH`, `NO_MATCH` or `UNDETERMINED` | | Finding | A match result with everything needed to check it again, including until when it holds | | Outcome | What a binding says about a request: `ALLOW`, `DENY`, `NOT_APPLICABLE` or `INDETERMINATE` | | Disposition | What the adopter does with an outcome: `PROCEED`, `REFUSE`, `DEFER` or `PROCEED_RESTRICTED` | | Assessment | The standard result of applying a binding to a request | | Reuse | Whether a decision on an action may be used again: `NONE`, `WHILE_CURRENT` or `ADMISSION` | Four questions are asked about an agent before working with it: | Question | What answers it | | --- | --- | | Who is it? | Identity, control, group membership | | What is known or shown about it? | History, capability, runtime, assertions, behaviour | | Do I admit it for this? | The adopter's rules, the activity, the action, the state at the time | | What can it then do? | The permissions of the contract, task or runtime that acts on the answer | AAF specifies the third and provides a checkable input to the fourth. It uses answers to the first two and does not define them. AAF does not specify: which objects to admit or refuse; any dimension or evidence a list has to use; scores or rankings; identity systems, assertion systems or proof systems; the terms of an operation, such as its amount or its target, which the consumer that carries it out checks; what a refusal means for work already done or for payment; verification of the state of other chains. ### 2. Conformance AAF has three parts. | Part | Interface | Role | | --- | --- | --- | | Registry | `IAAFRegistry` | Records scopes, criteria, lists, entries and committed sets, and answers whether a subject matches a list | | Guard | `IAAFGuard` | Records bindings and applies them to requests | | Modules | `IAAFEvaluator`, `IAAFRelationSource`, `IAAFSubjectResolver` | Compute membership from criteria, name related objects, and establish standing | A Registry MUST implement lists of mode `ENUMERATED`. The modes `COMMITTED`, `PREDICATE` and `DERIVED` are OPTIONAL. A Registry that does not implement a mode MUST refuse to create a list of that mode. A consumer MAY apply bindings in its own code instead of calling a Guard. An implementation that reports `IAAFGuard` MUST follow Section 8. A Registry and a Guard MUST implement [ERC-165](./eip-165.md) and report the interfaces they implement. The interface identifiers are in the Test Cases. One rule holds for every part: **a party that cannot evaluate a condition MUST NOT report a determined result for it.** A condition that was not understood, a source that could not be read, a module that failed and a proof that was not presented are undetermined. They are never skipped and never counted as satisfied. This proposal depends on ERC-165 only. Identity registries, assertion registries, task ledgers and other sources of evidence are reached through modules and are not required by the core. ### 3. Subjects A subject is identified by a typed reference. ```text SubjectRef = (kind, chainId, namespace, id) subjectKey = keccak256(abi.encode(kind, chainId, namespace, id)) ``` `kind` is the keccak256 hash of a type name. This proposal defines six kinds: | Type name | `chainId` | `namespace` | `id` | Typical use | | --- | --- | --- | --- | --- | | `aaf.subject.account` | Chain of the account | Zero address | The address, left-padded to 32 bytes | A wallet, a contract account | | `aaf.subject.entry` | Chain of the registry | The registry contract | The identifier of the entry in that registry, as a 256-bit number | A registered agent identity, a token that stands for a skill or a task | | `aaf.subject.group` | Chain of the registry | The registry of groups | The group identifier that registry defines | A swarm, an organisation | | `aaf.subject.instance` | Chain of the operator account | The operator account | keccak256 of the instance descriptor | One running instance of an agent runtime | | `aaf.subject.digest` | 0 | Zero address | keccak256 of the bytes of the artefact | A model, tool, code package or configuration, at one version | | `aaf.subject.name` | 0 | Zero address | keccak256 of the UTF-8 name | A service named by a URI | Rules: 1. A reference MUST carry every field its kind prescribes. An identifier without the chain and the namespace it belongs to is not a subject reference. 2. Type names beginning with `aaf.` are reserved for this proposal. Any other name MAY be used as a further kind without registration, provided its definition says how `chainId`, `namespace` and `id` are filled. 3. Two references with different keys are different objects. An entry for a registered identity does not cover the account that controls it, an entry for a group does not cover its members, and an entry for one version of an artefact does not cover another version. A result passes from one object to another only where a derived list says so (Section 6.9). 4. A reference to an object on another chain identifies that object. It verifies nothing about it. 5. A party that does not know a kind can still compare keys. It MUST treat the standing of a presenter for a subject of that kind as unverified (Section 8.3). ### 4. Documents and grounds #### 4.1 Documents Scopes, lists, criteria, entries and bindings are described by JSON documents. A document is identified by the keccak256 hash of its canonical form under [RFC 8785](https://www.rfc-editor.org/rfc/rfc8785). Documents hold strings, integers, booleans, arrays and objects; they hold no fractional numbers. The schemas are part of this proposal: | Document | Schema | Its hash is | | --- | --- | --- | | Scope | [aaf-scope.schema.json](../assets/eip-8507/schemas/aaf-scope.schema.json) | `Scope.documentHash` | | List | [aaf-list.schema.json](../assets/eip-8507/schemas/aaf-list.schema.json) | Referred to by the list's location | | Criteria | [aaf-criteria.schema.json](../assets/eip-8507/schemas/aaf-criteria.schema.json) | `Criteria.documentHash` | | Basis of an entry | [aaf-basis.schema.json](../assets/eip-8507/schemas/aaf-basis.schema.json) | `Entry.basisHash` | | Binding | [aaf-binding.schema.json](../assets/eip-8507/schemas/aaf-binding.schema.json) | `BindingConfig.documentHash` | | Assessment record | [aaf-assessment.schema.json](../assets/eip-8507/schemas/aaf-assessment.schema.json) | Not anchored; a form for logs and receipts | Shared definitions are in [aaf-defs.schema.json](../assets/eip-8507/schemas/aaf-defs.schema.json). #### 4.2 Seven questions A list together with the binding that adopts it MUST answer seven questions. An answer MAY be "not used". It MUST NOT be left out, so that nobody who applies the rule has to guess. | # | Question | Answered in | Left to the parties | | --- | --- | --- | --- | | 1 | Who maintains the list, who adopts it, who may change either | List document, binding | A single account, several signers, a collective decision | | 2 | Which activity, resources and actions the rule applies to | Scope, binding | A whole venue, one task, one kind of transaction, one interface | | 3 | Which objects are judged and how they are identified | Subject kinds of the list | Accounts, registered identities, groups, instances, versions, services | | 4 | What membership rests on and which evidence is accepted | Criteria, basis of an entry | Designation, assertions, history, runtime, other lists, combinations | | 5 | Which time counts and what a change does | Criteria, entry window, pins | Snapshot, window, current state, expiry, revocation, change of controller | | 6 | What happens on a conflict, on no match, on the undetermined | Binding | Deny first, allow first, exceptions, deferral, explicit defaults | | 7 | What the result affects and where it is enforced | Binding, consumer | Joining, bidding, calling, pausing a session, isolating a resource | #### 4.3 Dimensions The grounds a rule may look at are named by dimensions. The vocabulary is in [aaf-dimensions.json](../assets/eip-8507/schemas/aaf-dimensions.json): | Dimension | Covers | | --- | --- | | `aaf.designation` | The manager's own choice | | `aaf.identity` | Accounts, registered identities, control, delegation | | `aaf.credential` | Profiles, assertions about the agent, qualifications, capability or credit assessments | | `aaf.principal` | Verification of the person or organisation behind the agent, and of payment instruments | | `aaf.runtime` | Runtime history, instances, code digests, tool permissions, configuration | | `aaf.inference` | Models and inference services used, metered usage, inference entitlements redeemed, properties of content | | `aaf.performance` | Tasks completed, acceptance, quality, timeliness, repeated failure | | `aaf.relation` | Counterparties, collaborators, group membership | | `aaf.activity` | On-chain transactions, settlement, stake, default or repayment | | `aaf.safety` | Adoption of safety specifications, incidents | | `aaf.dispute` | Disputes and their outcomes | | `aaf.reputation` | Feedback signals and aggregates | | `aaf.liveness` | Current operation, unfinished work, capacity in use | | `aaf.list` | Membership in another list | The vocabulary is open. No list is required to use any dimension, and a rule MAY name a dimension that is not in the table, provided its name does not begin with `aaf.`. #### 4.4 Evidence Whatever the dimension, a rule that asks for evidence, and a basis document that cites evidence, MUST make six things explicit: the proposition the evidence supports, the object it is about, its source, the method by which it is checked, the time it speaks about, and when it expires or how its revocation is learned. Three kinds of time are distinct and MUST be labelled: | Kind | Proposition | | --- | --- | | Snapshot | At one block or instant, the state was this | | Interval | Within this window, this happened | | Current | When this request is made, this still holds | A rule MAY combine them: a membership that rests on a fixed snapshot MAY still require, at every use, that it was not revoked and that the controller did not change. The criteria decide the window, the freshness and the conditions under which a result lapses. An entry or a requester MUST NOT substitute a weaker check for the one the criteria name. A snapshot fixes the ground on which a result was reached. Whether the result can be reproduced later depends on whether the historical data, the proofs and the evaluation procedure are still available. Further rules: 1. A hash commits to content. It does not make the content true. 2. A verified proof establishes its statement. It does not establish that the inputs of the statement were genuine unless the statement says so. 3. Holding an inference entitlement, having made inference calls, and a given request having been served by a given model are three propositions. Each needs its own evidence. 4. "No record of X" is a claim about a named source and a named window. It is established only against a source that is complete for that window. 5. Source material about natural persons and organisations, such as identity documents, document numbers and account numbers, MUST NOT be placed on chain or in the documents of this proposal. A rule asks for the result of a verification, its issuer, its validity, its revocation status and its binding to the subject. Signed assertions, on-chain assertions and proofs of predicates are all acceptable forms. A hash of low-entropy personal data is not a protection and MUST NOT be used as one. ### 5. Types ```solidity /// @dev Whether matching a list speaks for admitting or for refusing. Fixed when the list is /// created and part of its identifier. enum Polarity { NONE, ALLOW, DENY } /// @dev How a list determines its members. enum Mode { NONE, ENUMERATED, // entries written by the manager COMMITTED, // a committed set; members are shown by proofs against its root PREDICATE, // whatever satisfies the criteria, decided by an evaluator at query time DERIVED // members of a source list, or objects related to them under a declared relation } /// @dev Result of asking one list about one subject. The zero value is the undetermined one. enum Match { UNDETERMINED, // the question could not be settled MATCH, // the subject is a member NO_MATCH // it is confirmed that the subject is not a member } /// @dev Result of applying a binding to one request. The zero value is the indeterminate one. enum Outcome { INDETERMINATE, // missing information, a failed evaluation or an unresolved conflict ALLOW, DENY, NOT_APPLICABLE // the binding forms no conclusion for this request } /// @dev What the adopter does with an outcome. The zero value is the refusing one. enum Disposition { REFUSE, PROCEED, DEFER, // hold the request for more evidence or for review PROCEED_RESTRICTED // proceed within a limit the consumer applies where it carries out the action } /// @dev Stored status of an entry. Pending and expired follow from its validity window. enum EntryStatus { NONE, ACTIVE, SUSPENDED, REVOKED } /// @dev What an entry rests on. enum Basis { DESIGNATION, // the manager's own choice; it asserts nothing about the subject EVIDENCED // a statement of fact about the subject; basisHash commits to the evidence } /// @dev What a committed set can show. enum SetKind { NONE, MEMBERSHIP, // membership only; a negative query stays undetermined SORTED // sorted and complete; membership and non-membership } /// @dev Part the subject plays in a request. enum Role { ACTOR, // the subject acts; the presenter must be entitled to act for it OBJECT // the subject is what the action is directed at } /// @dev Whether a decision on an action may be used again. The zero value allows no reuse. enum Reuse { NONE, // every use is decided on its own, and a decision is a ground for that use only WHILE_CURRENT, // the consumer may rely on a decision again while its validity conditions hold ADMISSION // a decision to proceed is recorded per context and subject and honoured afterwards } /// @dev Typed reference to the object a list entry or a request is about. /// subjectKey = keccak256(abi.encode(kind, chainId, namespace, id)) struct SubjectRef { bytes32 kind; // keccak256 of the type name uint256 chainId; // chain of the namespace; 0 where the type is not tied to a chain address namespace; // contract or account that defines the identifier space; zero where the type has none bytes32 id; // identifier inside the namespace, encoded as the type prescribes } /// @dev Where a rule is meant to apply. /// scopeId = keccak256(abi.encode(SCOPE_TAG, block.chainid, anchor, context, documentHash)) struct Scope { address anchor; // contract or account whose actions are in scope bytes32 context; // one activity of the anchor (a task, a group, a resource); zero for all of them bytes32 documentHash; // keccak256 of the scope document } /// @dev One immutable version of the rules a list applies. /// criteriaId = keccak256(abi.encode(CRITERIA_TAG, block.chainid, documentHash, module, /// moduleCodeHash, moduleConfig, rule, fanout)) struct Criteria { bytes32 documentHash; // keccak256 of the criteria document address module; // PREDICATE: evaluator. DERIVED: relation source, zero for none. Otherwise zero bytes32 moduleCodeHash; // code hash of the module when the criteria were registered bytes32 moduleConfig; // configHash() of the module when the criteria were registered bytes32 rule; // PREDICATE: parameter set defined by the evaluator. DERIVED: relation type uint8 fanout; // DERIVED with a relation: most origins considered for one subject } /// @dev Input of createList. struct ListConfig { Polarity polarity; Mode mode; bytes32 scopeId; // scope the list is published for; zero for none bytes32 criteriaId; // zero for none uint32 noticePeriod; // seconds between adding an entry and its earliest effect bytes32 source; // DERIVED: source list in the same registry bytes32 sourcePin; // DERIVED: state of the source the list holds to; zero to follow the source bytes32 salt; } struct ListInfo { address manager; Polarity polarity; Mode mode; bool closed; uint8 depth; // length of the chain of sources below the list uint32 noticePeriod; uint64 revision; // raised by every act of the manager that can change a result bytes32 scopeId; bytes32 criteriaId; bytes32 source; bytes32 sourcePin; bytes32 setRoot; SetKind setKind; uint64 setSize; } /// @dev Input of addEntry. struct EntryInput { uint64 validFrom; // zero for the earliest time the notice period allows uint64 validUntil; // zero for no expiry Basis basis; bytes32 basisHash; // keccak256 of the basis document; required for EVIDENCED bytes32 reason; // code from an open vocabulary address controller; // non-zero: the entry holds only while this account controls the subject bytes32 codeHash; // non-zero: the entry holds only while the code of the account has this hash } struct Entry { EntryStatus status; Basis basis; uint32 serial; // counts the entries this list has had for the subject uint64 listedAt; uint64 validFrom; uint64 validUntil; uint64 changedAt; address controller; bytes32 basisHash; bytes32 reason; bytes32 codeHash; } /// @dev The request a result is asked for, as established by the caller. struct Request { address consumer; // whose action is being decided bytes32 action; bytes32 context; address presenter; // account that invokes the subject's standing; zero for none address controller; // controller of the subject; zero where not established } /// @dev What one list says about one subject, with everything needed to check it again. struct Finding { bytes32 listId; Polarity polarity; Match result; bytes32 reason; uint64 revision; bytes32 stateHash; bytes32 criteriaId; uint64 validUntil; // the result holds until then if the list state does not change; 0 for this call only bytes32 basis; // entry basis, set root or evidence commitment bytes32 derivedFrom; // subjectKey of the listed origin of a derived match } /// @dev Proof against a committed set. abi.encode(SetProof) is the evidence of a COMMITTED list. struct SetProof { bool member; // true: the subject is leaf `index`. false: it lies between leaves `index` and `index + 1` uint256 index; bytes32[] path; bytes32 lowKey; // non-membership: key of leaf `index` bytes32 highKey; // non-membership: key of leaf `index + 1` bytes32[] highPath; // non-membership: path of leaf `index + 1` } /// @dev Reference from a binding to a list. struct ListRef { address registry; bytes32 listId; bytes32 pin; // list state the binding holds to; zero to follow the list } struct ActionRule { bytes32 action; Reuse reuse; // whether a decision on this action may be used again } /// @dev What an adopter declares when it puts lists to use. struct BindingConfig { Scope scope; // scope.anchor is the consumer Role role; ActionRule[] actions; ListRef[] allow; uint8 allowThreshold; // number of ALLOW lists that must match; 1 is ANY, allow.length is ALL ListRef[] deny; uint8 denyThreshold; Outcome onConflict; // both sides match: ALLOW, DENY or INDETERMINATE Outcome onNoMatch; // neither side matches: ALLOW, DENY or NOT_APPLICABLE Disposition onIndeterminate; Disposition onNotApplicable; address resolver; // decides who may act for a subject; zero for the built-in rules bytes32 documentHash; // keccak256 of the binding document; required where PROCEED_RESTRICTED is declared } struct BindingInfo { address consumer; address adoptedBy; uint64 version; bool retired; bytes32 scopeId; bytes32 configHash; // keccak256(abi.encode(config)) } /// @dev The standard result of one assessment. struct Assessment { bytes32 bindingId; uint64 bindingVersion; bytes32 subjectKey; address presenter; address controller; bytes32 action; bytes32 context; Match standing; // ACTOR: whether the presenter may act for the subject Match allowSide; Match denySide; Outcome outcome; bytes32 reason; Disposition disposition; uint64 assessedAt; uint64 validUntil; // WHILE_CURRENT: earliest validUntil of the findings. Otherwise 0: for this use only bytes32 stateDigest; // commits to the binding version and the state of every list used Finding[] findings; // ALLOW lists in binding order, then DENY lists } struct Admission { uint64 at; uint64 bindingVersion; Outcome outcome; // the outcome under which the adopter proceeded Disposition disposition; } // Identifier tags. bytes32 constant SCOPE_TAG = keccak256("AAF.Scope.v1"); bytes32 constant CRITERIA_TAG = keccak256("AAF.Criteria.v1"); bytes32 constant LIST_TAG = keccak256("AAF.List.v1"); bytes32 constant STATE_TAG = keccak256("AAF.ListState.v1"); bytes32 constant SET_LEAF_TAG = keccak256("AAF.SetLeaf.v1"); bytes32 constant BINDING_TAG = keccak256("AAF.Binding.v1"); bytes32 constant DIGEST_TAG = keccak256("AAF.StateDigest.v1"); // Subject kinds defined by this specification. bytes32 constant KIND_ACCOUNT = keccak256("aaf.subject.account"); bytes32 constant KIND_ENTRY = keccak256("aaf.subject.entry"); bytes32 constant KIND_GROUP = keccak256("aaf.subject.group"); bytes32 constant KIND_INSTANCE = keccak256("aaf.subject.instance"); bytes32 constant KIND_DIGEST = keccak256("aaf.subject.digest"); bytes32 constant KIND_NAME = keccak256("aaf.subject.name"); // Reason codes of the registry. Codes are short ASCII strings; the vocabulary is open. bytes32 constant R_LISTED = "LISTED"; bytes32 constant R_NOT_LISTED = "NOT_LISTED"; bytes32 constant R_ENTRY_PENDING = "ENTRY_PENDING"; bytes32 constant R_ENTRY_EXPIRED = "ENTRY_EXPIRED"; bytes32 constant R_ENTRY_SUSPENDED = "ENTRY_SUSPENDED"; bytes32 constant R_ENTRY_REVOKED = "ENTRY_REVOKED"; bytes32 constant R_CONTROLLER_UNKNOWN = "CONTROLLER_UNKNOWN"; bytes32 constant R_CONTROLLER_CHANGED = "CONTROLLER_CHANGED"; bytes32 constant R_CODE_CHANGED = "CODE_CHANGED"; bytes32 constant R_LIST_UNKNOWN = "LIST_UNKNOWN"; bytes32 constant R_LIST_CLOSED = "LIST_CLOSED"; bytes32 constant R_SET_MEMBER = "SET_MEMBER"; bytes32 constant R_SET_NON_MEMBER = "SET_NON_MEMBER"; bytes32 constant R_SET_MISSING = "SET_MISSING"; bytes32 constant R_PROOF_MISSING = "PROOF_MISSING"; bytes32 constant R_PROOF_INVALID = "PROOF_INVALID"; bytes32 constant R_NEGATIVE_UNSUPPORTED = "NEGATIVE_UNSUPPORTED"; bytes32 constant R_MODULE_CHANGED = "MODULE_CHANGED"; bytes32 constant R_MODULE_FAILED = "MODULE_FAILED"; bytes32 constant R_SOURCE_STATE_CHANGED = "SOURCE_STATE_CHANGED"; bytes32 constant R_EXTENSION_LIMIT = "EXTENSION_LIMIT"; bytes32 constant R_RELATED = "RELATED"; bytes32 constant R_NOT_RELATED = "NOT_RELATED"; bytes32 constant R_RELATION_INCOMPLETE = "RELATION_INCOMPLETE"; // Reason codes of the guard. bytes32 constant R_ALLOW_MATCH = "ALLOW_MATCH"; bytes32 constant R_DENY_MATCH = "DENY_MATCH"; bytes32 constant R_CONFLICT = "CONFLICT"; bytes32 constant R_DEFAULT = "DEFAULT"; bytes32 constant R_UNDETERMINED_INPUT = "UNDETERMINED_INPUT"; bytes32 constant R_BINDING_UNKNOWN = "BINDING_UNKNOWN"; bytes32 constant R_BINDING_RETIRED = "BINDING_RETIRED"; bytes32 constant R_CONSUMER_MISMATCH = "CONSUMER_MISMATCH"; bytes32 constant R_ACTION_NOT_COVERED = "ACTION_NOT_COVERED"; bytes32 constant R_CONTEXT_NOT_COVERED = "CONTEXT_NOT_COVERED"; bytes32 constant R_LIST_STATE_CHANGED = "LIST_STATE_CHANGED"; bytes32 constant R_REGISTRY_UNAVAILABLE = "REGISTRY_UNAVAILABLE"; bytes32 constant R_POLARITY_MISMATCH = "POLARITY_MISMATCH"; bytes32 constant R_PRESENTER_NOT_AUTHORIZED = "PRESENTER_NOT_AUTHORIZED"; bytes32 constant R_STANDING_UNVERIFIED = "STANDING_UNVERIFIED"; bytes32 constant R_ADMISSION_HONOURED = "ADMISSION_HONOURED"; ``` Identifiers are computed as the comments say. Reason codes are short ASCII strings held left-aligned in 32 bytes. The codes above are those of the Registry and the Guard; modules add their own. ### 6. Lists #### 6.1 Scope A scope names where a rule is meant to apply: `anchor` is the contract or account whose actions are in scope, `context` is one activity of the anchor (a task, a group, a resource) or zero for all of them, and `documentHash` commits to the scope document. Anyone MAY declare a scope. Declaring a scope gives no right over its anchor. A list MAY name the scope it is published for; this is a statement of purpose and binds nobody. The scope that matters for an assessment is the one in the binding (Section 8). #### 6.2 Criteria Criteria are one immutable version of the rules a list applies. They consist of a document and, where the rule is computed by a contract, a module with the code hash and configuration it had when the criteria were registered, a `rule` value the module interprets, and for a relation the largest number of origins considered. 1. Criteria MUST NOT change after registration. Any change of rule, parameters, module, module code or module configuration is another version with another identifier. 2. When criteria are registered with a module, the Registry MUST read the code hash of the module and its `configHash()` and make both part of the identifier. 3. Before every use of a module the Registry MUST compare both with the pinned values. If either differs, the result is `UNDETERMINED` with reason `MODULE_CHANGED` until the manager adopts new criteria. 4. A module whose behaviour can change without a change of its code hash MUST return a `configHash()` that changes whenever logic or configuration that can affect a result changes. A module that cannot guarantee this MUST NOT be upgradeable. 5. A list of mode `ENUMERATED` or `COMMITTED` MAY have criteria without a module, or no criteria at all. A list of mode `PREDICATE` MUST have criteria with an evaluator. #### 6.3 Identity of a list A list is created by its first manager. Its identifier covers the chain, the registry, the creator, the polarity, the mode, the source and a salt. **Polarity, mode and source MUST NOT change.** No entry and no proof made under one polarity can come to mean the opposite. | Mode | Members are | | --- | --- | | `ENUMERATED` | The subjects with an entry in effect, written by the manager | | `COMMITTED` | The subjects of a committed set, shown by proofs against its root | | `PREDICATE` | Whatever satisfies the criteria, decided by an evaluator when asked | | `DERIVED` | The members of a source list, or the objects related to them under a declared relation | A list has one mode. A rule that mixes modes, such as admission by criteria with named exceptions, is expressed by combining lists in a binding (Section 8.5). #### 6.4 Revision and state Every act of the manager that can change a result MUST raise the `revision` of the list by one and emit `ListRevised`. These acts are: creating the list, adding, suspending, resuming or revoking an entry, committing a set, setting criteria, setting the source pin, accepting the management of the list, and closing it. The state of a list is identified by a hash: ```text stateHash = keccak256(abi.encode(STATE_TAG, listId, revision, manager, closed, criteriaId, setRoot, sourcePin, sourceState)) ``` where `sourceState` is the state hash of the source for a derived list and zero otherwise. The state hash of an unknown list is zero. Two things change results without raising the revision, and neither is covered by the state hash. The first is time: an entry taking effect or expiring. It is foreseeable, and the validity of a finding ends before it (Section 6.10). The second is what a result reads outside the list: a credential being revoked, a relation ending, the code of an account being replaced. It is not foreseeable, and a finding that rests on it holds for the call that produced it and no longer. #### 6.5 Management Only the manager writes to a list. Management is handed over in two steps: the manager offers, the candidate accepts. A closed list accepts no further writes and is never reopened. A closed list MUST yield `UNDETERMINED` with reason `LIST_CLOSED` for every subject. It MUST NOT be read as a list on which nobody is listed. #### 6.6 Entries An entry is the record of one subject in an enumerated list. 1. A subject has at most one entry in effect or suspended at a time. A revoked or expired entry MAY be followed by a new one; `serial` counts the entries the list has had for the subject. Entries are not deleted, and every change is emitted. 2. An entry has a basis. `DESIGNATION` is the manager's own choice to admit or to refuse. It is a sufficient ground for an entry and asserts nothing about the subject. `EVIDENCED` is a statement of fact about the subject; such an entry MUST commit to a basis document. The statement "I do not work with A" and the statement "A did X" are different statements, and a list MUST NOT present the first as the second. 3. An entry is added without the consent of the subject. It has effect for a consumer only through a binding of that consumer. 4. An entry has a validity window. `validFrom` MUST NOT be earlier than the time of the addition plus the notice period of the list. `validUntil` is zero or later than `validFrom`. 5. An entry MAY be tied to a controller. It then holds only while that account controls the subject. 6. An entry about an account on the chain of the Registry MAY be tied to the code of that account, by the hash of the code. It then holds only while the account has code with that hash. The code hash of an account without code is `keccak256` of the empty byte string, `0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`, whether or not the account exists yet. An entry about any other subject MUST NOT be tied to code, and the Registry MUST refuse it. 7. Suspension and resumption are OPTIONAL steps between addition and revocation. Revocation is final for that entry. The match result of an enumerated list is: | Stored status | Condition | Result | Reason | | --- | --- | --- | --- | | None | | `NO_MATCH` | `NOT_LISTED` | | Revoked | | `NO_MATCH` | `ENTRY_REVOKED` | | Suspended | | `NO_MATCH` | `ENTRY_SUSPENDED` | | Active | Before `validFrom` | `NO_MATCH` | `ENTRY_PENDING` | | Active | At or after a non-zero `validUntil` | `NO_MATCH` | `ENTRY_EXPIRED` | | Active | In the window, tied to code, and the account has other code | `UNDETERMINED` | `CODE_CHANGED` | | Active | In the window, not tied to a controller, or tied to the controller in the request | `MATCH` | `LISTED` | | Active | In the window, tied to a controller, none established in the request | `UNDETERMINED` | `CONTROLLER_UNKNOWN` | | Active | In the window, tied to another controller than the one in the request | `NO_MATCH` | `CONTROLLER_CHANGED` | The rows are applied in this order. In the window, every result of an entry that is tied to code has a `validUntil` of zero. **The same address with other code is another object.** An account can come to run other code without changing its address: an account that delegates its code under [EIP-7702](./eip-7702.md) can delegate elsewhere at any time, and its code hash is then the hash of the new delegation. An entry made by address alone says nothing about code and holds whatever the code is. An entry tied to code says "this account while it runs this code"; when the code differs, the list cannot say, and the result is `UNDETERMINED`: the account is reported neither as a member nor as a confirmed non-member. The tie covers the code at the address of the account. It does not cover what that code loads from elsewhere, such as an implementation behind a proxy or a module the account installs; criteria that depend on those are expressed through an evaluator that reads them (Section 6.8). Not being on an `ALLOW` list does not make a subject a member of any `DENY` list. Being removed from a `DENY` list does not make a subject a member of any `ALLOW` list. **Notice, objection, appeal.** All three are OPTIONAL. A list with a notice period keeps every new entry on record for that period before it has effect. Anyone MAY record an objection to an entry; the Registry emits it and changes nothing. Whether an entry has effect while an objection is open, who may change the entry and from when a change applies are decided by the manager under the rules the list document states. The place where an entry can be contested is named in the list document or in the basis document. #### 6.7 Committed sets A committed list publishes the root of a tree instead of its members. ```text leaf(i) = keccak256(abi.encode(SET_LEAF_TAG, i, key(i))) for 0 <= i < size leaf(i) = bytes32(0) for size <= i < 2^depth node(l, j) = keccak256(abi.encode(node(l-1, 2j), node(l-1, 2j+1))) depth = the smallest d with 2^d >= size root = node(depth, 0) ``` `key(i)` is the subject key at position `i`. A set of kind `SORTED` holds its keys in strictly ascending order, begins with the key of 32 zero bytes and ends with the key of 32 bytes `0xff`; these two sentinels are not subjects. A set of kind `MEMBERSHIP` makes no statement about order or completeness. The evidence of a committed list is `abi.encode(SetProof)`: 1. **Membership.** `member` is true, `index` is the position of the subject and `path` holds the `depth` siblings from the leaf upwards. The proof is valid if the root computed from `leaf(index)` with the subject's key equals the committed root. The result is `MATCH`. 2. **Non-membership.** `member` is false, `index` and `index + 1` are two neighbouring positions with keys `lowKey` and `highKey` and paths `path` and `highPath`. The proof is valid if the set is of kind `SORTED`, both leaves are in the tree, and `lowKey < subjectKey < highKey`. The result is `NO_MATCH`. 3. A non-membership proof against a set of kind `MEMBERSHIP` yields `UNDETERMINED` with reason `NEGATIVE_UNSUPPORTED`. 4. No evidence yields `UNDETERMINED` with reason `PROOF_MISSING`. A proof that does not verify against the current root, including a proof that verified against an earlier root, yields `UNDETERMINED` with reason `PROOF_INVALID`. Malformed evidence yields the same and MUST NOT make the query revert. **The absence of a membership proof is not absence from the set.** A consumer that binds a committed `DENY` list obtains `NO_MATCH` only from a non-membership proof. This proposal does not require zero-knowledge proofs; other proof systems MAY be added as further set kinds or through an evaluator, with the same three results. #### 6.8 Predicate lists A predicate list has no stored members. The Registry asks the evaluator named by the criteria: 1. The call MUST be a static call with a bounded amount of gas, and the bound MUST be stated by the implementation. 2. If the call fails, runs out of gas, or returns anything other than a result in the three defined values with the other three fields, the result is `UNDETERMINED` with reason `MODULE_FAILED`. 3. Otherwise the result, reason, validity and basis are those the evaluator returned. An evaluator: 1. MUST return `MATCH` or `NO_MATCH` only where its criteria settle the question, and `UNDETERMINED` otherwise. 2. MUST check that the evidence is about the subject of the call and, where the criteria tie the result to a controller, an instance or a version, that it is about that as well. The level at which a result is tied is chosen by the criteria and MUST NOT be chosen by the requester. 3. MUST distinguish what the requester failed to present from what the evaluator failed to read. Where the criteria make presenting something a condition, its absence MAY be a settled `NO_MATCH`. A source that cannot be read is `UNDETERMINED`; it is never a finding about the subject. 4. MUST return a `validUntil` of zero if the result rests on anything that can change at a time the evaluator cannot read in advance, such as a credential that its issuer can revoke. A time until which a credential is valid is not such a guarantee where the credential can be revoked before it. Otherwise it MUST return a `validUntil` no later than the earliest time at which the result would change. #### 6.9 Derived lists A derived list names a source list in the same registry. 1. The source MUST exist when the derived list is created and MUST have the same polarity. A list therefore never refers, directly or through other lists, to itself. 2. The length of the chain of sources below a list MUST be bounded, and the bound MUST be stated by the implementation. A list that would exceed it MUST NOT be created. 3. A derived list either follows its source (`sourcePin` is zero) or holds to one state of it. If the state hash of the source differs from a non-zero pin, the result is `UNDETERMINED` with reason `SOURCE_STATE_CHANGED` for every subject, until the manager sets a new pin. 4. A source that yields `UNDETERMINED`, for whatever reason, makes the derived result `UNDETERMINED`. A dependency that cannot answer is never skipped. **Reference.** Without a relation, the members of the derived list are the members of the source: the result for a subject is the result of the source for that subject. **Related-object extension.** With criteria that name a relation source, a relation type and a fan-out, the members of the derived list are the objects related to a member of the source. The relation runs from the origin, which the source lists, to the subject that is asked about. 5. Extension exists only as a derived list. The source list is not extended by it, and a consumer is affected by it only if its binding names the derived list. 6. To decide a subject, the Registry asks the relation source for the origins of the subject, one position at a time, for at most `fanout` origins, and then once more to learn whether the enumeration is complete. 7. If an origin is a member of the source, the result is `MATCH` with reason `RELATED`, and `derivedFrom` is the key of that origin. 8. If the enumeration is complete and every origin is confirmed not to be a member of the source, the result is `NO_MATCH` with reason `NOT_RELATED`. 9. In every other case, including a relation source that fails or cannot tell, more origins than the fan-out, and an origin for which the source is undetermined, the result is `UNDETERMINED` with reason `RELATION_INCOMPLETE`. 10. Extension is not transitive. If the source of an extension is itself reached through an extension, the result for the origin is `UNDETERMINED` with reason `EXTENSION_LIMIT`. 11. A derived result is computed when asked and never stored. It ceases when the origin leaves the source, when the relation ends, or when the criteria change. A relation can end at any time without the state of a list changing, so a result of an extension has a `validUntil` of zero. 12. A relation source MUST report a relation only on evidence its relation type defines, and MUST NOT report one on the statement of the origin alone. An object does not become related to a listed object because the listed object, or anybody else, says so. The relation type, its direction, the evidence that establishes it, the time at which it has to hold and the fan-out are stated in the criteria document. In this version a relation has to hold when the request is made. #### 6.10 Results `check` and `matchOf` return what a list says about a subject. They MUST NOT revert for an unknown list, a closed list, a failed module or malformed evidence; each of these is an `UNDETERMINED` result with its reason. A finding carries `validUntil`: the time until which the result holds, provided the state of the list does not change. Zero means that the result holds for the call that produced it and no longer. A list MUST return zero wherever its result rests on something that can change at any time without its state changing. Three cases are named in this proposal: a result of an evaluator that reads something revocable (Section 6.8), a result of a related-object extension (Section 6.9), and a result of an entry tied to code (Section 6.6). A finding carries the list, its polarity, the result and reason, the revision and state hash of the list, the criteria, a basis and, for a derived match, the origin. Its `validUntil` is the last moment at which the result holds provided the state hash does not change; zero means the result holds for this call only. #### 6.11 Registry interface ```solidity /// @title Registry of scopes, criteria, lists and entries /// @notice Records who lists what on which ground, and answers whether a subject matches a list. /// A list recorded here has no effect on anybody until an adopter binds it. interface IAAFRegistry { event ScopeDeclared( bytes32 indexed scopeId, address indexed anchor, bytes32 context, bytes32 documentHash, string uri, address declarer ); event CriteriaRegistered( bytes32 indexed criteriaId, address indexed module, bytes32 documentHash, bytes32 moduleCodeHash, bytes32 moduleConfig, bytes32 rule, uint8 fanout, string uri ); event ListCreated( bytes32 indexed listId, address indexed manager, Polarity polarity, Mode mode, bytes32 scopeId, bytes32 source, uint32 noticePeriod, string uri ); /// @dev Emitted by every act that raises the revision of a list. event ListRevised(bytes32 indexed listId, uint64 revision, bytes32 stateHash); event CriteriaSet(bytes32 indexed listId, bytes32 criteriaId); event SourcePinSet(bytes32 indexed listId, bytes32 sourcePin); event ManagerOffered(bytes32 indexed listId, address indexed candidate); event ManagerChanged(bytes32 indexed listId, address indexed previousManager, address indexed manager); event ListClosed(bytes32 indexed listId); event EntryAdded( bytes32 indexed listId, bytes32 indexed subjectKey, SubjectRef subject, uint32 serial, uint64 validFrom, uint64 validUntil, Basis basis, bytes32 basisHash, bytes32 reason, address controller, bytes32 codeHash, string basisURI ); event EntryStatusChanged( bytes32 indexed listId, bytes32 indexed subjectKey, uint32 serial, EntryStatus status, bytes32 reason ); event SetCommitted(bytes32 indexed listId, bytes32 root, SetKind kind, uint64 size, string uri); event ObjectionFiled( bytes32 indexed listId, bytes32 indexed subjectKey, address indexed filer, bytes32 objectionHash, string uri ); error NotManager(); error UnknownList(); error UnknownCriteria(); error ListExists(); error ListIsClosed(); error WrongMode(); error InvalidConfig(); error InvalidWindow(); error BasisRequired(); error EntryExists(); error EntryNotFound(); error NotCandidate(); error CodePinNotSupported(); // ------------------------------------------------------------ identifiers function subjectKeyOf(SubjectRef calldata subject) external pure returns (bytes32); function scopeIdOf(Scope calldata scope) external view returns (bytes32); function criteriaIdOf(Criteria calldata criteria) external view returns (bytes32); function listIdOf(address creator, ListConfig calldata config) external view returns (bytes32); // ------------------------------------------------------------ scopes and criteria /// @notice Records a scope. Anyone may declare one; declaring gives no right over the anchor. function declareScope(Scope calldata scope, string calldata uri) external returns (bytes32 scopeId); /// @notice Records one version of criteria. The code hash and the configuration of the module /// are read at this moment and become part of the identifier. function registerCriteria( bytes32 documentHash, address module, bytes32 rule, uint8 fanout, string calldata uri ) external returns (bytes32 criteriaId); function scopeOf(bytes32 scopeId) external view returns (Scope memory); function criteriaOf(bytes32 criteriaId) external view returns (Criteria memory); // ------------------------------------------------------------ lists /// @notice Creates a list managed by the caller. Polarity, mode and source never change. function createList(ListConfig calldata config, string calldata uri) external returns (bytes32 listId); function setCriteria(bytes32 listId, bytes32 criteriaId) external; function setSourcePin(bytes32 listId, bytes32 sourcePin) external; function offerManager(bytes32 listId, address candidate) external; function acceptManager(bytes32 listId) external; function closeList(bytes32 listId) external; function listOf(bytes32 listId) external view returns (ListInfo memory); /// @notice The revision of a list and the hash that identifies its state. The hash covers the /// manager, the criteria, the committed set and, for a derived list, the state of its source. function stateOf(bytes32 listId) external view returns (uint64 revision, bytes32 stateHash); // ------------------------------------------------------------ entries (ENUMERATED) function addEntry(bytes32 listId, SubjectRef calldata subject, EntryInput calldata input, string calldata basisURI) external returns (bytes32 subjectKey); function suspendEntry(bytes32 listId, bytes32 subjectKey, bytes32 reason) external; function resumeEntry(bytes32 listId, bytes32 subjectKey, bytes32 reason) external; function revokeEntry(bytes32 listId, bytes32 subjectKey, bytes32 reason) external; /// @notice Records an objection to an entry. It changes nothing in the list. function fileObjection(bytes32 listId, bytes32 subjectKey, bytes32 objectionHash, string calldata uri) external; function entryOf(bytes32 listId, bytes32 subjectKey) external view returns (Entry memory); // ------------------------------------------------------------ committed sets (COMMITTED) function commitSet(bytes32 listId, bytes32 root, SetKind kind, uint64 size, string calldata uri) external; /// @notice Checks a SetProof for `subjectKey` against a root over `size` leaves. function verifySetProof(bytes32 root, SetKind kind, uint64 size, bytes32 subjectKey, bytes calldata evidence) external pure returns (Match result, bytes32 reason); // ------------------------------------------------------------ results /// @notice What the list says about the subject without a request and without evidence. function check(bytes32 listId, SubjectRef calldata subject) external view returns (Match result, bytes32 reason); /// @notice What the list says about the subject for a request, given evidence. Never reverts /// for an unknown list, a failed module or malformed evidence: those are undetermined results. function matchOf(bytes32 listId, SubjectRef calldata subject, Request calldata request, bytes calldata evidence) external view returns (Finding memory); } ``` ### 7. Modules An evaluator decides membership in a predicate list (Section 6.8): ```solidity /// @title Evaluator of a PREDICATE list /// @notice Decides at query time whether a subject satisfies the criteria of a list. interface IAAFEvaluator { /// @notice A value that changes whenever logic or configuration that can affect a result /// changes. A registry compares it, together with the code hash, with what the criteria pinned. function configHash() external view returns (bytes32); /// @param listId the list the result is for /// @param rule the parameter set named by the criteria /// @param subject the object the question is about /// @param request the request as established by the caller /// @param evidence what the requester presents; its format is defined by the evaluator /// @return result MATCH or NO_MATCH only where the criteria settle it; otherwise UNDETERMINED /// @return reason code from an open vocabulary /// @return validUntil until when the result holds if the state of the list does not change; /// 0 for this call only, which is required wherever the result rests on something that /// can change at any time, such as a credential that can be revoked /// @return basis commitment to the evidence and sources the result rests on function evaluate( bytes32 listId, bytes32 rule, SubjectRef calldata subject, Request calldata request, bytes calldata evidence ) external view returns (Match result, bytes32 reason, uint64 validUntil, bytes32 basis); } ``` A relation source names the objects a subject is related to (Section 6.9): ```solidity /// @title Source of relations for a DERIVED list /// @notice Names the objects a subject is related to under a relation type. The relation runs from /// the origin, which may be listed, to the subject, which is the one being asked about. interface IAAFRelationSource { /// @notice Same meaning as IAAFEvaluator.configHash. function configHash() external view returns (bytes32); /// @param relationType the relation named by the criteria /// @param subject the object being asked about /// @param evidence what the requester presents; its format is defined by the source /// @param index position in the enumeration of origins, from 0 /// @return status 0: the source cannot tell. 1: `origin` is the origin at `index`. /// 2: there is no origin at `index` and the enumeration is complete /// @return origin an object the subject is related to /// @return since the time from which the relation has held; 0 if not known function originOf(bytes32 relationType, SubjectRef calldata subject, bytes calldata evidence, uint256 index) external view returns (uint8 status, SubjectRef memory origin, uint64 since); } ``` A resolver establishes standing for subject kinds the built-in rules do not cover (Section 8.3): ```solidity /// @title Resolver of standing /// @notice Tells whether an account may act for a subject, and who controls the subject. interface IAAFSubjectResolver { /// @return authorized MATCH: `presenter` may act for `subject`. NO_MATCH: it may not. /// UNDETERMINED: the resolver cannot tell /// @return controller the account that controls the subject; zero if not established function standingOf(SubjectRef calldata subject, address presenter) external view returns (Match authorized, address controller); } ``` Modules are read-only. The format of the evidence a module accepts is defined by the module and stated in the criteria document. ### 8. Bindings and assessments #### 8.1 Adoption A list has no effect until a consumer binds it. 1. A binding is written by the consumer it governs, or by the adopter that consumer named. Nobody else can write it: publishing a list, maintaining a list, issuing evidence and declaring a scope give no authority over a consumer. 2. The `anchor` of the scope in a binding is the consumer. A binding governs only that consumer. 3. A binding is identified by the chain, the guard, the consumer, the scope and a salt. Amending a binding replaces its configuration, raises its version and keeps its scope; another scope is another binding. A retired binding forms no conclusion. #### 8.2 What a binding declares | Field | Declares | | --- | --- | | `scope` | The consumer, the context and the scope document | | `role` | Whether the subject of a request is the actor or the object of the action | | `actions` | The actions the binding governs, and for each whether a decision may be used again (Section 8.9) | | `allow`, `allowThreshold` | The `ALLOW` lists used and how many of them have to match | | `deny`, `denyThreshold` | The `DENY` lists used and how many of them have to match | | `pin` of a list | The list state the binding holds to, or zero to follow the list | | `onConflict` | The outcome when both sides match: `ALLOW`, `DENY` or `INDETERMINATE` | | `onNoMatch` | The outcome when neither side matches: `ALLOW`, `DENY` or `NOT_APPLICABLE` | | `onIndeterminate` | The disposition for an indeterminate outcome | | `onNotApplicable` | The disposition for a request the binding forms no conclusion on | | `resolver` | Who establishes standing; zero for the built-in rules | | `documentHash` | The binding document; required where `PROCEED_RESTRICTED` is declared | A binding MUST name at least one action and at least one list. A threshold MUST be between one and the number of lists on its side, and zero for an empty side. A list on the `allow` side MUST be of polarity `ALLOW` and a list on the `deny` side of polarity `DENY`. Nothing is assumed in favour of a request: the zero value of every declaration is the indeterminate one, the refusing one or the one that allows no reuse, and a binding that gives no rule for the case that neither side matches MUST be refused. A binding that declares `PROCEED_RESTRICTED` without a binding document MUST be refused (Section 8.7). #### 8.3 Standing A list result is of use only to a caller entitled to use it. With role `ACTOR`, the subject acts and the presenter invokes its standing. The Guard MUST establish whether the presenter may act for the subject, with one of three results: it may (`MATCH`), it may not (`NO_MATCH`), or this cannot be established (`UNDETERMINED`). Without a resolver the built-in rules apply: | Kind | Condition | Standing | Controller | | --- | --- | --- | --- | | Any | The subject is on another chain | `UNDETERMINED` | Not established | | `aaf.subject.account` | The presenter is the account | `MATCH` | The account | | `aaf.subject.account` | The presenter is another account | `NO_MATCH` | The account | | `aaf.subject.entry` | The presenter is the owner of the entry in its registry, is approved for the entry, or is an approved operator of the owner, as the registry reports through `ownerOf`, `getApproved` and `isApprovedForAll` | `MATCH` | The owner | | `aaf.subject.entry` | The registry reports an owner and none of these holds | `NO_MATCH` | The owner | | `aaf.subject.entry` | The registry does not report an owner | `UNDETERMINED` | Not established | | Any other | | `UNDETERMINED` | Not established | | Any | No presenter is given | `UNDETERMINED` | As above | The three functions named are those of [ERC-721](./eip-721.md); a registry of another shape needs a resolver. With role `OBJECT`, the subject is what the action is directed at, such as a tool version about to be run. No standing is established. The consumer is responsible for deriving the reference from the object actually used. #### 8.4 Assessment To assess a request (binding, subject, presenter, action, context, evidence), a Guard proceeds in this order: 1. **Coverage.** If the binding is unknown or retired, if the action is not among its actions, or if the scope has a non-zero context that differs from the context of the request, the outcome is `NOT_APPLICABLE` and no list is asked. 2. **Standing.** For role `ACTOR`, standing and controller are established (Section 8.3). 3. **Findings.** Every list of the binding is asked, the `ALLOW` lists first, with the request as the Guard established it and with the evidence at the position of the list. A list whose state hash differs from a non-zero pin is not asked; its result is `UNDETERMINED` with reason `LIST_STATE_CHANGED`. A registry that cannot be reached, or a list that reports another polarity than its side, yields `UNDETERMINED`. 4. **Sides.** The results of each side are combined by its threshold (Section 8.5). 5. **Outcome.** The two sides are combined by the declared rules (Section 8.6). 6. **Standing applied.** For role `ACTOR`: if standing is `NO_MATCH`, the outcome is `DENY` with reason `PRESENTER_NOT_AUTHORIZED`, whatever the lists say. If standing is `UNDETERMINED` and the outcome would be `ALLOW`, the outcome is `INDETERMINATE` with reason `STANDING_UNVERIFIED`. **`ALLOW` is never returned for an actor whose presenter was not verified.** 7. **Disposition.** `ALLOW` gives `PROCEED`, `DENY` gives `REFUSE`, and the other two give what the binding declares (Section 8.7). 8. **Validity.** The assessment carries a digest of the binding version and the list states it used. For an action declared `WHILE_CURRENT` it carries the earliest `validUntil` of its findings. For every other action its `validUntil` is zero (Sections 8.8 and 8.9). #### 8.5 Sides Each side combines the results of its lists by a threshold `k`. With `m` lists that match and `u` that are undetermined: | Condition | Side | | --- | --- | | The side has no lists | `NO_MATCH` | | `m >= k` | `MATCH` | | `m + u < k` | `NO_MATCH` | | Otherwise | `UNDETERMINED` | A threshold of one is "any of the lists"; a threshold equal to the number of lists is "all of the lists". What is combined are match results of lists, never outcomes. "A except B" is expressed by the two sides and the conflict rule: the `ALLOW` side except the `DENY` side is `onConflict = DENY`; the `DENY` side except the `ALLOW` side is `onConflict = ALLOW`. #### 8.6 Outcome With both sides determined: | `ALLOW` side | `DENY` side | Outcome | | --- | --- | --- | | `MATCH` | `NO_MATCH` | `ALLOW` | | `NO_MATCH` | `MATCH` | `DENY` | | `MATCH` | `MATCH` | `onConflict` | | `NO_MATCH` | `NO_MATCH` | `onNoMatch` | With an undetermined side, **the outcome is determined only if it is the same whichever way every undetermined side would resolve.** Otherwise it is `INDETERMINATE`. Written out: | `ALLOW` side | `DENY` side | Outcome | | --- | --- | --- | | `MATCH` | `UNDETERMINED` | `ALLOW` if `onConflict` is `ALLOW`, else `INDETERMINATE` | | `UNDETERMINED` | `MATCH` | `DENY` if `onConflict` is `DENY`, else `INDETERMINATE` | | `NO_MATCH` | `UNDETERMINED` | `DENY` if `onNoMatch` is `DENY`, else `INDETERMINATE` | | `UNDETERMINED` | `NO_MATCH` | `ALLOW` if `onNoMatch` is `ALLOW`, else `INDETERMINATE` | | `UNDETERMINED` | `UNDETERMINED` | `INDETERMINATE` | A conflict under `onConflict = INDETERMINATE` is `INDETERMINATE`. An outcome that follows from a default is still a determined outcome: under a binding that admits members of an `ALLOW` list only, a subject confirmed not to be a member is refused with `DENY`, and no `DENY` entry comes into being. #### 8.7 Disposition The outcome says what the rules conclude. The disposition says what the adopter does. For `INDETERMINATE` and `NOT_APPLICABLE` the binding declares the disposition in advance: refuse, defer for more evidence or for review, proceed, or proceed within a limit. `PROCEED_RESTRICTED` is for a consumer that applies a limit in the same execution in which it carries out the action: a cap on value, a count, a set of permitted targets, an expiry. It is subject to three conditions: 1. The limit MUST be stated in the binding document, under `rules.restriction`, with what is limited, by how much and where it is applied. A Guard MUST refuse a binding that declares `PROCEED_RESTRICTED` and names no binding document. 2. The consumer MUST apply the stated limit where the action is carried out. A Guard reports the disposition and applies nothing. 3. A consumer that cannot apply such a limit MUST NOT declare `PROCEED_RESTRICTED`. It declares `DEFER` or `REFUSE`. A restriction that is not applied where the action takes effect is not a restriction: it is proceeding on the unknown. An adopter that proceeds on an indeterminate outcome MUST keep the outcome as it is. The record is "indeterminate, and the adopter decided to proceed". It MUST NOT be rewritten as an admission that was verified. #### 8.8 Versions and validity Three versions are distinct and MUST be identified separately: | Version | Identified by | Changes when | | --- | --- | --- | | Rules | `criteriaId` | Never; another rule is another identifier | | List state | `revision` and `stateHash` | The manager acts on the list | | Binding | `version` and `configHash` | The adopter amends the binding | Holding the rules fixed does not freeze the members of a list. An assessment therefore names all three. ```text stateDigest = keccak256(abi.encode(DIGEST_TAG, bindingId, bindingVersion, stateHashes)) ``` where `stateHashes` are the state hashes of the lists of the binding, the `ALLOW` lists first. An assessment is a record of what was determined at its time. It is not a permit. Nobody presents it, it authorises no particular operation, and whether it may be relied on again is declared by the binding, action by action (Section 8.9). For an action declared `WHILE_CURRENT`, a consumer MAY rely on an earlier assessment for the same subject, action and context while three conditions hold: the binding is not retired, the `stateDigest` of the assessment equals the digest computed now, and its `validUntil` has not passed. A consumer that does so MUST check the three conditions and MUST establish standing again at every use; where the controller it then finds is not the controller named in the assessment, the assessment is no ground to act on. An assessment with a `validUntil` of zero MUST NOT be relied on again: the state digest does not show what such an assessment rested on. A result shown by the requester, such as an earlier assessment or a proof against an earlier root, is never accepted in place of the current state. A binding that pins a list holds to one state of it. When the list moves on, the list says nothing for that binding until the adopter amends the pin. This lets an adopter require its own decision before changes made by a manager take effect for it. #### 8.9 Reuse and work in progress A binding declares, action by action, whether a decision may be used again. The zero value allows no reuse. | `reuse` | Meaning | | --- | --- | | `NONE` | Every use is decided on its own. A decision is a ground for the use it was taken for and for nothing else. The assessment has a `validUntil` of zero | | `WHILE_CURRENT` | Every use the Guard is asked about is decided on its own. The consumer MAY rely on an earlier decision under the conditions of Section 8.8 | | `ADMISSION` | The action is decided once per context and subject. A decision to proceed is recorded as an admission and honoured at later uses of that action in that context, whatever the lists then say. The assessment has a `validUntil` of zero | 1. A decision concerns a subject, an action and a context. It does not concern the terms of an operation. Whether an amount, a target or call data is acceptable is checked by the consumer that carries the operation out. 2. An action through which value moves, or whose effect cannot be undone, SHOULD be declared `NONE`, and the consumer SHOULD obtain the decision in the same execution in which it carries out the action. The decision is then used by that operation and by no other. 3. A consumer that wants the record of a decision to name the operation it was taken for MAY pass a commitment to that operation as the context of the request, under a binding whose scope leaves the context open. 4. A change of result affects later decisions. For `NONE` and `WHILE_CURRENT` it takes effect at the next use the Guard is asked about. For `ADMISSION` it does not affect an admission already given. 5. An admission is honoured only for the subject it was given to, and standing is established again at every use. 6. The adopter MAY withdraw an admission. Ending admitted work is a decision of the adopter under its own agreements, not a consequence of a list. **A change of a list does not, by itself, extinguish any obligation.** Nothing in this proposal affects what has been earned, what is owed or what has been settled. Suspending, terminating or re-pricing work in progress requires a ground in the agreement that governs that work. A result about current capacity or availability is not a reservation. A consumer that needs exclusive use reserves it where the action is executed. #### 8.10 Guard interface `assess` returns the assessment. `enforce` makes the same assessment for the consumer of the binding, which MUST be the caller, emits `Assessed`, and records an admission where the action rule says so. A Guard MAY be asked through `assess` by anyone; only `enforce` has effects. ```solidity /// @title Bindings and assessments /// @notice Holds what adopters declared and applies it to requests. A binding governs only the /// consumer that adopted it. interface IAAFGuard { event AdopterSet(address indexed consumer, address indexed adopter); event BindingAdopted( bytes32 indexed bindingId, address indexed consumer, bytes32 indexed scopeId, bytes32 configHash, address adoptedBy, string uri ); event BindingAmended(bytes32 indexed bindingId, uint64 version, bytes32 configHash, address amendedBy, string uri); event BindingRetired(bytes32 indexed bindingId, address retiredBy); event Assessed( bytes32 indexed bindingId, bytes32 indexed subjectKey, bytes32 indexed action, bytes32 context, address presenter, Outcome outcome, Disposition disposition, bytes32 reason, uint64 bindingVersion, bytes32 stateDigest, uint64 validUntil ); event AdmissionRecorded( bytes32 indexed bindingId, bytes32 indexed subjectKey, bytes32 indexed action, bytes32 context, Outcome outcome ); event AdmissionWithdrawn( bytes32 indexed bindingId, bytes32 indexed subjectKey, bytes32 indexed action, bytes32 context ); error NotAuthorized(); error UnknownBinding(); error BindingExists(); error BindingIsRetired(); error InvalidBinding(); // ------------------------------------------------------------ adoption /// @notice Names the account that may adopt, amend and retire bindings for the caller. function setAdopter(address adopter) external; function adopterOf(address consumer) external view returns (address); /// @notice Adopts a binding for `config.scope.anchor`. The caller is that consumer or its adopter. function adopt(BindingConfig calldata config, bytes32 salt, string calldata uri) external returns (bytes32 bindingId); /// @notice Replaces the configuration of a binding and raises its version. The scope stays. function amend(bytes32 bindingId, BindingConfig calldata config, string calldata uri) external; function retire(bytes32 bindingId) external; function bindingIdOf(address consumer, bytes32 scopeId, bytes32 salt) external view returns (bytes32); function bindingOf(bytes32 bindingId) external view returns (BindingInfo memory info, BindingConfig memory config); // ------------------------------------------------------------ assessment /// @notice Applies a binding to a request. `evidence[i]` belongs to list i, counting the ALLOW /// lists first; a shorter array leaves the remaining lists without evidence. function assess( bytes32 bindingId, SubjectRef calldata subject, address presenter, bytes32 action, bytes32 context, bytes[] calldata evidence ) external view returns (Assessment memory); /// @notice The same assessment, made for the consumer of the binding, which is the caller. /// Emits Assessed. Where the action is declared with reuse ADMISSION, a decision to proceed is /// recorded and honoured at later uses. function enforce( bytes32 bindingId, SubjectRef calldata subject, address presenter, bytes32 action, bytes32 context, bytes[] calldata evidence ) external returns (Disposition disposition, Outcome outcome, bytes32 reason); /// @notice The digest an assessment made now would carry. function stateDigestOf(bytes32 bindingId) external view returns (bytes32); /// @notice Whether an earlier assessment still rests on the current binding version and list /// states and has not passed its validity. Always false for a `validUntil` of zero. function isCurrent(bytes32 bindingId, bytes32 stateDigest, uint64 validUntil) external view returns (bool); function admissionOf(bytes32 bindingId, bytes32 context, bytes32 subjectKey, bytes32 action) external view returns (Admission memory); function withdrawAdmission(bytes32 bindingId, bytes32 context, bytes32 subjectKey, bytes32 action) external; } ``` ### 9. Invariants An implementation MUST preserve the following. 1. A list affects a consumer only through a binding written by that consumer or its adopter. 2. The polarity, the mode and the source of a list never change. 3. Criteria never change. A module that differs from what the criteria pinned yields no determined result. 4. Every act of a manager that can change a result changes the state hash of the list, and every amendment changes the version of the binding. 5. An undetermined result is never reported as a determined one. It enters a determined outcome only where the outcome is the same whichever way it would resolve. 6. `ALLOW` is never returned for an actor unless the presenter's standing was verified in that assessment. 7. Failing to match an `ALLOW` list creates no `DENY` entry. Leaving a `DENY` list creates no `ALLOW` entry. 8. No chain of derived lists refers to itself, every chain is bounded, and an extension takes one relation hop over a bounded number of origins. 9. A derived match exists only while its origin is a member of the source and the relation holds. 10. An objection changes no entry and no result. 11. An admission is honoured only for the subject, the context and the action it was given for. 12. No query for a result reverts because of the evidence presented or because a list, a module or a registry does not answer. 13. A decision is used again only where the binding declares it for the action, and never beyond the validity of the findings it rests on. 14. A result that rests on something that can change without the state of its list changing holds for the call that produced it. ## Rationale **A scoped relation, not a property.** Admitting or refusing an agent is something one party does for one activity. The same agent may be allowed to browse a market and not to take orders, be admitted by one group and refused by another, and qualify yesterday and need to be checked again today. All of these are consistent, because the result belongs to the relation between adopter and subject. That is why a list has no effect by being published, why the binding is the object that carries scope and action, and why the scope of a binding is anchored at the consumer that adopts it. **One list with a polarity.** Allowlists and denylists need the same members, the same grounds, the same lifecycle and the same proofs. Two interfaces would duplicate all of it and invite the mistake of treating "not on the allowlist" as "on the denylist". One list with an immutable polarity keeps the structure shared and the meanings apart. The title names the admitting polarity; the text uses `ALLOW` and `DENY` because they name the two polarities symmetrically. **Three match results and four outcomes.** A two-valued result cannot say "the denylist could not be checked". The four outcomes follow the long-established distinction of access-control policy languages between permit, deny, not applicable and indeterminate. AAF adopts the meanings and none of the policy language: a binding is a small fixed form, two sides with thresholds and two declared rules. **Algorithms are open, meanings are fixed.** An evaluator can compute anything. What two implementations must agree on is what its answer means, what happens when it fails, what its evidence is bound to and until when its answer holds. For that reason the core has no scoring engine, and the interface of an evaluator is narrow and its failure modes are specified. Pinning the code hash and a configuration hash of a module prevents the rules of a list from changing under an unchanged criteria identifier. **No built-in precedence.** "Deny wins" is a common choice and a wrong default for a list of exceptions to a denylist. A binding states its conflict rule, its default and its handling of the undetermined, and where it states nothing the indeterminate or refusing value applies. The rule for undetermined inputs is the strictest one that is still useful: an outcome stands only if no resolution of the unknown could change it. **Reuse is declared, and the default is none.** An assessment names versions and a validity, which makes it look like something that can be kept and used. If every assessment could be relied on until its validity passed, a decision taken for one use would silently cover the next, and for an action that moves value that is how an admission meant for one operation comes to cover another. The binding therefore says for each action whether a decision may be used again, and says nothing in favour of reuse by default. A decision that is not reusable has no validity to speak of: it is consumed by the operation in whose execution it was taken. What a decision never covers is the operation's own terms. AAF answers who may take part in an action; how much, to whom and with which call data are questions for the contract that carries the action out. **Validity is a promise only about what can be foreseen.** An expiry is foreseeable; a revocation is not. A result whose inputs include something revocable cannot promise to hold until the expiry of that thing, because the state digest of an assessment covers lists and bindings and cannot show what happens outside them. Such a result is therefore valid for its call only. The alternative, a second interface through which reuse reads every dependency again, would repeat the evaluation under another name. A consumer that wants a decision to stand while its inputs may change says so openly, by declaring the action an admission. **An account is its address and, where it matters, its code.** Two versions of a tool are two objects because they have two digests. An account that keeps its address while its code is replaced was, until now, one object with two behaviours. Tying an entry to a code hash is OPTIONAL and gives a manager the means to say which of the two it assessed. A changed code yields an undetermined result and not a confirmed non-member, because the list holds no finding about the new code. **Proceeding within a limit.** Proceeding on an indeterminate outcome within a limit is useful where a small exposure is acceptable and a deferral is costly. It is the unknown treated as a pass unless the limit is real, and a limit is real only where the action takes effect. The disposition is therefore tied to a stated limit and to a consumer that applies it, and a Guard refuses the declaration without the document that states the limit. **Extension is a separate list and needs both sides.** When a listed agent moves to another address, a refusal of the old object does not reach the new one, and an automatic rule that makes it follow gives the listed party a weapon: it could name an uninvolved account as its successor and have that account refused. AAF therefore treats a relation as information. It becomes a ground for a result only in a derived list that states the relation, only for consumers that bind that list, and only on evidence the relation type defines, which a statement by the listed side alone never is. Because derived results are computed when asked, they end with the entry or the relation they rest on. **Committed sets with ordered non-membership.** A private or large list cannot always be enumerated on chain. A sorted tree with two sentinels gives membership and non-membership proofs with nothing more than hashing, at the price of disclosing two neighbouring keys in a proof of absence. Zero-knowledge proofs of membership and non-membership, such as those of [ERC-8262](./eip-8262.md), fit the same three results and can be attached through an evaluator or a further set kind. The rule that matters is independent of the proof system: what cannot show absence returns undetermined. **Pointers for objection and appeal.** Due process differs between a personal list and a list that a market relies on. AAF gives the hooks every process needs (a notice period enforced by the list, objections on record, places to name a venue) and leaves the process to the list. An objection that changed an entry by itself would hand the listed side a switch. **A small core.** The core depends on ERC-165 only. Everything about a particular identity, assertion or task system is in a module that an adopter chooses. A list can thus be used by parties that share no other infrastructure, and a proposal that defines a new source of evidence does not have to change this one. **One chain per assessment.** A subject reference carries its chain and its namespace so that objects elsewhere can be named now. Their state is not read in this version: a reference is not a verification, and a rule about an object on another chain is undetermined until a module brings evidence about it. **Verification of principals.** Lists that require a verified person or company behind an agent are common. The framework asks for the result of the verification and its binding to the subject, and keeps source documents out of every record it defines. It does not restrict the form to hashes or proofs of predicates, since a signed assertion with a named issuer, a validity and a revocation status is often the appropriate evidence, and since a bare hash protects nothing. **Relation to other proposals.** [ERC-8004](./eip-8004.md) registers agent identities and carries feedback and validation signals about them; AAF refers to such an identity as a registry entry and uses those signals, where a list wants them, as evidence. [ERC-8107](./eip-8107.md) lets a name controller endorse or deny other names and lets a coordinator admit participants by the trust path between names. AAF differs in what it standardizes: its subjects are typed references to any object rather than names of one naming system; its lists are maintained on stated grounds and criteria rather than as pairwise trust levels; a list takes effect per consumer, activity and action through a binding; several lists are combined with declared rules over three-valued results; and nothing passes from one object to another unless a derived list says so. A trust registry of that kind can be the source behind an AAF evaluator. Collective decisions as defined by [ERC-8436](./eip-8436.md) can stand behind a manager or an adopter where a list or a binding is to be governed by a body rather than by one account. Assertion registries about agents, address-anchored agent identities, task tenders, agent groups, safety specifications and dispute procedures supply dimensions of evidence through modules; the two example modules of the reference implementation read an assertion registry, a task ledger and an address-anchored identity registry. **Acknowledgements.** The declaration of reuse per action, the tie of an account entry to its code and the conditions on proceeding within a limit follow review by Secrypta. The rule that a result resting on a revocable credential holds for its call only follows review by Revinand. ## Backwards Compatibility This proposal introduces new interfaces and changes no existing one. A contract that keeps its own mapping of admitted or refused addresses can keep it and expose it as a list through an evaluator that reads the mapping. Registries that follow ERC-721 work with the built-in rules for standing; other registries need a resolver. ## Test Cases The three cases below are those of the example documents and of the tests of the reference implementation. Every step states the result an implementation has to produce. ### Case A: who may bid for a task is decided by criteria A task board adopts, for task 7 and the action of bidding, one `ALLOW` list of mode `PREDICATE` with `onNoMatch = DENY`, `onIndeterminate = DEFER` and `onNotApplicable = REFUSE`. Bidding is declared with reuse `NONE`. The criteria require a credential of level 2 from an accepted issuer, bound to the controller of the agent identity, and two accepted task deliveries by that controller within ninety days, presented by the bidder. | # | Request | List result | Outcome | Disposition | | --- | --- | --- | --- | --- | | 1 | The owner of a qualified identity bids and presents two accepted deliveries | `MATCH` | `ALLOW` | `PROCEED` | | 2 | The owner of an identity with a level 1 credential bids | `NO_MATCH`, credential not valid | `DENY`, by default | `REFUSE` | | 3 | The owner of the qualified identity bids and presents no history | `NO_MATCH`, evidence not presented | `DENY`, by default | `REFUSE` | | 4 | Another account bids in the name of the qualified identity, with the same history | `MATCH` | `DENY`, presenter not authorized | `REFUSE` | | 5 | The identity is transferred; the new owner bids with the former owner's history | `NO_MATCH`, credential bound to the former controller | `DENY`, by default | `REFUSE` | | 6 | An identity bids shortly before its credential expires | `MATCH` | `ALLOW` | `PROCEED` | | 7 | The same bid after the expiry; no list changed | `NO_MATCH`, credential not valid | `DENY`, by default | `REFUSE` | | 8 | The issuer gives that identity a credential that lasts thirty days; it bids | `MATCH` | `ALLOW` | `PROCEED` | | 9 | The issuer revokes that credential the same day; no list changed; the identity bids again | `NO_MATCH`, credential not valid | `DENY`, by default | `REFUSE` | | 10 | The assertion registry cannot be read | `UNDETERMINED`, source unavailable | `INDETERMINATE` | `DEFER` | | 11 | The same delivery is presented twice | `UNDETERMINED`, evidence malformed | `INDETERMINATE` | `DEFER` | | 12 | The qualified identity bids for task 8 | Not asked | `NOT_APPLICABLE` | `REFUSE` | In steps 2, 3, 5, 7 and 9 the subject is refused and is on no `DENY` list. In step 10 the subject is not refused as unqualified. The findings of steps 1, 6 and 8 have a `validUntil` of zero, and so have their assessments: the credential they rest on can be revoked at any time. In step 9 it is revoked twenty-nine days before it would have expired, the state digest of the binding is the same as in step 8, and the bid is refused because it is decided on what is true at that use. ### Case B: a group refuses listed agents, with notice, and decides separately on related accounts A group adopts, for the action of joining, declared with reuse `NONE`, one `DENY` list of mode `ENUMERATED` with a notice period, `onNoMatch = ALLOW`. A second list is derived from it by the relation "the account bound as the anchor of the identity"; the binding does not name it at first. | # | Event or request | Result | | --- | --- | --- | | 1 | The agent identity asks to join | `ALLOW`, by default | | 2 | The manager enters the identity with basis `EVIDENCED` and a basis document | The entry is on record with `validFrom` equal to the time of the addition plus the notice period | | 3 | The identity asks to join during the notice period | `ALLOW`; the finding is `NO_MATCH` with reason `ENTRY_PENDING` and is valid until one second before `validFrom` | | 4 | The listed side records an objection | Emitted; no entry and no state hash changes | | 5 | The identity asks to join after the notice period | `DENY`, reason `DENY_MATCH` | | 6 | The account bound to the identity asks to join as an account | `ALLOW`: the account is another object and no extension is adopted | | 7 | The group amends its binding to name the derived list as well; the account asks again | `DENY`; the second finding is `MATCH` with reason `RELATED` and `derivedFrom` is the key of the identity; the binding is at version 2 | | 8 | The bound account retires and names an uninvolved account as its successor; that account asks to join | `ALLOW`: naming a successor relates nobody | | 9 | A third account takes the identity over and binds itself to it; it asks to join | `DENY`, derived from the identity | | 10 | The manager revokes the entry; the third account asks again | `ALLOW`: the derived result ended with the entry | ### Case C: a service combines an allow list with two deny lists A service adopts, for the action of invoking it, declared with reuse `WHILE_CURRENT`, an `ALLOW` list of partners, a `DENY` list of barred accounts and a `DENY` list committed as a sorted set, with thresholds of one, `onConflict = DENY`, `onNoMatch = DENY` and `onIndeterminate = DEFER`. A second binding of the same service, with role `OBJECT` and `onNoMatch = ALLOW`, uses a `DENY` list of tool packages named by their digests. | # | Request | `ALLOW` side | `DENY` side | Outcome | Disposition | | --- | --- | --- | --- | --- | --- | | 1 | A partner calls and proves absence from the committed set | `MATCH` | `NO_MATCH` | `ALLOW` | `PROCEED` | | 2 | The same partner calls without the proof | `MATCH` | `UNDETERMINED` | `INDETERMINATE` | `DEFER` | | 3 | An account on both enumerated lists calls | `MATCH` | `MATCH` | `DENY`, conflict | `REFUSE` | | 4 | An account on no list calls and proves absence | `NO_MATCH` | `NO_MATCH` | `DENY`, by default | `REFUSE` | | 5 | The same account calls without the proof | `NO_MATCH` | `UNDETERMINED` | `DENY`, by default | `REFUSE` | | 6 | Another account calls in the name of the partner of step 1, with its proof | `MATCH` | `NO_MATCH` | `DENY`, presenter not authorized | `REFUSE` | | 7 | The partner asks the service to run an excluded tool version | | `MATCH` | `DENY` | `REFUSE` | | 8 | The partner asks the service to run the current tool version | | `NO_MATCH` | `ALLOW`, by default | `PROCEED` | | 9 | The partner is removed from the allow list and calls with the same proof | `NO_MATCH` | `NO_MATCH` | `DENY`, by default | `REFUSE` | | 10 | A new set that contains the former partner is committed; the proof of step 1 is presented | | | The finding is `UNDETERMINED` with reason `PROOF_INVALID` | | The assessment of step 1 may be relied on again while it is current. After step 9 it is not: its state digest differs from the digest computed now. In step 5 the outcome is determined although one side is not, because both ways the `DENY` side could resolve give `DENY`. In step 7 nothing is concluded about the partner. ### Reuse One binding with one `ALLOW` list of mode `ENUMERATED` and three actions, and a subject whose entry has no expiry: | Action declared | `validUntil` of the finding | `validUntil` of the assessment | Current afterwards | Admission recorded | | --- | --- | --- | --- | --- | | `NONE` | The greatest value | 0 | No, although no state changed | No | | `WHILE_CURRENT` | The greatest value | The greatest value | Yes, until a list or the binding changes | No | | `ADMISSION` | The greatest value | 0 | No | Yes, when the consumer is let proceed | With an action declared `WHILE_CURRENT` and a list whose finding has a `validUntil` of zero, the assessment has a `validUntil` of zero and is not current afterwards. ### Entries tied to code An account `A`, two implementations `X` and `Y`, and three entries about `A` in three `ALLOW` lists: the first tied to the hash of the empty byte string, the second tied to `keccak256(0xef0100 || X)`, the third not tied to code. The code of an account that delegates to `X` is the 23 bytes `0xef0100 || X`. | Code of `A` | First entry | Second entry | Third entry | | --- | --- | --- | --- | | None | `MATCH` | `UNDETERMINED`, `CODE_CHANGED` | `MATCH` | | Delegates to `X` | `UNDETERMINED`, `CODE_CHANGED` | `MATCH` | `MATCH` | | Delegates to `Y` | `UNDETERMINED`, `CODE_CHANGED` | `UNDETERMINED`, `CODE_CHANGED` | `MATCH` | | None again | `MATCH` | `UNDETERMINED`, `CODE_CHANGED` | `MATCH` | Every result of the first two entries has a `validUntil` of zero. No state hash changes between the rows. For a request that `A` makes itself, a binding with `onNoMatch = DENY` and `onIndeterminate = DEFER` that uses the first list alone gives `ALLOW` in the first and the last row and `INDETERMINATE` with disposition `DEFER` in the other two. An entry tied to code about a registry entry, about an artefact or about an account on another chain is refused by the Registry. ### Proceeding within a limit | Binding | Result | | --- | --- | | Declares `PROCEED_RESTRICTED` for `INDETERMINATE` or for `NOT_APPLICABLE` and names no binding document | Refused by the Guard, on adoption and on amendment | | The same with a binding document | Adopted | | The outcome is `INDETERMINATE` under that binding | Disposition `PROCEED_RESTRICTED`; the outcome stays `INDETERMINATE` | The example consumer applies a limit of one use per subject, action and context: under that binding it carries out the first request and refuses the second with reason `LIMIT_REACHED`, while the Guard reports `PROCEED_RESTRICTED` both times. ### Thresholds With three lists on a side and results in the order given: | Results | Threshold 1 | Threshold 2 | Threshold 3 | | --- | --- | --- | --- | | `MATCH`, `NO_MATCH`, `NO_MATCH` | `MATCH` | `NO_MATCH` | `NO_MATCH` | | `MATCH`, `UNDETERMINED`, `NO_MATCH` | `MATCH` | `UNDETERMINED` | `NO_MATCH` | | `MATCH`, `MATCH`, `UNDETERMINED` | `MATCH` | `MATCH` | `UNDETERMINED` | | `NO_MATCH`, `UNDETERMINED`, `NO_MATCH` | `UNDETERMINED` | `NO_MATCH` | `NO_MATCH` | | `UNDETERMINED`, `UNDETERMINED`, `UNDETERMINED` | `UNDETERMINED` | `UNDETERMINED` | `UNDETERMINED` | ### Vectors Identifier tags: | Tag | Preimage | Value | | --- | --- | --- | | `SCOPE_TAG` | `AAF.Scope.v1` | `0x2d7cc03ca26afbfd17737255725f7ce7477c1a7423b903d0214095753e981faa` | | `CRITERIA_TAG` | `AAF.Criteria.v1` | `0x00bab24ed835b5b85ac5630d4ed3f35a2b8616c85a9fcff4aaa5b17a82fbd85f` | | `LIST_TAG` | `AAF.List.v1` | `0xe13dcca8201126e23b422b33cd00542d7c07bf78959333120ebabd0ccdf1c62d` | | `STATE_TAG` | `AAF.ListState.v1` | `0x330e7a01db1a90d66e3b6037351af16c84aece66a294c0133957d6f2a51f18e7` | | `SET_LEAF_TAG` | `AAF.SetLeaf.v1` | `0x296d58010d8a4ff0dc217a265feb69af73c8d7769490150fe880fa9f0b76ec61` | | `BINDING_TAG` | `AAF.Binding.v1` | `0x7204b50bc6c375caa79d1d38fe18dd1d0becd38ba33c872c2b1c201ec32f2b78` | | `DIGEST_TAG` | `AAF.StateDigest.v1` | `0x48c3e0e390d95f9691239e2b610da96f7437c5f2917bf5bf67d6b7cf8ad2b90a` | Subject kinds: | Type name | `kind` | | --- | --- | | `aaf.subject.account` | `0x03813c442991f3da2ffa1b594d6e587b7b33f9974bfd3f086f299d2cf188f9d4` | | `aaf.subject.entry` | `0x5c5cafd536d6351e8b2053d893d20ec6ec3b6e7923870b120623a948111f5b36` | | `aaf.subject.group` | `0xc17f79a43efcfd2a15c74264c2f31d45fa2cb3358473dea086c45c31e809ac88` | | `aaf.subject.instance` | `0xbbfa1a2a004e5f2bffed1c201cc9735a40ef7c86ab3f251a142dd9eaafbf2014` | | `aaf.subject.digest` | `0x95f59e1a9944fd498e553df77a935fe8cc9746a68046515ec17ba3ffb419d112` | | `aaf.subject.name` | `0xbc9b424b623c57e1948bab063f1951f1fe34483c696ff07c0fa7263aa94bb7da` | Interface identifiers: | Interface | Identifier | | --- | --- | | `IAAFRegistry` | `0x6ed07f52` | | `IAAFGuard` | `0x45d78aa2` | | `IAAFEvaluator` | `0x5adb69b7` | | `IAAFRelationSource` | `0x7d89fa6c` | | `IAAFSubjectResolver` | `0x190108dd` | Identifiers of the worked cases on chain 1, with the registry at `0x5e4fC511280cD8f30e6Bace811E6Df01C1321114`, the guard at `0xF02DE745d536eE32910e9f69895a593d0823De31` and the lists created by `0x5bb689C451967B6bdf8D0fAa4F388257C25709aF`: | Object | Identifier | | --- | --- | | Subject key of the account `0x8F68b6bB541fCeAb09400809185158D433a2e5ae` | `0xce187c889ba360c6e5ecdf086f055029ce0c4dcb7dbee906db137a3998e0403d` | | Subject key of entry 1 of the registry `0x86Cb4233bf5565646e174a190BEf9276191B4e71` | `0x2ed44ba763a7e1235252fd2702e260c49218b5fc3483585bbadb704705d3a4c2` | | Scope of Case A, anchored at `0x6919876B7f0A69D6F1ce17C9c2dA0bff53459f61` with context 7 | `0x51b2edb4ec3c826436714a42d0daa692e18f9a4b80ef4da3ee49605f2b69c126` | | List of Case A (`ALLOW`, `PREDICATE`, salt 1) | `0xb62f326183a232f194d45187ca6c1c954fadbae443aa910a585bc1c661701a0d` | | List of Case B (`DENY`, `ENUMERATED`, salt 2) | `0xc9403375bdc6f2b06b016f6dd6da0d6cefcc424fdb58401963d04a1102ab92ad` | | Derived list of Case B (`DENY`, `DERIVED`, salt 3) | `0xddf010def967d31ef0a19a9abd603e2fcf10e7023cc36f26fba5c53b64deaed8` | | Allow list of Case C (`ALLOW`, `ENUMERATED`, salt 4) | `0xecce9ca4f266133fde60c5407955d9b27b02408ecdf51e1d5d9ba873caac6e5c` | | State hash of that list at revision 1 | `0x8d612b9eed1cbce45ebbac404c3f09233f09ce9d8baae6d677971e4091bab769` | | Binding of Case C, salt 0 | `0x061be9acbe60272773a770f0e0701139547ffadb76152606ae62a4551a383a66` | | Its configuration hash | `0xe65f3b98d30449165098a308d6d6b08b0ce6945ac3d7835ae8745b536066da16` | | Its state digest at version 1 with its three lists at revision 1 | `0xd66a37fa17de8cf91ba1d570eef27a1493662e9117eb1ceaba559a4881aca662` | The complete vectors, with the encoded configurations, the set proofs and all eighty-one combinations of the outcome rules, are in the files listed under Reference Implementation. ## Reference Implementation The reference implementation has no owner, no upgrade path and no privileged account. It bounds the chain of derived lists at 4, the fan-out of a relation at 8, the gas of a module call at 1,500,000, the lists on one side of a binding at 8 and the actions of a binding at 16. | File | Content | | --- | --- | | [AAFTypes.sol](../assets/eip-8507/contracts/interfaces/AAFTypes.sol) | Types, tags, subject kinds, reason codes | | [IAAFRegistry.sol](../assets/eip-8507/contracts/interfaces/IAAFRegistry.sol), [IAAFGuard.sol](../assets/eip-8507/contracts/interfaces/IAAFGuard.sol) | Interfaces of the two core parts | | [IAAFEvaluator.sol](../assets/eip-8507/contracts/interfaces/IAAFEvaluator.sol), [IAAFRelationSource.sol](../assets/eip-8507/contracts/interfaces/IAAFRelationSource.sol), [IAAFSubjectResolver.sol](../assets/eip-8507/contracts/interfaces/IAAFSubjectResolver.sol) | Interfaces of the modules | | [AAFRegistry.sol](../assets/eip-8507/contracts/AAFRegistry.sol) | Registry with all four modes | | [AAFGuard.sol](../assets/eip-8507/contracts/AAFGuard.sol) | Guard with the built-in rules for standing | | [Introspection.sol](../assets/eip-8507/contracts/Introspection.sol) | The interface-detection interface both contracts report through | | [AAFCredentialHistoryEvaluator.sol](../assets/eip-8507/contracts/adapters/AAFCredentialHistoryEvaluator.sol) | Example evaluator: a credential from an assertion registry and a delivery history from a task ledger (Case A) | | [AAFBoundAnchorRelation.sol](../assets/eip-8507/contracts/adapters/AAFBoundAnchorRelation.sol) | Example relation source: the account bound to an agent identity (Case B) | | [AAFExampleConsumer.sol](../assets/eip-8507/contracts/examples/AAFExampleConsumer.sol) | Example consumer that gates its actions through the guard | The two example modules are informative. They show how evidence from other systems enters through a module and are not part of the core. Example documents: | Case | Documents | | --- | --- | | A | [scope](../assets/eip-8507/examples/case-a/scope.json), [criteria](../assets/eip-8507/examples/case-a/criteria.json), [list](../assets/eip-8507/examples/case-a/list-qualified.json), [binding](../assets/eip-8507/examples/case-a/binding.json) | | B | [scope](../assets/eip-8507/examples/case-b/scope.json), [list](../assets/eip-8507/examples/case-b/list-barred.json), [basis of the entry](../assets/eip-8507/examples/case-b/basis-incident.json), [criteria of the extension](../assets/eip-8507/examples/case-b/criteria-extension.json), [derived list](../assets/eip-8507/examples/case-b/list-barred-anchors.json), [binding](../assets/eip-8507/examples/case-b/binding.json), [binding after adopting the extension](../assets/eip-8507/examples/case-b/binding-extended.json) | | C | [scope](../assets/eip-8507/examples/case-c/scope.json), [allow list](../assets/eip-8507/examples/case-c/list-partners.json), [deny list](../assets/eip-8507/examples/case-c/list-barred.json), [committed deny list](../assets/eip-8507/examples/case-c/list-sanctioned.json), [binding](../assets/eip-8507/examples/case-c/binding.json), [list of excluded tools](../assets/eip-8507/examples/case-c/list-excluded-tools.json), [binding for tools](../assets/eip-8507/examples/case-c/binding-tools.json) | | | [Assessment record of step 1 of Case C](../assets/eip-8507/examples/assessment.json) | Vectors: | File | Content | | --- | --- | | [constants.json](../assets/eip-8507/vectors/constants.json) | Tags, subject kinds, action names, enumerations, reason codes | | [identifiers.json](../assets/eip-8507/vectors/identifiers.json) | Document hashes, subject keys, scopes, criteria, lists with their first state hash, bindings with their encoded configuration, a state digest | | [sets.json](../assets/eip-8507/vectors/sets.json) | A sorted set and a membership-only set with proofs that have to be accepted and proofs that have to be refused | | [outcomes.json](../assets/eip-8507/vectors/outcomes.json) | Every combination of the two sides with the conflict and default rules, and every combination of three results under the three thresholds | | [interfaces.json](../assets/eip-8507/vectors/interfaces.json) | Interface identifiers and function selectors | ## Security Considerations **A list is a claim by its manager.** Nothing in a registry makes an entry true. A `DENY` entry with basis `DESIGNATION` says only that the manager refuses the subject. A `DENY` entry with basis `EVIDENCED` commits to a document that readers have to judge for themselves. Consumers choose which lists they bind, and a list that nobody binds affects nobody. Interfaces that display entries without their basis and their scope turn a refusal into an accusation. **Compromised or hostile managers.** Whoever controls the manager account controls the list. A binding that follows a list accepts every later change of it. A binding that pins a list accepts none until the adopter amends the pin; the price is that the list says nothing for that binding in the meantime, which under most rules means deferral or refusal. Hand-over in two steps prevents a list from being transferred to an address nobody controls, and it changes the state hash, so that pinned bindings notice it. For lists that many parties rely on, a manager account governed by several signers or by a collective decision is appropriate. **Denylists and new identities.** A `DENY` list refuses the objects it names. An operator that can create a new identity at no cost is not stopped by a binding that admits everything not denied. Bindings that have to withstand this rely on an `ALLOW` side whose criteria are costly to meet, or adopt an extension to related objects. An extension reaches only as far as its relation can be established on evidence from both sides, and no further than one hop. Wider propagation would let a listed party draw others into its refusal. **Borrowed standing.** Every list result is public, so anyone can name an admitted subject. The protection is the standing check, and it is only as good as the binding between the caller of the consumer and the presenter passed to the guard. A consumer that passes anything other than its actual caller, or that accepts a presenter chosen by the requester, has no protection. Standing can change between an assessment and its use, which is why it is established again at every use, also when an earlier admission is honoured. **The undetermined treated as a pass.** A binding that declares `PROCEED` for indeterminate outcomes admits everything it cannot check, including requests that were made uncheckable on purpose: by withholding a proof, by supplying too little gas for a module, or while a source is unreachable. Such a binding is appropriate only where proceeding in error is cheap. `PROCEED_RESTRICTED` has the same exposure within the limit the consumer applies, and no protection at all where the limit is only written down: a guard cannot tell whether a consumer applies what its binding document states. The limit is worth what the code that carries out the action enforces. The record of such a decision keeps the indeterminate outcome, so that it cannot later be presented as a verified admission. **Modules.** An evaluator or relation source is code chosen by the manager of a list. Pinning its code hash and configuration hash prevents a silent change of rules, yet a module can still read state that somebody else controls. A proxy that reports an unchanged configuration hash after its implementation changed defeats the pin; the registry cannot detect this, and adopters of lists with upgradeable modules depend on the party that can upgrade them. Modules are called with bounded gas and their failure is an undetermined result, so a module cannot block a query, though it can make its own list useless. **An assessment is not a permit.** An assessment says that a subject may take part in an action in a context. It is produced for the consumer of the binding, which is the only caller a guard answers with effect, and it is never presented by a requester. The danger is a consumer that keeps a decision and applies it to an operation it was not taken for. Where the action moves value this is the usual route from a correct admission to a loss. Three things limit it: reuse is declared per action and is none unless declared; a consumer that carries out a transfer obtains the decision in the same execution; and the amount, the target and the call data of the transfer are checked by that consumer, since no list decides them. Honouring an admission is the opposite choice, made openly: it suits continuing work and does not suit single transfers. **Earlier results and replays.** An assessment or a proof is evidence of a past state. Accepting it without checking the state digest and the validity lets a requester replay an admission after it was revoked. The state digest covers the binding and its lists and nothing outside them. A credential that is revoked, a relation that ends and the code of an account that is replaced change a result without changing any state hash, which is why a finding that rests on one of them is valid for its call only. An evaluator that reports the expiry of a revocable credential as the validity of its result reopens the gap for every consumer that reuses assessments. **Code behind an address.** An entry made by address alone admits or refuses whatever code the account runs. An account that delegates its code can delegate elsewhere at any time, and many contract accounts can be upgraded or extended. An entry tied to a code hash notices a change of the code at the address, including a change of delegation. It does not notice a change of an implementation behind a proxy or of installed modules, because the code at the address stays the same; lists that have to notice those use an evaluator that reads the account's own configuration. A tie to code on a `DENY` list lets the listed account leave the entry by changing its code, with an undetermined result as the consequence; whether that suits a list is for its manager to decide. **Notice periods.** A notice period lets a listed party act before a refusal takes effect, which is its purpose and its cost. A list meant for urgent refusals has no notice period. A consumer that needs both binds one list of each kind. **Privacy.** Lists, entries and assessments on a public chain are public, and so is the fact that a subject asked. A committed set hides its members from those who hold no proofs, but a proof of absence discloses two neighbouring keys, and keys of low-entropy subjects such as accounts can be tested against a guess. Basis documents are published by their managers; putting personal data into them is outside the proposal and against its rules for principals. An objection is public and attributed to its sender. **Time and reorganisation.** Windows and notice periods are measured by block time, which block producers can shift by small amounts; windows of a few seconds are not meaningful. An assessment made in a block that is later reorganised away is void with it. **Registries a guard cannot reach.** A binding can name lists in several registries. A registry that stops answering turns its lists into undetermined results for every binding that uses them. This fails closed for bindings that defer or refuse on the undetermined, and it gives the operator of such a registry the ability to stall those consumers. Adopters choose registries accordingly. **References across chains.** A subject on another chain can be listed. Nothing in this version verifies its state, its controller or the standing of a presenter for it. Rules that depend on such state stay undetermined unless a module supplies evidence, and the trust placed in that evidence is the trust placed in the module. ## Copyright Copyright and related rights waived via [CC0](../LICENSE.md).