Conversation
Pull Request ReviewThis PR adds BEP-702, a draft protocol specification for CAS20 fungible tokens implemented as stateful precompiled contracts on BNB Smart Chain. It defines deterministic token addressing, factory and registry components, role-based controls, compliance policies, pause and supply controls, permit support, token variants, gas accounting, activation, and consensus storage layout, and adds the proposal to the README index. Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
CAS20 is a fungible-token standard built into the protocol: a token is a stateful precompile at a derived address rather than deployed bytecode, so its behaviour is a guarantee of the chain instead of of per-token contract code. It keeps the BEP-20 selector and event surface, so existing wallets and indexers need no change, and it makes the compliance controls an issuer would otherwise reimplement part of the standard — transfer policies resolved from shared allow- and blocklists, per-feature pause, and role-separated mint, burn and seizure. Everything a second implementation must agree on is specified rather than left to the client, because each of these decides a state root: the address derivation and its preimage, the ERC-7201 storage layout down to the slot and the packed lane, the gas schedule and the EIP-2929 warm-set rules, the order in which a call's checks apply and therefore which error a caller receives, and the account sentinel that keeps a code-less token from being reaped with its balances. Two variants share that surface. Asset adds the ERC-8056 scaled multiplier, including a scheduled change that takes effect on read with no transaction and no event — stated explicitly, because an indexer rebuilding from logs alone would silently diverge. Stablecoin adds a currency code. Activation is separate from shipping. A per-feature switch lives in a singleton registry: governance appoints the account that may throw it, and that account opens or closes a feature immediately, so a network chooses its own schedule without a fork and without waiting out a voting period for an emergency stop. The switch reaches creation and registry writes only; it can never touch a token that already exists, and reads are never gated, because a network-level switch must not be able to make transfers fail.
Pull Request ReviewThis PR adds BEP-702, a protocol-level CAS20 fungible-token standard implemented through stateful precompiled contracts, with native roles, compliance policies, pausing, supply caps, permits, and asset/stablecoin variants. It also documents consensus-critical addressing, storage, gas, activation, and account-sentinel behavior, and adds BEP-702 to the README index. Sensitive ContentNo sensitive content detected. Security Issues🟠 [HIGH] Conflicting CAS20 address namespace definitions could cause consensus divergence
🟠 [HIGH] Composite policy identifiers conflict with authorization rules
Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Each of these would let two implementations disagree while both followed the document. The address section named the reserved namespace as 0xCA5… and then said the distinguishing second byte was 0xB0 for tokens and 0xBF for the factory — the values from before the rename, left behind because the replacement only caught the fully-written 0x20B0 form. An implementation reading the sentence rather than the table would recognise a different address range. The policy-id encoding said the most significant byte is 0x00 for BLOCKLIST or 0x01 for ALLOWLIST and that "any other value is not a valid type", while the enum three sections earlier has four members and composites carry 0x02 and 0x03. Read literally, every composite policy is invalid and authorizes nobody — so one implementation refuses a transfer the other permits. All four values are now named, and an id above the enum is refused as naming no policy rather than treated as a policy that authorizes nobody, which is the safer of the two readings and the one the reference implementation takes. createCompositePolicy, updateComposite and compositePolicyChildIds were described in prose but absent from IPolicyRegistry, leaving three consensus-visible selectors without a signature to derive them from. They are declared now, and their selectors were checked against the implementation rather than transcribed.
Pull Request ReviewThis PR adds BEP-702, a specification for CAS20 protocol-native compliant fungible tokens implemented as stateful precompiles on BNB Smart Chain. It defines token variants, deterministic addressing, role-based controls, shared transfer policies, pausing, permits, gas accounting, activation governance, account sentinels, and consensus storage layouts, and adds the proposal to the README index. Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Eighteen edits, all of them places where the document and the reference client disagreed. Ten describe behavior the client already had and the document had not written down; the rest correct claims the client does not implement. Undeclared surface. The gas table called itself exhaustive while permit charges the ECRECOVER precompile's own cost, which it owes: a signature check at less than the price of the same work in bytecode would be the one charge the parity rule forbids skipping. A composite creation and every replacement emit CompositePolicyUpdated, which no interface declared, so an implementation following the document literally would produce a different receipt root. Eight callable selectors were undeclared: the six policy-scope identifiers, which are keccak256 of the names the scope table already used, and the two composite child bounds. ICAS20Factory omitted InternalCallMalformed, which 3.4 requires it to raise. And Panic(uint256) is Solidity's own, declared by no interface, so the declare-where-raised rule needs its one exemption stated rather than silently broken. Corrections. 3.8 said a malformed policy id must be refused wherever an id is accepted "rather than treated as a policy that authorizes nobody" — which is what the next paragraph, and the client, do on the read path. The clause now covers the paths that mutate, bind or nest, which are the ones that refuse. The composite constructor was documented as checking the type before the admin, and as being asymmetric with the simple constructors; it is neither. Child validation is two passes over the whole set, and a sentinel is no more eligible as a child than a composite. isAuthorized's empty-set rule was stated as a principle without saying where the four types land, which left the one case that surprises — an INTERSECT over no children is vacuously true — to be inferred. variantOf does not read byte [10] alone; it establishes the address is in the reserved space first, and rejects a variant the fork does not recognize, because its return type has no member for one. The Go interface in 3.2 was the shape from an earlier draft. The scope rule as first written claimed updatePolicy refuses an unknown scope, which it does only after the caller clears the role check. 3.3 said NonPayable precedes anything else, though the call-form guards precede it. A paragraph in 3.15 described an activation surface that is not the one specified here. And the sentinel policies exist from the registry's first block, before any creation has seeded them — a rule the client enforces and the document never stated. Removed the claim that an operator can audit the reserved space with a client subcommand. No such command is part of this proposal. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pull Request ReviewThis PR adds BEP-702, a specification for CAS20 compliant assets implemented as stateful BSC precompiles, including shared compliance controls, token variants, deterministic storage/address rules, gas behavior, and network-level feature activation. It also adds BEP-702 to the README proposal index as a draft standard. Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
The marker is two bytes, but the eight zero bytes that follow it belong to the layout, so the first five hex digits of every token address are the marker plus a zero the padding supplies. Spending the second byte on 0x52 makes those digits spell the standard's name, which 0x50 did without its number. The factory keeps 0xCA5F and the registries keep 0x7020. The reserved-space check was made against the whole 0xCA5 namespace rather than the token prefix alone, so it already covers this choice; the paragraph recording it now says so, in place of a sentence that narrated when the prefix was last chosen. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pull Request ReviewThis PR adds BEP-702, specifying CAS20 as a protocol-level compliant fungible-asset standard implemented through stateful precompiles on BNB Smart Chain. It also adds the draft proposal to the README index; no executable implementation changes are included in the supplied diff. Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
…annot wait A token's sentinel is written by the factory at creation and metered; a registry's is written by the fork transition as an irregular state change. The registry's cannot wait for its first write: GovHub tests extcodesize before forwarding a parameter change, so a registry without code could never be appointed an admin. Also index all three RoleAdminChanged arguments, as the client emits them, and state that role mutation is gated on the target role's own admin role rather than on DEFAULT_ADMIN_ROLE. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…n genesis Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… dispatch Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A review against the two-client premise found the standard silent where bsc-geth and reth-bsc could each make a defensible choice and fork. - The check order of every token entry point is now a table, with the shared prefix (call form, existence, decoding, static frame) and the exit precedence spelled out; from == to takes no policy fast path, and a self transferFrom spends the allowance. - Account fields: the nonce and balance are never written; the initial state table lists exactly the slots createCAS20 writes, including the Asset multiplier at 1e18, and forbids writing a default. - The registry sentinels are planted at the start of the fork block, in the same pass as HistoryStorageAddress. - EIP-7702 delegation to a CAS20 address executes the sentinel byte and halts; EIP-7928 records a CAS20 account as an ordinary account. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pull Request ReviewThis PR adds BEP-702, a specification for protocol-native compliant fungible assets on BNB Smart Chain, including shared compliance controls, role-separated operations, token variants, and network-level feature activation. It also adds BEP-702 to the README index as a draft standard; however, the actual BEP file is represented as binary or empty and was unavailable for line-level review. Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
…and backed at every mutation Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pull Request ReviewThis PR adds BEP-702, a specification for CAS20 compliant assets implemented as stateful BSC precompiles, including shared compliance controls, Asset and Stablecoin variants, protocol storage and gas rules, and network-level feature activation. It also adds BEP-702 to the README’s standards index with Draft status; the specification file itself was not available for content-level review in the supplied diff. Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Description
Adds BEP-702: CAS20, the Compliant Asset Standard — a fungible-token standard built into the BSC protocol, where a token is a stateful precompile at a derived address rather than deployed bytecode.
Reference implementation: bnb-chain/bsc#3813
At a high level, the standard:
Rationale
A BEP-20 transfer spends most of its gas on interpreting bytecode rather than on the state it touches, and every issuer reimplements the same compliance logic with its own bugs. Putting the token in the protocol removes that overhead and lets one audited implementation serve every token of a variant, with compliance state shared across tokens instead of duplicated.
What is specified, and why
Everything a second implementation must agree on, because each of these decides a state root:
Two behaviours are called out explicitly because they surprise integrators rather than implementers. The Asset variant's scheduled multiplier takes effect on read, with no transaction and no event, so an indexer rebuilding balances from the log stream alone will silently diverge (§3.12). And deactivating a feature reaches creation and registry writes only — never a token that already exists, and never a read, because a network-level switch must not be able to make transfers fail (§3.15).
Activation authority
Governance appoints the account that may throw the switch; that account opens or closes a feature immediately. The split lets a network hold an emergency stop without waiting out a voting period, while the authority behind it stays with governance and a lost key is replaced by a parameter-change proposal rather than a fork (§3.15).
Changes
BEPs/BEP-702.md— the specificationREADME.md— index row