{"eip":8152,"title":"Content-Addressable Logic Modules (CALM)","description":"Content-addressable logic modules for proxy architectures. Multichain consistent and permissionlessly replicable, leading to gas-efficiency.","authors":["Radek Svarz (@radeksvarz)","Nick Mudge (@mudgen)","William Morriss (@wjmelements)"],"status":"Review","type":"Standards Track","category":"ERC","created":"2026-01-18","discussionsTo":"https://ethereum-magicians.org/t/erc-8152-content-addressable-logic-modules-calm/23070","repo":"ERCs","label":"ERC-8152","officialUrl":"https://eips.ethereum.org/EIPS/eip-8152","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8152.md","url":"https://eips.huatuo.xyz/eip-8152/","tldr":{"en":"Defines constructor-free, immutable-free, selfdestruct-free logic modules for proxies and diamonds whose deployment address depends only on their runtime bytecode, so the same logic lives at the same address on every EVM chain.","ja":"プロキシとダイヤモンド向けに、コンストラクタなし・immutable なし・selfdestruct なしのロジックモジュールを定義する。デプロイ先アドレスは実行時バイトコードのみに依存するため、同じロジックがすべての EVM チェーンで同じアドレスに存在する。","ko":"프록시와 다이아몬드를 위한 생성자 없음, immutable 없음, selfdestruct 없음의 로직 모듈을 정의한다. 배포 주소가 런타임 바이트코드에만 의존하므로 같은 로직이 모든 EVM 체인에서 같은 주소에 존재한다.","zh":"为代理合约和钻石定义无构造函数、无 immutable、无 selfdestruct 的逻辑模块，其部署地址仅取决于运行时字节码，因此相同的逻辑在每条 EVM 链上都位于同一地址。"},"tags":["proxy","diamonds","deployment","multichain","modules"],"explainers":{"en":{"lang":"en","tldr":"Defines constructor-free, immutable-free, selfdestruct-free logic modules for proxies and diamonds whose deployment address depends only on their runtime bytecode, so the same logic lives at the same address on every EVM chain.","tags":["proxy","diamonds","deployment","multichain","modules"],"related":[2535,8167,7201,8042,7863],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8152/","markdown":"## What problem does it solve?\n\nProxy architectures such as Diamonds ([ERC-2535](/eip-2535/)), UUPS and Modular Dispatch Proxies ([ERC-8167](/eip-8167/)) `delegatecall` into separate logic contracts (facets, libraries, implementations). Today the same logic gets deployed over and over, at different addresses on each chain, because constructors, immutables and deployer-specific details change the address. That makes cross-chain verification and reuse painful.\n\nCALM (Content-Addressable Logic Modules) sets rules so that a logic module's address is a pure commitment to its runtime bytecode: \"runtime bytecode is identity\". Anyone can redeploy the same module to a new chain and it lands at the same address.\n\n## How it works\n\n**Deployment rules**\n\n- No constructor logic: the initcode only returns the runtime bytecode (the spec gives the 11-byte micro-constructor `600B380380600B3D393DF3` as an example).\n- No immutables, since they would change the bytecode per deployment.\n- The address must be a function of public constants and the runtime bytecode only (e.g. a known permissionless deployer, salt 0, the fixed micro-constructor), and redeployment on other chains must be permissionless.\n\n**Runtime rules**\n\n- No `SELFDESTRUCT`, and no delegatecall into code that has it, so proxies can rely on the module forever.\n- The module never touches its own storage; it works on the calling proxy's storage, preferably at namespaced locations ([ERC-7201](/eip-7201/) or [ERC-8042](/eip-8042/)). Legacy slot-0 layouts are allowed only for backwards compatibility and should be disclosed.\n\n**Signalling.** Source should carry a \"Capability and Impact Manifest\" (e.g. in NatSpec) listing storage touched, external calls and required opcodes/precompiles (such as PUSH0). It is an unverified claim; tooling should check the bytecode itself.\n\n**Two dispatch models.** *Multi-method* modules have a normal selector dispatcher. *Atomic-logic* modules contain only a `fallback()`, so a diamond maps one selector straight to them and skips the second dispatch.\n\n## Sample code\n\nThe spec's single-function facet for `decimals()` returning 18 (compiled without CBOR metadata it becomes `0x60125f5260205ff3`):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity 0.8.33;\n\n/// @custom:CALM-manifest Storage: none. External calls: none. Requires EIP-3855 (PUSH0).\ncontract Decimals_Const18_Optimized {\n    fallback() external payable {\n        assembly {\n            mstore(0x00, 0x12)\n            return(0x00, 0x20)\n        }\n    }\n}\n```\n\nPredicting the module address from runtime code alone (ethers v6; `deployer` is whichever permissionless CREATE2 deployer the ecosystem standardises on):\n\n```ts\nimport { concat, getCreate2Address, keccak256, ZeroHash } from \"ethers\";\n\nconst MICRO_CONSTRUCTOR = \"0x600B380380600B3D393DF3\";\nconst runtime = \"0x60125f5260205ff3\";\n\nconst initCode = concat([MICRO_CONSTRUCTOR, runtime]);\nconst calmAddress = getCreate2Address(deployer, ZeroHash, keccak256(initCode));\n```\n\n## Things to know\n\n- Status is **Review**.\n- Compiler metadata (the CBOR footer) is part of the bytecode, so a changed comment changes the address. Strip it (`bytecode_hash = \"none\"`, `cbor_metadata = false`) for logic-only identity, or keep it so audited source and comments are bound to the address. The spec recommends keeping it for complex, security-critical modules.\n- Treat manifests as claims, not facts; verify storage access and opcode support with static analysis.\n- Mixing modules that use different storage conventions (7201 vs 8042) in one proxy will cause bugs.\n- The spec argues shared canonical modules would benefit from block-level warming ([EIP-7863](/eip-7863/), Draft) and from client bytecode caches.\n"},"ja":{"lang":"ja","tldr":"プロキシとダイヤモンド向けに、コンストラクタなし・immutable なし・selfdestruct なしのロジックモジュールを定義する。デプロイ先アドレスは実行時バイトコードのみに依存するため、同じロジックがすべての EVM チェーンで同じアドレスに存在する。","tags":["proxy","diamonds","deployment","multichain","modules"],"related":[2535,8167,7201,8042,7863],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8152/","markdown":"## 何を解決するのか\n\nダイヤモンド（[ERC-2535](/eip-2535/)）、UUPS、Modular Dispatch Proxy（[ERC-8167](/eip-8167/)）のようなプロキシアーキテクチャは、別個のロジックコントラクト（ファセット、ライブラリ、実装）へ `delegatecall` します。現在は、コンストラクタ、immutable、デプロイヤー固有の事情によってアドレスが変わるため、同じロジックがチェーンごとに異なるアドレスで何度もデプロイされています。そのため、クロスチェーンでの検証や再利用が面倒です。\n\nCALM（Content-Addressable Logic Modules）は、ロジックモジュールのアドレスが、その実行時バイトコードへの純粋なコミットメントになるようにルールを定めます。「実行時バイトコードがアイデンティティ」です。誰でも同じモジュールを新しいチェーンに再デプロイでき、同じアドレスに配置されます。\n\n## 仕組み\n\n**デプロイのルール**\n\n- コンストラクタのロジックなし: initcode は実行時バイトコードを返すだけです（仕様は例として、11 バイトのマイクロコンストラクタ `600B380380600B3D393DF3` を示しています）。\n- immutable なし。デプロイごとにバイトコードが変わってしまうためです。\n- アドレスは、公開された定数と実行時バイトコードだけの関数でなければなりません（例: 既知のパーミッションレスなデプロイヤー、salt 0、固定のマイクロコンストラクタ）。また、他のチェーンへの再デプロイはパーミッションレスでなければなりません。\n\n**実行時のルール**\n\n- `SELFDESTRUCT` なし。それを持つコードへの delegatecall もなし。これにより、プロキシはモジュールをいつまでも頼りにできます。\n- モジュールは自身のストレージには一切触れません。呼び出し元のプロキシのストレージ上で動作し、できれば名前空間付きの位置（[ERC-7201](/eip-7201/) または [ERC-8042](/eip-8042/)）を使います。従来のスロット 0 のレイアウトは、後方互換性のためにのみ許され、開示すべきです。\n\n**シグナリング。** ソースには、「Capability and Impact Manifest」（たとえば NatSpec 内）を付けるべきです。触れるストレージ、外部呼び出し、必要なオペコード／プリコンパイル（PUSH0 など）を列挙します。これは未検証の主張であり、ツールはバイトコード自体を確認すべきです。\n\n**2 つのディスパッチモデル。** *マルチメソッド*モジュールは、通常のセレクターディスパッチャーを持ちます。*アトミックロジック*モジュールは `fallback()` だけを含むため、ダイヤモンドは 1 つのセレクターをそれに直接マップでき、2 段目のディスパッチを省略できます。\n\n## サンプルコード\n\n仕様にある、18 を返す `decimals()` 用の単一関数ファセット（CBOR メタデータなしでコンパイルすると `0x60125f5260205ff3` になります）:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity 0.8.33;\n\n/// @custom:CALM-manifest Storage: none. External calls: none. Requires EIP-3855 (PUSH0).\ncontract Decimals_Const18_Optimized {\n    fallback() external payable {\n        assembly {\n            mstore(0x00, 0x12)\n            return(0x00, 0x20)\n        }\n    }\n}\n```\n\n実行時コードだけからモジュールのアドレスを予測する（ethers v6。`deployer` は、エコシステムが標準とするパーミッションレスな CREATE2 デプロイヤーのいずれかです）:\n\n```ts\nimport { concat, getCreate2Address, keccak256, ZeroHash } from \"ethers\";\n\nconst MICRO_CONSTRUCTOR = \"0x600B380380600B3D393DF3\";\nconst runtime = \"0x60125f5260205ff3\";\n\nconst initCode = concat([MICRO_CONSTRUCTOR, runtime]);\nconst calmAddress = getCreate2Address(deployer, ZeroHash, keccak256(initCode));\n```\n\n## 知っておくべきこと\n\n- ステータスは **Review** です。\n- コンパイラのメタデータ（CBOR のフッター）はバイトコードの一部であるため、コメントを変更するとアドレスも変わります。ロジックのみのアイデンティティにしたい場合は、これを取り除いてください（`bytecode_hash = \"none\"`、`cbor_metadata = false`）。監査済みのソースとコメントをアドレスに結び付けたい場合は、残してください。仕様は、複雑でセキュリティ上重要なモジュールでは残すことを推奨しています。\n- マニフェストは事実ではなく主張として扱い、静的解析でストレージアクセスとオペコードのサポートを確認してください。\n- 異なるストレージ規約（7201 と 8042）を使うモジュールを 1 つのプロキシに混在させると、バグの原因になります。\n- 仕様は、共有される正規のモジュールは、ブロックレベルのウォーミング（[EIP-7863](/eip-7863/)、Draft）とクライアントのバイトコードキャッシュの恩恵を受けられると論じています。\n"},"ko":{"lang":"ko","tldr":"프록시와 다이아몬드를 위한 생성자 없음, immutable 없음, selfdestruct 없음의 로직 모듈을 정의한다. 배포 주소가 런타임 바이트코드에만 의존하므로 같은 로직이 모든 EVM 체인에서 같은 주소에 존재한다.","tags":["proxy","diamonds","deployment","multichain","modules"],"related":[2535,8167,7201,8042,7863],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8152/","markdown":"## 어떤 문제를 해결하나요?\n\n다이아몬드([ERC-2535](/eip-2535/)), UUPS, 모듈형 디스패치 프록시([ERC-8167](/eip-8167/)) 같은 프록시 아키텍처는 별도의 로직 컨트랙트(페이싯, 라이브러리, 구현)로 `delegatecall`합니다. 오늘날에는 생성자, immutable, 배포자 고유의 세부 사항이 주소를 바꾸기 때문에 같은 로직이 체인마다 다른 주소로 반복해서 배포됩니다. 그 탓에 체인 간 검증과 재사용이 힘듭니다.\n\nCALM(Content-Addressable Logic Modules)은 로직 모듈의 주소가 런타임 바이트코드에 대한 순수한 커밋먼트가 되도록 규칙을 정합니다. \"런타임 바이트코드가 곧 신원\"입니다. 누구든 같은 모듈을 새 체인에 다시 배포할 수 있고, 같은 주소에 놓입니다.\n\n## 어떻게 동작하나요?\n\n**배포 규칙**\n\n- 생성자 로직 없음: initcode는 런타임 바이트코드만 반환합니다(명세는 예로 11바이트 마이크로 생성자 `600B380380600B3D393DF3`을 듭니다).\n- immutable 없음. 배포마다 바이트코드가 바뀌기 때문입니다.\n- 주소는 공개 상수와 런타임 바이트코드만의 함수여야 하며(예: 알려진 퍼미션리스 배포자, salt 0, 고정된 마이크로 생성자), 다른 체인에서의 재배포는 퍼미션리스여야 합니다.\n\n**런타임 규칙**\n\n- `SELFDESTRUCT` 없음, 그것을 가진 코드로의 delegatecall도 없음. 따라서 프록시가 모듈을 영구히 신뢰할 수 있습니다.\n- 모듈은 자신의 스토리지를 절대 건드리지 않습니다. 호출하는 프록시의 스토리지에서 동작하며, 가급적 네임스페이스가 있는 위치([ERC-7201](/eip-7201/) 또는 [ERC-8042](/eip-8042/))를 사용합니다. 레거시 슬롯 0 레이아웃은 하위 호환을 위해서만 허용되며 공개해야 합니다.\n\n**신호 전달.** 소스에는 건드리는 스토리지, 외부 호출, 필요한 옵코드/프리컴파일(PUSH0 등)을 나열한 \"Capability and Impact Manifest\"(예: NatSpec에)를 담아야 합니다. 이는 검증되지 않은 주장이며, 도구는 바이트코드 자체를 확인해야 합니다.\n\n**두 가지 디스패치 모델.** *멀티 메서드* 모듈은 일반적인 셀렉터 디스패처를 가집니다. *아토믹 로직* 모듈은 `fallback()`만 가지므로, 다이아몬드는 셀렉터 하나를 곧바로 그것에 매핑하여 두 번째 디스패치를 건너뜁니다.\n\n## 샘플 코드\n\n명세의 18을 반환하는 `decimals()`용 단일 함수 페이싯(CBOR 메타데이터 없이 컴파일하면 `0x60125f5260205ff3`이 됩니다):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity 0.8.33;\n\n/// @custom:CALM-manifest Storage: none. External calls: none. Requires EIP-3855 (PUSH0).\ncontract Decimals_Const18_Optimized {\n    fallback() external payable {\n        assembly {\n            mstore(0x00, 0x12)\n            return(0x00, 0x20)\n        }\n    }\n}\n```\n\n런타임 코드만으로 모듈 주소 예측하기(ethers v6. `deployer`는 생태계가 표준으로 삼는 퍼미션리스 CREATE2 배포자 중 하나입니다):\n\n```ts\nimport { concat, getCreate2Address, keccak256, ZeroHash } from \"ethers\";\n\nconst MICRO_CONSTRUCTOR = \"0x600B380380600B3D393DF3\";\nconst runtime = \"0x60125f5260205ff3\";\n\nconst initCode = concat([MICRO_CONSTRUCTOR, runtime]);\nconst calmAddress = getCreate2Address(deployer, ZeroHash, keccak256(initCode));\n```\n\n## 알아둘 점\n\n- 상태는 **Review**입니다.\n- 컴파일러 메타데이터(CBOR 푸터)는 바이트코드의 일부이므로 주석을 바꾸면 주소가 바뀝니다. 로직만의 신원을 원하면 제거하고(`bytecode_hash = \"none\"`, `cbor_metadata = false`), 감사받은 소스와 주석을 주소에 묶고 싶다면 유지하세요. 명세는 복잡하고 보안이 중요한 모듈에는 유지하기를 권장합니다.\n- 매니페스트는 사실이 아니라 주장으로 취급하고, 스토리지 접근과 옵코드 지원은 정적 분석으로 확인하세요.\n- 서로 다른 스토리지 규약(7201과 8042)을 쓰는 모듈을 하나의 프록시에 섞으면 버그가 생깁니다.\n- 명세는 공유되는 표준 모듈이 블록 수준 워밍([EIP-7863](/eip-7863/), Draft)과 클라이언트의 바이트코드 캐시의 이점을 누릴 수 있다고 주장합니다.\n"},"zh":{"lang":"zh","tldr":"为代理合约和钻石定义无构造函数、无 immutable、无 selfdestruct 的逻辑模块，其部署地址仅取决于运行时字节码，因此相同的逻辑在每条 EVM 链上都位于同一地址。","tags":["proxy","diamonds","deployment","multichain","modules"],"related":[2535,8167,7201,8042,7863],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8152/","markdown":"## 它解决什么问题？\n\n钻石（[ERC-2535](/eip-2535/)）、UUPS 和模块化调度代理（[ERC-8167](/eip-8167/)）等代理架构会 `delegatecall` 到独立的逻辑合约（facet、库、实现）。如今，由于构造函数、immutable 以及部署者特有的细节会改变地址，同样的逻辑在每条链上都会以不同的地址被反复部署。这让跨链验证和复用变得很麻烦。\n\nCALM（Content-Addressable Logic Modules，内容寻址逻辑模块）制定规则，使逻辑模块的地址纯粹是对其运行时字节码的承诺：\"运行时字节码即身份\"。任何人都可以把同一个模块重新部署到新链上，并得到相同的地址。\n\n## 它如何运作\n\n**部署规则**\n\n- 无构造函数逻辑：initcode 只返回运行时字节码（规范以 11 字节的微型构造函数 `600B380380600B3D393DF3` 为例）。\n- 无 immutable，因为它们会让每次部署的字节码不同。\n- 地址必须仅是公开常量和运行时字节码的函数（例如已知的无需许可的部署者、salt 为 0、固定的微型构造函数），并且在其他链上的重新部署必须无需许可。\n\n**运行时规则**\n\n- 没有 `SELFDESTRUCT`，也不能 delegatecall 到含有它的代码，这样代理就可以永远依赖该模块。\n- 模块从不触碰自己的存储；它在调用方代理的存储上工作，最好使用带命名空间的位置（[ERC-7201](/eip-7201/) 或 [ERC-8042](/eip-8042/)）。旧式的槽 0 布局仅为向后兼容才被允许，并且应当予以披露。\n\n**信号。** 源代码应带有\"能力与影响清单\"（Capability and Impact Manifest，例如放在 NatSpec 中），列出所触碰的存储、外部调用以及所需的操作码/预编译（如 PUSH0）。这是一种未经验证的声明；工具应当检查字节码本身。\n\n**两种调度模型。** *多方法*模块有常规的选择器调度器。*原子逻辑*模块只包含一个 `fallback()`，因此钻石可以把一个选择器直接映射到它们，跳过第二次调度。\n\n## 示例代码\n\n规范中返回 18 的 `decimals()` 的单函数 facet（不带 CBOR 元数据编译后为 `0x60125f5260205ff3`）：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity 0.8.33;\n\n/// @custom:CALM-manifest Storage: none. External calls: none. Requires EIP-3855 (PUSH0).\ncontract Decimals_Const18_Optimized {\n    fallback() external payable {\n        assembly {\n            mstore(0x00, 0x12)\n            return(0x00, 0x20)\n        }\n    }\n}\n```\n\n仅根据运行时代码预测模块地址（ethers v6；`deployer` 是生态系统所采用的任一无需许可的 CREATE2 部署者）：\n\n```ts\nimport { concat, getCreate2Address, keccak256, ZeroHash } from \"ethers\";\n\nconst MICRO_CONSTRUCTOR = \"0x600B380380600B3D393DF3\";\nconst runtime = \"0x60125f5260205ff3\";\n\nconst initCode = concat([MICRO_CONSTRUCTOR, runtime]);\nconst calmAddress = getCreate2Address(deployer, ZeroHash, keccak256(initCode));\n```\n\n## 需要注意\n\n- 状态为 **Review**。\n- 编译器元数据（CBOR 尾部）是字节码的一部分，因此改动一条注释就会改变地址。若只想要逻辑本身的身份，请去掉它（`bytecode_hash = \"none\"`、`cbor_metadata = false`）；若想把经过审计的源码和注释与地址绑定，则保留它。规范建议对复杂且安全关键的模块保留它。\n- 把清单视为声明而非事实；用静态分析验证存储访问和操作码支持情况。\n- 在同一个代理中混用采用不同存储约定（7201 与 8042）的模块会导致 bug。\n- 规范认为，共享的规范模块将受益于区块级预热（[EIP-7863](/eip-7863/)，Draft）以及客户端的字节码缓存。\n"}}}
