@aztec/ethereum 3.0.0-nightly.20251005 → 3.0.0-nightly.20251008
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/config.d.ts.map +1 -1
- package/dest/config.js +5 -0
- package/dest/contracts/governance.js +6 -2
- package/dest/deploy_l1_contracts.d.ts +2 -2
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +14 -3
- package/dest/l1_artifacts.d.ts +1 -1
- package/dest/l1_tx_utils/factory.d.ts +18 -3
- package/dest/l1_tx_utils/factory.d.ts.map +1 -1
- package/dest/l1_tx_utils/factory.js +4 -6
- package/dest/l1_tx_utils/index.d.ts +1 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +1 -0
- package/dest/l1_tx_utils/interfaces.d.ts +76 -0
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
- package/dest/l1_tx_utils/interfaces.js +4 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +18 -3
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +130 -70
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +14 -3
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +4 -6
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +1 -1
- package/dest/l1_tx_utils/types.d.ts +1 -0
- package/dest/l1_tx_utils/types.d.ts.map +1 -1
- package/dest/publisher_manager.d.ts +2 -0
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +11 -1
- package/package.json +5 -5
- package/src/config.ts +5 -0
- package/src/contracts/governance.ts +2 -2
- package/src/deploy_l1_contracts.ts +10 -8
- package/src/l1_tx_utils/factory.ts +35 -15
- package/src/l1_tx_utils/index.ts +1 -0
- package/src/l1_tx_utils/interfaces.ts +86 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +135 -70
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +31 -10
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +1 -1
- package/src/l1_tx_utils/types.ts +1 -0
- package/src/publisher_manager.ts +14 -1
package/src/publisher_manager.ts
CHANGED
|
@@ -28,7 +28,7 @@ const busyStates: TxUtilsState[] = [
|
|
|
28
28
|
export type PublisherFilter<UtilsType extends L1TxUtils> = (utils: UtilsType) => boolean;
|
|
29
29
|
|
|
30
30
|
export class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
31
|
-
private log = createLogger('
|
|
31
|
+
private log = createLogger('publisher:manager');
|
|
32
32
|
private config: { publisherAllowInvalidStates?: boolean };
|
|
33
33
|
|
|
34
34
|
constructor(
|
|
@@ -40,6 +40,11 @@ export class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
|
40
40
|
this.config = pick(config, 'publisherAllowInvalidStates');
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/** Loads the state of all publishers and resumes monitoring any pending txs */
|
|
44
|
+
public async loadState(): Promise<void> {
|
|
45
|
+
await Promise.all(this.publishers.map(pub => pub.loadStateAndResumeMonitoring()));
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
// Finds and prioritises available publishers based on
|
|
44
49
|
// 1. Validity as per the provided filter function
|
|
45
50
|
// 2. Validity based on the state the publisher is in
|
|
@@ -47,6 +52,14 @@ export class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
|
47
52
|
// 4. Then priority based on highest balance
|
|
48
53
|
// 5. Then priority based on least recently used
|
|
49
54
|
public async getAvailablePublisher(filter: PublisherFilter<UtilsType> = () => true): Promise<UtilsType> {
|
|
55
|
+
this.log.debug(`Getting available publisher`, {
|
|
56
|
+
publishers: this.publishers.map(p => ({
|
|
57
|
+
address: p.getSenderAddress(),
|
|
58
|
+
state: p.state,
|
|
59
|
+
lastMined: p.lastMinedAtBlockNumber,
|
|
60
|
+
})),
|
|
61
|
+
});
|
|
62
|
+
|
|
50
63
|
// Extract the valid publishers
|
|
51
64
|
let validPublishers = this.publishers.filter((pub: UtilsType) => !busyStates.includes(pub.state) && filter(pub));
|
|
52
65
|
|