@aztec/sequencer-client 1.0.0-staging.2 → 1.0.0-staging.4
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 +2 -1
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +25 -15
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +3 -2
- package/package.json +26 -26
- package/src/publisher/sequencer-publisher.ts +17 -4
- package/src/sequencer/sequencer.ts +6 -0
|
@@ -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;
|
|
@@ -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,KAA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;IACU,eAAe,CAC1B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,UAAU,EACzB,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,GACrD,OAAO,CAAC,OAAO,CAAC;IASnB;;;;;OAKG;IACU,qBAAqB,CAChC,KAAK,EAAE,OAAO,EACd,YAAY,CAAC,EAAE,oBAAoB,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, {
|
|
@@ -278,7 +288,7 @@ export class SequencerPublisher {
|
|
|
278
288
|
const committee = await this.rollupContract.getCurrentEpochCommittee();
|
|
279
289
|
return committee?.map(EthAddress.fromString);
|
|
280
290
|
}
|
|
281
|
-
async enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base) {
|
|
291
|
+
async enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base, signerAddress, signer) {
|
|
282
292
|
if (this.myLastVotes[voteType] >= slotNumber) {
|
|
283
293
|
return false;
|
|
284
294
|
}
|
|
@@ -293,7 +303,7 @@ export class SequencerPublisher {
|
|
|
293
303
|
const cachedLastVote = this.myLastVotes[voteType];
|
|
294
304
|
this.myLastVotes[voteType] = slotNumber;
|
|
295
305
|
const action = voteType === 0 ? 'governance-vote' : 'slashing-vote';
|
|
296
|
-
const request = await base.createVoteRequestWithSignature(payload.toString(), this.
|
|
306
|
+
const request = await base.createVoteRequestWithSignature(payload.toString(), this.config.l1ChainId, signerAddress.toString(), signer);
|
|
297
307
|
this.log.debug(`Created ${action} request with signature`, {
|
|
298
308
|
request,
|
|
299
309
|
round,
|
|
@@ -345,13 +355,13 @@ export class SequencerPublisher {
|
|
|
345
355
|
* @param timestamp - The timestamp of the slot to cast a vote for.
|
|
346
356
|
* @param voteType - The type of vote to cast.
|
|
347
357
|
* @returns True if the vote was successfully enqueued, false otherwise.
|
|
348
|
-
*/ async enqueueCastVote(slotNumber, timestamp, voteType) {
|
|
358
|
+
*/ async enqueueCastVote(slotNumber, timestamp, voteType, signerAddress, signer) {
|
|
349
359
|
const voteConfig = await this.getVoteConfig(slotNumber, voteType);
|
|
350
360
|
if (!voteConfig) {
|
|
351
361
|
return false;
|
|
352
362
|
}
|
|
353
363
|
const { payload, base } = voteConfig;
|
|
354
|
-
return this.enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base);
|
|
364
|
+
return this.enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base, signerAddress, signer);
|
|
355
365
|
}
|
|
356
366
|
/**
|
|
357
367
|
* Proposes a L2 block on L1.
|
|
@@ -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,OAA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,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
6
6
|
}
|
|
7
7
|
import { INITIAL_L2_BLOCK_NUM } from '@aztec/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';
|
|
@@ -285,8 +286,8 @@ export { SequencerState };
|
|
|
285
286
|
validatorAddresses
|
|
286
287
|
});
|
|
287
288
|
const newGlobalVariables = await this.globalsBuilder.buildGlobalVariables(newBlockNumber, this.coinbase, this._feeRecipient, slot);
|
|
288
|
-
const enqueueGovernanceVotePromise = this.publisher.enqueueCastVote(slot, newGlobalVariables.timestamp, VoteType.GOVERNANCE);
|
|
289
|
-
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()));
|
|
290
291
|
this.setState(SequencerState.INITIALIZING_PROPOSAL, slot);
|
|
291
292
|
this.log.verbose(`Preparing proposal for block ${newBlockNumber} at slot ${slot}`, {
|
|
292
293
|
proposer: proposerInNextSlot?.toString(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "1.0.0-staging.
|
|
3
|
+
"version": "1.0.0-staging.4",
|
|
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.0.0-staging.
|
|
30
|
-
"@aztec/bb-prover": "1.0.0-staging.
|
|
31
|
-
"@aztec/blob-lib": "1.0.0-staging.
|
|
32
|
-
"@aztec/blob-sink": "1.0.0-staging.
|
|
33
|
-
"@aztec/constants": "1.0.0-staging.
|
|
34
|
-
"@aztec/epoch-cache": "1.0.0-staging.
|
|
35
|
-
"@aztec/ethereum": "1.0.0-staging.
|
|
36
|
-
"@aztec/foundation": "1.0.0-staging.
|
|
37
|
-
"@aztec/l1-artifacts": "1.0.0-staging.
|
|
38
|
-
"@aztec/merkle-tree": "1.0.0-staging.
|
|
39
|
-
"@aztec/noir-acvm_js": "1.0.0-staging.
|
|
40
|
-
"@aztec/noir-contracts.js": "1.0.0-staging.
|
|
41
|
-
"@aztec/noir-protocol-circuits-types": "1.0.0-staging.
|
|
42
|
-
"@aztec/noir-types": "1.0.0-staging.
|
|
43
|
-
"@aztec/p2p": "1.0.0-staging.
|
|
44
|
-
"@aztec/protocol-contracts": "1.0.0-staging.
|
|
45
|
-
"@aztec/prover-client": "1.0.0-staging.
|
|
46
|
-
"@aztec/simulator": "1.0.0-staging.
|
|
47
|
-
"@aztec/slasher": "1.0.0-staging.
|
|
48
|
-
"@aztec/stdlib": "1.0.0-staging.
|
|
49
|
-
"@aztec/telemetry-client": "1.0.0-staging.
|
|
50
|
-
"@aztec/validator-client": "1.0.0-staging.
|
|
51
|
-
"@aztec/world-state": "1.0.0-staging.
|
|
29
|
+
"@aztec/aztec.js": "1.0.0-staging.4",
|
|
30
|
+
"@aztec/bb-prover": "1.0.0-staging.4",
|
|
31
|
+
"@aztec/blob-lib": "1.0.0-staging.4",
|
|
32
|
+
"@aztec/blob-sink": "1.0.0-staging.4",
|
|
33
|
+
"@aztec/constants": "1.0.0-staging.4",
|
|
34
|
+
"@aztec/epoch-cache": "1.0.0-staging.4",
|
|
35
|
+
"@aztec/ethereum": "1.0.0-staging.4",
|
|
36
|
+
"@aztec/foundation": "1.0.0-staging.4",
|
|
37
|
+
"@aztec/l1-artifacts": "1.0.0-staging.4",
|
|
38
|
+
"@aztec/merkle-tree": "1.0.0-staging.4",
|
|
39
|
+
"@aztec/noir-acvm_js": "1.0.0-staging.4",
|
|
40
|
+
"@aztec/noir-contracts.js": "1.0.0-staging.4",
|
|
41
|
+
"@aztec/noir-protocol-circuits-types": "1.0.0-staging.4",
|
|
42
|
+
"@aztec/noir-types": "1.0.0-staging.4",
|
|
43
|
+
"@aztec/p2p": "1.0.0-staging.4",
|
|
44
|
+
"@aztec/protocol-contracts": "1.0.0-staging.4",
|
|
45
|
+
"@aztec/prover-client": "1.0.0-staging.4",
|
|
46
|
+
"@aztec/simulator": "1.0.0-staging.4",
|
|
47
|
+
"@aztec/slasher": "1.0.0-staging.4",
|
|
48
|
+
"@aztec/stdlib": "1.0.0-staging.4",
|
|
49
|
+
"@aztec/telemetry-client": "1.0.0-staging.4",
|
|
50
|
+
"@aztec/validator-client": "1.0.0-staging.4",
|
|
51
|
+
"@aztec/world-state": "1.0.0-staging.4",
|
|
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.0.0-staging.
|
|
59
|
-
"@aztec/kv-store": "1.0.0-staging.
|
|
58
|
+
"@aztec/archiver": "1.0.0-staging.4",
|
|
59
|
+
"@aztec/kv-store": "1.0.0-staging.4",
|
|
60
60
|
"@jest/globals": "^30.0.0",
|
|
61
61
|
"@types/jest": "^30.0.0",
|
|
62
62
|
"@types/lodash.chunk": "^4.2.7",
|
|
@@ -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;
|
|
@@ -402,6 +402,8 @@ export class SequencerPublisher {
|
|
|
402
402
|
voteType: VoteType,
|
|
403
403
|
payload: EthAddress,
|
|
404
404
|
base: IEmpireBase,
|
|
405
|
+
signerAddress: EthAddress,
|
|
406
|
+
signer: (msg: `0x${string}`) => Promise<`0x${string}`>,
|
|
405
407
|
): Promise<boolean> {
|
|
406
408
|
if (this.myLastVotes[voteType] >= slotNumber) {
|
|
407
409
|
return false;
|
|
@@ -421,7 +423,12 @@ export class SequencerPublisher {
|
|
|
421
423
|
|
|
422
424
|
const action = voteType === VoteType.GOVERNANCE ? 'governance-vote' : 'slashing-vote';
|
|
423
425
|
|
|
424
|
-
const request = await base.createVoteRequestWithSignature(
|
|
426
|
+
const request = await base.createVoteRequestWithSignature(
|
|
427
|
+
payload.toString(),
|
|
428
|
+
this.config.l1ChainId,
|
|
429
|
+
signerAddress.toString(),
|
|
430
|
+
signer,
|
|
431
|
+
);
|
|
425
432
|
this.log.debug(`Created ${action} request with signature`, {
|
|
426
433
|
request,
|
|
427
434
|
round,
|
|
@@ -472,13 +479,19 @@ export class SequencerPublisher {
|
|
|
472
479
|
* @param voteType - The type of vote to cast.
|
|
473
480
|
* @returns True if the vote was successfully enqueued, false otherwise.
|
|
474
481
|
*/
|
|
475
|
-
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> {
|
|
476
489
|
const voteConfig = await this.getVoteConfig(slotNumber, voteType);
|
|
477
490
|
if (!voteConfig) {
|
|
478
491
|
return false;
|
|
479
492
|
}
|
|
480
493
|
const { payload, base } = voteConfig;
|
|
481
|
-
return this.enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base);
|
|
494
|
+
return this.enqueueCastVoteHelper(slotNumber, timestamp, voteType, payload, base, signerAddress, signer);
|
|
482
495
|
}
|
|
483
496
|
|
|
484
497
|
/**
|
|
@@ -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';
|
|
@@ -346,6 +347,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
346
347
|
// Double check we are good for proposing at the next block before we start operations.
|
|
347
348
|
// We should never fail this check assuming the logic above is good.
|
|
348
349
|
const proposerAddress = proposerInNextSlot ?? EthAddress.ZERO;
|
|
350
|
+
|
|
349
351
|
const canProposeCheck = await this.publisher.canProposeAtNextEthBlock(chainTipArchive.toBuffer(), proposerAddress);
|
|
350
352
|
if (canProposeCheck === undefined) {
|
|
351
353
|
this.log.warn(
|
|
@@ -386,12 +388,16 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
386
388
|
slot,
|
|
387
389
|
newGlobalVariables.timestamp,
|
|
388
390
|
VoteType.GOVERNANCE,
|
|
391
|
+
proposerAddress,
|
|
392
|
+
msg => this.validatorClient!.signWithAddress(proposerAddress, Buffer32.fromString(msg)).then(s => s.toString()),
|
|
389
393
|
);
|
|
390
394
|
|
|
391
395
|
const enqueueSlashingVotePromise = this.publisher.enqueueCastVote(
|
|
392
396
|
slot,
|
|
393
397
|
newGlobalVariables.timestamp,
|
|
394
398
|
VoteType.SLASHING,
|
|
399
|
+
proposerAddress,
|
|
400
|
+
msg => this.validatorClient!.signWithAddress(proposerAddress, Buffer32.fromString(msg)).then(s => s.toString()),
|
|
395
401
|
);
|
|
396
402
|
|
|
397
403
|
this.setState(SequencerState.INITIALIZING_PROPOSAL, slot);
|