@aztec/stdlib 4.0.0-nightly.20260112 → 4.0.0-nightly.20260113
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/dest/block/attestation_info.d.ts +5 -5
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +4 -4
- package/dest/block/l2_block.d.ts +6 -3
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +2 -2
- package/dest/block/l2_block_new.d.ts +1 -2
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +4 -1
- package/dest/block/l2_block_source.d.ts +245 -41
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +23 -5
- package/dest/block/l2_block_stream/index.d.ts +2 -1
- package/dest/block/l2_block_stream/index.d.ts.map +1 -1
- package/dest/block/l2_block_stream/index.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +16 -5
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +4 -2
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +102 -30
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +24 -16
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +55 -61
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +49 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.js +179 -0
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +483 -38
- package/dest/block/validate_block_result.d.ts +24 -24
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +13 -13
- package/dest/checkpoint/checkpoint.d.ts +1 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +1 -0
- package/dest/checkpoint/checkpoint_info.d.ts +32 -3
- package/dest/checkpoint/checkpoint_info.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_info.js +34 -1
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/interfaces/api_limit.d.ts +2 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +1 -0
- package/dest/interfaces/archiver.d.ts +6 -6
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +6 -4
- package/dest/interfaces/aztec-node-admin.d.ts +12 -6
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +2 -2
- package/dest/interfaces/aztec-node.d.ts +2 -2
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +8 -3
- package/dest/interfaces/configs.d.ts +6 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +2 -1
- package/dest/interfaces/p2p.d.ts +7 -9
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +3 -4
- package/dest/interfaces/proving-job.d.ts +166 -166
- package/dest/interfaces/validator.d.ts +41 -7
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +3 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -5
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +5 -6
- package/dest/p2p/attestation_utils.d.ts +3 -3
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +1 -1
- package/dest/p2p/block_proposal.d.ts +85 -21
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +120 -37
- package/dest/p2p/checkpoint_attestation.d.ts +77 -0
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -0
- package/dest/p2p/{block_attestation.js → checkpoint_attestation.js} +22 -19
- package/dest/p2p/checkpoint_proposal.d.ts +154 -0
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -0
- package/dest/p2p/checkpoint_proposal.js +217 -0
- package/dest/p2p/consensus_payload.d.ts +4 -2
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +3 -2
- package/dest/p2p/index.d.ts +4 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +3 -1
- package/dest/p2p/signature_utils.d.ts +5 -3
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +3 -1
- package/dest/p2p/signed_txs.d.ts +40 -0
- package/dest/p2p/signed_txs.d.ts.map +1 -0
- package/dest/p2p/signed_txs.js +70 -0
- package/dest/p2p/topic_type.d.ts +3 -2
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +8 -2
- package/dest/rollup/checkpoint_header.d.ts +5 -1
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +4 -0
- package/dest/tests/factories.d.ts +13 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +50 -1
- package/dest/tests/mocks.d.ts +55 -9
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +84 -35
- package/dest/tx/private_execution_result.d.ts +1 -5
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +3 -20
- package/package.json +8 -8
- package/src/block/attestation_info.ts +9 -6
- package/src/block/l2_block.ts +3 -3
- package/src/block/l2_block_new.ts +5 -1
- package/src/block/l2_block_source.ts +66 -16
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +16 -4
- package/src/block/l2_block_stream/l2_block_stream.ts +121 -38
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +62 -56
- package/src/block/l2_block_stream/l2_tips_store_base.ts +226 -0
- package/src/block/test/l2_tips_store_test_suite.ts +485 -36
- package/src/block/validate_block_result.ts +35 -31
- package/src/checkpoint/checkpoint.ts +1 -0
- package/src/checkpoint/checkpoint_info.ts +45 -2
- package/src/checkpoint/index.ts +1 -0
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +14 -6
- package/src/interfaces/aztec-node-admin.ts +5 -2
- package/src/interfaces/aztec-node.ts +30 -3
- package/src/interfaces/configs.ts +5 -0
- package/src/interfaces/p2p.ts +8 -12
- package/src/interfaces/validator.ts +57 -7
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +5 -8
- package/src/p2p/attestation_utils.ts +3 -3
- package/src/p2p/block_proposal.ts +185 -41
- package/src/p2p/{block_attestation.ts → checkpoint_attestation.ts} +31 -25
- package/src/p2p/checkpoint_proposal.ts +337 -0
- package/src/p2p/consensus_payload.ts +5 -2
- package/src/p2p/index.ts +3 -1
- package/src/p2p/signature_utils.ts +3 -1
- package/src/p2p/signed_txs.ts +83 -0
- package/src/p2p/topic_type.ts +3 -2
- package/src/rollup/checkpoint_header.ts +13 -0
- package/src/tests/factories.ts +42 -1
- package/src/tests/mocks.ts +146 -50
- package/src/tx/private_execution_result.ts +0 -15
- package/dest/p2p/block_attestation.d.ts +0 -77
- package/dest/p2p/block_attestation.d.ts.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
2
|
import { keccak256 } from '@aztec/foundation/crypto/keccak';
|
|
3
3
|
import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
5
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
5
6
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
7
|
+
import { BlockHeader } from '../tx/block_header.js';
|
|
6
8
|
import { TxHash } from '../tx/index.js';
|
|
7
|
-
import { Tx } from '../tx/tx.js';
|
|
8
|
-
import { ConsensusPayload } from './consensus_payload.js';
|
|
9
9
|
import { Gossipable } from './gossipable.js';
|
|
10
10
|
import { SignatureDomainSeparator, getHashedSignaturePayload, getHashedSignaturePayloadEthSignedMessage } from './signature_utils.js';
|
|
11
|
+
import { SignedTxs } from './signed_txs.js';
|
|
11
12
|
import { TopicType } from './topic_type.js';
|
|
12
13
|
export class BlockProposalHash extends Buffer32 {
|
|
13
14
|
constructor(hash){
|
|
@@ -15,84 +16,166 @@ export class BlockProposalHash extends Buffer32 {
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* be included in the head of the chain
|
|
19
|
+
* A block proposal is created by the leader of the chain proposing a sequence of transactions
|
|
20
|
+
* to be included in a block within a checkpoint. This is used for non-last blocks in a slot.
|
|
21
|
+
* The last block is sent as part of a CheckpointProposal.
|
|
22
22
|
*/ export class BlockProposal extends Gossipable {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
blockHeader;
|
|
24
|
+
indexWithinCheckpoint;
|
|
25
|
+
inHash;
|
|
26
|
+
archiveRoot;
|
|
25
27
|
txHashes;
|
|
26
|
-
|
|
28
|
+
signature;
|
|
29
|
+
signedTxs;
|
|
27
30
|
static p2pTopic = TopicType.block_proposal;
|
|
28
31
|
sender;
|
|
29
|
-
constructor(/** The
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
constructor(/** The per-block header containing block state and global variables */ blockHeader, // TODO(palla/mbps): Is this really needed? Can we just derive it from the indexWithinCheckpoint of the parent block and the slot number?
|
|
33
|
+
// See the block-proposal-handler, we have a lot of extra validations to check this is correct, so maybe we can avoid storing it here.
|
|
34
|
+
/** Index of this block within the checkpoint (0-indexed) */ indexWithinCheckpoint, /** Hash of L1 to L2 messages for this checkpoint (constant across all blocks in checkpoint) */ inHash, /** Archive root after this block is applied */ archiveRoot, /** The sequence of transactions in the block */ txHashes, /** The proposer's signature over the block data */ signature, /** The signed transactions in the block (optional, for DA guarantees) */ signedTxs){
|
|
35
|
+
super(), this.blockHeader = blockHeader, this.indexWithinCheckpoint = indexWithinCheckpoint, this.inHash = inHash, this.archiveRoot = archiveRoot, this.txHashes = txHashes, this.signature = signature, this.signedTxs = signedTxs;
|
|
32
36
|
}
|
|
33
37
|
generateP2PMessageIdentifier() {
|
|
34
38
|
return Promise.resolve(new BlockProposalHash(keccak256(this.signature.toBuffer())));
|
|
35
39
|
}
|
|
36
40
|
get archive() {
|
|
37
|
-
return this.
|
|
41
|
+
return this.archiveRoot;
|
|
38
42
|
}
|
|
39
43
|
get slotNumber() {
|
|
40
|
-
return this.
|
|
44
|
+
return this.blockHeader.getSlot();
|
|
45
|
+
}
|
|
46
|
+
get blockNumber() {
|
|
47
|
+
return this.blockHeader.getBlockNumber();
|
|
48
|
+
}
|
|
49
|
+
/** Convenience getter for txs from signedTxs */ get txs() {
|
|
50
|
+
return this.signedTxs?.txs;
|
|
41
51
|
}
|
|
42
52
|
toBlockInfo() {
|
|
43
53
|
return {
|
|
44
54
|
slotNumber: this.slotNumber,
|
|
45
|
-
lastArchive: this.
|
|
46
|
-
timestamp: this.
|
|
47
|
-
archive: this.
|
|
55
|
+
lastArchive: this.blockHeader.lastArchive.root,
|
|
56
|
+
timestamp: this.blockHeader.globalVariables.timestamp,
|
|
57
|
+
archive: this.archiveRoot,
|
|
48
58
|
txCount: this.txHashes.length
|
|
49
59
|
};
|
|
50
60
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Get the payload to sign for this block proposal.
|
|
63
|
+
* The signature is over: blockHeader + indexWithinCheckpoint + inHash + archiveRoot + txHashes
|
|
64
|
+
*/ getPayloadToSign(domainSeparator) {
|
|
65
|
+
return serializeToBuffer([
|
|
66
|
+
domainSeparator,
|
|
67
|
+
this.blockHeader,
|
|
68
|
+
this.indexWithinCheckpoint,
|
|
69
|
+
this.inHash,
|
|
70
|
+
this.archiveRoot,
|
|
71
|
+
this.txHashes.length,
|
|
72
|
+
this.txHashes
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
static async createProposalFromSigner(blockHeader, indexWithinCheckpoint, inHash, archiveRoot, txHashes, txs, payloadSigner) {
|
|
76
|
+
// Create a temporary proposal to get the payload to sign
|
|
77
|
+
const tempProposal = new BlockProposal(blockHeader, indexWithinCheckpoint, inHash, archiveRoot, txHashes, Signature.empty());
|
|
78
|
+
const hashed = getHashedSignaturePayload(tempProposal, SignatureDomainSeparator.blockProposal);
|
|
54
79
|
const sig = await payloadSigner(hashed);
|
|
55
|
-
|
|
80
|
+
// If txs are provided, sign them as well
|
|
81
|
+
let signedTxs;
|
|
82
|
+
if (txs) {
|
|
83
|
+
signedTxs = await SignedTxs.createFromSigner(txs, payloadSigner);
|
|
84
|
+
}
|
|
85
|
+
return new BlockProposal(blockHeader, indexWithinCheckpoint, inHash, archiveRoot, txHashes, sig, signedTxs);
|
|
56
86
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Lazily evaluate the sender of the proposal; result is cached
|
|
59
|
-
*
|
|
87
|
+
/**
|
|
88
|
+
* Lazily evaluate the sender of the proposal; result is cached.
|
|
89
|
+
* If there's signedTxs, also verifies the signedTxs sender matches the block proposal sender.
|
|
90
|
+
* @returns The sender address, or undefined if signature recovery fails or senders don't match
|
|
60
91
|
*/ getSender() {
|
|
61
92
|
if (!this.sender) {
|
|
62
|
-
const hashed = getHashedSignaturePayloadEthSignedMessage(this
|
|
93
|
+
const hashed = getHashedSignaturePayloadEthSignedMessage(this, SignatureDomainSeparator.blockProposal);
|
|
94
|
+
const blockSender = tryRecoverAddress(hashed, this.signature);
|
|
95
|
+
// If there's signedTxs, verify the sender matches
|
|
96
|
+
if (blockSender && this.signedTxs) {
|
|
97
|
+
const txsSender = this.signedTxs.getSender();
|
|
98
|
+
if (!txsSender || !txsSender.equals(blockSender)) {
|
|
99
|
+
return undefined; // Sender mismatch - fail
|
|
100
|
+
}
|
|
101
|
+
}
|
|
63
102
|
// Cache the sender for later use
|
|
64
|
-
this.sender =
|
|
103
|
+
this.sender = blockSender;
|
|
65
104
|
}
|
|
66
105
|
return this.sender;
|
|
67
106
|
}
|
|
68
107
|
getPayload() {
|
|
69
|
-
return this.
|
|
108
|
+
return this.getPayloadToSign(SignatureDomainSeparator.blockProposal);
|
|
70
109
|
}
|
|
71
110
|
toBuffer() {
|
|
72
111
|
const buffer = [
|
|
73
|
-
this.
|
|
112
|
+
this.blockHeader,
|
|
113
|
+
this.indexWithinCheckpoint,
|
|
114
|
+
this.inHash,
|
|
115
|
+
this.archiveRoot,
|
|
74
116
|
this.signature,
|
|
75
117
|
this.txHashes.length,
|
|
76
118
|
this.txHashes
|
|
77
119
|
];
|
|
78
|
-
if (this.
|
|
79
|
-
buffer.push(
|
|
80
|
-
buffer.push(this.
|
|
120
|
+
if (this.signedTxs) {
|
|
121
|
+
buffer.push(1); // hasSignedTxs = true
|
|
122
|
+
buffer.push(this.signedTxs.toBuffer());
|
|
123
|
+
} else {
|
|
124
|
+
buffer.push(0); // hasSignedTxs = false
|
|
81
125
|
}
|
|
82
126
|
return serializeToBuffer(buffer);
|
|
83
127
|
}
|
|
84
128
|
static fromBuffer(buf) {
|
|
85
129
|
const reader = BufferReader.asReader(buf);
|
|
86
|
-
const
|
|
87
|
-
const
|
|
130
|
+
const blockHeader = reader.readObject(BlockHeader);
|
|
131
|
+
const indexWithinCheckpoint = reader.readNumber();
|
|
132
|
+
const inHash = reader.readObject(Fr);
|
|
133
|
+
const archiveRoot = reader.readObject(Fr);
|
|
134
|
+
const signature = reader.readObject(Signature);
|
|
88
135
|
const txHashes = reader.readArray(reader.readNumber(), TxHash);
|
|
89
136
|
if (!reader.isEmpty()) {
|
|
90
|
-
const
|
|
91
|
-
|
|
137
|
+
const hasSignedTxs = reader.readNumber();
|
|
138
|
+
if (hasSignedTxs) {
|
|
139
|
+
const signedTxs = SignedTxs.fromBuffer(reader);
|
|
140
|
+
return new BlockProposal(blockHeader, indexWithinCheckpoint, inHash, archiveRoot, txHashes, signature, signedTxs);
|
|
141
|
+
}
|
|
92
142
|
}
|
|
93
|
-
return new BlockProposal(
|
|
143
|
+
return new BlockProposal(blockHeader, indexWithinCheckpoint, inHash, archiveRoot, txHashes, signature);
|
|
94
144
|
}
|
|
95
145
|
getSize() {
|
|
96
|
-
return this.
|
|
146
|
+
return this.blockHeader.getSize() + 4 /* indexWithinCheckpoint */ + this.inHash.size + this.archiveRoot.size + this.signature.getSize() + 4 /* txHashes.length */ + this.txHashes.length * TxHash.SIZE + 4 /* hasSignedTxs flag */ + (this.signedTxs ? this.signedTxs.getSize() : 0);
|
|
147
|
+
}
|
|
148
|
+
static empty() {
|
|
149
|
+
return new BlockProposal(BlockHeader.empty(), 0, Fr.ZERO, Fr.ZERO, [], Signature.empty());
|
|
150
|
+
}
|
|
151
|
+
static random() {
|
|
152
|
+
return new BlockProposal(BlockHeader.random(), Math.floor(Math.random() * 5), Fr.random(), Fr.random(), [
|
|
153
|
+
TxHash.random(),
|
|
154
|
+
TxHash.random()
|
|
155
|
+
], Signature.random());
|
|
156
|
+
}
|
|
157
|
+
toInspect() {
|
|
158
|
+
return {
|
|
159
|
+
blockHeader: this.blockHeader.toInspect(),
|
|
160
|
+
indexWithinCheckpoint: this.indexWithinCheckpoint,
|
|
161
|
+
inHash: this.inHash.toString(),
|
|
162
|
+
archiveRoot: this.archiveRoot.toString(),
|
|
163
|
+
signature: this.signature.toString(),
|
|
164
|
+
txHashes: this.txHashes.map((h)=>h.toString())
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Check if this proposal matches the given block.
|
|
169
|
+
* Compares the archive root and block header.
|
|
170
|
+
* @param block - The L2Block to compare against
|
|
171
|
+
* @returns True if the proposal matches the block
|
|
172
|
+
*/ matchesBlock(block) {
|
|
173
|
+
return this.archiveRoot.equals(block.archive.root) && this.blockHeader.equals(block.getBlockHeader());
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Returns a copy of this proposal without signedTxs.
|
|
177
|
+
* Used when storing proposals in attestation pool to avoid storing full tx data.
|
|
178
|
+
*/ withoutSignedTxs() {
|
|
179
|
+
return new BlockProposal(this.blockHeader, this.indexWithinCheckpoint, this.inHash, this.archiveRoot, this.txHashes, this.signature);
|
|
97
180
|
}
|
|
98
181
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
6
|
+
import { BufferReader } from '@aztec/foundation/serialize';
|
|
7
|
+
import type { ZodFor } from '../schemas/index.js';
|
|
8
|
+
import { ConsensusPayload } from './consensus_payload.js';
|
|
9
|
+
import { Gossipable } from './gossipable.js';
|
|
10
|
+
import { TopicType } from './topic_type.js';
|
|
11
|
+
export declare class CheckpointAttestationHash extends Buffer32 {
|
|
12
|
+
constructor(hash: Buffer);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* CheckpointAttestation
|
|
16
|
+
*
|
|
17
|
+
* A validator that has attested to seeing all blocks in a checkpoint
|
|
18
|
+
* will produce a checkpoint attestation over the checkpoint header.
|
|
19
|
+
*/
|
|
20
|
+
export declare class CheckpointAttestation extends Gossipable {
|
|
21
|
+
readonly payload: ConsensusPayload;
|
|
22
|
+
readonly signature: Signature;
|
|
23
|
+
readonly proposerSignature: Signature;
|
|
24
|
+
static p2pTopic: TopicType;
|
|
25
|
+
private sender;
|
|
26
|
+
private proposer;
|
|
27
|
+
constructor(
|
|
28
|
+
/** The payload of the message, and what the signature is over */
|
|
29
|
+
payload: ConsensusPayload,
|
|
30
|
+
/** The signature of the checkpoint attester */
|
|
31
|
+
signature: Signature,
|
|
32
|
+
/** The signature from the checkpoint proposer */
|
|
33
|
+
proposerSignature: Signature);
|
|
34
|
+
static get schema(): ZodFor<CheckpointAttestation>;
|
|
35
|
+
generateP2PMessageIdentifier(): Promise<Buffer32>;
|
|
36
|
+
get archive(): Fr;
|
|
37
|
+
get slotNumber(): SlotNumber;
|
|
38
|
+
/**
|
|
39
|
+
* Lazily evaluate and cache the signer of the attestation
|
|
40
|
+
* @returns The signer of the attestation, or undefined if signature recovery fails
|
|
41
|
+
*/
|
|
42
|
+
getSender(): EthAddress | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Lazily evaluate and cache the proposer of the checkpoint
|
|
45
|
+
* @returns The proposer of the checkpoint
|
|
46
|
+
*/
|
|
47
|
+
getProposer(): EthAddress | undefined;
|
|
48
|
+
getPayload(): Buffer;
|
|
49
|
+
toBuffer(): Buffer;
|
|
50
|
+
static fromBuffer(buf: Buffer | BufferReader): CheckpointAttestation;
|
|
51
|
+
static empty(): CheckpointAttestation;
|
|
52
|
+
static random(): CheckpointAttestation;
|
|
53
|
+
getSize(): number;
|
|
54
|
+
toInspect(): {
|
|
55
|
+
payload: {
|
|
56
|
+
header: {
|
|
57
|
+
lastArchive: `0x${string}`;
|
|
58
|
+
blockHeadersHash: `0x${string}`;
|
|
59
|
+
blobsHash: `0x${string}`;
|
|
60
|
+
inHash: `0x${string}`;
|
|
61
|
+
slotNumber: SlotNumber;
|
|
62
|
+
timestamp: bigint;
|
|
63
|
+
coinbase: `0x${string}`;
|
|
64
|
+
feeRecipient: `0x${string}`;
|
|
65
|
+
gasFees: {
|
|
66
|
+
feePerDaGas: bigint;
|
|
67
|
+
feePerL2Gas: bigint;
|
|
68
|
+
};
|
|
69
|
+
totalManaUsed: bigint;
|
|
70
|
+
};
|
|
71
|
+
archive: `0x${string}`;
|
|
72
|
+
};
|
|
73
|
+
signature: `0x${string}`;
|
|
74
|
+
proposerSignature: `0x${string}`;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2twb2ludF9hdHRlc3RhdGlvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3AycC9jaGVja3BvaW50X2F0dGVzdGF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUM3RCxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFHcEQsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzVELE9BQU8sRUFBRSxZQUFZLEVBQXFCLE1BQU0sNkJBQTZCLENBQUM7QUFJOUUsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFbEQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDMUQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRTdDLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUU1QyxxQkFBYSx5QkFBMEIsU0FBUSxRQUFRO0lBQ3JELFlBQVksSUFBSSxFQUFFLE1BQU0sRUFFdkI7Q0FDRjtBQUVEOzs7OztHQUtHO0FBQ0g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C,CAEzD;IAED,IAAI,OAAO,IAAI,EAAE,CAEhB;IAED,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED;;;OAGG;IACH,SAAS,IAAI,UAAU,GAAG,SAAS,CAYlC;IAED;;;OAGG;IACH,WAAW,IAAI,UAAU,GAAG,SAAS,CAWpC;IAED,UAAU,IAAI,MAAM,CAEnB;IAED,QAAQ,IAAI,MAAM,CAEjB;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,qBAAqB,CAOnE;IAED,MAAM,CAAC,KAAK,IAAI,qBAAqB,CAEpC;IAED,MAAM,CAAC,MAAM,IAAI,qBAAqB,CAErC;IAED,OAAO,IAAI,MAAM,CAEhB;IAED,SAAS;;;;;;;;;;;;;;;;;;;;;MAMR;CACF"}
|
|
@@ -4,28 +4,29 @@ import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
|
4
4
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
5
5
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
+
import { CheckpointProposal } from './checkpoint_proposal.js';
|
|
7
8
|
import { ConsensusPayload } from './consensus_payload.js';
|
|
8
9
|
import { Gossipable } from './gossipable.js';
|
|
9
10
|
import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from './signature_utils.js';
|
|
10
11
|
import { TopicType } from './topic_type.js';
|
|
11
|
-
export class
|
|
12
|
+
export class CheckpointAttestationHash extends Buffer32 {
|
|
12
13
|
constructor(hash){
|
|
13
14
|
super(hash);
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* CheckpointAttestation
|
|
18
19
|
*
|
|
19
|
-
* A validator that has attested to seeing
|
|
20
|
-
* will produce a
|
|
21
|
-
*/ export class
|
|
20
|
+
* A validator that has attested to seeing all blocks in a checkpoint
|
|
21
|
+
* will produce a checkpoint attestation over the checkpoint header.
|
|
22
|
+
*/ export class CheckpointAttestation extends Gossipable {
|
|
22
23
|
payload;
|
|
23
24
|
signature;
|
|
24
25
|
proposerSignature;
|
|
25
|
-
static p2pTopic = TopicType.
|
|
26
|
+
static p2pTopic = TopicType.checkpoint_attestation;
|
|
26
27
|
sender;
|
|
27
28
|
proposer;
|
|
28
|
-
constructor(/** The payload of the message, and what the signature is over */ payload, /** The signature of the
|
|
29
|
+
constructor(/** The payload of the message, and what the signature is over */ payload, /** The signature of the checkpoint attester */ signature, /** The signature from the checkpoint proposer */ proposerSignature){
|
|
29
30
|
super(), this.payload = payload, this.signature = signature, this.proposerSignature = proposerSignature;
|
|
30
31
|
}
|
|
31
32
|
static get schema() {
|
|
@@ -33,10 +34,10 @@ export class BlockAttestationHash extends Buffer32 {
|
|
|
33
34
|
payload: ConsensusPayload.schema,
|
|
34
35
|
signature: Signature.schema,
|
|
35
36
|
proposerSignature: Signature.schema
|
|
36
|
-
}).transform((obj)=>new
|
|
37
|
+
}).transform((obj)=>new CheckpointAttestation(obj.payload, obj.signature, obj.proposerSignature));
|
|
37
38
|
}
|
|
38
39
|
generateP2PMessageIdentifier() {
|
|
39
|
-
return Promise.resolve(new
|
|
40
|
+
return Promise.resolve(new CheckpointAttestationHash(keccak256(this.signature.toBuffer())));
|
|
40
41
|
}
|
|
41
42
|
get archive() {
|
|
42
43
|
return this.payload.archive;
|
|
@@ -50,26 +51,28 @@ export class BlockAttestationHash extends Buffer32 {
|
|
|
50
51
|
*/ getSender() {
|
|
51
52
|
if (!this.sender) {
|
|
52
53
|
// Recover the sender from the attestation
|
|
53
|
-
const hashed = getHashedSignaturePayloadEthSignedMessage(this.payload, SignatureDomainSeparator.
|
|
54
|
+
const hashed = getHashedSignaturePayloadEthSignedMessage(this.payload, SignatureDomainSeparator.checkpointAttestation);
|
|
54
55
|
// Cache the sender for later use
|
|
55
56
|
this.sender = tryRecoverAddress(hashed, this.signature);
|
|
56
57
|
}
|
|
57
58
|
return this.sender;
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
|
-
* Lazily evaluate and cache the proposer of the
|
|
61
|
-
* @returns The proposer of the
|
|
61
|
+
* Lazily evaluate and cache the proposer of the checkpoint
|
|
62
|
+
* @returns The proposer of the checkpoint
|
|
62
63
|
*/ getProposer() {
|
|
63
64
|
if (!this.proposer) {
|
|
64
|
-
//
|
|
65
|
-
|
|
65
|
+
// Create a temporary CheckpointProposal to recover the proposer address.
|
|
66
|
+
// We need to use CheckpointProposal because it has a different getPayloadToSign()
|
|
67
|
+
// implementation than ConsensusPayload (uses serializeToBuffer vs ABI encoding).
|
|
68
|
+
const proposal = new CheckpointProposal(this.payload.header, this.payload.archive, this.proposerSignature);
|
|
66
69
|
// Cache the proposer for later use
|
|
67
|
-
this.proposer =
|
|
70
|
+
this.proposer = proposal.getSender();
|
|
68
71
|
}
|
|
69
72
|
return this.proposer;
|
|
70
73
|
}
|
|
71
74
|
getPayload() {
|
|
72
|
-
return this.payload.getPayloadToSign(SignatureDomainSeparator.
|
|
75
|
+
return this.payload.getPayloadToSign(SignatureDomainSeparator.checkpointAttestation);
|
|
73
76
|
}
|
|
74
77
|
toBuffer() {
|
|
75
78
|
return serializeToBuffer([
|
|
@@ -80,13 +83,13 @@ export class BlockAttestationHash extends Buffer32 {
|
|
|
80
83
|
}
|
|
81
84
|
static fromBuffer(buf) {
|
|
82
85
|
const reader = BufferReader.asReader(buf);
|
|
83
|
-
return new
|
|
86
|
+
return new CheckpointAttestation(reader.readObject(ConsensusPayload), reader.readObject(Signature), reader.readObject(Signature));
|
|
84
87
|
}
|
|
85
88
|
static empty() {
|
|
86
|
-
return new
|
|
89
|
+
return new CheckpointAttestation(ConsensusPayload.empty(), Signature.empty(), Signature.empty());
|
|
87
90
|
}
|
|
88
91
|
static random() {
|
|
89
|
-
return new
|
|
92
|
+
return new CheckpointAttestation(ConsensusPayload.random(), Signature.random(), Signature.random());
|
|
90
93
|
}
|
|
91
94
|
getSize() {
|
|
92
95
|
return this.payload.getSize() + this.signature.getSize() + this.proposerSignature.getSize();
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
6
|
+
import { BufferReader } from '@aztec/foundation/serialize';
|
|
7
|
+
import type { L2BlockInfo } from '../block/l2_block_info.js';
|
|
8
|
+
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
9
|
+
import { BlockHeader } from '../tx/block_header.js';
|
|
10
|
+
import { TxHash } from '../tx/index.js';
|
|
11
|
+
import type { Tx } from '../tx/tx.js';
|
|
12
|
+
import { BlockProposal } from './block_proposal.js';
|
|
13
|
+
import { Gossipable } from './gossipable.js';
|
|
14
|
+
import { SignatureDomainSeparator } from './signature_utils.js';
|
|
15
|
+
import { SignedTxs } from './signed_txs.js';
|
|
16
|
+
import { TopicType } from './topic_type.js';
|
|
17
|
+
export declare class CheckpointProposalHash extends Buffer32 {
|
|
18
|
+
constructor(hash: Buffer);
|
|
19
|
+
}
|
|
20
|
+
export type CheckpointProposalOptions = {
|
|
21
|
+
publishFullTxs: boolean;
|
|
22
|
+
/** Whether to generate an invalid checkpoint proposal for broadcasting. Use only for testing. */
|
|
23
|
+
broadcastInvalidCheckpointProposal?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** Data for the last block included in a checkpoint proposal */
|
|
26
|
+
export type CheckpointLastBlockData = {
|
|
27
|
+
/** The per-block header for the last block in the checkpoint */
|
|
28
|
+
blockHeader: BlockHeader;
|
|
29
|
+
/** Index of this block within the checkpoint (should be the last index, e.g., numBlocks - 1) */
|
|
30
|
+
indexWithinCheckpoint: number;
|
|
31
|
+
/** The sequence of transactions in the last block */
|
|
32
|
+
txHashes: TxHash[];
|
|
33
|
+
/** The tx in the last block (optional, for DA guarantees) */
|
|
34
|
+
txs?: Tx[];
|
|
35
|
+
};
|
|
36
|
+
/** Last block included in a checkpoint proposal */
|
|
37
|
+
export type CheckpointLastBlock = Omit<CheckpointLastBlockData, 'txs'> & {
|
|
38
|
+
/** The proposer's signature over the block data (separate from checkpoint signature) */
|
|
39
|
+
signature: Signature;
|
|
40
|
+
/** The signed transactions in the last block (optional, for DA guarantees) */
|
|
41
|
+
signedTxs?: SignedTxs;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A checkpoint proposal is created by the leader of the chain for the last block in a checkpoint.
|
|
45
|
+
* It includes the aggregated checkpoint header that validators will attest to, plus optionally
|
|
46
|
+
* the last block's info for nodes to re-execute. This marks the completion of a slot's worth of blocks.
|
|
47
|
+
*/
|
|
48
|
+
export declare class CheckpointProposal extends Gossipable {
|
|
49
|
+
readonly checkpointHeader: CheckpointHeader;
|
|
50
|
+
readonly archive: Fr;
|
|
51
|
+
readonly signature: Signature;
|
|
52
|
+
readonly lastBlock?: CheckpointLastBlock | undefined;
|
|
53
|
+
static p2pTopic: TopicType;
|
|
54
|
+
private sender;
|
|
55
|
+
constructor(
|
|
56
|
+
/** The aggregated checkpoint header for consensus */
|
|
57
|
+
checkpointHeader: CheckpointHeader,
|
|
58
|
+
/** Archive root after this checkpoint is applied */
|
|
59
|
+
archive: Fr,
|
|
60
|
+
/** The proposer's signature over the checkpoint payload (checkpointHeader + archive) */
|
|
61
|
+
signature: Signature,
|
|
62
|
+
/** Optional last block info, including its own signature for BlockProposal extraction */
|
|
63
|
+
lastBlock?: CheckpointLastBlock | undefined);
|
|
64
|
+
generateP2PMessageIdentifier(): Promise<Buffer32>;
|
|
65
|
+
get slotNumber(): SlotNumber;
|
|
66
|
+
get blockNumber(): BlockNumber;
|
|
67
|
+
/** Convenience getter for txHashes from lastBlock */
|
|
68
|
+
get txHashes(): TxHash[];
|
|
69
|
+
/** Convenience getter for txs from lastBlock */
|
|
70
|
+
get txs(): Tx[] | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Extract a BlockProposal from the last block info.
|
|
73
|
+
* Uses inHash from checkpointHeader.contentCommitment.inHash
|
|
74
|
+
*/
|
|
75
|
+
getBlockProposal(): BlockProposal | undefined;
|
|
76
|
+
toBlockInfo(): Omit<L2BlockInfo, 'blockNumber'>;
|
|
77
|
+
/**
|
|
78
|
+
* Get the payload to sign for this checkpoint proposal.
|
|
79
|
+
* The signature is over the checkpoint header + archive root (for consensus).
|
|
80
|
+
*/
|
|
81
|
+
getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer;
|
|
82
|
+
static createProposalFromSigner(checkpointHeader: CheckpointHeader, archiveRoot: Fr, lastBlockInfo: CheckpointLastBlockData | undefined, payloadSigner: (payload: Buffer32) => Promise<Signature>): Promise<CheckpointProposal>;
|
|
83
|
+
/**
|
|
84
|
+
* Lazily evaluate the sender of the proposal; result is cached.
|
|
85
|
+
* If there's a lastBlock, also verifies the block proposal sender matches the checkpoint sender.
|
|
86
|
+
* @returns The sender address, or undefined if signature recovery fails or senders don't match
|
|
87
|
+
*/
|
|
88
|
+
getSender(): EthAddress | undefined;
|
|
89
|
+
getPayload(): Buffer<ArrayBufferLike>;
|
|
90
|
+
toBuffer(): Buffer;
|
|
91
|
+
static fromBuffer(buf: Buffer | BufferReader): CheckpointProposal;
|
|
92
|
+
getSize(): number;
|
|
93
|
+
static empty(): CheckpointProposal;
|
|
94
|
+
static random(): CheckpointProposal;
|
|
95
|
+
toInspect(): {
|
|
96
|
+
checkpointHeader: {
|
|
97
|
+
lastArchive: `0x${string}`;
|
|
98
|
+
blockHeadersHash: `0x${string}`;
|
|
99
|
+
blobsHash: `0x${string}`;
|
|
100
|
+
inHash: `0x${string}`;
|
|
101
|
+
slotNumber: SlotNumber;
|
|
102
|
+
timestamp: bigint;
|
|
103
|
+
coinbase: `0x${string}`;
|
|
104
|
+
feeRecipient: `0x${string}`;
|
|
105
|
+
gasFees: {
|
|
106
|
+
feePerDaGas: bigint;
|
|
107
|
+
feePerL2Gas: bigint;
|
|
108
|
+
};
|
|
109
|
+
totalManaUsed: bigint;
|
|
110
|
+
};
|
|
111
|
+
archive: `0x${string}`;
|
|
112
|
+
signature: `0x${string}`;
|
|
113
|
+
lastBlock: {
|
|
114
|
+
blockHeader: {
|
|
115
|
+
lastArchive: `0x${string}`;
|
|
116
|
+
state: {
|
|
117
|
+
l1ToL2MessageTree: `0x${string}`;
|
|
118
|
+
noteHashTree: `0x${string}`;
|
|
119
|
+
nullifierTree: `0x${string}`;
|
|
120
|
+
publicDataTree: `0x${string}`;
|
|
121
|
+
};
|
|
122
|
+
spongeBlobHash: bigint;
|
|
123
|
+
globalVariables: {
|
|
124
|
+
chainId: number;
|
|
125
|
+
version: number;
|
|
126
|
+
blockNumber: BlockNumber;
|
|
127
|
+
slotNumber: SlotNumber;
|
|
128
|
+
timestamp: bigint;
|
|
129
|
+
coinbase: `0x${string}`;
|
|
130
|
+
feeRecipient: `0x${string}`;
|
|
131
|
+
feePerDaGas: number;
|
|
132
|
+
feePerL2Gas: number;
|
|
133
|
+
};
|
|
134
|
+
totalFees: bigint;
|
|
135
|
+
totalManaUsed: bigint;
|
|
136
|
+
};
|
|
137
|
+
indexWithinCheckpoint: number;
|
|
138
|
+
txHashes: `0x${string}`[];
|
|
139
|
+
signature: `0x${string}`;
|
|
140
|
+
} | undefined;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Returns a copy of this proposal without lastBlock info, as a CheckpointProposalCore.
|
|
144
|
+
* Used when the lastBlock has been extracted and stored separately.
|
|
145
|
+
*/
|
|
146
|
+
toCore(): CheckpointProposalCore;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A checkpoint proposal without the lastBlock info.
|
|
150
|
+
* Used when the lastBlock has been extracted and handled separately as a BlockProposal.
|
|
151
|
+
* This type makes it clear that lastBlock and getBlockProposal() are not available.
|
|
152
|
+
*/
|
|
153
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