@aztec/sequencer-client 0.82.2 → 0.82.3-nightly.20250330
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/client/sequencer-client.d.ts +1 -0
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +10 -1
- package/dest/publisher/sequencer-publisher-metrics.d.ts +1 -0
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +35 -0
- package/dest/sequencer/sequencer.d.ts +1 -0
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +6 -3
- package/dest/slasher/slasher_client.js +1 -1
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +0 -4
- package/dest/tx_validator/tx_validator_factory.d.ts +2 -3
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.js +11 -8
- package/package.json +25 -25
- package/src/client/sequencer-client.ts +13 -1
- package/src/publisher/sequencer-publisher-metrics.ts +22 -0
- package/src/sequencer/sequencer.ts +7 -3
- package/src/slasher/slasher_client.ts +1 -1
- package/src/test/index.ts +4 -4
- package/src/tx_validator/tx_validator_factory.ts +19 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-client.d.ts","sourceRoot":"","sources":["../../src/client/sequencer-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;A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WACiB,GAAG,CACrB,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE;QACJ,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;QAC7C,SAAS,EAAE,GAAG,CAAC;QACf,sBAAsB,EAAE,sBAAsB,CAAC;QAC/C,aAAa,EAAE,aAAa,CAAC;QAC7B,kBAAkB,EAAE,kBAAkB,CAAC;QACvC,aAAa,EAAE,aAAa,CAAC;QAC7B,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,SAAS,EAAE,eAAe,CAAC;QAC3B,SAAS,CAAC,EAAE,kBAAkB,CAAC;QAC/B,cAAc,CAAC,EAAE,uBAAuB,CAAC;QACzC,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,SAAS,CAAC,EAAE,kBAAkB,CAAC;KAChC;IAyHH;;;OAGG;IACI,qBAAqB,CAAC,MAAM,EAAE,eAAe;IAIpD;;OAEG;IACU,IAAI;IAIjB,uGAAuG;IAChG,KAAK;IAIZ;;OAEG;IACI,OAAO;IAId,IAAI,QAAQ,IAAI,UAAU,CAEzB;IAED,IAAI,YAAY,IAAI,YAAY,CAE/B;IAED,IAAI,gBAAgB,IAAI,UAAU,CAEjC;IAED,IAAI,gBAAgB,IAAI,UAAU,GAAG,SAAS,CAE7C;IAED,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;CACF"}
|
|
@@ -66,6 +66,11 @@ import { Sequencer } from '../sequencer/index.js';
|
|
|
66
66
|
const globalsBuilder = new GlobalVariableBuilder(config);
|
|
67
67
|
const publicProcessorFactory = new PublicProcessorFactory(contractDataSource, deps.dateProvider, telemetryClient);
|
|
68
68
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
69
|
+
const rollupManaLimit = await rollupContract.getManaLimit();
|
|
70
|
+
const sequencerManaLimit = config.maxL2BlockGas ?? Number(rollupManaLimit);
|
|
71
|
+
if (sequencerManaLimit > Number(rollupManaLimit)) {
|
|
72
|
+
throw new Error(`provided maxL2BlockGas of ${sequencerManaLimit} is greater than the maximum allowed by the L1 (${rollupManaLimit})`);
|
|
73
|
+
}
|
|
69
74
|
// When running in anvil, assume we can post a tx up until the very last second of an L1 slot.
|
|
70
75
|
// Otherwise, assume we must have broadcasted the tx before the slot started (we use a default
|
|
71
76
|
// maxL1TxInclusionTimeIntoSlot of zero) to get the tx into that L1 slot.
|
|
@@ -80,7 +85,8 @@ import { Sequencer } from '../sequencer/index.js';
|
|
|
80
85
|
};
|
|
81
86
|
const sequencer = new Sequencer(publisher, validatorClient, globalsBuilder, p2pClient, worldStateSynchronizer, slasherClient, new LightweightBlockBuilderFactory(telemetryClient), l2BlockSource, l1ToL2MessageSource, publicProcessorFactory, contractDataSource, l1Constants, deps.dateProvider, {
|
|
82
87
|
...config,
|
|
83
|
-
maxL1TxInclusionTimeIntoSlot
|
|
88
|
+
maxL1TxInclusionTimeIntoSlot,
|
|
89
|
+
maxL2BlockGas: sequencerManaLimit
|
|
84
90
|
}, telemetryClient);
|
|
85
91
|
await validatorClient?.start();
|
|
86
92
|
await sequencer.start();
|
|
@@ -117,4 +123,7 @@ import { Sequencer } from '../sequencer/index.js';
|
|
|
117
123
|
get validatorAddress() {
|
|
118
124
|
return this.sequencer.getValidatorAddress();
|
|
119
125
|
}
|
|
126
|
+
get maxL2BlockGas() {
|
|
127
|
+
return this.sequencer.maxL2BlockGas;
|
|
128
|
+
}
|
|
120
129
|
}
|
|
@@ -11,6 +11,7 @@ export declare class SequencerPublisherMetrics {
|
|
|
11
11
|
private txCalldataGas;
|
|
12
12
|
private txBlobDataGasUsed;
|
|
13
13
|
private txBlobDataGasCost;
|
|
14
|
+
private txTotalFee;
|
|
14
15
|
private readonly blobCountHistogram;
|
|
15
16
|
private readonly blobInclusionBlocksHistogram;
|
|
16
17
|
private readonly blobTxSuccessCounter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-publisher-metrics.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher-metrics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAKL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC;AAEjC,qBAAa,yBAAyB;
|
|
1
|
+
{"version":3,"file":"sequencer-publisher-metrics.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher-metrics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAKL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC;AAEjC,qBAAa,yBAAyB;IAsBlC,OAAO,CAAC,MAAM;IArBhB,OAAO,CAAC,QAAQ,CAAY;IAE5B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,cAAc,CAAY;IAClC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,iBAAiB,CAAY;IACrC,OAAO,CAAC,iBAAiB,CAAY;IACrC,OAAO,CAAC,UAAU,CAAY;IAE9B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAY;IAC/C,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAY;IACzD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAgB;IACrD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAgB;IAErD,OAAO,CAAC,aAAa,CAAQ;gBAG3B,MAAM,EAAE,eAAe,EACvB,IAAI,SAAuB,EACnB,MAAM,mCAA8C;IAwF9D,cAAc,CAAC,MAAM,EAAE,QAAQ;IAW/B,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB;IAcnE,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAOtD,OAAO,CAAC,QAAQ;CAuCjB"}
|
|
@@ -11,6 +11,7 @@ export class SequencerPublisherMetrics {
|
|
|
11
11
|
txCalldataGas;
|
|
12
12
|
txBlobDataGasUsed;
|
|
13
13
|
txBlobDataGasCost;
|
|
14
|
+
txTotalFee;
|
|
14
15
|
blobCountHistogram;
|
|
15
16
|
blobInclusionBlocksHistogram;
|
|
16
17
|
blobTxSuccessCounter;
|
|
@@ -73,6 +74,32 @@ export class SequencerPublisherMetrics {
|
|
|
73
74
|
this.blobTxFailureCounter = meter.createUpDownCounter(Metrics.L1_PUBLISHER_BLOB_TX_FAILURE, {
|
|
74
75
|
description: 'Number of failed L1 transactions with blobs'
|
|
75
76
|
});
|
|
77
|
+
this.txTotalFee = meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE, {
|
|
78
|
+
description: 'How much L1 tx costs',
|
|
79
|
+
unit: 'eth',
|
|
80
|
+
valueType: ValueType.DOUBLE,
|
|
81
|
+
advice: {
|
|
82
|
+
explicitBucketBoundaries: [
|
|
83
|
+
0.001,
|
|
84
|
+
0.002,
|
|
85
|
+
0.004,
|
|
86
|
+
0.008,
|
|
87
|
+
0.01,
|
|
88
|
+
0.02,
|
|
89
|
+
0.04,
|
|
90
|
+
0.08,
|
|
91
|
+
0.1,
|
|
92
|
+
0.2,
|
|
93
|
+
0.4,
|
|
94
|
+
0.8,
|
|
95
|
+
1,
|
|
96
|
+
1.2,
|
|
97
|
+
1.4,
|
|
98
|
+
1.8,
|
|
99
|
+
2
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
});
|
|
76
103
|
this.senderBalance = meter.createGauge(Metrics.L1_PUBLISHER_BALANCE, {
|
|
77
104
|
unit: 'eth',
|
|
78
105
|
description: 'The balance of the sender address',
|
|
@@ -125,5 +152,13 @@ export class SequencerPublisherMetrics {
|
|
|
125
152
|
} catch (e) {
|
|
126
153
|
// ignore
|
|
127
154
|
}
|
|
155
|
+
const executionFee = stats.gasUsed * stats.gasPrice;
|
|
156
|
+
const blobFee = stats.blobGasUsed * stats.blobDataGas;
|
|
157
|
+
const totalFee = executionFee + blobFee;
|
|
158
|
+
try {
|
|
159
|
+
this.txTotalFee.record(parseFloat(formatEther(totalFee)));
|
|
160
|
+
} catch (e) {
|
|
161
|
+
// ignore
|
|
162
|
+
}
|
|
128
163
|
}
|
|
129
164
|
}
|
|
@@ -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;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,EAAW,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAGL,KAAK,sBAAsB,EAE5B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,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EAAE,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAiBnG;;;;;;;;OAQG;IACH,QAAQ,CAAC,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe;IAWzF;;;;;;;;;OASG;cACa,UAAU,CACxB,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,EAAE,CAAC,EAC5C,kBAAkB,EAAE,eAAe,EACnC,IAAI,GAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAO;;;;;;;;;IAgIvC;;;;;;;;OAQG;YAIW,2BAA2B;cAkEzB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,GAAG,SAAS,CAAC;IA6CzG;;;OAGG;cAIa,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,YAAY,CAAC,EAAE,SAAS,EAAE,EAC1B,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,IAAI,CAAC;IAiBhB;;;;OAIG;cACa,WAAW,IAAI,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,EAAE,CAAA;KAAE,GAAG,SAAS,CAAC;IAsDxF,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,kBAAkB;IAK1B,IAAI,iBAAiB,WAEpB;IAED,IAAI,QAAQ,IAAI,UAAU,CAEzB;IAED,IAAI,YAAY,IAAI,YAAY,CAE/B;IAED,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;CACF"}
|
|
@@ -19,7 +19,7 @@ import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
|
19
19
|
import { BlockHeader, ContentCommitment, StateReference, Tx } from '@aztec/stdlib/tx';
|
|
20
20
|
import { Attributes, L1Metrics, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
21
21
|
import { VoteType } from '../publisher/sequencer-publisher.js';
|
|
22
|
-
import {
|
|
22
|
+
import { createValidatorForBlockBuilding } from '../tx_validator/tx_validator_factory.js';
|
|
23
23
|
import { getDefaultAllowedSetupFunctions } from './allowed.js';
|
|
24
24
|
import { SequencerMetrics } from './metrics.js';
|
|
25
25
|
import { SequencerTimetable, SequencerTooSlowError } from './timetable.js';
|
|
@@ -370,7 +370,7 @@ export { SequencerState };
|
|
|
370
370
|
now: new Date(this.dateProvider.now()),
|
|
371
371
|
deadline
|
|
372
372
|
});
|
|
373
|
-
const
|
|
373
|
+
const validator = createValidatorForBlockBuilding(publicProcessorDBFork, this.contractDataSource, newGlobalVariables, this.allowedInSetup);
|
|
374
374
|
// TODO(#11000): Public processor should just handle processing, one tx at a time. It should be responsibility
|
|
375
375
|
// of the sequencer to update world state and iterate over txs. We should refactor this along with unifying the
|
|
376
376
|
// publicProcessorFork and orchestratorFork, to avoid doing tree insertions twice when building the block.
|
|
@@ -385,7 +385,7 @@ export { SequencerState };
|
|
|
385
385
|
deadline,
|
|
386
386
|
...proposerLimits
|
|
387
387
|
};
|
|
388
|
-
const [publicProcessorDuration, [processedTxs, failedTxs]] = await elapsed(()=>processor.process(pendingTxs, limits,
|
|
388
|
+
const [publicProcessorDuration, [processedTxs, failedTxs]] = await elapsed(()=>processor.process(pendingTxs, limits, validator));
|
|
389
389
|
if (!opts.validateOnly && failedTxs.length > 0) {
|
|
390
390
|
const failedTxData = failedTxs.map((fail)=>fail.tx);
|
|
391
391
|
const failedTxHashes = await Tx.getHashes(failedTxData);
|
|
@@ -609,6 +609,9 @@ export { SequencerState };
|
|
|
609
609
|
get feeRecipient() {
|
|
610
610
|
return this._feeRecipient;
|
|
611
611
|
}
|
|
612
|
+
get maxL2BlockGas() {
|
|
613
|
+
return this.config.maxL2BlockGas;
|
|
614
|
+
}
|
|
612
615
|
}
|
|
613
616
|
_ts_decorate([
|
|
614
617
|
trackSpan('Sequencer.work')
|
|
@@ -49,7 +49,7 @@ import { createPublicClient, fallback, getAddress, getContract, http } from 'vie
|
|
|
49
49
|
slashingAmount;
|
|
50
50
|
constructor(config, l2BlockSource, telemetry = getTelemetryClient(), log = createLogger('slasher')){
|
|
51
51
|
super(telemetry, 'slasher'), this.config = config, this.l2BlockSource = l2BlockSource, this.log = log, this.slashEvents = [], this.slashFactoryContract = undefined, this.slashingAmount = 0n;
|
|
52
|
-
if (config.l1Contracts.slashFactoryAddress && config.l1Contracts.slashFactoryAddress
|
|
52
|
+
if (config.l1Contracts.slashFactoryAddress && !config.l1Contracts.slashFactoryAddress.equals(EthAddress.ZERO)) {
|
|
53
53
|
const chain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
54
54
|
const publicClient = createPublicClient({
|
|
55
55
|
chain: chain.chainInfo,
|
package/dest/test/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,cAAM,cAAe,SAAQ,SAAS;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,cAAM,cAAe,SAAQ,SAAS;IACrB,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,SAAS,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE,kBAAkB,CAAC;CAC9C;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAE3C,cAAM,oBAAqB,SAAQ,eAAe;IACjC,SAAS,EAAE,aAAa,CAAC;CACzC;AAED,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC"}
|
package/dest/test/index.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { SequencerClient } from '../client/sequencer-client.js';
|
|
2
2
|
import { Sequencer } from '../sequencer/sequencer.js';
|
|
3
3
|
class TestSequencer_ extends Sequencer {
|
|
4
|
-
publicProcessorFactory;
|
|
5
|
-
timetable;
|
|
6
|
-
publisher;
|
|
7
4
|
}
|
|
8
5
|
class TestSequencerClient_ extends SequencerClient {
|
|
9
|
-
sequencer;
|
|
10
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
2
2
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
3
3
|
import type { AllowedElement, ClientProtocolCircuitVerifier, MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
|
|
4
|
-
import { GlobalVariables, type
|
|
4
|
+
import { GlobalVariables, type Tx, type TxValidator } from '@aztec/stdlib/tx';
|
|
5
5
|
import { NullifierCache } from './nullifier_cache.js';
|
|
6
6
|
export declare function createValidatorForAcceptingTxs(db: MerkleTreeReadOperations, contractDataSource: ContractDataSource, verifier: ClientProtocolCircuitVerifier | undefined, { blockNumber, l1ChainId, setupAllowList, gasFees, skipFeeEnforcement, }: {
|
|
7
7
|
blockNumber: number;
|
|
@@ -10,9 +10,8 @@ export declare function createValidatorForAcceptingTxs(db: MerkleTreeReadOperati
|
|
|
10
10
|
gasFees: GasFees;
|
|
11
11
|
skipFeeEnforcement?: boolean;
|
|
12
12
|
}): TxValidator<Tx>;
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function createValidatorForBlockBuilding(db: MerkleTreeReadOperations, contractDataSource: ContractDataSource, globalVariables: GlobalVariables, setupAllowList: AllowedElement[]): {
|
|
14
14
|
preprocessValidator: TxValidator<Tx>;
|
|
15
|
-
postprocessValidator: TxValidator<ProcessedTx>;
|
|
16
15
|
nullifierCache: NullifierCache;
|
|
17
16
|
};
|
|
18
17
|
//# 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":"AAYA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"tx_validator_factory.d.ts","sourceRoot":"","sources":["../../src/tx_validator/tx_validator_factory.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,KAAK,EACV,cAAc,EACd,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI9E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,wBAAgB,8BAA8B,CAC5C,EAAE,EAAE,wBAAwB,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,6BAA6B,GAAG,SAAS,EACnD,EACE,WAAW,EACX,SAAS,EACT,cAAc,EACd,OAAO,EACP,kBAAkB,GACnB,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,cAAc,EAAE,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GACA,WAAW,CAAC,EAAE,CAAC,CAkBjB;AAED,wBAAgB,+BAA+B,CAC7C,EAAE,EAAE,wBAAwB,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAAE,GAC/B;IACD,mBAAmB,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;IACrC,cAAc,EAAE,cAAc,CAAC;CAChC,CAgBA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { MerkleTreeId } from '@aztec/aztec.js';
|
|
1
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { AggregateTxValidator, BlockHeaderTxValidator, DataTxValidator, DoubleSpendTxValidator, MetadataTxValidator, TxProofValidator } from '@aztec/p2p';
|
|
3
4
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
4
|
-
import {
|
|
5
|
+
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
5
6
|
import { ArchiveCache } from './archive_cache.js';
|
|
6
7
|
import { GasTxValidator } from './gas_validator.js';
|
|
7
8
|
import { NullifierCache } from './nullifier_cache.js';
|
|
@@ -22,13 +23,12 @@ export function createValidatorForAcceptingTxs(db, contractDataSource, verifier,
|
|
|
22
23
|
}
|
|
23
24
|
return new AggregateTxValidator(...validators);
|
|
24
25
|
}
|
|
25
|
-
export function
|
|
26
|
+
export function createValidatorForBlockBuilding(db, contractDataSource, globalVariables, setupAllowList) {
|
|
26
27
|
const nullifierCache = new NullifierCache(db);
|
|
27
28
|
const archiveCache = new ArchiveCache(db);
|
|
28
29
|
const publicStateSource = new DatabasePublicStateSource(db);
|
|
29
30
|
return {
|
|
30
31
|
preprocessValidator: preprocessValidator(nullifierCache, archiveCache, publicStateSource, contractDataSource, globalVariables, setupAllowList),
|
|
31
|
-
postprocessValidator: postprocessValidator(nullifierCache),
|
|
32
32
|
nullifierCache
|
|
33
33
|
};
|
|
34
34
|
}
|
|
@@ -37,14 +37,17 @@ class DatabasePublicStateSource {
|
|
|
37
37
|
constructor(db){
|
|
38
38
|
this.db = db;
|
|
39
39
|
}
|
|
40
|
-
storageRead(contractAddress, slot) {
|
|
41
|
-
|
|
40
|
+
async storageRead(contractAddress, slot) {
|
|
41
|
+
const leafSlot = (await computePublicDataTreeLeafSlot(contractAddress, slot)).toBigInt();
|
|
42
|
+
const lowLeafResult = await this.db.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot);
|
|
43
|
+
if (!lowLeafResult || !lowLeafResult.alreadyPresent) {
|
|
44
|
+
return Fr.ZERO;
|
|
45
|
+
}
|
|
46
|
+
const preimage = await this.db.getLeafPreimage(MerkleTreeId.PUBLIC_DATA_TREE, lowLeafResult.index);
|
|
47
|
+
return preimage.value;
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
function preprocessValidator(nullifierCache, archiveCache, publicStateSource, contractDataSource, globalVariables, setupAllowList) {
|
|
45
51
|
// We don't include the TxProofValidator nor the DataTxValidator here because they are already checked by the time we get to block building.
|
|
46
52
|
return new AggregateTxValidator(new MetadataTxValidator(globalVariables.chainId, globalVariables.blockNumber), new DoubleSpendTxValidator(nullifierCache), new PhasesTxValidator(contractDataSource, setupAllowList, globalVariables.blockNumber.toNumber()), new GasTxValidator(publicStateSource, ProtocolContractAddress.FeeJuice, globalVariables.gasFees), new BlockHeaderTxValidator(archiveCache));
|
|
47
53
|
}
|
|
48
|
-
function postprocessValidator(nullifierCache) {
|
|
49
|
-
return new DoubleSpendTxValidator(nullifierCache);
|
|
50
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "0.82.
|
|
3
|
+
"version": "0.82.3-nightly.20250330",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,36 +28,36 @@
|
|
|
28
28
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/aztec.js": "0.82.
|
|
32
|
-
"@aztec/bb-prover": "0.82.
|
|
33
|
-
"@aztec/blob-lib": "0.82.
|
|
34
|
-
"@aztec/blob-sink": "0.82.
|
|
35
|
-
"@aztec/constants": "0.82.
|
|
36
|
-
"@aztec/epoch-cache": "0.82.
|
|
37
|
-
"@aztec/ethereum": "0.82.
|
|
38
|
-
"@aztec/foundation": "0.82.
|
|
39
|
-
"@aztec/l1-artifacts": "0.82.
|
|
40
|
-
"@aztec/merkle-tree": "0.82.
|
|
41
|
-
"@aztec/noir-acvm_js": "0.82.
|
|
42
|
-
"@aztec/noir-contracts.js": "0.82.
|
|
43
|
-
"@aztec/noir-protocol-circuits-types": "0.82.
|
|
44
|
-
"@aztec/noir-types": "0.82.
|
|
45
|
-
"@aztec/p2p": "0.82.
|
|
46
|
-
"@aztec/protocol-contracts": "0.82.
|
|
47
|
-
"@aztec/prover-client": "0.82.
|
|
48
|
-
"@aztec/simulator": "0.82.
|
|
49
|
-
"@aztec/stdlib": "0.82.
|
|
50
|
-
"@aztec/telemetry-client": "0.82.
|
|
51
|
-
"@aztec/validator-client": "0.82.
|
|
52
|
-
"@aztec/world-state": "0.82.
|
|
31
|
+
"@aztec/aztec.js": "0.82.3-nightly.20250330",
|
|
32
|
+
"@aztec/bb-prover": "0.82.3-nightly.20250330",
|
|
33
|
+
"@aztec/blob-lib": "0.82.3-nightly.20250330",
|
|
34
|
+
"@aztec/blob-sink": "0.82.3-nightly.20250330",
|
|
35
|
+
"@aztec/constants": "0.82.3-nightly.20250330",
|
|
36
|
+
"@aztec/epoch-cache": "0.82.3-nightly.20250330",
|
|
37
|
+
"@aztec/ethereum": "0.82.3-nightly.20250330",
|
|
38
|
+
"@aztec/foundation": "0.82.3-nightly.20250330",
|
|
39
|
+
"@aztec/l1-artifacts": "0.82.3-nightly.20250330",
|
|
40
|
+
"@aztec/merkle-tree": "0.82.3-nightly.20250330",
|
|
41
|
+
"@aztec/noir-acvm_js": "0.82.3-nightly.20250330",
|
|
42
|
+
"@aztec/noir-contracts.js": "0.82.3-nightly.20250330",
|
|
43
|
+
"@aztec/noir-protocol-circuits-types": "0.82.3-nightly.20250330",
|
|
44
|
+
"@aztec/noir-types": "0.82.3-nightly.20250330",
|
|
45
|
+
"@aztec/p2p": "0.82.3-nightly.20250330",
|
|
46
|
+
"@aztec/protocol-contracts": "0.82.3-nightly.20250330",
|
|
47
|
+
"@aztec/prover-client": "0.82.3-nightly.20250330",
|
|
48
|
+
"@aztec/simulator": "0.82.3-nightly.20250330",
|
|
49
|
+
"@aztec/stdlib": "0.82.3-nightly.20250330",
|
|
50
|
+
"@aztec/telemetry-client": "0.82.3-nightly.20250330",
|
|
51
|
+
"@aztec/validator-client": "0.82.3-nightly.20250330",
|
|
52
|
+
"@aztec/world-state": "0.82.3-nightly.20250330",
|
|
53
53
|
"lodash.chunk": "^4.2.0",
|
|
54
54
|
"lodash.pick": "^4.4.0",
|
|
55
55
|
"tslib": "^2.4.0",
|
|
56
56
|
"viem": "2.23.7"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@aztec/archiver": "0.82.
|
|
60
|
-
"@aztec/kv-store": "0.82.
|
|
59
|
+
"@aztec/archiver": "0.82.3-nightly.20250330",
|
|
60
|
+
"@aztec/kv-store": "0.82.3-nightly.20250330",
|
|
61
61
|
"@jest/globals": "^29.5.0",
|
|
62
62
|
"@types/jest": "^29.5.0",
|
|
63
63
|
"@types/levelup": "^5.1.2",
|
|
@@ -141,6 +141,14 @@ export class SequencerClient {
|
|
|
141
141
|
|
|
142
142
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
143
143
|
|
|
144
|
+
const rollupManaLimit = await rollupContract.getManaLimit();
|
|
145
|
+
const sequencerManaLimit = config.maxL2BlockGas ?? Number(rollupManaLimit);
|
|
146
|
+
if (sequencerManaLimit > Number(rollupManaLimit)) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
`provided maxL2BlockGas of ${sequencerManaLimit} is greater than the maximum allowed by the L1 (${rollupManaLimit})`,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
144
152
|
// When running in anvil, assume we can post a tx up until the very last second of an L1 slot.
|
|
145
153
|
// Otherwise, assume we must have broadcasted the tx before the slot started (we use a default
|
|
146
154
|
// maxL1TxInclusionTimeIntoSlot of zero) to get the tx into that L1 slot.
|
|
@@ -170,7 +178,7 @@ export class SequencerClient {
|
|
|
170
178
|
contractDataSource,
|
|
171
179
|
l1Constants,
|
|
172
180
|
deps.dateProvider,
|
|
173
|
-
{ ...config, maxL1TxInclusionTimeIntoSlot },
|
|
181
|
+
{ ...config, maxL1TxInclusionTimeIntoSlot, maxL2BlockGas: sequencerManaLimit },
|
|
174
182
|
telemetryClient,
|
|
175
183
|
);
|
|
176
184
|
await validatorClient?.start();
|
|
@@ -220,4 +228,8 @@ export class SequencerClient {
|
|
|
220
228
|
get validatorAddress(): EthAddress | undefined {
|
|
221
229
|
return this.sequencer.getValidatorAddress();
|
|
222
230
|
}
|
|
231
|
+
|
|
232
|
+
get maxL2BlockGas(): number | undefined {
|
|
233
|
+
return this.sequencer.maxL2BlockGas;
|
|
234
|
+
}
|
|
223
235
|
}
|
|
@@ -24,6 +24,7 @@ export class SequencerPublisherMetrics {
|
|
|
24
24
|
private txCalldataGas: Histogram;
|
|
25
25
|
private txBlobDataGasUsed: Histogram;
|
|
26
26
|
private txBlobDataGasCost: Histogram;
|
|
27
|
+
private txTotalFee: Histogram;
|
|
27
28
|
|
|
28
29
|
private readonly blobCountHistogram: Histogram;
|
|
29
30
|
private readonly blobInclusionBlocksHistogram: Histogram;
|
|
@@ -105,6 +106,17 @@ export class SequencerPublisherMetrics {
|
|
|
105
106
|
description: 'Number of failed L1 transactions with blobs',
|
|
106
107
|
});
|
|
107
108
|
|
|
109
|
+
this.txTotalFee = meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE, {
|
|
110
|
+
description: 'How much L1 tx costs',
|
|
111
|
+
unit: 'eth',
|
|
112
|
+
valueType: ValueType.DOUBLE,
|
|
113
|
+
advice: {
|
|
114
|
+
explicitBucketBoundaries: [
|
|
115
|
+
0.001, 0.002, 0.004, 0.008, 0.01, 0.02, 0.04, 0.08, 0.1, 0.2, 0.4, 0.8, 1, 1.2, 1.4, 1.8, 2,
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
|
|
108
120
|
this.senderBalance = meter.createGauge(Metrics.L1_PUBLISHER_BALANCE, {
|
|
109
121
|
unit: 'eth',
|
|
110
122
|
description: 'The balance of the sender address',
|
|
@@ -172,5 +184,15 @@ export class SequencerPublisherMetrics {
|
|
|
172
184
|
} catch (e) {
|
|
173
185
|
// ignore
|
|
174
186
|
}
|
|
187
|
+
|
|
188
|
+
const executionFee = stats.gasUsed * stats.gasPrice;
|
|
189
|
+
const blobFee = stats.blobGasUsed * stats.blobDataGas;
|
|
190
|
+
const totalFee = executionFee + blobFee;
|
|
191
|
+
|
|
192
|
+
try {
|
|
193
|
+
this.txTotalFee.record(parseFloat(formatEther(totalFee)));
|
|
194
|
+
} catch (e) {
|
|
195
|
+
// ignore
|
|
196
|
+
}
|
|
175
197
|
}
|
|
176
198
|
}
|
|
@@ -46,7 +46,7 @@ import type { ValidatorClient } from '@aztec/validator-client';
|
|
|
46
46
|
import type { GlobalVariableBuilder } from '../global_variable_builder/global_builder.js';
|
|
47
47
|
import { type SequencerPublisher, VoteType } from '../publisher/sequencer-publisher.js';
|
|
48
48
|
import type { SlasherClient } from '../slasher/slasher_client.js';
|
|
49
|
-
import {
|
|
49
|
+
import { createValidatorForBlockBuilding } from '../tx_validator/tx_validator_factory.js';
|
|
50
50
|
import { getDefaultAllowedSetupFunctions } from './allowed.js';
|
|
51
51
|
import type { SequencerConfig } from './config.js';
|
|
52
52
|
import { SequencerMetrics } from './metrics.js';
|
|
@@ -465,7 +465,7 @@ export class Sequencer {
|
|
|
465
465
|
deadline,
|
|
466
466
|
});
|
|
467
467
|
|
|
468
|
-
const
|
|
468
|
+
const validator = createValidatorForBlockBuilding(
|
|
469
469
|
publicProcessorDBFork,
|
|
470
470
|
this.contractDataSource,
|
|
471
471
|
newGlobalVariables,
|
|
@@ -482,7 +482,7 @@ export class Sequencer {
|
|
|
482
482
|
};
|
|
483
483
|
const limits = opts.validateOnly ? { deadline } : { deadline, ...proposerLimits };
|
|
484
484
|
const [publicProcessorDuration, [processedTxs, failedTxs]] = await elapsed(() =>
|
|
485
|
-
processor.process(pendingTxs, limits,
|
|
485
|
+
processor.process(pendingTxs, limits, validator),
|
|
486
486
|
);
|
|
487
487
|
|
|
488
488
|
if (!opts.validateOnly && failedTxs.length > 0) {
|
|
@@ -773,4 +773,8 @@ export class Sequencer {
|
|
|
773
773
|
get feeRecipient(): AztecAddress {
|
|
774
774
|
return this._feeRecipient;
|
|
775
775
|
}
|
|
776
|
+
|
|
777
|
+
get maxL2BlockGas(): number | undefined {
|
|
778
|
+
return this.config.maxL2BlockGas;
|
|
779
|
+
}
|
|
776
780
|
}
|
|
@@ -94,7 +94,7 @@ export class SlasherClient extends WithTracer {
|
|
|
94
94
|
) {
|
|
95
95
|
super(telemetry, 'slasher');
|
|
96
96
|
|
|
97
|
-
if (config.l1Contracts.slashFactoryAddress && config.l1Contracts.slashFactoryAddress
|
|
97
|
+
if (config.l1Contracts.slashFactoryAddress && !config.l1Contracts.slashFactoryAddress.equals(EthAddress.ZERO)) {
|
|
98
98
|
const chain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
99
99
|
const publicClient = createPublicClient({
|
|
100
100
|
chain: chain.chainInfo,
|
package/src/test/index.ts
CHANGED
|
@@ -6,15 +6,15 @@ import { Sequencer } from '../sequencer/sequencer.js';
|
|
|
6
6
|
import type { SequencerTimetable } from '../sequencer/timetable.js';
|
|
7
7
|
|
|
8
8
|
class TestSequencer_ extends Sequencer {
|
|
9
|
-
public
|
|
10
|
-
public
|
|
11
|
-
public
|
|
9
|
+
public declare publicProcessorFactory: PublicProcessorFactory;
|
|
10
|
+
public declare timetable: SequencerTimetable;
|
|
11
|
+
public declare publisher: SequencerPublisher;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export type TestSequencer = TestSequencer_;
|
|
15
15
|
|
|
16
16
|
class TestSequencerClient_ extends SequencerClient {
|
|
17
|
-
public
|
|
17
|
+
public declare sequencer: TestSequencer;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export type TestSequencerClient = TestSequencerClient_;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MerkleTreeId } from '@aztec/aztec.js';
|
|
1
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import {
|
|
3
4
|
AggregateTxValidator,
|
|
@@ -8,16 +9,17 @@ import {
|
|
|
8
9
|
TxProofValidator,
|
|
9
10
|
} from '@aztec/p2p';
|
|
10
11
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
11
|
-
import { readPublicState } from '@aztec/simulator/server';
|
|
12
12
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
13
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
14
14
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
15
|
+
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
15
16
|
import type {
|
|
16
17
|
AllowedElement,
|
|
17
18
|
ClientProtocolCircuitVerifier,
|
|
18
19
|
MerkleTreeReadOperations,
|
|
19
20
|
} from '@aztec/stdlib/interfaces/server';
|
|
20
|
-
import
|
|
21
|
+
import type { PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
|
|
22
|
+
import { GlobalVariables, type Tx, type TxValidator } from '@aztec/stdlib/tx';
|
|
21
23
|
|
|
22
24
|
import { ArchiveCache } from './archive_cache.js';
|
|
23
25
|
import { GasTxValidator, type PublicStateSource } from './gas_validator.js';
|
|
@@ -61,14 +63,13 @@ export function createValidatorForAcceptingTxs(
|
|
|
61
63
|
return new AggregateTxValidator(...validators);
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
export function
|
|
66
|
+
export function createValidatorForBlockBuilding(
|
|
65
67
|
db: MerkleTreeReadOperations,
|
|
66
68
|
contractDataSource: ContractDataSource,
|
|
67
69
|
globalVariables: GlobalVariables,
|
|
68
70
|
setupAllowList: AllowedElement[],
|
|
69
71
|
): {
|
|
70
72
|
preprocessValidator: TxValidator<Tx>;
|
|
71
|
-
postprocessValidator: TxValidator<ProcessedTx>;
|
|
72
73
|
nullifierCache: NullifierCache;
|
|
73
74
|
} {
|
|
74
75
|
const nullifierCache = new NullifierCache(db);
|
|
@@ -84,7 +85,6 @@ export function createValidatorsForBlockBuilding(
|
|
|
84
85
|
globalVariables,
|
|
85
86
|
setupAllowList,
|
|
86
87
|
),
|
|
87
|
-
postprocessValidator: postprocessValidator(nullifierCache),
|
|
88
88
|
nullifierCache,
|
|
89
89
|
};
|
|
90
90
|
}
|
|
@@ -92,8 +92,20 @@ export function createValidatorsForBlockBuilding(
|
|
|
92
92
|
class DatabasePublicStateSource implements PublicStateSource {
|
|
93
93
|
constructor(private db: MerkleTreeReadOperations) {}
|
|
94
94
|
|
|
95
|
-
storageRead(contractAddress: AztecAddress, slot: Fr): Promise<Fr> {
|
|
96
|
-
|
|
95
|
+
async storageRead(contractAddress: AztecAddress, slot: Fr): Promise<Fr> {
|
|
96
|
+
const leafSlot = (await computePublicDataTreeLeafSlot(contractAddress, slot)).toBigInt();
|
|
97
|
+
|
|
98
|
+
const lowLeafResult = await this.db.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot);
|
|
99
|
+
if (!lowLeafResult || !lowLeafResult.alreadyPresent) {
|
|
100
|
+
return Fr.ZERO;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const preimage = (await this.db.getLeafPreimage(
|
|
104
|
+
MerkleTreeId.PUBLIC_DATA_TREE,
|
|
105
|
+
lowLeafResult.index,
|
|
106
|
+
)) as PublicDataTreeLeafPreimage;
|
|
107
|
+
|
|
108
|
+
return preimage.value;
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
111
|
|
|
@@ -114,7 +126,3 @@ function preprocessValidator(
|
|
|
114
126
|
new BlockHeaderTxValidator(archiveCache),
|
|
115
127
|
);
|
|
116
128
|
}
|
|
117
|
-
|
|
118
|
-
function postprocessValidator(nullifierCache: NullifierCache): TxValidator<ProcessedTx> {
|
|
119
|
-
return new DoubleSpendTxValidator(nullifierCache);
|
|
120
|
-
}
|