@aztec/sequencer-client 0.87.0 → 0.87.2-nightly.20250523
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.
|
@@ -10,6 +10,8 @@ import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
12
12
|
private log;
|
|
13
|
+
private currentBaseFees;
|
|
14
|
+
private currentL1BlockNumber;
|
|
13
15
|
private readonly rollupContract;
|
|
14
16
|
private readonly publicClient;
|
|
15
17
|
private readonly ethereumSlotDuration;
|
|
@@ -18,8 +20,9 @@ export declare class GlobalVariableBuilder implements GlobalVariableBuilderInter
|
|
|
18
20
|
constructor(config: L1ReaderConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>);
|
|
19
21
|
/**
|
|
20
22
|
* Computes the "current" base fees, e.g., the price that you currently should pay to get include in the next block
|
|
21
|
-
* @returns Base fees for the
|
|
23
|
+
* @returns Base fees for the next block
|
|
22
24
|
*/
|
|
25
|
+
private computeCurrentBaseFees;
|
|
23
26
|
getCurrentBaseFees(): Promise<GasFees>;
|
|
24
27
|
getGlobalConstantVariables(): Promise<Pick<GlobalVariables, 'chainId' | 'version'>>;
|
|
25
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global_builder.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/global_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAIpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KA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C,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;IAUhG;;;;;;;OAOG;IACU,oBAAoB,CAC/B,WAAW,EAAE,EAAE,EACf,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC;CA6B5B"}
|
|
@@ -8,6 +8,8 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
8
8
|
* Simple global variables builder.
|
|
9
9
|
*/ export class GlobalVariableBuilder {
|
|
10
10
|
log = createLogger('sequencer:global_variable_builder');
|
|
11
|
+
currentBaseFees = Promise.resolve(new GasFees(Fr.ZERO, Fr.ZERO));
|
|
12
|
+
currentL1BlockNumber = undefined;
|
|
11
13
|
rollupContract;
|
|
12
14
|
publicClient;
|
|
13
15
|
ethereumSlotDuration;
|
|
@@ -26,8 +28,8 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Computes the "current" base fees, e.g., the price that you currently should pay to get include in the next block
|
|
29
|
-
* @returns Base fees for the
|
|
30
|
-
*/ async
|
|
31
|
+
* @returns Base fees for the next block
|
|
32
|
+
*/ async computeCurrentBaseFees() {
|
|
31
33
|
// Since this might be called in the middle of a slot where a block might have been published,
|
|
32
34
|
// we need to fetch the last block written, and estimate the earliest timestamp for the next block.
|
|
33
35
|
// The timestamp of that last block will act as a lower bound for the next block.
|
|
@@ -37,6 +39,16 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
37
39
|
const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
|
|
38
40
|
return new GasFees(Fr.ZERO, new Fr(await this.rollupContract.getManaBaseFeeAt(timestamp, true)));
|
|
39
41
|
}
|
|
42
|
+
async getCurrentBaseFees() {
|
|
43
|
+
// Get the current block number
|
|
44
|
+
const blockNumber = await this.publicClient.getBlockNumber();
|
|
45
|
+
// If the L1 block number has changed then chain a new promise to get the current base fees
|
|
46
|
+
if (this.currentL1BlockNumber === undefined || blockNumber > this.currentL1BlockNumber) {
|
|
47
|
+
this.currentL1BlockNumber = blockNumber;
|
|
48
|
+
this.currentBaseFees = this.currentBaseFees.then(()=>this.computeCurrentBaseFees());
|
|
49
|
+
}
|
|
50
|
+
return this.currentBaseFees;
|
|
51
|
+
}
|
|
40
52
|
async getGlobalConstantVariables() {
|
|
41
53
|
if (!this.chainId) {
|
|
42
54
|
this.chainId = new Fr(this.publicClient.chain.id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.2-nightly.20250523",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,36 +26,36 @@
|
|
|
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": "0.87.
|
|
30
|
-
"@aztec/bb-prover": "0.87.
|
|
31
|
-
"@aztec/blob-lib": "0.87.
|
|
32
|
-
"@aztec/blob-sink": "0.87.
|
|
33
|
-
"@aztec/constants": "0.87.
|
|
34
|
-
"@aztec/epoch-cache": "0.87.
|
|
35
|
-
"@aztec/ethereum": "0.87.
|
|
36
|
-
"@aztec/foundation": "0.87.
|
|
37
|
-
"@aztec/l1-artifacts": "0.87.
|
|
38
|
-
"@aztec/merkle-tree": "0.87.
|
|
39
|
-
"@aztec/noir-acvm_js": "0.87.
|
|
40
|
-
"@aztec/noir-contracts.js": "0.87.
|
|
41
|
-
"@aztec/noir-protocol-circuits-types": "0.87.
|
|
42
|
-
"@aztec/noir-types": "0.87.
|
|
43
|
-
"@aztec/p2p": "0.87.
|
|
44
|
-
"@aztec/protocol-contracts": "0.87.
|
|
45
|
-
"@aztec/prover-client": "0.87.
|
|
46
|
-
"@aztec/simulator": "0.87.
|
|
47
|
-
"@aztec/stdlib": "0.87.
|
|
48
|
-
"@aztec/telemetry-client": "0.87.
|
|
49
|
-
"@aztec/validator-client": "0.87.
|
|
50
|
-
"@aztec/world-state": "0.87.
|
|
29
|
+
"@aztec/aztec.js": "0.87.2-nightly.20250523",
|
|
30
|
+
"@aztec/bb-prover": "0.87.2-nightly.20250523",
|
|
31
|
+
"@aztec/blob-lib": "0.87.2-nightly.20250523",
|
|
32
|
+
"@aztec/blob-sink": "0.87.2-nightly.20250523",
|
|
33
|
+
"@aztec/constants": "0.87.2-nightly.20250523",
|
|
34
|
+
"@aztec/epoch-cache": "0.87.2-nightly.20250523",
|
|
35
|
+
"@aztec/ethereum": "0.87.2-nightly.20250523",
|
|
36
|
+
"@aztec/foundation": "0.87.2-nightly.20250523",
|
|
37
|
+
"@aztec/l1-artifacts": "0.87.2-nightly.20250523",
|
|
38
|
+
"@aztec/merkle-tree": "0.87.2-nightly.20250523",
|
|
39
|
+
"@aztec/noir-acvm_js": "0.87.2-nightly.20250523",
|
|
40
|
+
"@aztec/noir-contracts.js": "0.87.2-nightly.20250523",
|
|
41
|
+
"@aztec/noir-protocol-circuits-types": "0.87.2-nightly.20250523",
|
|
42
|
+
"@aztec/noir-types": "0.87.2-nightly.20250523",
|
|
43
|
+
"@aztec/p2p": "0.87.2-nightly.20250523",
|
|
44
|
+
"@aztec/protocol-contracts": "0.87.2-nightly.20250523",
|
|
45
|
+
"@aztec/prover-client": "0.87.2-nightly.20250523",
|
|
46
|
+
"@aztec/simulator": "0.87.2-nightly.20250523",
|
|
47
|
+
"@aztec/stdlib": "0.87.2-nightly.20250523",
|
|
48
|
+
"@aztec/telemetry-client": "0.87.2-nightly.20250523",
|
|
49
|
+
"@aztec/validator-client": "0.87.2-nightly.20250523",
|
|
50
|
+
"@aztec/world-state": "0.87.2-nightly.20250523",
|
|
51
51
|
"lodash.chunk": "^4.2.0",
|
|
52
52
|
"lodash.pick": "^4.4.0",
|
|
53
53
|
"tslib": "^2.4.0",
|
|
54
54
|
"viem": "2.23.7"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@aztec/archiver": "0.87.
|
|
58
|
-
"@aztec/kv-store": "0.87.
|
|
57
|
+
"@aztec/archiver": "0.87.2-nightly.20250523",
|
|
58
|
+
"@aztec/kv-store": "0.87.2-nightly.20250523",
|
|
59
59
|
"@jest/globals": "^29.5.0",
|
|
60
60
|
"@types/jest": "^29.5.0",
|
|
61
61
|
"@types/lodash.chunk": "^4.2.7",
|
|
@@ -20,6 +20,8 @@ import { createPublicClient, fallback, http } from 'viem';
|
|
|
20
20
|
*/
|
|
21
21
|
export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
22
22
|
private log = createLogger('sequencer:global_variable_builder');
|
|
23
|
+
private currentBaseFees: Promise<GasFees> = Promise.resolve(new GasFees(Fr.ZERO, Fr.ZERO));
|
|
24
|
+
private currentL1BlockNumber: bigint | undefined = undefined;
|
|
23
25
|
|
|
24
26
|
private readonly rollupContract: RollupContract;
|
|
25
27
|
private readonly publicClient: ViemPublicClient;
|
|
@@ -46,9 +48,9 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
46
48
|
|
|
47
49
|
/**
|
|
48
50
|
* Computes the "current" base fees, e.g., the price that you currently should pay to get include in the next block
|
|
49
|
-
* @returns Base fees for the
|
|
51
|
+
* @returns Base fees for the next block
|
|
50
52
|
*/
|
|
51
|
-
|
|
53
|
+
private async computeCurrentBaseFees(): Promise<GasFees> {
|
|
52
54
|
// Since this might be called in the middle of a slot where a block might have been published,
|
|
53
55
|
// we need to fetch the last block written, and estimate the earliest timestamp for the next block.
|
|
54
56
|
// The timestamp of that last block will act as a lower bound for the next block.
|
|
@@ -61,6 +63,18 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
61
63
|
return new GasFees(Fr.ZERO, new Fr(await this.rollupContract.getManaBaseFeeAt(timestamp, true)));
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
public async getCurrentBaseFees(): Promise<GasFees> {
|
|
67
|
+
// Get the current block number
|
|
68
|
+
const blockNumber = await this.publicClient.getBlockNumber();
|
|
69
|
+
|
|
70
|
+
// If the L1 block number has changed then chain a new promise to get the current base fees
|
|
71
|
+
if (this.currentL1BlockNumber === undefined || blockNumber > this.currentL1BlockNumber) {
|
|
72
|
+
this.currentL1BlockNumber = blockNumber;
|
|
73
|
+
this.currentBaseFees = this.currentBaseFees.then(() => this.computeCurrentBaseFees());
|
|
74
|
+
}
|
|
75
|
+
return this.currentBaseFees;
|
|
76
|
+
}
|
|
77
|
+
|
|
64
78
|
public async getGlobalConstantVariables(): Promise<Pick<GlobalVariables, 'chainId' | 'version'>> {
|
|
65
79
|
if (!this.chainId) {
|
|
66
80
|
this.chainId = new Fr(this.publicClient.chain.id);
|