@aztec/sequencer-client 1.0.0 → 1.1.2
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/publisher/sequencer-publisher.d.ts +4 -3
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +36 -20
- package/dest/sequencer/sequencer.d.ts +1 -1
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +6 -4
- package/dest/tx_validator/tx_validator_factory.d.ts +4 -2
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.js +5 -3
- package/package.json +26 -26
- package/src/publisher/sequencer-publisher.ts +31 -12
- package/src/sequencer/sequencer.ts +10 -3
- package/src/tx_validator/tx_validator_factory.ts +9 -4
|
@@ -2,7 +2,7 @@ import type { L2Block } from '@aztec/aztec.js';
|
|
|
2
2
|
import { Blob } from '@aztec/blob-lib';
|
|
3
3
|
import { type BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
4
4
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
5
|
-
import { type GasPrice, type GovernanceProposerContract, type L1BlobInputs, type L1ContractsConfig, type L1GasConfig, type L1TxRequest, RollupContract, type SlashingProposerContract, type TransactionStats } from '@aztec/ethereum';
|
|
5
|
+
import { FormattedViemError, type GasPrice, type GovernanceProposerContract, type L1BlobInputs, type L1ContractsConfig, type L1GasConfig, type L1TxRequest, RollupContract, type SlashingProposerContract, type TransactionStats } from '@aztec/ethereum';
|
|
6
6
|
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
7
7
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
8
8
|
import { CommitteeAttestation } from '@aztec/stdlib/block';
|
|
@@ -30,6 +30,7 @@ interface RequestWithExpiry {
|
|
|
30
30
|
}) => void;
|
|
31
31
|
}
|
|
32
32
|
export declare class SequencerPublisher {
|
|
33
|
+
private config;
|
|
33
34
|
private interrupted;
|
|
34
35
|
private metrics;
|
|
35
36
|
epochCache: EpochCache;
|
|
@@ -74,7 +75,7 @@ export declare class SequencerPublisher {
|
|
|
74
75
|
* - undefined if no valid requests are found OR the tx failed to send.
|
|
75
76
|
*/
|
|
76
77
|
sendRequests(): Promise<{
|
|
77
|
-
result: {
|
|
78
|
+
result: FormattedViemError | {
|
|
78
79
|
receipt: import("viem").TransactionReceipt;
|
|
79
80
|
gasPrice: GasPrice;
|
|
80
81
|
stats: TransactionStats | undefined;
|
|
@@ -129,7 +130,7 @@ export declare class SequencerPublisher {
|
|
|
129
130
|
* @param voteType - The type of vote to cast.
|
|
130
131
|
* @returns True if the vote was successfully enqueued, false otherwise.
|
|
131
132
|
*/
|
|
132
|
-
enqueueCastVote(slotNumber: bigint, timestamp: bigint, voteType: VoteType): Promise<boolean>;
|
|
133
|
+
enqueueCastVote(slotNumber: bigint, timestamp: bigint, voteType: VoteType, signerAddress: EthAddress, signer: (msg: `0x${string}`) => Promise<`0x${string}`>): Promise<boolean>;
|
|
133
134
|
/**
|
|
134
135
|
* Proposes a L2 block on L1.
|
|
135
136
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"sequencer-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CA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B,EAAE,EACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,EACnB,IAAI,GAAE;QAAE,WAAW,CAAC,EAAE,IAAI,CAAA;KAAO,GAChC,OAAO,CAAC,OAAO,CAAC;IAyCnB;;;;;OAKG;IACI,SAAS;IAKhB,wDAAwD;IACjD,OAAO;YAKA,gBAAgB;IAoD9B;;;;;OAKG;YACW,iBAAiB;YAmEjB,YAAY;IAoE1B;;;;;;;OAOG;IACH,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAGlF"}
|
|
@@ -19,20 +19,18 @@ export var VoteType = /*#__PURE__*/ function(VoteType) {
|
|
|
19
19
|
return VoteType;
|
|
20
20
|
}({});
|
|
21
21
|
export class SequencerPublisher {
|
|
22
|
-
|
|
22
|
+
config;
|
|
23
|
+
interrupted;
|
|
23
24
|
metrics;
|
|
24
25
|
epochCache;
|
|
25
|
-
governanceLog
|
|
26
|
+
governanceLog;
|
|
26
27
|
governanceProposerAddress;
|
|
27
|
-
governancePayload
|
|
28
|
-
slashingLog
|
|
28
|
+
governancePayload;
|
|
29
|
+
slashingLog;
|
|
29
30
|
slashingProposerAddress;
|
|
30
|
-
getSlashPayload
|
|
31
|
-
myLastVotes
|
|
32
|
-
|
|
33
|
-
[1]: 0n
|
|
34
|
-
};
|
|
35
|
-
log = createLogger('sequencer:publisher');
|
|
31
|
+
getSlashPayload;
|
|
32
|
+
myLastVotes;
|
|
33
|
+
log;
|
|
36
34
|
ethereumSlotDuration;
|
|
37
35
|
blobSinkClient;
|
|
38
36
|
// @note - with blobs, the below estimate seems too large.
|
|
@@ -45,8 +43,20 @@ export class SequencerPublisher {
|
|
|
45
43
|
rollupContract;
|
|
46
44
|
govProposerContract;
|
|
47
45
|
slashingProposerContract;
|
|
48
|
-
requests
|
|
46
|
+
requests;
|
|
49
47
|
constructor(config, deps){
|
|
48
|
+
this.config = config;
|
|
49
|
+
this.interrupted = false;
|
|
50
|
+
this.governanceLog = createLogger('sequencer:publisher:governance');
|
|
51
|
+
this.governancePayload = EthAddress.ZERO;
|
|
52
|
+
this.slashingLog = createLogger('sequencer:publisher:slashing');
|
|
53
|
+
this.getSlashPayload = undefined;
|
|
54
|
+
this.myLastVotes = {
|
|
55
|
+
[0]: 0n,
|
|
56
|
+
[1]: 0n
|
|
57
|
+
};
|
|
58
|
+
this.log = createLogger('sequencer:publisher');
|
|
59
|
+
this.requests = [];
|
|
50
60
|
this.ethereumSlotDuration = BigInt(config.ethereumSlotDuration);
|
|
51
61
|
this.epochCache = deps.epochCache;
|
|
52
62
|
this.blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config, {
|
|
@@ -157,11 +167,17 @@ export class SequencerPublisher {
|
|
|
157
167
|
}
|
|
158
168
|
}
|
|
159
169
|
callbackBundledTransactions(requests, result) {
|
|
160
|
-
const
|
|
170
|
+
const isError = result instanceof FormattedViemError;
|
|
171
|
+
const success = isError ? false : result?.receipt.status === 'success';
|
|
161
172
|
const logger = success ? this.log.info : this.log.error;
|
|
162
173
|
for (const request of requests){
|
|
163
174
|
logger(`Bundled [${request.action}] transaction [${success ? 'succeeded' : 'failed'}]`);
|
|
164
|
-
|
|
175
|
+
if (!isError) {
|
|
176
|
+
request.onResult?.(request.request, result);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (isError) {
|
|
180
|
+
this.log.error('Failed to publish bundled transactions', result);
|
|
165
181
|
}
|
|
166
182
|
}
|
|
167
183
|
/**
|
|
@@ -198,7 +214,7 @@ export class SequencerPublisher {
|
|
|
198
214
|
};
|
|
199
215
|
const args = [
|
|
200
216
|
header.toViem(),
|
|
201
|
-
[],
|
|
217
|
+
RollupContract.packAttestations([]),
|
|
202
218
|
`0x${'0'.repeat(64)}`,
|
|
203
219
|
header.contentCommitment.blobsHash.toString(),
|
|
204
220
|
flags
|
|
@@ -262,7 +278,7 @@ export class SequencerPublisher {
|
|
|
262
278
|
feeAssetPriceModifier: 0n
|
|
263
279
|
}
|
|
264
280
|
},
|
|
265
|
-
formattedAttestations,
|
|
281
|
+
RollupContract.packAttestations(formattedAttestations),
|
|
266
282
|
blobInput
|
|
267
283
|
];
|
|
268
284
|
await this.simulateProposeTx(args, ts);
|
|
@@ -272,7 +288,7 @@ export class SequencerPublisher {
|
|
|
272
288
|
const committee = await this.rollupContract.getCurrentEpochCommittee();
|
|
273
289
|
return committee?.map(EthAddress.fromString);
|
|
274
290
|
}
|
|
275
|
-
async enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base) {
|
|
291
|
+
async enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base, signerAddress, signer) {
|
|
276
292
|
if (this.myLastVotes[voteType] >= slotNumber) {
|
|
277
293
|
return false;
|
|
278
294
|
}
|
|
@@ -287,7 +303,7 @@ export class SequencerPublisher {
|
|
|
287
303
|
const cachedLastVote = this.myLastVotes[voteType];
|
|
288
304
|
this.myLastVotes[voteType] = slotNumber;
|
|
289
305
|
const action = voteType === 0 ? 'governance-vote' : 'slashing-vote';
|
|
290
|
-
const request = await base.createVoteRequestWithSignature(payload.toString(), this.
|
|
306
|
+
const request = await base.createVoteRequestWithSignature(payload.toString(), this.config.l1ChainId, signerAddress.toString(), signer);
|
|
291
307
|
this.log.debug(`Created ${action} request with signature`, {
|
|
292
308
|
request,
|
|
293
309
|
round,
|
|
@@ -339,13 +355,13 @@ export class SequencerPublisher {
|
|
|
339
355
|
* @param timestamp - The timestamp of the slot to cast a vote for.
|
|
340
356
|
* @param voteType - The type of vote to cast.
|
|
341
357
|
* @returns True if the vote was successfully enqueued, false otherwise.
|
|
342
|
-
*/ async enqueueCastVote(slotNumber, timestamp, voteType) {
|
|
358
|
+
*/ async enqueueCastVote(slotNumber, timestamp, voteType, signerAddress, signer) {
|
|
343
359
|
const voteConfig = await this.getVoteConfig(slotNumber, voteType);
|
|
344
360
|
if (!voteConfig) {
|
|
345
361
|
return false;
|
|
346
362
|
}
|
|
347
363
|
const { payload, base } = voteConfig;
|
|
348
|
-
return this.enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base);
|
|
364
|
+
return this.enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base, signerAddress, signer);
|
|
349
365
|
}
|
|
350
366
|
/**
|
|
351
367
|
* Proposes a L2 block on L1.
|
|
@@ -441,7 +457,7 @@ export class SequencerPublisher {
|
|
|
441
457
|
},
|
|
442
458
|
txHashes
|
|
443
459
|
},
|
|
444
|
-
attestations,
|
|
460
|
+
RollupContract.packAttestations(attestations),
|
|
445
461
|
blobInput
|
|
446
462
|
];
|
|
447
463
|
const { rollupData, simulationResult } = await this.simulateProposeTx(args, timestamp);
|
|
@@ -91,7 +91,7 @@ export declare class Sequencer extends Sequencer_base {
|
|
|
91
91
|
get tracer(): Tracer;
|
|
92
92
|
getValidatorAddresses(): EthAddress[] | undefined;
|
|
93
93
|
/**
|
|
94
|
-
* Updates sequencer config.
|
|
94
|
+
* Updates sequencer config by the defined values in the config on input.
|
|
95
95
|
* @param config - New parameters.
|
|
96
96
|
*/
|
|
97
97
|
updateConfig(config: SequencerConfig): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAK/C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAA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constants';
|
|
8
8
|
import { FormattedViemError, NoCommitteeError } from '@aztec/ethereum';
|
|
9
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
9
10
|
import { omit } from '@aztec/foundation/collection';
|
|
10
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
12
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -83,7 +84,7 @@ export { SequencerState };
|
|
|
83
84
|
return this.validatorClient?.getValidatorAddresses();
|
|
84
85
|
}
|
|
85
86
|
/**
|
|
86
|
-
* Updates sequencer config.
|
|
87
|
+
* Updates sequencer config by the defined values in the config on input.
|
|
87
88
|
* @param config - New parameters.
|
|
88
89
|
*/ updateConfig(config) {
|
|
89
90
|
this.log.info(`Sequencer config set`, omit(pickFromSchema(config, SequencerConfigSchema), 'txPublicSetupAllowList'));
|
|
@@ -123,7 +124,8 @@ export { SequencerState };
|
|
|
123
124
|
}
|
|
124
125
|
this.setTimeTable();
|
|
125
126
|
// TODO: Just read everything from the config object as needed instead of copying everything into local vars.
|
|
126
|
-
this.config
|
|
127
|
+
// Update all values on this.config that are populated in the config object.
|
|
128
|
+
Object.assign(this.config, config);
|
|
127
129
|
}
|
|
128
130
|
setTimeTable() {
|
|
129
131
|
this.timetable = new SequencerTimetable(this.l1Constants.ethereumSlotDuration, this.aztecSlotDuration, this.maxL1TxInclusionTimeIntoSlot, this.enforceTimeTable, this.metrics, this.log);
|
|
@@ -284,8 +286,8 @@ export { SequencerState };
|
|
|
284
286
|
validatorAddresses
|
|
285
287
|
});
|
|
286
288
|
const newGlobalVariables = await this.globalsBuilder.buildGlobalVariables(newBlockNumber, this.coinbase, this._feeRecipient, slot);
|
|
287
|
-
const enqueueGovernanceVotePromise = this.publisher.enqueueCastVote(slot, newGlobalVariables.timestamp, VoteType.GOVERNANCE);
|
|
288
|
-
const enqueueSlashingVotePromise = this.publisher.enqueueCastVote(slot, newGlobalVariables.timestamp, VoteType.SLASHING);
|
|
289
|
+
const enqueueGovernanceVotePromise = this.publisher.enqueueCastVote(slot, newGlobalVariables.timestamp, VoteType.GOVERNANCE, proposerAddress, (msg)=>this.validatorClient.signWithAddress(proposerAddress, Buffer32.fromString(msg)).then((s)=>s.toString()));
|
|
290
|
+
const enqueueSlashingVotePromise = this.publisher.enqueueCastVote(slot, newGlobalVariables.timestamp, VoteType.SLASHING, proposerAddress, (msg)=>this.validatorClient.signWithAddress(proposerAddress, Buffer32.fromString(msg)).then((s)=>s.toString()));
|
|
289
291
|
this.setState(SequencerState.INITIALIZING_PROPOSAL, slot);
|
|
290
292
|
this.log.verbose(`Preparing proposal for block ${newBlockNumber} at slot ${slot}`, {
|
|
291
293
|
proposer: proposerInNextSlot?.toString(),
|
|
@@ -2,13 +2,15 @@ import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
|
2
2
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
3
3
|
import type { AllowedElement, ClientProtocolCircuitVerifier, MerkleTreeReadOperations, PublicProcessorValidator } from '@aztec/stdlib/interfaces/server';
|
|
4
4
|
import { GlobalVariables, type Tx, type TxValidator } from '@aztec/stdlib/tx';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
6
|
+
export declare function createValidatorForAcceptingTxs(db: MerkleTreeReadOperations, contractDataSource: ContractDataSource, verifier: ClientProtocolCircuitVerifier | undefined, { l1ChainId, rollupVersion, setupAllowList, gasFees, skipFeeEnforcement, timestamp, blockNumber, }: {
|
|
7
7
|
l1ChainId: number;
|
|
8
8
|
rollupVersion: number;
|
|
9
9
|
setupAllowList: AllowedElement[];
|
|
10
10
|
gasFees: GasFees;
|
|
11
11
|
skipFeeEnforcement?: boolean;
|
|
12
|
+
timestamp: UInt64;
|
|
13
|
+
blockNumber: number;
|
|
12
14
|
}): TxValidator<Tx>;
|
|
13
15
|
export declare function createValidatorForBlockBuilding(db: MerkleTreeReadOperations, contractDataSource: ContractDataSource, globalVariables: GlobalVariables, setupAllowList: AllowedElement[]): PublicProcessorValidator;
|
|
14
16
|
//# sourceMappingURL=tx_validator_factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_validator_factory.d.ts","sourceRoot":"","sources":["../../src/tx_validator/tx_validator_factory.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EACV,cAAc,EACd,6BAA6B,EAC7B,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"tx_validator_factory.d.ts","sourceRoot":"","sources":["../../src/tx_validator/tx_validator_factory.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EACV,cAAc,EACd,6BAA6B,EAC7B,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAIlD,wBAAgB,8BAA8B,CAC5C,EAAE,EAAE,wBAAwB,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,6BAA6B,GAAG,SAAS,EACnD,EACE,SAAS,EACT,aAAa,EACb,cAAc,EACd,OAAO,EACP,kBAAkB,EAClB,SAAS,EACT,WAAW,GACZ,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,cAAc,EAAE,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,GACA,WAAW,CAAC,EAAE,CAAC,CAyBjB;AAED,wBAAgB,+BAA+B,CAC7C,EAAE,EAAE,wBAAwB,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAAE,GAC/B,wBAAwB,CAgB1B"}
|
|
@@ -4,18 +4,19 @@ import { AggregateTxValidator, ArchiveCache, BlockHeaderTxValidator, DataTxValid
|
|
|
4
4
|
import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
5
5
|
import { DatabasePublicStateSource } from '@aztec/stdlib/trees';
|
|
6
6
|
import { NullifierCache } from './nullifier_cache.js';
|
|
7
|
-
export function createValidatorForAcceptingTxs(db, contractDataSource, verifier, {
|
|
7
|
+
export function createValidatorForAcceptingTxs(db, contractDataSource, verifier, { l1ChainId, rollupVersion, setupAllowList, gasFees, skipFeeEnforcement, timestamp, blockNumber }) {
|
|
8
8
|
const validators = [
|
|
9
9
|
new DataTxValidator(),
|
|
10
10
|
new MetadataTxValidator({
|
|
11
11
|
l1ChainId: new Fr(l1ChainId),
|
|
12
12
|
rollupVersion: new Fr(rollupVersion),
|
|
13
|
+
timestamp,
|
|
13
14
|
blockNumber,
|
|
14
15
|
protocolContractTreeRoot,
|
|
15
16
|
vkTreeRoot: getVKTreeRoot()
|
|
16
17
|
}),
|
|
17
18
|
new DoubleSpendTxValidator(new NullifierCache(db)),
|
|
18
|
-
new PhasesTxValidator(contractDataSource, setupAllowList,
|
|
19
|
+
new PhasesTxValidator(contractDataSource, setupAllowList, timestamp),
|
|
19
20
|
new BlockHeaderTxValidator(new ArchiveCache(db))
|
|
20
21
|
];
|
|
21
22
|
if (!skipFeeEnforcement) {
|
|
@@ -40,8 +41,9 @@ function preprocessValidator(nullifierCache, archiveCache, publicStateSource, co
|
|
|
40
41
|
return new AggregateTxValidator(new MetadataTxValidator({
|
|
41
42
|
l1ChainId: globalVariables.chainId,
|
|
42
43
|
rollupVersion: globalVariables.version,
|
|
44
|
+
timestamp: globalVariables.timestamp,
|
|
43
45
|
blockNumber: globalVariables.blockNumber,
|
|
44
46
|
protocolContractTreeRoot,
|
|
45
47
|
vkTreeRoot: getVKTreeRoot()
|
|
46
|
-
}), new DoubleSpendTxValidator(nullifierCache), new PhasesTxValidator(contractDataSource, setupAllowList, globalVariables.
|
|
48
|
+
}), new DoubleSpendTxValidator(nullifierCache), new PhasesTxValidator(contractDataSource, setupAllowList, globalVariables.timestamp), new GasTxValidator(publicStateSource, ProtocolContractAddress.FeeJuice, globalVariables.gasFees), new BlockHeaderTxValidator(archiveCache));
|
|
47
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,37 +26,37 @@
|
|
|
26
26
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/aztec.js": "1.
|
|
30
|
-
"@aztec/bb-prover": "1.
|
|
31
|
-
"@aztec/blob-lib": "1.
|
|
32
|
-
"@aztec/blob-sink": "1.
|
|
33
|
-
"@aztec/constants": "1.
|
|
34
|
-
"@aztec/epoch-cache": "1.
|
|
35
|
-
"@aztec/ethereum": "1.
|
|
36
|
-
"@aztec/foundation": "1.
|
|
37
|
-
"@aztec/l1-artifacts": "1.
|
|
38
|
-
"@aztec/merkle-tree": "1.
|
|
39
|
-
"@aztec/noir-acvm_js": "1.
|
|
40
|
-
"@aztec/noir-contracts.js": "1.
|
|
41
|
-
"@aztec/noir-protocol-circuits-types": "1.
|
|
42
|
-
"@aztec/noir-types": "1.
|
|
43
|
-
"@aztec/p2p": "1.
|
|
44
|
-
"@aztec/protocol-contracts": "1.
|
|
45
|
-
"@aztec/prover-client": "1.
|
|
46
|
-
"@aztec/simulator": "1.
|
|
47
|
-
"@aztec/slasher": "1.
|
|
48
|
-
"@aztec/stdlib": "1.
|
|
49
|
-
"@aztec/telemetry-client": "1.
|
|
50
|
-
"@aztec/validator-client": "1.
|
|
51
|
-
"@aztec/world-state": "1.
|
|
29
|
+
"@aztec/aztec.js": "1.1.2",
|
|
30
|
+
"@aztec/bb-prover": "1.1.2",
|
|
31
|
+
"@aztec/blob-lib": "1.1.2",
|
|
32
|
+
"@aztec/blob-sink": "1.1.2",
|
|
33
|
+
"@aztec/constants": "1.1.2",
|
|
34
|
+
"@aztec/epoch-cache": "1.1.2",
|
|
35
|
+
"@aztec/ethereum": "1.1.2",
|
|
36
|
+
"@aztec/foundation": "1.1.2",
|
|
37
|
+
"@aztec/l1-artifacts": "1.1.2",
|
|
38
|
+
"@aztec/merkle-tree": "1.1.2",
|
|
39
|
+
"@aztec/noir-acvm_js": "1.1.2",
|
|
40
|
+
"@aztec/noir-contracts.js": "1.1.2",
|
|
41
|
+
"@aztec/noir-protocol-circuits-types": "1.1.2",
|
|
42
|
+
"@aztec/noir-types": "1.1.2",
|
|
43
|
+
"@aztec/p2p": "1.1.2",
|
|
44
|
+
"@aztec/protocol-contracts": "1.1.2",
|
|
45
|
+
"@aztec/prover-client": "1.1.2",
|
|
46
|
+
"@aztec/simulator": "1.1.2",
|
|
47
|
+
"@aztec/slasher": "1.1.2",
|
|
48
|
+
"@aztec/stdlib": "1.1.2",
|
|
49
|
+
"@aztec/telemetry-client": "1.1.2",
|
|
50
|
+
"@aztec/validator-client": "1.1.2",
|
|
51
|
+
"@aztec/world-state": "1.1.2",
|
|
52
52
|
"lodash.chunk": "^4.2.0",
|
|
53
53
|
"lodash.pick": "^4.4.0",
|
|
54
54
|
"tslib": "^2.4.0",
|
|
55
55
|
"viem": "2.23.7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@aztec/archiver": "1.
|
|
59
|
-
"@aztec/kv-store": "1.
|
|
58
|
+
"@aztec/archiver": "1.1.2",
|
|
59
|
+
"@aztec/kv-store": "1.1.2",
|
|
60
60
|
"@jest/globals": "^30.0.0",
|
|
61
61
|
"@types/jest": "^30.0.0",
|
|
62
62
|
"@types/lodash.chunk": "^4.2.7",
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
RollupContract,
|
|
17
17
|
type SlashingProposerContract,
|
|
18
18
|
type TransactionStats,
|
|
19
|
-
type
|
|
19
|
+
type ViemCommitteeAttestations,
|
|
20
20
|
type ViemHeader,
|
|
21
21
|
type ViemStateReference,
|
|
22
22
|
formatViemError,
|
|
@@ -115,7 +115,7 @@ export class SequencerPublisher {
|
|
|
115
115
|
protected requests: RequestWithExpiry[] = [];
|
|
116
116
|
|
|
117
117
|
constructor(
|
|
118
|
-
config: TxSenderConfig & PublisherConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>,
|
|
118
|
+
private config: TxSenderConfig & PublisherConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>,
|
|
119
119
|
deps: {
|
|
120
120
|
telemetry?: TelemetryClient;
|
|
121
121
|
blobSinkClient?: BlobSinkClientInterface;
|
|
@@ -257,13 +257,19 @@ export class SequencerPublisher {
|
|
|
257
257
|
|
|
258
258
|
private callbackBundledTransactions(
|
|
259
259
|
requests: RequestWithExpiry[],
|
|
260
|
-
result?: { receipt: TransactionReceipt; gasPrice: GasPrice },
|
|
260
|
+
result?: { receipt: TransactionReceipt; gasPrice: GasPrice } | FormattedViemError,
|
|
261
261
|
) {
|
|
262
|
-
const
|
|
262
|
+
const isError = result instanceof FormattedViemError;
|
|
263
|
+
const success = isError ? false : result?.receipt.status === 'success';
|
|
263
264
|
const logger = success ? this.log.info : this.log.error;
|
|
264
265
|
for (const request of requests) {
|
|
265
266
|
logger(`Bundled [${request.action}] transaction [${success ? 'succeeded' : 'failed'}]`);
|
|
266
|
-
|
|
267
|
+
if (!isError) {
|
|
268
|
+
request.onResult?.(request.request, result);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (isError) {
|
|
272
|
+
this.log.error('Failed to publish bundled transactions', result);
|
|
267
273
|
}
|
|
268
274
|
}
|
|
269
275
|
|
|
@@ -300,7 +306,7 @@ export class SequencerPublisher {
|
|
|
300
306
|
|
|
301
307
|
const args = [
|
|
302
308
|
header.toViem(),
|
|
303
|
-
[]
|
|
309
|
+
RollupContract.packAttestations([]),
|
|
304
310
|
`0x${'0'.repeat(64)}`, // 32 empty bytes
|
|
305
311
|
header.contentCommitment.blobsHash.toString(),
|
|
306
312
|
flags,
|
|
@@ -377,7 +383,7 @@ export class SequencerPublisher {
|
|
|
377
383
|
feeAssetPriceModifier: 0n,
|
|
378
384
|
},
|
|
379
385
|
},
|
|
380
|
-
formattedAttestations,
|
|
386
|
+
RollupContract.packAttestations(formattedAttestations),
|
|
381
387
|
blobInput,
|
|
382
388
|
] as const;
|
|
383
389
|
|
|
@@ -396,6 +402,8 @@ export class SequencerPublisher {
|
|
|
396
402
|
voteType: VoteType,
|
|
397
403
|
payload: EthAddress,
|
|
398
404
|
base: IEmpireBase,
|
|
405
|
+
signerAddress: EthAddress,
|
|
406
|
+
signer: (msg: `0x${string}`) => Promise<`0x${string}`>,
|
|
399
407
|
): Promise<boolean> {
|
|
400
408
|
if (this.myLastVotes[voteType] >= slotNumber) {
|
|
401
409
|
return false;
|
|
@@ -415,7 +423,12 @@ export class SequencerPublisher {
|
|
|
415
423
|
|
|
416
424
|
const action = voteType === VoteType.GOVERNANCE ? 'governance-vote' : 'slashing-vote';
|
|
417
425
|
|
|
418
|
-
const request = await base.createVoteRequestWithSignature(
|
|
426
|
+
const request = await base.createVoteRequestWithSignature(
|
|
427
|
+
payload.toString(),
|
|
428
|
+
this.config.l1ChainId,
|
|
429
|
+
signerAddress.toString(),
|
|
430
|
+
signer,
|
|
431
|
+
);
|
|
419
432
|
this.log.debug(`Created ${action} request with signature`, {
|
|
420
433
|
request,
|
|
421
434
|
round,
|
|
@@ -466,13 +479,19 @@ export class SequencerPublisher {
|
|
|
466
479
|
* @param voteType - The type of vote to cast.
|
|
467
480
|
* @returns True if the vote was successfully enqueued, false otherwise.
|
|
468
481
|
*/
|
|
469
|
-
public async enqueueCastVote(
|
|
482
|
+
public async enqueueCastVote(
|
|
483
|
+
slotNumber: bigint,
|
|
484
|
+
timestamp: bigint,
|
|
485
|
+
voteType: VoteType,
|
|
486
|
+
signerAddress: EthAddress,
|
|
487
|
+
signer: (msg: `0x${string}`) => Promise<`0x${string}`>,
|
|
488
|
+
): Promise<boolean> {
|
|
470
489
|
const voteConfig = await this.getVoteConfig(slotNumber, voteType);
|
|
471
490
|
if (!voteConfig) {
|
|
472
491
|
return false;
|
|
473
492
|
}
|
|
474
493
|
const { payload, base } = voteConfig;
|
|
475
|
-
return this.enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base);
|
|
494
|
+
return this.enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base, signerAddress, signer);
|
|
476
495
|
}
|
|
477
496
|
|
|
478
497
|
/**
|
|
@@ -587,7 +606,7 @@ export class SequencerPublisher {
|
|
|
587
606
|
},
|
|
588
607
|
txHashes,
|
|
589
608
|
},
|
|
590
|
-
attestations,
|
|
609
|
+
RollupContract.packAttestations(attestations),
|
|
591
610
|
blobInput,
|
|
592
611
|
] as const;
|
|
593
612
|
|
|
@@ -613,7 +632,7 @@ export class SequencerPublisher {
|
|
|
613
632
|
readonly feeAssetPriceModifier: 0n;
|
|
614
633
|
};
|
|
615
634
|
},
|
|
616
|
-
|
|
635
|
+
ViemCommitteeAttestations,
|
|
617
636
|
`0x${string}`,
|
|
618
637
|
],
|
|
619
638
|
timestamp: bigint,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { L2Block } from '@aztec/aztec.js';
|
|
2
2
|
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
3
3
|
import { FormattedViemError, NoCommitteeError, type ViemPublicClient } from '@aztec/ethereum';
|
|
4
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
4
5
|
import { omit } from '@aztec/foundation/collection';
|
|
5
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
7
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -140,7 +141,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
/**
|
|
143
|
-
* Updates sequencer config.
|
|
144
|
+
* Updates sequencer config by the defined values in the config on input.
|
|
144
145
|
* @param config - New parameters.
|
|
145
146
|
*/
|
|
146
147
|
public updateConfig(config: SequencerConfig) {
|
|
@@ -171,7 +172,6 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
171
172
|
if (config.feeRecipient) {
|
|
172
173
|
this._feeRecipient = config.feeRecipient;
|
|
173
174
|
}
|
|
174
|
-
|
|
175
175
|
if (config.maxBlockSizeInBytes !== undefined) {
|
|
176
176
|
this.maxBlockSizeInBytes = config.maxBlockSizeInBytes;
|
|
177
177
|
}
|
|
@@ -188,7 +188,9 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
188
188
|
this.setTimeTable();
|
|
189
189
|
|
|
190
190
|
// TODO: Just read everything from the config object as needed instead of copying everything into local vars.
|
|
191
|
-
|
|
191
|
+
|
|
192
|
+
// Update all values on this.config that are populated in the config object.
|
|
193
|
+
Object.assign(this.config, config);
|
|
192
194
|
}
|
|
193
195
|
|
|
194
196
|
private setTimeTable() {
|
|
@@ -345,6 +347,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
345
347
|
// Double check we are good for proposing at the next block before we start operations.
|
|
346
348
|
// We should never fail this check assuming the logic above is good.
|
|
347
349
|
const proposerAddress = proposerInNextSlot ?? EthAddress.ZERO;
|
|
350
|
+
|
|
348
351
|
const canProposeCheck = await this.publisher.canProposeAtNextEthBlock(chainTipArchive.toBuffer(), proposerAddress);
|
|
349
352
|
if (canProposeCheck === undefined) {
|
|
350
353
|
this.log.warn(
|
|
@@ -385,12 +388,16 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
385
388
|
slot,
|
|
386
389
|
newGlobalVariables.timestamp,
|
|
387
390
|
VoteType.GOVERNANCE,
|
|
391
|
+
proposerAddress,
|
|
392
|
+
msg => this.validatorClient!.signWithAddress(proposerAddress, Buffer32.fromString(msg)).then(s => s.toString()),
|
|
388
393
|
);
|
|
389
394
|
|
|
390
395
|
const enqueueSlashingVotePromise = this.publisher.enqueueCastVote(
|
|
391
396
|
slot,
|
|
392
397
|
newGlobalVariables.timestamp,
|
|
393
398
|
VoteType.SLASHING,
|
|
399
|
+
proposerAddress,
|
|
400
|
+
msg => this.validatorClient!.signWithAddress(proposerAddress, Buffer32.fromString(msg)).then(s => s.toString()),
|
|
394
401
|
);
|
|
395
402
|
|
|
396
403
|
this.setState(SequencerState.INITIALIZING_PROPOSAL, slot);
|
|
@@ -22,6 +22,7 @@ import type {
|
|
|
22
22
|
} from '@aztec/stdlib/interfaces/server';
|
|
23
23
|
import { DatabasePublicStateSource, type PublicStateSource } from '@aztec/stdlib/trees';
|
|
24
24
|
import { GlobalVariables, type Tx, type TxValidator } from '@aztec/stdlib/tx';
|
|
25
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
25
26
|
|
|
26
27
|
import { NullifierCache } from './nullifier_cache.js';
|
|
27
28
|
|
|
@@ -30,19 +31,21 @@ export function createValidatorForAcceptingTxs(
|
|
|
30
31
|
contractDataSource: ContractDataSource,
|
|
31
32
|
verifier: ClientProtocolCircuitVerifier | undefined,
|
|
32
33
|
{
|
|
33
|
-
blockNumber,
|
|
34
34
|
l1ChainId,
|
|
35
35
|
rollupVersion,
|
|
36
36
|
setupAllowList,
|
|
37
37
|
gasFees,
|
|
38
38
|
skipFeeEnforcement,
|
|
39
|
+
timestamp,
|
|
40
|
+
blockNumber,
|
|
39
41
|
}: {
|
|
40
|
-
blockNumber: number;
|
|
41
42
|
l1ChainId: number;
|
|
42
43
|
rollupVersion: number;
|
|
43
44
|
setupAllowList: AllowedElement[];
|
|
44
45
|
gasFees: GasFees;
|
|
45
46
|
skipFeeEnforcement?: boolean;
|
|
47
|
+
timestamp: UInt64;
|
|
48
|
+
blockNumber: number;
|
|
46
49
|
},
|
|
47
50
|
): TxValidator<Tx> {
|
|
48
51
|
const validators: TxValidator<Tx>[] = [
|
|
@@ -50,12 +53,13 @@ export function createValidatorForAcceptingTxs(
|
|
|
50
53
|
new MetadataTxValidator({
|
|
51
54
|
l1ChainId: new Fr(l1ChainId),
|
|
52
55
|
rollupVersion: new Fr(rollupVersion),
|
|
56
|
+
timestamp,
|
|
53
57
|
blockNumber,
|
|
54
58
|
protocolContractTreeRoot,
|
|
55
59
|
vkTreeRoot: getVKTreeRoot(),
|
|
56
60
|
}),
|
|
57
61
|
new DoubleSpendTxValidator(new NullifierCache(db)),
|
|
58
|
-
new PhasesTxValidator(contractDataSource, setupAllowList,
|
|
62
|
+
new PhasesTxValidator(contractDataSource, setupAllowList, timestamp),
|
|
59
63
|
new BlockHeaderTxValidator(new ArchiveCache(db)),
|
|
60
64
|
];
|
|
61
65
|
|
|
@@ -106,12 +110,13 @@ function preprocessValidator(
|
|
|
106
110
|
new MetadataTxValidator({
|
|
107
111
|
l1ChainId: globalVariables.chainId,
|
|
108
112
|
rollupVersion: globalVariables.version,
|
|
113
|
+
timestamp: globalVariables.timestamp,
|
|
109
114
|
blockNumber: globalVariables.blockNumber,
|
|
110
115
|
protocolContractTreeRoot,
|
|
111
116
|
vkTreeRoot: getVKTreeRoot(),
|
|
112
117
|
}),
|
|
113
118
|
new DoubleSpendTxValidator(nullifierCache),
|
|
114
|
-
new PhasesTxValidator(contractDataSource, setupAllowList, globalVariables.
|
|
119
|
+
new PhasesTxValidator(contractDataSource, setupAllowList, globalVariables.timestamp),
|
|
115
120
|
new GasTxValidator(publicStateSource, ProtocolContractAddress.FeeJuice, globalVariables.gasFees),
|
|
116
121
|
new BlockHeaderTxValidator(archiveCache),
|
|
117
122
|
);
|