@resurrect-protocol/contracts 0.1.0-dev.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # `@resurrect-protocol/contracts`
2
+
3
+ Canonical, permissionless Resurrect Registry v1 Solidity source and ABI. The contract is stateless and has no owner, administrator, allowlist, pause, upgrade, withdrawal, or peer-storage path. Anyone may publish a bounded signed peer record. Applications consume recent `PeerAnnounced` logs as untrusted discovery hints.
4
+
5
+ ```bash
6
+ npm install @resurrect-protocol/contracts
7
+ ```
8
+
9
+ ```js
10
+ import registryAbi from '@resurrect-protocol/contracts/abi/ResurrectRegistryV1.json' with { type: 'json' }
11
+ ```
12
+
13
+ Solidity tools can import `@resurrect-protocol/contracts/src/ResurrectRegistryV1.sol`. The source exposes exactly `VERSION`, `MAX_TTL`, `MAX_RECORD_BYTES`, and `announce`. TTL must be between one second and 90 days; records must be between one and 4096 bytes. Expiry is computed from the block timestamp and emitted with the namespace, codec, and bytes.
14
+
15
+ The source is released under [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/). Consumers should deploy and verify the exact source themselves, then pin the chain ID, address, deployment block, and constants in their application descriptor. This package does not designate or endorse a production deployment.
16
+
17
+ An onchain event is an untrusted discovery hint. Consumers must still verify the embedded signed peer record, sequence, expiry, endpoint policy, and application handshake.
@@ -0,0 +1,48 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "MAX_RECORD_BYTES",
5
+ "inputs": [],
6
+ "outputs": [{ "name": "", "type": "uint32", "internalType": "uint32" }],
7
+ "stateMutability": "view"
8
+ },
9
+ {
10
+ "type": "function",
11
+ "name": "MAX_TTL",
12
+ "inputs": [],
13
+ "outputs": [{ "name": "", "type": "uint32", "internalType": "uint32" }],
14
+ "stateMutability": "view"
15
+ },
16
+ {
17
+ "type": "function",
18
+ "name": "VERSION",
19
+ "inputs": [],
20
+ "outputs": [{ "name": "", "type": "uint32", "internalType": "uint32" }],
21
+ "stateMutability": "view"
22
+ },
23
+ {
24
+ "type": "function",
25
+ "name": "announce",
26
+ "inputs": [
27
+ { "name": "namespace", "type": "bytes32", "internalType": "bytes32" },
28
+ { "name": "recordType", "type": "uint32", "internalType": "uint32" },
29
+ { "name": "ttl", "type": "uint32", "internalType": "uint32" },
30
+ { "name": "peerRecord", "type": "bytes", "internalType": "bytes" }
31
+ ],
32
+ "outputs": [],
33
+ "stateMutability": "nonpayable"
34
+ },
35
+ {
36
+ "type": "event",
37
+ "name": "PeerAnnounced",
38
+ "inputs": [
39
+ { "name": "namespace", "type": "bytes32", "indexed": true, "internalType": "bytes32" },
40
+ { "name": "recordType", "type": "uint32", "indexed": true, "internalType": "uint32" },
41
+ { "name": "validUntil", "type": "uint64", "indexed": false, "internalType": "uint64" },
42
+ { "name": "peerRecord", "type": "bytes", "indexed": false, "internalType": "bytes" }
43
+ ],
44
+ "anonymous": false
45
+ },
46
+ { "type": "error", "name": "InvalidTTL", "inputs": [] },
47
+ { "type": "error", "name": "RecordTooLarge", "inputs": [] }
48
+ ]
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@resurrect-protocol/contracts",
3
+ "version": "0.1.0-dev.12.1",
4
+ "description": "Canonical immutable Solidity registry source and ABI for Resurrect v1",
5
+ "license": "CC0-1.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/cazala/resurrect.git",
9
+ "directory": "packages/contracts"
10
+ },
11
+ "homepage": "https://github.com/cazala/resurrect",
12
+ "files": [
13
+ "abi",
14
+ "src",
15
+ "README.md"
16
+ ],
17
+ "exports": {
18
+ "./abi/ResurrectRegistryV1.json": "./abi/ResurrectRegistryV1.json",
19
+ "./src/ResurrectRegistryV1.sol": "./src/ResurrectRegistryV1.sol"
20
+ },
21
+ "scripts": {
22
+ "build": "node -e \"JSON.parse(require('node:fs').readFileSync('abi/ResurrectRegistryV1.json'))\"",
23
+ "check": "node -e \"JSON.parse(require('node:fs').readFileSync('abi/ResurrectRegistryV1.json'))\"",
24
+ "test": "node -e \"JSON.parse(require('node:fs').readFileSync('abi/ResurrectRegistryV1.json'))\""
25
+ },
26
+ "publishConfig": {
27
+ "access": "public",
28
+ "provenance": true
29
+ }
30
+ }
@@ -0,0 +1,34 @@
1
+ // SPDX-License-Identifier: CC0-1.0
2
+ pragma solidity 0.8.24;
3
+
4
+ /// @title Resurrect registry v1
5
+ /// @notice Permissionless, immutable, log-only rendezvous for signed peer records.
6
+ /// @dev This contract deliberately has no owner, storage, upgrade, pause, or withdrawal path.
7
+ contract ResurrectRegistryV1 {
8
+ uint32 public constant VERSION = 1;
9
+ uint32 public constant MAX_TTL = 90 days;
10
+ uint32 public constant MAX_RECORD_BYTES = 4096;
11
+
12
+ error InvalidTTL();
13
+ error RecordTooLarge();
14
+
15
+ event PeerAnnounced(
16
+ bytes32 indexed namespace, uint32 indexed recordType, uint64 validUntil, bytes peerRecord
17
+ );
18
+
19
+ /// @notice Publishes a bounded-lifetime, application-namespaced signed peer record.
20
+ /// @param namespace Application/network isolation identifier.
21
+ /// @param recordType Resurrect peer-record codec identifier.
22
+ /// @param ttl Lifetime in seconds, bounded by `MAX_TTL`.
23
+ /// @param peerRecord Raw self-authenticating peer-record bytes.
24
+ function announce(bytes32 namespace, uint32 recordType, uint32 ttl, bytes calldata peerRecord)
25
+ external
26
+ {
27
+ if (ttl == 0 || ttl > MAX_TTL) revert InvalidTTL();
28
+ if (peerRecord.length == 0 || peerRecord.length > MAX_RECORD_BYTES) {
29
+ revert RecordTooLarge();
30
+ }
31
+
32
+ emit PeerAnnounced(namespace, recordType, uint64(block.timestamp) + uint64(ttl), peerRecord);
33
+ }
34
+ }