@mikeargento/bitgraph-verify 1.13.1 → 1.14.0
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 +1 -1
- package/dist/__tests__/ceiling.test.d.ts +8 -0
- package/dist/__tests__/ceiling.test.d.ts.map +1 -0
- package/dist/__tests__/ceiling.test.js +247 -0
- package/dist/__tests__/ceiling.test.js.map +1 -0
- package/dist/ceiling-evm.d.ts +49 -0
- package/dist/ceiling-evm.d.ts.map +1 -0
- package/dist/ceiling-evm.js +331 -0
- package/dist/ceiling-evm.js.map +1 -0
- package/dist/ceiling-trie.d.ts +9 -0
- package/dist/ceiling-trie.d.ts.map +1 -0
- package/dist/ceiling-trie.js +113 -0
- package/dist/ceiling-trie.js.map +1 -0
- package/dist/ceiling.d.ts +123 -0
- package/dist/ceiling.d.ts.map +1 -0
- package/dist/ceiling.js +247 -0
- package/dist/ceiling.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/__tests__/ceiling.test.ts +281 -0
- package/src/__tests__/fixtures/ceiling/floor-26037892.header.hex +1 -0
- package/src/ceiling-evm.ts +326 -0
- package/src/ceiling-trie.ts +112 -0
- package/src/ceiling.ts +333 -0
- package/src/index.ts +12 -0
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ import { verify } from "@mikeargento/bitgraph-verify";
|
|
|
11
11
|
|
|
12
12
|
const result = await verify({ proof, bytes });
|
|
13
13
|
if (result.valid) {
|
|
14
|
-
// structure, canonical Ed25519 signature,
|
|
14
|
+
// structure, canonical Ed25519 signature, position binding, the attestation's
|
|
15
15
|
// binding to this signed body, and the digest match are all checked
|
|
16
16
|
} else {
|
|
17
17
|
console.error(result.reason);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bitgraph-ceiling/1: the offline verifier against a synthetic Base block
|
|
3
|
+
* built here from scratch (a real production proof, a transaction signed with
|
|
4
|
+
* a throwaway key, a header whose transactionsRoot is the rebuilt trie), and
|
|
5
|
+
* every adversarial case the build prompt lists. Nothing touches a network.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ceiling.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ceiling.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ceiling.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bitgraph-ceiling/1: the offline verifier against a synthetic Base block
|
|
3
|
+
* built here from scratch (a real production proof, a transaction signed with
|
|
4
|
+
* a throwaway key, a header whose transactionsRoot is the rebuilt trie), and
|
|
5
|
+
* every adversarial case the build prompt lists. Nothing touches a network.
|
|
6
|
+
*/
|
|
7
|
+
import { test } from "node:test";
|
|
8
|
+
import * as assert from "node:assert/strict";
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
10
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
11
|
+
import { sha256 } from "@noble/hashes/sha256";
|
|
12
|
+
import { computeProofHash } from "../proof-hash.js";
|
|
13
|
+
import { MerkleTree, merkleLeafHash } from "../fuse-merkle.js";
|
|
14
|
+
import { CEILING_VERSION, ceilingLeaf, ceilingPayloadHash, decodeCeilingPayload, encodeCeilingPayload, verifyCeiling, } from "../ceiling.js";
|
|
15
|
+
import { bytesToHex, hexToBytes, keccak256, rlpDecode, rlpEncode, decodeEip1559 } from "../ceiling-evm.js";
|
|
16
|
+
import { txTrieProof } from "../ceiling-trie.js";
|
|
17
|
+
const fix = (dir, name) => readFileSync(new URL(`../../src/__tests__/fixtures/${dir}/${name}`, import.meta.url), "utf8");
|
|
18
|
+
const proof = JSON.parse(fix("carrier", "demo2.proof.json"));
|
|
19
|
+
const floorHeader = fix("ceiling", "floor-26037892.header.hex").trim();
|
|
20
|
+
const CHAIN = 84532;
|
|
21
|
+
function u(n) {
|
|
22
|
+
let h = BigInt(n).toString(16);
|
|
23
|
+
if (h === "0")
|
|
24
|
+
return new Uint8Array(0);
|
|
25
|
+
if (h.length % 2)
|
|
26
|
+
h = "0" + h;
|
|
27
|
+
return hexToBytes(h);
|
|
28
|
+
}
|
|
29
|
+
function addressOf(priv) {
|
|
30
|
+
return bytesToHex(keccak256(secp256k1.getPublicKey(priv, false).slice(1)).slice(12));
|
|
31
|
+
}
|
|
32
|
+
function signTx(priv, opts) {
|
|
33
|
+
const fields = [
|
|
34
|
+
u(opts.chainId ?? CHAIN), u(opts.nonce ?? 0), u(1_000_000), u(2_000_000_000), u(30_000),
|
|
35
|
+
hexToBytes(opts.to), u(0), opts.data, [],
|
|
36
|
+
];
|
|
37
|
+
const hash = keccak256(new Uint8Array([0x02, ...rlpEncode(fields)]));
|
|
38
|
+
const sig = secp256k1.sign(hash, priv, { prehash: false, format: "recovered" });
|
|
39
|
+
const rec = sig[0];
|
|
40
|
+
const r = BigInt(bytesToHex(sig.slice(1, 33)));
|
|
41
|
+
const s = BigInt(bytesToHex(sig.slice(33, 65)));
|
|
42
|
+
return new Uint8Array([0x02, ...rlpEncode([...fields, u(rec), u(r), u(s)])]);
|
|
43
|
+
}
|
|
44
|
+
function header(txRoot, number, timestamp) {
|
|
45
|
+
const z32 = new Uint8Array(32);
|
|
46
|
+
return rlpEncode([
|
|
47
|
+
z32, z32, new Uint8Array(20), z32, txRoot, z32, new Uint8Array(256), u(0), u(number), u(30_000_000),
|
|
48
|
+
u(21_000), u(timestamp), new Uint8Array(0), z32, new Uint8Array(8), u(1000),
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
/** Build a complete, valid world; `tweak` edits the ingredients before anything is hashed. */
|
|
52
|
+
function build(tweak = {}) {
|
|
53
|
+
const priv = secp256k1.utils.randomSecretKey();
|
|
54
|
+
const writer = addressOf(priv);
|
|
55
|
+
const proofHash = computeProofHash(proof);
|
|
56
|
+
const others = [1, 2, 3, 4].map((i) => merkleLeafHash(sha256(new Uint8Array([i]))));
|
|
57
|
+
const leaves = [others[0], others[1], ceilingLeaf(proofHash), others[2], others[3]];
|
|
58
|
+
const tree = new MerkleTree(leaves);
|
|
59
|
+
let payload = encodeCeilingPayload({ root: tree.root, prev: new Uint8Array(32), firstPos: 2870n, lastPos: 2880n });
|
|
60
|
+
if (tweak.data)
|
|
61
|
+
payload = tweak.data(payload);
|
|
62
|
+
const raw = signTx(tweak.signer ?? priv, { to: tweak.to ?? writer, data: payload, ...(tweak.chainId ? { chainId: tweak.chainId } : {}) });
|
|
63
|
+
const block = [hexToBytes("0x7e0102"), hexToBytes("0x02c0ffee"), raw, hexToBytes("0x01aabbcc")];
|
|
64
|
+
const txIndex = 2;
|
|
65
|
+
const { root: txRoot, proof: inclusion } = txTrieProof(block, txIndex);
|
|
66
|
+
const ts = 1_790_000_000;
|
|
67
|
+
const hdr = header(txRoot, 30_000_000, ts);
|
|
68
|
+
const fh = rlpDecode(hexToBytes(floorHeader));
|
|
69
|
+
const floorTs = Number(BigInt(bytesToHex(fh[11])));
|
|
70
|
+
const sidecar = {
|
|
71
|
+
version: CEILING_VERSION,
|
|
72
|
+
proofHash,
|
|
73
|
+
leafIndex: 2,
|
|
74
|
+
leafCount: 5,
|
|
75
|
+
merklePath: tree.path(2).map(bytesToHex),
|
|
76
|
+
root: bytesToHex(tree.root),
|
|
77
|
+
anchor: {
|
|
78
|
+
chainId: CHAIN,
|
|
79
|
+
writer,
|
|
80
|
+
txHash: bytesToHex(keccak256(raw)),
|
|
81
|
+
rawTx: bytesToHex(raw),
|
|
82
|
+
payload: bytesToHex(payload),
|
|
83
|
+
blockNumber: 30_000_000,
|
|
84
|
+
blockHash: bytesToHex(keccak256(hdr)),
|
|
85
|
+
blockTimestamp: ts,
|
|
86
|
+
blockHeader: bytesToHex(hdr),
|
|
87
|
+
txIndex,
|
|
88
|
+
txInclusionProof: inclusion.map(bytesToHex),
|
|
89
|
+
},
|
|
90
|
+
status: "included",
|
|
91
|
+
statusObserved: { included: "2026-09-29T00:00:00.000Z", safe: null, finalized: null },
|
|
92
|
+
floor: { blockNumber: 26037892, blockHash: proof.commit.slotAnchor.blockHash, blockTimestamp: floorTs, blockHeader: floorHeader },
|
|
93
|
+
settlement: null,
|
|
94
|
+
};
|
|
95
|
+
return { sidecar, writer, priv };
|
|
96
|
+
}
|
|
97
|
+
const clone = (x) => JSON.parse(JSON.stringify(x));
|
|
98
|
+
test("payload round-trips and chains", () => {
|
|
99
|
+
const root = sha256(new Uint8Array([1]));
|
|
100
|
+
const p = encodeCeilingPayload({ root, prev: new Uint8Array(32), firstPos: 7n, lastPos: 2n ** 63n });
|
|
101
|
+
assert.equal(p.length, 84);
|
|
102
|
+
assert.equal(new TextDecoder().decode(p.slice(0, 4)), "BGC1");
|
|
103
|
+
const d = decodeCeilingPayload(p);
|
|
104
|
+
assert.deepEqual(d.root, root);
|
|
105
|
+
assert.equal(d.lastPos, 2n ** 63n);
|
|
106
|
+
assert.equal(ceilingPayloadHash(p).length, 32);
|
|
107
|
+
});
|
|
108
|
+
test("a single-record batch's root is its leaf hash", () => {
|
|
109
|
+
const leaf = ceilingLeaf(computeProofHash(proof));
|
|
110
|
+
assert.deepEqual(new MerkleTree([leaf]).root, leaf);
|
|
111
|
+
});
|
|
112
|
+
test("tx decoder recovers the signer", () => {
|
|
113
|
+
const priv = secp256k1.utils.randomSecretKey();
|
|
114
|
+
const raw = signTx(priv, { to: addressOf(priv), data: new Uint8Array(84) });
|
|
115
|
+
assert.equal(decodeEip1559(raw).from, addressOf(priv));
|
|
116
|
+
});
|
|
117
|
+
test("a valid sidecar verifies and reports the window", async () => {
|
|
118
|
+
const { sidecar, writer } = build();
|
|
119
|
+
const r = await verifyCeiling(proof, sidecar, { writerAddress: writer, chainId: CHAIN });
|
|
120
|
+
assert.equal(r.ok, true, r.reason);
|
|
121
|
+
assert.equal(r.window.ceiling.blockNumber, 30_000_000);
|
|
122
|
+
assert.equal(r.window.floor.blockNumber, 26037892);
|
|
123
|
+
assert.ok(r.window.floor.blockTimestamp > 0);
|
|
124
|
+
assert.equal(r.window.widthSeconds, 1_790_000_000 - r.window.floor.blockTimestamp);
|
|
125
|
+
assert.match(r.label, /Relies on Base's sequencer until settled on Ethereum\.$/);
|
|
126
|
+
assert.equal(r.headerCheckedAgainstChain, false);
|
|
127
|
+
});
|
|
128
|
+
test("at safe the label says settled", async () => {
|
|
129
|
+
const { sidecar, writer } = build();
|
|
130
|
+
sidecar.status = "safe";
|
|
131
|
+
const r = await verifyCeiling(proof, sidecar, { writerAddress: writer, chainId: CHAIN });
|
|
132
|
+
assert.match(r.label, /settled on Ethereum\.$/);
|
|
133
|
+
assert.doesNotMatch(r.label, /Relies/);
|
|
134
|
+
});
|
|
135
|
+
test("pending says pending, never a ceiling", async () => {
|
|
136
|
+
const { sidecar, writer } = build();
|
|
137
|
+
sidecar.status = "pending";
|
|
138
|
+
sidecar.anchor = null;
|
|
139
|
+
const r = await verifyCeiling(proof, sidecar, { writerAddress: writer, chainId: CHAIN });
|
|
140
|
+
assert.equal(r.ok, false);
|
|
141
|
+
assert.match(r.reason, /ceiling pending/);
|
|
142
|
+
assert.equal(r.window, undefined);
|
|
143
|
+
});
|
|
144
|
+
// ── adversarial fixtures ──
|
|
145
|
+
const rejects = async (name, mk, re) => test(`rejects: ${name}`, async () => {
|
|
146
|
+
const { sidecar, writer, p } = mk();
|
|
147
|
+
const r = await verifyCeiling(p ?? proof, sidecar, { writerAddress: writer, chainId: CHAIN });
|
|
148
|
+
assert.equal(r.ok, false, `accepted: ${name}`);
|
|
149
|
+
assert.match(r.reason, re);
|
|
150
|
+
});
|
|
151
|
+
await rejects("wrong sender", () => {
|
|
152
|
+
const other = secp256k1.utils.randomSecretKey();
|
|
153
|
+
const w = build({ signer: other });
|
|
154
|
+
return { sidecar: w.sidecar, writer: w.writer };
|
|
155
|
+
}, /^sender: .*not the declared writer/);
|
|
156
|
+
await rejects("declared writer is someone else", () => {
|
|
157
|
+
const w = build();
|
|
158
|
+
return { sidecar: w.sidecar, writer: "0x" + "11".repeat(20) };
|
|
159
|
+
}, /^sender:/);
|
|
160
|
+
await rejects("not addressed to the writer", () => {
|
|
161
|
+
const w = build({ to: "0x" + "22".repeat(20) });
|
|
162
|
+
return { sidecar: w.sidecar, writer: w.writer };
|
|
163
|
+
}, /^sender: .*addressed to/);
|
|
164
|
+
await rejects("altered root (sidecar)", () => {
|
|
165
|
+
const w = build();
|
|
166
|
+
const s = clone(w.sidecar);
|
|
167
|
+
s.root = "0x" + "ab".repeat(32);
|
|
168
|
+
return { sidecar: s, writer: w.writer };
|
|
169
|
+
}, /^merkle:/);
|
|
170
|
+
await rejects("altered root (payload, re-signed by the writer)", () => {
|
|
171
|
+
const w = build({ data: (p) => { const q = p.slice(); q[10] = q[10] ^ 1; return q; } });
|
|
172
|
+
return { sidecar: w.sidecar, writer: w.writer };
|
|
173
|
+
}, /^payload: .*root/);
|
|
174
|
+
await rejects("leaf not in the tree", () => {
|
|
175
|
+
const w = build();
|
|
176
|
+
const s = clone(w.sidecar);
|
|
177
|
+
s.leafIndex = 3;
|
|
178
|
+
return { sidecar: s, writer: w.writer };
|
|
179
|
+
}, /^merkle:/);
|
|
180
|
+
await rejects("tampered block header", () => {
|
|
181
|
+
const w = build();
|
|
182
|
+
const s = clone(w.sidecar);
|
|
183
|
+
const h = hexToBytes(s.anchor.blockHeader);
|
|
184
|
+
h[h.length - 3] = h[h.length - 3] ^ 1;
|
|
185
|
+
s.anchor.blockHeader = bytesToHex(h);
|
|
186
|
+
return { sidecar: s, writer: w.writer };
|
|
187
|
+
}, /^header:/);
|
|
188
|
+
await rejects("tampered timestamp (sidecar field)", () => {
|
|
189
|
+
const w = build();
|
|
190
|
+
const s = clone(w.sidecar);
|
|
191
|
+
s.anchor.blockTimestamp -= 3600;
|
|
192
|
+
return { sidecar: s, writer: w.writer };
|
|
193
|
+
}, /^header: .*timestamp/);
|
|
194
|
+
await rejects("transaction not in the block", () => {
|
|
195
|
+
const w = build();
|
|
196
|
+
const s = clone(w.sidecar);
|
|
197
|
+
s.anchor.txIndex = 1;
|
|
198
|
+
return { sidecar: s, writer: w.writer };
|
|
199
|
+
}, /^inclusion:/);
|
|
200
|
+
await rejects("inclusion proof from another block", () => {
|
|
201
|
+
const w1 = build();
|
|
202
|
+
const w2 = build();
|
|
203
|
+
const s = clone(w1.sidecar);
|
|
204
|
+
s.anchor.txInclusionProof = w2.sidecar.anchor.txInclusionProof;
|
|
205
|
+
return { sidecar: s, writer: w1.writer };
|
|
206
|
+
}, /^inclusion:/);
|
|
207
|
+
await rejects("wrong magic", () => {
|
|
208
|
+
const w = build({ data: (p) => { const q = p.slice(); q.set(new TextEncoder().encode("BGC2"), 0); return q; } });
|
|
209
|
+
return { sidecar: w.sidecar, writer: w.writer };
|
|
210
|
+
}, /^payload: .*magic/);
|
|
211
|
+
await rejects("sidecar belonging to a different proof", () => {
|
|
212
|
+
const w = build();
|
|
213
|
+
const other = clone(proof);
|
|
214
|
+
other.commit.counter = "9999";
|
|
215
|
+
return { sidecar: w.sidecar, writer: w.writer, p: other };
|
|
216
|
+
}, /^(proof|record):/);
|
|
217
|
+
await rejects("wrong chain", () => {
|
|
218
|
+
const w = build({ chainId: 8453 });
|
|
219
|
+
return { sidecar: w.sidecar, writer: w.writer };
|
|
220
|
+
}, /^chain:/);
|
|
221
|
+
test("a rebuilt header with a moved timestamp passes offline and says it was not checked against the chain", async () => {
|
|
222
|
+
const w = build();
|
|
223
|
+
const s = clone(w.sidecar);
|
|
224
|
+
const f = rlpDecode(hexToBytes(s.anchor.blockHeader));
|
|
225
|
+
// A fabricated header must still commit to the real transactionsRoot to pass;
|
|
226
|
+
// moving the timestamp changes the hash, which only a Base RPC can refute.
|
|
227
|
+
f[11] = u(1_700_000_000);
|
|
228
|
+
const h = rlpEncode(f);
|
|
229
|
+
s.anchor.blockHeader = bytesToHex(h);
|
|
230
|
+
s.anchor.blockHash = bytesToHex(keccak256(h));
|
|
231
|
+
s.anchor.blockTimestamp = 1_700_000_000;
|
|
232
|
+
const r = await verifyCeiling(proof, s, { writerAddress: w.writer, chainId: CHAIN });
|
|
233
|
+
assert.equal(r.ok, true);
|
|
234
|
+
assert.equal(r.headerCheckedAgainstChain, false);
|
|
235
|
+
});
|
|
236
|
+
test("a floor header that is not the proof's signed floor is ignored, not trusted", async () => {
|
|
237
|
+
const w = build();
|
|
238
|
+
const s = clone(w.sidecar);
|
|
239
|
+
const f = rlpDecode(hexToBytes(s.floor.blockHeader));
|
|
240
|
+
f[11] = u(1);
|
|
241
|
+
s.floor.blockHeader = bytesToHex(rlpEncode(f));
|
|
242
|
+
const r = await verifyCeiling(proof, s, { writerAddress: w.writer, chainId: CHAIN });
|
|
243
|
+
assert.equal(r.ok, true);
|
|
244
|
+
assert.equal(r.window.floor.blockTimestamp, null);
|
|
245
|
+
assert.equal(r.window.widthSeconds, null);
|
|
246
|
+
});
|
|
247
|
+
//# sourceMappingURL=ceiling.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ceiling.test.js","sourceRoot":"","sources":["../../src/__tests__/ceiling.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EACL,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,aAAa,GAE5G,MA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CAAC,CAAC;IACb,CAAC,CAAC,KAAM,CAAC,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,CAAC,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACrF,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACzB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAO,CAAC,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type RlpItem = Uint8Array | RlpItem[];
|
|
2
|
+
export declare function hexToBytes(hex: string): Uint8Array;
|
|
3
|
+
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
4
|
+
export declare function keccak256(bytes: Uint8Array): Uint8Array;
|
|
5
|
+
export declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean;
|
|
6
|
+
export declare function rlpEncode(item: RlpItem): Uint8Array;
|
|
7
|
+
/** Decode exactly one RLP item filling all of `bytes`; throws on anything non-canonical. */
|
|
8
|
+
export declare function rlpDecode(bytes: Uint8Array): RlpItem;
|
|
9
|
+
/** An RLP scalar (big-endian, no leading zeros) as a bigint. */
|
|
10
|
+
export declare function rlpUint(item: RlpItem | undefined, what: string): bigint;
|
|
11
|
+
export interface DecodedHeader {
|
|
12
|
+
/** keccak256 of the header RLP: the block hash. */
|
|
13
|
+
hash: string;
|
|
14
|
+
parentHash: string;
|
|
15
|
+
transactionsRoot: string;
|
|
16
|
+
number: number;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
}
|
|
19
|
+
/** Decode the fields a ceiling reads from a header RLP, and hash it. */
|
|
20
|
+
export declare function decodeHeader(headerRlp: Uint8Array): DecodedHeader;
|
|
21
|
+
export interface DecodedTx {
|
|
22
|
+
type: 2;
|
|
23
|
+
chainId: bigint;
|
|
24
|
+
nonce: bigint;
|
|
25
|
+
to: string | null;
|
|
26
|
+
value: bigint;
|
|
27
|
+
data: Uint8Array;
|
|
28
|
+
/** Address recovered from the signature, lowercase 0x hex. */
|
|
29
|
+
from: string;
|
|
30
|
+
/** keccak256 of the raw transaction: its hash on chain. */
|
|
31
|
+
hash: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Decode a signed type-2 transaction and recover its sender. Only type 2 is
|
|
35
|
+
* accepted: the writer sends nothing else, and a narrower decoder is a
|
|
36
|
+
* smaller thing to get wrong.
|
|
37
|
+
*/
|
|
38
|
+
export declare function decodeEip1559(raw: Uint8Array): DecodedTx;
|
|
39
|
+
/**
|
|
40
|
+
* Walk an inclusion proof for `key` from `root`. Returns the stored value, or
|
|
41
|
+
* null when the proof shows the key absent or does not hold together (a node
|
|
42
|
+
* that does not hash to the reference pointing at it, a path that diverges).
|
|
43
|
+
* Every node is bound to its parent's reference, so the value is bound to
|
|
44
|
+
* `root` and to nothing the prover could choose.
|
|
45
|
+
*/
|
|
46
|
+
export declare function mptVerify(root: Uint8Array, key: Uint8Array, proof: readonly Uint8Array[]): Uint8Array | null;
|
|
47
|
+
/** The trie key of transaction `index` in a block: rlp(index). */
|
|
48
|
+
export declare function txTrieKey(index: number): Uint8Array;
|
|
49
|
+
//# sourceMappingURL=ceiling-evm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ceiling-evm.d.ts","sourceRoot":"","sources":["../src/ceiling-evm.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,OAAO,EAAE,CAAC;AAE7C,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAOlD;AAED,wBA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