@aztec/ethereum 0.0.0-test.1 → 0.0.1-commit.001888fc
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/account.d.ts +2 -0
- package/dest/account.d.ts.map +1 -0
- package/dest/account.js +4 -0
- package/dest/chain.d.ts +1 -1
- package/dest/client.d.ts +14 -4
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +27 -3
- package/dest/config.d.ts +70 -23
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +155 -34
- package/dest/constants.d.ts +1 -1
- package/dest/contracts/empire_base.d.ts +27 -8
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +75 -2
- package/dest/contracts/empire_slashing_proposer.d.ts +69 -0
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/empire_slashing_proposer.js +216 -0
- package/dest/contracts/errors.d.ts +7 -0
- package/dest/contracts/errors.d.ts.map +1 -0
- package/dest/contracts/errors.js +12 -0
- package/dest/contracts/fee_asset_handler.d.ts +20 -0
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -0
- package/dest/contracts/fee_asset_handler.js +59 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts +101 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
- package/dest/contracts/fee_asset_price_oracle.js +651 -0
- package/dest/contracts/fee_juice.d.ts +6 -7
- package/dest/contracts/fee_juice.d.ts.map +1 -1
- package/dest/contracts/fee_juice.js +27 -20
- package/dest/contracts/governance.d.ts +45 -32
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +98 -85
- package/dest/contracts/governance_proposer.d.ts +19 -13
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +441 -26
- package/dest/contracts/gse.d.ts +32 -0
- package/dest/contracts/gse.d.ts.map +1 -0
- package/dest/contracts/gse.js +72 -0
- package/dest/contracts/inbox.d.ts +47 -0
- package/dest/contracts/inbox.d.ts.map +1 -0
- package/dest/contracts/inbox.js +80 -0
- package/dest/contracts/index.d.ts +12 -3
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +11 -2
- package/dest/contracts/log.d.ts +13 -0
- package/dest/contracts/log.d.ts.map +1 -0
- package/dest/contracts/log.js +1 -0
- package/dest/contracts/multicall.d.ts +21 -0
- package/dest/contracts/multicall.d.ts.map +1 -0
- package/dest/contracts/multicall.js +157 -0
- package/dest/contracts/outbox.d.ts +41 -0
- package/dest/contracts/outbox.d.ts.map +1 -0
- package/dest/contracts/outbox.js +86 -0
- package/dest/contracts/registry.d.ts +12 -5
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/registry.js +74 -17
- package/dest/contracts/rollup.d.ts +311 -53
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +1180 -116
- package/dest/contracts/slasher_contract.d.ts +44 -0
- package/dest/contracts/slasher_contract.d.ts.map +1 -0
- package/dest/contracts/slasher_contract.js +75 -0
- package/dest/contracts/tally_slashing_proposer.d.ts +140 -0
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/tally_slashing_proposer.js +320 -0
- package/dest/contracts/utils.d.ts +3 -0
- package/dest/contracts/utils.d.ts.map +1 -0
- package/dest/contracts/utils.js +11 -0
- package/dest/deploy_aztec_l1_contracts.d.ts +259 -0
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
- package/dest/deploy_aztec_l1_contracts.js +413 -0
- package/dest/deploy_l1_contract.d.ts +68 -0
- package/dest/deploy_l1_contract.d.ts.map +1 -0
- package/dest/deploy_l1_contract.js +312 -0
- package/dest/eth-signer/eth-signer.d.ts +21 -0
- package/dest/eth-signer/eth-signer.d.ts.map +1 -0
- package/dest/eth-signer/eth-signer.js +5 -0
- package/dest/eth-signer/index.d.ts +2 -0
- package/dest/eth-signer/index.d.ts.map +1 -0
- package/dest/eth-signer/index.js +1 -0
- package/dest/forwarder_proxy.d.ts +32 -0
- package/dest/forwarder_proxy.d.ts.map +1 -0
- package/dest/forwarder_proxy.js +93 -0
- package/dest/generated/l1-contracts-defaults.d.ts +30 -0
- package/dest/generated/l1-contracts-defaults.d.ts.map +1 -0
- package/dest/generated/l1-contracts-defaults.js +30 -0
- package/dest/l1_artifacts.d.ts +81744 -0
- package/dest/l1_artifacts.d.ts.map +1 -0
- package/dest/l1_artifacts.js +166 -0
- package/dest/l1_contract_addresses.d.ts +24 -4
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +25 -21
- package/dest/l1_reader.d.ts +6 -2
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +20 -9
- package/dest/l1_tx_utils/config.d.ts +65 -0
- package/dest/l1_tx_utils/config.d.ts.map +1 -0
- package/dest/l1_tx_utils/config.js +109 -0
- package/dest/l1_tx_utils/constants.d.ts +12 -0
- package/dest/l1_tx_utils/constants.d.ts.map +1 -0
- package/dest/l1_tx_utils/constants.js +39 -0
- package/dest/l1_tx_utils/factory.d.ts +32 -0
- package/dest/l1_tx_utils/factory.d.ts.map +1 -0
- package/dest/l1_tx_utils/factory.js +22 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +42 -0
- package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
- package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/index-blobs.js +2 -0
- package/dest/l1_tx_utils/index.d.ts +13 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/index.js +13 -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_fee_analyzer.d.ts +233 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +105 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils.js +639 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +83 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +327 -0
- package/dest/l1_tx_utils/signer.d.ts +4 -0
- package/dest/l1_tx_utils/signer.d.ts.map +1 -0
- package/dest/l1_tx_utils/signer.js +16 -0
- package/dest/l1_tx_utils/tx_delayer.d.ts +56 -0
- package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
- package/dest/l1_tx_utils/tx_delayer.js +221 -0
- package/dest/l1_tx_utils/types.d.ts +67 -0
- package/dest/l1_tx_utils/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/types.js +26 -0
- package/dest/l1_tx_utils/utils.d.ts +4 -0
- package/dest/l1_tx_utils/utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/utils.js +14 -0
- package/dest/l1_types.d.ts +6 -0
- package/dest/l1_types.d.ts.map +1 -0
- package/dest/l1_types.js +1 -0
- package/dest/publisher_manager.d.ts +16 -0
- package/dest/publisher_manager.d.ts.map +1 -0
- package/dest/publisher_manager.js +88 -0
- package/dest/queries.d.ts +5 -3
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +61 -12
- package/dest/test/chain_monitor.d.ts +94 -0
- package/dest/test/chain_monitor.d.ts.map +1 -0
- package/dest/test/chain_monitor.js +244 -0
- package/dest/test/eth_cheat_codes.d.ts +229 -0
- package/dest/test/eth_cheat_codes.d.ts.map +1 -0
- package/dest/test/eth_cheat_codes.js +560 -0
- package/dest/test/eth_cheat_codes_with_state.d.ts +2 -2
- package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes_with_state.js +1 -1
- package/dest/test/index.d.ts +4 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +3 -2
- package/dest/test/rollup_cheat_codes.d.ts +90 -0
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -0
- package/dest/test/rollup_cheat_codes.js +292 -0
- package/dest/test/start_anvil.d.ts +23 -2
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +133 -24
- package/dest/test/upgrade_utils.d.ts +6 -5
- package/dest/test/upgrade_utils.d.ts.map +1 -1
- package/dest/test/upgrade_utils.js +23 -16
- package/dest/types.d.ts +62 -8
- package/dest/types.d.ts.map +1 -1
- package/dest/types.js +3 -1
- package/dest/utils.d.ts +17 -3
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +111 -88
- package/dest/zkPassportVerifierAddress.d.ts +15 -0
- package/dest/zkPassportVerifierAddress.d.ts.map +1 -0
- package/dest/zkPassportVerifierAddress.js +11 -0
- package/package.json +51 -25
- package/src/account.ts +5 -0
- package/src/client.ts +51 -5
- package/src/config.ts +222 -43
- package/src/contracts/README.md +157 -0
- package/src/contracts/empire_base.ts +79 -7
- package/src/contracts/empire_slashing_proposer.ts +265 -0
- package/src/contracts/errors.ts +13 -0
- package/src/contracts/fee_asset_handler.ts +66 -0
- package/src/contracts/fee_asset_price_oracle.ts +280 -0
- package/src/contracts/fee_juice.ts +29 -15
- package/src/contracts/governance.ts +90 -78
- package/src/contracts/governance_proposer.ts +81 -25
- package/src/contracts/gse.ts +88 -0
- package/src/contracts/inbox.ts +115 -0
- package/src/contracts/index.ts +11 -2
- package/src/contracts/log.ts +13 -0
- package/src/contracts/multicall.ts +158 -0
- package/src/contracts/outbox.ts +98 -0
- package/src/contracts/registry.ts +81 -26
- package/src/contracts/rollup.ts +940 -89
- package/src/contracts/slasher_contract.ts +89 -0
- package/src/contracts/tally_slashing_proposer.ts +322 -0
- package/src/contracts/utils.ts +14 -0
- package/src/deploy_aztec_l1_contracts.ts +650 -0
- package/src/deploy_l1_contract.ts +362 -0
- package/src/eth-signer/eth-signer.ts +25 -0
- package/src/eth-signer/index.ts +1 -0
- package/src/forwarder_proxy.ts +108 -0
- package/src/generated/l1-contracts-defaults.ts +32 -0
- package/src/l1_artifacts.ts +254 -0
- package/src/l1_contract_addresses.ts +49 -34
- package/src/l1_reader.ts +30 -10
- package/src/l1_tx_utils/README.md +177 -0
- package/src/l1_tx_utils/config.ts +181 -0
- package/src/l1_tx_utils/constants.ts +29 -0
- package/src/l1_tx_utils/factory.ts +64 -0
- package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
- package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +108 -0
- package/src/l1_tx_utils/index-blobs.ts +2 -0
- package/src/l1_tx_utils/index.ts +15 -0
- package/src/l1_tx_utils/interfaces.ts +86 -0
- package/src/l1_tx_utils/l1_fee_analyzer.ts +803 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +766 -0
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +423 -0
- package/src/l1_tx_utils/signer.ts +28 -0
- package/src/l1_tx_utils/tx_delayer.ts +294 -0
- package/src/l1_tx_utils/types.ts +85 -0
- package/src/l1_tx_utils/utils.ts +16 -0
- package/src/l1_types.ts +6 -0
- package/src/publisher_manager.ts +108 -0
- package/src/queries.ts +82 -16
- package/src/test/chain_monitor.ts +302 -0
- package/src/test/eth_cheat_codes.ts +588 -0
- package/src/test/eth_cheat_codes_with_state.ts +1 -1
- package/src/test/index.ts +3 -2
- package/src/test/rollup_cheat_codes.ts +330 -0
- package/src/test/start_anvil.ts +166 -22
- package/src/test/upgrade_utils.ts +30 -21
- package/src/types.ts +71 -7
- package/src/utils.ts +137 -93
- package/src/zkPassportVerifierAddress.ts +15 -0
- package/dest/contracts/forwarder.d.ts +0 -24
- package/dest/contracts/forwarder.d.ts.map +0 -1
- package/dest/contracts/forwarder.js +0 -101
- package/dest/contracts/slashing_proposer.d.ts +0 -21
- package/dest/contracts/slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/slashing_proposer.js +0 -47
- package/dest/deploy_l1_contracts.d.ts +0 -21210
- package/dest/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.js +0 -687
- package/dest/eth_cheat_codes.d.ts +0 -147
- package/dest/eth_cheat_codes.d.ts.map +0 -1
- package/dest/eth_cheat_codes.js +0 -303
- package/dest/index.d.ts +0 -14
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -13
- package/dest/l1_tx_utils.d.ts +0 -192
- package/dest/l1_tx_utils.d.ts.map +0 -1
- package/dest/l1_tx_utils.js +0 -641
- package/dest/l1_tx_utils_with_blobs.d.ts +0 -12
- package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils_with_blobs.js +0 -64
- package/dest/test/delayed_tx_utils.d.ts +0 -8
- package/dest/test/delayed_tx_utils.d.ts.map +0 -1
- package/dest/test/delayed_tx_utils.js +0 -21
- package/dest/test/tx_delayer.d.ts +0 -25
- package/dest/test/tx_delayer.d.ts.map +0 -1
- package/dest/test/tx_delayer.js +0 -116
- package/src/contracts/forwarder.ts +0 -132
- package/src/contracts/slashing_proposer.ts +0 -51
- package/src/deploy_l1_contracts.ts +0 -948
- package/src/eth_cheat_codes.ts +0 -314
- package/src/index.ts +0 -13
- package/src/l1_tx_utils.ts +0 -847
- package/src/l1_tx_utils_with_blobs.ts +0 -86
- package/src/test/delayed_tx_utils.ts +0 -24
- package/src/test/tx_delayer.ts +0 -163
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { omit } from '@aztec/foundation/collection';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
4
|
+
import { inspect } from 'util';
|
|
5
|
+
import { keccak256, parseTransaction, publicActions, recoverTransactionAddress, serializeTransaction, walletActions } from 'viem';
|
|
6
|
+
const MAX_WAIT_TIME_SECONDS = 180;
|
|
7
|
+
export function waitUntilBlock(client, blockNumber, logger, timeout) {
|
|
8
|
+
const publicClient = 'getBlockNumber' in client && typeof client.getBlockNumber === 'function' ? client : client.extend(publicActions);
|
|
9
|
+
return retryUntil(async ()=>{
|
|
10
|
+
const currentBlockNumber = await publicClient.getBlockNumber({
|
|
11
|
+
cacheTime: 0
|
|
12
|
+
});
|
|
13
|
+
logger?.debug(`Block number is ${currentBlockNumber} (waiting until ${blockNumber})`);
|
|
14
|
+
return currentBlockNumber >= BigInt(blockNumber);
|
|
15
|
+
}, `Wait until L1 block ${blockNumber}`, timeout ?? MAX_WAIT_TIME_SECONDS, 0.1);
|
|
16
|
+
}
|
|
17
|
+
export function waitUntilL1Timestamp(client, timestamp, logger, timeout) {
|
|
18
|
+
const publicClient = 'getBlockNumber' in client && typeof client.getBlockNumber === 'function' ? client : client.extend(publicActions);
|
|
19
|
+
let lastBlock = undefined;
|
|
20
|
+
return retryUntil(async ()=>{
|
|
21
|
+
const currentBlockNumber = await publicClient.getBlockNumber({
|
|
22
|
+
cacheTime: 0
|
|
23
|
+
});
|
|
24
|
+
if (currentBlockNumber === lastBlock) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
lastBlock = currentBlockNumber;
|
|
28
|
+
const currentBlock = await publicClient.getBlock({
|
|
29
|
+
includeTransactions: false,
|
|
30
|
+
blockNumber: currentBlockNumber
|
|
31
|
+
});
|
|
32
|
+
const currentTs = currentBlock.timestamp;
|
|
33
|
+
logger?.debug(`Block timstamp is ${currentTs} (waiting until ${timestamp})`);
|
|
34
|
+
return currentTs >= BigInt(timestamp);
|
|
35
|
+
}, `Wait until L1 timestamp ${timestamp}`, timeout ?? MAX_WAIT_TIME_SECONDS, 0.1);
|
|
36
|
+
}
|
|
37
|
+
/** Manages tx delaying for testing, intercepting sendRawTransaction calls to delay or cancel them. */ export class Delayer {
|
|
38
|
+
dateProvider;
|
|
39
|
+
logger;
|
|
40
|
+
maxInclusionTimeIntoSlot;
|
|
41
|
+
ethereumSlotDuration;
|
|
42
|
+
nextWait;
|
|
43
|
+
sentTxHashes;
|
|
44
|
+
cancelledTxs;
|
|
45
|
+
constructor(dateProvider, opts, bindings){
|
|
46
|
+
this.dateProvider = dateProvider;
|
|
47
|
+
this.maxInclusionTimeIntoSlot = undefined;
|
|
48
|
+
this.nextWait = undefined;
|
|
49
|
+
this.sentTxHashes = [];
|
|
50
|
+
this.cancelledTxs = [];
|
|
51
|
+
this.ethereumSlotDuration = BigInt(opts.ethereumSlotDuration);
|
|
52
|
+
this.logger = createLogger('ethereum:tx_delayer', bindings);
|
|
53
|
+
}
|
|
54
|
+
/** Returns the logger instance used by this delayer. */ getLogger() {
|
|
55
|
+
return this.logger;
|
|
56
|
+
}
|
|
57
|
+
/** Returns the hashes of all effectively sent txs. */ getSentTxHashes() {
|
|
58
|
+
return this.sentTxHashes;
|
|
59
|
+
}
|
|
60
|
+
/** Returns the raw hex for all cancelled txs. */ getCancelledTxs() {
|
|
61
|
+
return this.cancelledTxs;
|
|
62
|
+
}
|
|
63
|
+
/** Delays the next tx to be sent so it lands on the given L1 block number. */ pauseNextTxUntilBlock(l1BlockNumber) {
|
|
64
|
+
this.nextWait = {
|
|
65
|
+
l1BlockNumber: BigInt(l1BlockNumber)
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Delays the next tx to be sent so it lands on the given timestamp. */ pauseNextTxUntilTimestamp(l1Timestamp) {
|
|
69
|
+
this.nextWait = {
|
|
70
|
+
l1Timestamp: BigInt(l1Timestamp)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Delays the next tx to be sent indefinitely. */ cancelNextTx() {
|
|
74
|
+
this.nextWait = {
|
|
75
|
+
indefinitely: true
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Sets max inclusion time into slot. If more than this many seconds have passed
|
|
80
|
+
* since the last L1 block was mined, then any tx will not be mined in the current
|
|
81
|
+
* L1 slot but will be deferred for the next one.
|
|
82
|
+
*/ setMaxInclusionTimeIntoSlot(seconds) {
|
|
83
|
+
this.maxInclusionTimeIntoSlot = seconds;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Creates a new Delayer instance. Exposed so callers can create a single shared delayer
|
|
88
|
+
* and pass it to multiple `wrapClientWithDelayer` calls.
|
|
89
|
+
*/ export function createDelayer(dateProvider, opts, bindings) {
|
|
90
|
+
return new Delayer(dateProvider, opts, bindings);
|
|
91
|
+
}
|
|
92
|
+
/** Tries to recover the sender address from a serialized signed transaction. */ async function tryRecoverSender(serializedTransaction) {
|
|
93
|
+
try {
|
|
94
|
+
return await recoverTransactionAddress({
|
|
95
|
+
serializedTransaction: serializedTransaction
|
|
96
|
+
});
|
|
97
|
+
} catch {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Wraps a viem client with tx delaying logic. Returns the wrapped client.
|
|
103
|
+
* The delayer intercepts sendRawTransaction calls and delays them based on the delayer's state.
|
|
104
|
+
*/ export function wrapClientWithDelayer(client, delayer) {
|
|
105
|
+
const logger = delayer.getLogger();
|
|
106
|
+
// Cast to ExtendedViemWalletClient for the extend chain since it has sendRawTransaction.
|
|
107
|
+
// The sendRawTransaction override is applied to all clients regardless of type.
|
|
108
|
+
const withRawTx = client// Tweak sendRawTransaction so it uses the delay defined in the delayer.
|
|
109
|
+
// Note that this will only work with local accounts (ie accounts for which we have the private key).
|
|
110
|
+
// Transactions signed by the node will not be delayed since they use sendTransaction directly,
|
|
111
|
+
// but we do not use them in our codebase at all.
|
|
112
|
+
.extend((client)=>({
|
|
113
|
+
async sendRawTransaction (...args) {
|
|
114
|
+
let wait;
|
|
115
|
+
let txHash;
|
|
116
|
+
const { serializedTransaction } = args[0];
|
|
117
|
+
const publicClient = client;
|
|
118
|
+
const sender = await tryRecoverSender(serializedTransaction);
|
|
119
|
+
if (delayer.nextWait !== undefined) {
|
|
120
|
+
// Check if we have been instructed to delay the next tx.
|
|
121
|
+
const waitUntil = delayer.nextWait;
|
|
122
|
+
delayer.nextWait = undefined;
|
|
123
|
+
// Compute the tx hash manually so we emulate sendRawTransaction response
|
|
124
|
+
txHash = computeTxHash(serializedTransaction);
|
|
125
|
+
// Cancel tx outright if instructed
|
|
126
|
+
if ('indefinitely' in waitUntil && waitUntil.indefinitely) {
|
|
127
|
+
logger.info(`Cancelling tx ${txHash}`, {
|
|
128
|
+
sender
|
|
129
|
+
});
|
|
130
|
+
delayer.cancelledTxs.push(serializedTransaction);
|
|
131
|
+
return Promise.resolve(txHash);
|
|
132
|
+
}
|
|
133
|
+
// Or wait until the desired block number or timestamp
|
|
134
|
+
wait = 'l1BlockNumber' in waitUntil ? waitUntilBlock(publicClient, waitUntil.l1BlockNumber - 1n, logger) : 'l1Timestamp' in waitUntil ? waitUntilL1Timestamp(publicClient, waitUntil.l1Timestamp - delayer.ethereumSlotDuration, logger) : undefined;
|
|
135
|
+
logger.info(`Delaying tx ${txHash} until ${inspect(waitUntil)}`, {
|
|
136
|
+
sender,
|
|
137
|
+
argsLen: args.length,
|
|
138
|
+
...omit(parseTransaction(serializedTransaction), 'data', 'sidecars')
|
|
139
|
+
});
|
|
140
|
+
} else if (delayer.maxInclusionTimeIntoSlot !== undefined) {
|
|
141
|
+
// Check if we need to delay txs sent too close to the end of the slot.
|
|
142
|
+
const currentBlock = await publicClient.getBlock({
|
|
143
|
+
includeTransactions: false
|
|
144
|
+
});
|
|
145
|
+
const { timestamp: lastBlockTimestamp, number } = currentBlock;
|
|
146
|
+
const now = delayer.dateProvider.now();
|
|
147
|
+
txHash = computeTxHash(serializedTransaction);
|
|
148
|
+
const logData = {
|
|
149
|
+
sender,
|
|
150
|
+
...omit(parseTransaction(serializedTransaction), 'data', 'sidecars'),
|
|
151
|
+
lastBlockTimestamp,
|
|
152
|
+
now,
|
|
153
|
+
maxInclusionTimeIntoSlot: delayer.maxInclusionTimeIntoSlot
|
|
154
|
+
};
|
|
155
|
+
if (now / 1000 - Number(lastBlockTimestamp) > delayer.maxInclusionTimeIntoSlot) {
|
|
156
|
+
// If the last block was mined more than `maxInclusionTimeIntoSlot` seconds ago, then we cannot include
|
|
157
|
+
// any txs in the current slot, so we delay the tx until the next slot.
|
|
158
|
+
logger.info(`Delaying inclusion of tx ${txHash} until the next slot since it was sent too late`, logData);
|
|
159
|
+
wait = waitUntilBlock(publicClient, number + 1n, logger);
|
|
160
|
+
} else {
|
|
161
|
+
logger.debug(`Immediately sending tx ${txHash} as it was received early enough in the slot`, logData);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (wait !== undefined) {
|
|
165
|
+
// Do not await here so we can return the tx hash immediately as if it had been sent on the spot.
|
|
166
|
+
// Instead, delay it so it lands on the desired block number or timestamp, assuming anvil will
|
|
167
|
+
// mine it immediately.
|
|
168
|
+
void wait.then(async ()=>{
|
|
169
|
+
const clientTxHash = await client.sendRawTransaction(...args);
|
|
170
|
+
if (clientTxHash !== txHash) {
|
|
171
|
+
logger.error(`Tx hash returned by the client does not match computed one`, {
|
|
172
|
+
clientTxHash,
|
|
173
|
+
computedTxHash: txHash
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
logger.info(`Sent previously delayed tx ${clientTxHash}`, {
|
|
177
|
+
sender
|
|
178
|
+
});
|
|
179
|
+
delayer.sentTxHashes.push(clientTxHash);
|
|
180
|
+
}).catch((err)=>logger.error(`Error sending tx after delay`, err));
|
|
181
|
+
return Promise.resolve(txHash);
|
|
182
|
+
} else {
|
|
183
|
+
const txHash = await client.sendRawTransaction(...args);
|
|
184
|
+
logger.debug(`Sent tx immediately ${txHash}`, {
|
|
185
|
+
sender
|
|
186
|
+
});
|
|
187
|
+
delayer.sentTxHashes.push(txHash);
|
|
188
|
+
return txHash;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}));
|
|
192
|
+
// Only re-bind wallet actions (sendTransaction, writeContract, deployContract) for wallet clients.
|
|
193
|
+
// This is needed for tests that use wallet actions directly rather than sendRawTransaction.
|
|
194
|
+
const isWalletClient = 'account' in client && client.account !== undefined;
|
|
195
|
+
const extended = isWalletClient ? withRawTx// Re-extend with sendTransaction so it uses the modified sendRawTransaction.
|
|
196
|
+
.extend((client)=>({
|
|
197
|
+
sendTransaction: walletActions(client).sendTransaction
|
|
198
|
+
}))// And with the actions that depend on the modified sendTransaction
|
|
199
|
+
.extend((client)=>({
|
|
200
|
+
writeContract: walletActions(client).writeContract,
|
|
201
|
+
deployContract: walletActions(client).deployContract
|
|
202
|
+
})) : withRawTx;
|
|
203
|
+
return extended;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Compute the tx hash given the serialized tx. Note that if this is a blob tx, we need to
|
|
207
|
+
* exclude the blobs, commitments, and proofs from the hash.
|
|
208
|
+
*/ function computeTxHash(serializedTransaction) {
|
|
209
|
+
if (serializedTransaction.startsWith('0x03')) {
|
|
210
|
+
const parsed = parseTransaction(serializedTransaction);
|
|
211
|
+
if (parsed.blobs || parsed.sidecars) {
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
213
|
+
const { blobs, sidecars, ...rest } = parsed;
|
|
214
|
+
return keccak256(serializeTransaction({
|
|
215
|
+
type: 'eip4844',
|
|
216
|
+
...rest
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return keccak256(serializedTransaction);
|
|
221
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { BlobKzgInstance } from '@aztec/blob-lib/types';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import type { ViemTransactionSignature } from '@aztec/foundation/eth-signature';
|
|
4
|
+
import type { Abi, Address, Hex, TransactionReceipt, TransactionSerializable } from 'viem';
|
|
5
|
+
import type { L1TxUtilsConfig } from './config.js';
|
|
6
|
+
export interface L1TxRequest {
|
|
7
|
+
to: Address | null;
|
|
8
|
+
data?: Hex;
|
|
9
|
+
value?: bigint;
|
|
10
|
+
abi?: Abi;
|
|
11
|
+
}
|
|
12
|
+
export type L1TxConfig = Partial<L1TxUtilsConfig> & {
|
|
13
|
+
gasLimit?: bigint;
|
|
14
|
+
txTimeoutAt?: Date;
|
|
15
|
+
};
|
|
16
|
+
export interface L1BlobInputs {
|
|
17
|
+
blobs: Uint8Array[];
|
|
18
|
+
kzg: BlobKzgInstance;
|
|
19
|
+
maxFeePerBlobGas?: bigint;
|
|
20
|
+
}
|
|
21
|
+
export interface GasPrice {
|
|
22
|
+
maxFeePerGas: bigint;
|
|
23
|
+
maxPriorityFeePerGas: bigint;
|
|
24
|
+
maxFeePerBlobGas?: bigint;
|
|
25
|
+
}
|
|
26
|
+
export type TransactionStats = {
|
|
27
|
+
/** Address of the sender. */
|
|
28
|
+
sender: string;
|
|
29
|
+
/** Hash of the transaction. */
|
|
30
|
+
transactionHash: string;
|
|
31
|
+
/** Size in bytes of the tx calldata */
|
|
32
|
+
calldataSize: number;
|
|
33
|
+
/** Gas required to pay for the calldata inclusion (depends on size and number of zeros) */
|
|
34
|
+
calldataGas: number;
|
|
35
|
+
};
|
|
36
|
+
export declare enum TxUtilsState {
|
|
37
|
+
IDLE = 0,
|
|
38
|
+
SENT = 1,
|
|
39
|
+
SPEED_UP = 2,
|
|
40
|
+
CANCELLED = 3,
|
|
41
|
+
NOT_MINED = 4,
|
|
42
|
+
MINED = 5
|
|
43
|
+
}
|
|
44
|
+
export declare const TerminalTxUtilsState: TxUtilsState[];
|
|
45
|
+
export type L1TxState = {
|
|
46
|
+
id: number;
|
|
47
|
+
txHashes: Hex[];
|
|
48
|
+
cancelTxHashes: Hex[];
|
|
49
|
+
gasLimit: bigint;
|
|
50
|
+
gasPrice: GasPrice;
|
|
51
|
+
txConfigOverrides: L1TxConfig;
|
|
52
|
+
request: L1TxRequest;
|
|
53
|
+
status: TxUtilsState;
|
|
54
|
+
nonce: number;
|
|
55
|
+
sentAtL1Ts: Date;
|
|
56
|
+
lastSentAtL1Ts: Date;
|
|
57
|
+
receipt?: TransactionReceipt;
|
|
58
|
+
blobInputs: L1BlobInputs | undefined;
|
|
59
|
+
};
|
|
60
|
+
export type SigningCallback = (transaction: TransactionSerializable, signingAddress: EthAddress) => Promise<ViemTransactionSignature>;
|
|
61
|
+
export declare class UnknownMinedTxError extends Error {
|
|
62
|
+
constructor(nonce: number, account: string);
|
|
63
|
+
}
|
|
64
|
+
export declare class DroppedTransactionError extends Error {
|
|
65
|
+
constructor(nonce: number, account: string);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sMV90eF91dGlscy90eXBlcy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B,SAAQ,KAAK;IAC5C,YAAY,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAGzC;CACF;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,YAAY,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAGzC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export var TxUtilsState = /*#__PURE__*/ function(TxUtilsState) {
|
|
2
|
+
TxUtilsState[TxUtilsState["IDLE"] = 0] = "IDLE";
|
|
3
|
+
TxUtilsState[TxUtilsState["SENT"] = 1] = "SENT";
|
|
4
|
+
TxUtilsState[TxUtilsState["SPEED_UP"] = 2] = "SPEED_UP";
|
|
5
|
+
TxUtilsState[TxUtilsState["CANCELLED"] = 3] = "CANCELLED";
|
|
6
|
+
TxUtilsState[TxUtilsState["NOT_MINED"] = 4] = "NOT_MINED";
|
|
7
|
+
TxUtilsState[TxUtilsState["MINED"] = 5] = "MINED";
|
|
8
|
+
return TxUtilsState;
|
|
9
|
+
}({});
|
|
10
|
+
export const TerminalTxUtilsState = [
|
|
11
|
+
0,
|
|
12
|
+
5,
|
|
13
|
+
4
|
|
14
|
+
];
|
|
15
|
+
export class UnknownMinedTxError extends Error {
|
|
16
|
+
constructor(nonce, account){
|
|
17
|
+
super(`Nonce ${nonce} from account ${account} is MINED but not by one of our expected transactions`);
|
|
18
|
+
this.name = 'UnknownMinedTxError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export class DroppedTransactionError extends Error {
|
|
22
|
+
constructor(nonce, account){
|
|
23
|
+
super(`Transaction with nonce ${nonce} from account ${account} was dropped from the mempool`);
|
|
24
|
+
this.name = 'DroppedTransactionError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ContractFunctionExecutionError } from 'viem';
|
|
2
|
+
export declare function tryGetCustomErrorNameContractFunction(err: ContractFunctionExecutionError): string;
|
|
3
|
+
export declare function getCalldataGasUsage(data: Uint8Array): number;
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sMV90eF91dGlscy91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEtBQUssRUFBRSw4QkFBOEIsRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUUzRCx3QkFBZ0IscUNBQXFDLENBQUMsR0FBRyxFQUFFLDhCQUE4QixVQUV4RjtBQU9ELHdCQUFnQixtQkFBbUIsQ0FBQyxJQUFJLEVBQUUsVUFBVSxVQUVuRCJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/l1_tx_utils/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,MAAM,CAAC;AAE3D,wBAAgB,qCAAqC,CAAC,GAAG,EAAE,8BAA8B,UAExF;AAOD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,UAEnD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { compactArray } from '@aztec/foundation/collection';
|
|
2
|
+
export function tryGetCustomErrorNameContractFunction(err) {
|
|
3
|
+
return compactArray([
|
|
4
|
+
err.shortMessage,
|
|
5
|
+
...(err.metaMessages ?? []).slice(0, 2).map((s)=>s.trim())
|
|
6
|
+
]).join(' ');
|
|
7
|
+
}
|
|
8
|
+
/*
|
|
9
|
+
* Returns cost of calldata usage in Ethereum.
|
|
10
|
+
* @param data - Calldata.
|
|
11
|
+
* @returns 4 for each zero byte, 16 for each nonzero.
|
|
12
|
+
*/ export function getCalldataGasUsage(data) {
|
|
13
|
+
return data.filter((byte)=>byte === 0).length * 4 + data.filter((byte)=>byte !== 0).length * 16;
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
|
+
export type L1BlockId = {
|
|
3
|
+
l1BlockNumber: bigint;
|
|
4
|
+
l1BlockHash: Buffer32;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDFfdHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9sMV90eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUV6RCxNQUFNLE1BQU0sU0FBUyxHQUFHO0lBQ3RCLGFBQWEsRUFBRSxNQUFNLENBQUM7SUFDdEIsV0FBVyxFQUFFLFFBQVEsQ0FBQztDQUN2QixDQUFDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"l1_types.d.ts","sourceRoot":"","sources":["../src/l1_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,MAAM,SAAS,GAAG;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,QAAQ,CAAC;CACvB,CAAC"}
|
package/dest/l1_types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type LoggerBindings } from '@aztec/foundation/log';
|
|
2
|
+
import { L1TxUtils } from './l1_tx_utils/index.js';
|
|
3
|
+
export type PublisherFilter<UtilsType extends L1TxUtils> = (utils: UtilsType) => boolean;
|
|
4
|
+
export declare class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
5
|
+
private publishers;
|
|
6
|
+
private log;
|
|
7
|
+
private config;
|
|
8
|
+
constructor(publishers: UtilsType[], config: {
|
|
9
|
+
publisherAllowInvalidStates?: boolean;
|
|
10
|
+
}, bindings?: LoggerBindings);
|
|
11
|
+
/** Loads the state of all publishers and resumes monitoring any pending txs */
|
|
12
|
+
loadState(): Promise<void>;
|
|
13
|
+
getAvailablePublisher(filter?: PublisherFilter<UtilsType>): Promise<UtilsType>;
|
|
14
|
+
interrupt(): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGlzaGVyX21hbmFnZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9wdWJsaXNoZXJfbWFuYWdlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQWUsS0FBSyxjQUFjLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFFdkYsT0FBTyxFQUFFLFNBQVMsRUFBZ0IsTUFBTSx3QkFBd0IsQ0FBQztBQXdCakUsTUFBTSxNQUFNLGVBQWUsQ0FBQyxTQUFTLFNBQVMsU0FBUyxJQUFJLENBQUMsS0FBSyxFQUFFLFNBQVMsS0FBSyxPQUFPLENBQUM7QUFFekYscUJBQWEsZ0JBQWdCLENBQUMsU0FBUyxTQUFTLFNBQVMsR0FBRyxTQUFTO0lBS2pFLE9BQU8sQ0FBQyxVQUFVO0lBSnBCLE9BQU8sQ0FBQyxHQUFHLENBQVM7SUFDcEIsT0FBTyxDQUFDLE1BQU0sQ0FBNEM7SUFFMUQsWUFDVSxVQUFVLEVBQUUsU0FBUyxFQUFFLEVBQy9CLE1BQU0sRUFBRTtRQUFFLDJCQUEyQixDQUFDLEVBQUUsT0FBTyxDQUFBO0tBQUUsRUFDakQsUUFBUSxDQUFDLEVBQUUsY0FBYyxFQU0xQjtJQUVELCtFQUErRTtJQUNsRSxTQUFTLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUV0QztJQVFZLHFCQUFxQixDQUFDLE1BQU0sR0FBRSxlQUFlLENBQUMsU0FBUyxDQUFjLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQStDdEc7SUFFTSxTQUFTLFNBRWY7Q0FDRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisher_manager.d.ts","sourceRoot":"","sources":["../src/publisher_manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAEvF,OAAO,EAAE,SAAS,EAAgB,MAAM,wBAAwB,CAAC;AAwBjE,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,SAAS,IAAI,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC;AAEzF,qBAAa,gBAAgB,CAAC,SAAS,SAAS,SAAS,GAAG,SAAS;IAKjE,OAAO,CAAC,UAAU;IAJpB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,MAAM,CAA4C;IAE1D,YACU,UAAU,EAAE,SAAS,EAAE,EAC/B,MAAM,EAAE;QAAE,2BAA2B,CAAC,EAAE,OAAO,CAAA;KAAE,EACjD,QAAQ,CAAC,EAAE,cAAc,EAM1B;IAED,+EAA+E;IAClE,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAEtC;IAQY,qBAAqB,CAAC,MAAM,GAAE,eAAe,CAAC,SAAS,CAAc,GAAG,OAAO,CAAC,SAAS,CAAC,CA+CtG;IAEM,SAAS,SAEf;CACF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { pick } from '@aztec/foundation/collection';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { TxUtilsState } from './l1_tx_utils/index.js';
|
|
4
|
+
// Defines the order in which we prioritise publishers based on their state (first is better)
|
|
5
|
+
const sortOrder = [
|
|
6
|
+
// Always prefer sending from idle publishers
|
|
7
|
+
TxUtilsState.IDLE,
|
|
8
|
+
// Then from publishers that have sent a tx and it got mined
|
|
9
|
+
TxUtilsState.MINED,
|
|
10
|
+
// Then from publishers that have sent a tx but it's in-flight
|
|
11
|
+
TxUtilsState.SPEED_UP,
|
|
12
|
+
TxUtilsState.SENT,
|
|
13
|
+
// We leave cancelled and not-mined states for last, since these represent failures to mines and could be problematic
|
|
14
|
+
TxUtilsState.CANCELLED,
|
|
15
|
+
TxUtilsState.NOT_MINED
|
|
16
|
+
];
|
|
17
|
+
// Which states represent a busy publisher that we should avoid if possible
|
|
18
|
+
const busyStates = [
|
|
19
|
+
TxUtilsState.SENT,
|
|
20
|
+
TxUtilsState.SPEED_UP,
|
|
21
|
+
TxUtilsState.CANCELLED,
|
|
22
|
+
TxUtilsState.NOT_MINED
|
|
23
|
+
];
|
|
24
|
+
export class PublisherManager {
|
|
25
|
+
publishers;
|
|
26
|
+
log;
|
|
27
|
+
config;
|
|
28
|
+
constructor(publishers, config, bindings){
|
|
29
|
+
this.publishers = publishers;
|
|
30
|
+
this.log = createLogger('publisher:manager', bindings);
|
|
31
|
+
this.log.info(`PublisherManager initialized with ${publishers.length} publishers.`);
|
|
32
|
+
this.publishers = publishers;
|
|
33
|
+
this.config = pick(config, 'publisherAllowInvalidStates');
|
|
34
|
+
}
|
|
35
|
+
/** Loads the state of all publishers and resumes monitoring any pending txs */ async loadState() {
|
|
36
|
+
await Promise.all(this.publishers.map((pub)=>pub.loadStateAndResumeMonitoring()));
|
|
37
|
+
}
|
|
38
|
+
// Finds and prioritises available publishers based on
|
|
39
|
+
// 1. Validity as per the provided filter function
|
|
40
|
+
// 2. Validity based on the state the publisher is in
|
|
41
|
+
// 3. Priority based on state as defined by sortOrder
|
|
42
|
+
// 4. Then priority based on highest balance
|
|
43
|
+
// 5. Then priority based on least recently used
|
|
44
|
+
async getAvailablePublisher(filter = ()=>true) {
|
|
45
|
+
this.log.debug(`Getting available publisher`, {
|
|
46
|
+
publishers: this.publishers.map((p)=>({
|
|
47
|
+
address: p.getSenderAddress(),
|
|
48
|
+
state: p.state,
|
|
49
|
+
lastMined: p.lastMinedAtBlockNumber
|
|
50
|
+
}))
|
|
51
|
+
});
|
|
52
|
+
// Extract the valid publishers
|
|
53
|
+
let validPublishers = this.publishers.filter((pub)=>!busyStates.includes(pub.state) && filter(pub));
|
|
54
|
+
// If none found but we allow invalid (busy) states, try again including them
|
|
55
|
+
if (validPublishers.length === 0 && this.config.publisherAllowInvalidStates) {
|
|
56
|
+
this.log.warn(`No valid publishers found. Trying again including invalid states.`);
|
|
57
|
+
validPublishers = this.publishers.filter((pub)=>filter(pub));
|
|
58
|
+
}
|
|
59
|
+
// Error if none found
|
|
60
|
+
if (validPublishers.length === 0) {
|
|
61
|
+
throw new Error(`Failed to find an available publisher.`);
|
|
62
|
+
}
|
|
63
|
+
// Get the balances
|
|
64
|
+
const publishersWithBalance = await Promise.all(validPublishers.map(async (pub)=>{
|
|
65
|
+
return {
|
|
66
|
+
balance: await pub.getSenderBalance(),
|
|
67
|
+
publisher: pub
|
|
68
|
+
};
|
|
69
|
+
}));
|
|
70
|
+
// Sort based on state, then balance, then time since last use
|
|
71
|
+
const sortedPublishers = publishersWithBalance.sort((a, b)=>{
|
|
72
|
+
const stateComparison = sortOrder.indexOf(a.publisher.state) - sortOrder.indexOf(b.publisher.state);
|
|
73
|
+
if (stateComparison !== 0) {
|
|
74
|
+
return stateComparison;
|
|
75
|
+
}
|
|
76
|
+
const balanceComparison = Number(b.balance - a.balance);
|
|
77
|
+
if (balanceComparison !== 0) {
|
|
78
|
+
return balanceComparison;
|
|
79
|
+
}
|
|
80
|
+
const lastUsedComparison = Number((a.publisher.lastMinedAtBlockNumber ?? 0n) - (b.publisher.lastMinedAtBlockNumber ?? 0n));
|
|
81
|
+
return lastUsedComparison;
|
|
82
|
+
});
|
|
83
|
+
return sortedPublishers[0].publisher;
|
|
84
|
+
}
|
|
85
|
+
interrupt() {
|
|
86
|
+
this.publishers.forEach((pub)=>pub.interrupt());
|
|
87
|
+
}
|
|
88
|
+
}
|
package/dest/queries.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { type L1ContractsConfig } from './config.js';
|
|
3
3
|
import type { ViemPublicClient } from './types.js';
|
|
4
4
|
/** Reads the L1ContractsConfig from L1 contracts. */
|
|
5
5
|
export declare function getL1ContractsConfig(publicClient: ViemPublicClient, addresses: {
|
|
@@ -8,5 +8,7 @@ export declare function getL1ContractsConfig(publicClient: ViemPublicClient, add
|
|
|
8
8
|
}): Promise<Omit<L1ContractsConfig, 'ethereumSlotDuration'> & {
|
|
9
9
|
l1StartBlock: bigint;
|
|
10
10
|
l1GenesisTime: bigint;
|
|
11
|
+
rollupVersion: number;
|
|
12
|
+
genesisArchiveTreeRoot: `0x${string}`;
|
|
11
13
|
}>;
|
|
12
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVlcmllcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3F1ZXJpZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRTNELE9BQU8sRUFBNEIsS0FBSyxpQkFBaUIsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUsvRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUVuRCxxREFBcUQ7QUFDckQsd0JBQXNCLG9CQUFvQixDQUN4QyxZQUFZLEVBQUUsZ0JBQWdCLEVBQzlCLFNBQVMsRUFBRTtJQUFFLGlCQUFpQixFQUFFLFVBQVUsQ0FBQztJQUFDLGFBQWEsQ0FBQyxFQUFFLFVBQVUsQ0FBQTtDQUFFLEdBQ3ZFLE9BQU8sQ0FDUixJQUFJLENBQUMsaUJBQWlCLEVBQUUsc0JBQXNCLENBQUMsR0FBRztJQUNoRCxZQUFZLEVBQUUsTUFBTSxDQUFDO0lBQ3JCLGFBQWEsRUFBRSxNQUFNLENBQUM7SUFDdEIsYUFBYSxFQUFFLE1BQU0sQ0FBQztJQUN0QixzQkFBc0IsRUFBRSxLQUFLLE1BQU0sRUFBRSxDQUFDO0NBQ3ZDLENBQ0YsQ0F1R0EifQ==
|
package/dest/queries.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAK/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,qDAAqD;AACrD,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,gBAAgB,EAC9B,SAAS,EAAE;IAAE,iBAAiB,EAAE,UAAU,CAAC;IAAC,aAAa,CAAC,EAAE,UAAU,CAAA;CAAE,GACvE,OAAO,CACR,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,GAAG;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,KAAK,MAAM,EAAE,CAAC;CACvC,CACF,CAuGA"}
|
package/dest/queries.js
CHANGED
|
@@ -1,35 +1,84 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { DefaultL1ContractsConfig } from './config.js';
|
|
3
|
+
import { ReadOnlyGovernanceContract } from './contracts/governance.js';
|
|
4
|
+
import { GovernanceProposerContract } from './contracts/governance_proposer.js';
|
|
5
|
+
import { InboxContract } from './contracts/inbox.js';
|
|
2
6
|
import { RollupContract } from './contracts/rollup.js';
|
|
3
7
|
/** Reads the L1ContractsConfig from L1 contracts. */ export async function getL1ContractsConfig(publicClient, addresses) {
|
|
4
|
-
const governance = new
|
|
5
|
-
const
|
|
6
|
-
const
|
|
8
|
+
const governance = new ReadOnlyGovernanceContract(addresses.governanceAddress.toString(), publicClient);
|
|
9
|
+
const governanceProposerAddress = await governance.getGovernanceProposerAddress();
|
|
10
|
+
const governanceProposer = new GovernanceProposerContract(publicClient, governanceProposerAddress.toString());
|
|
11
|
+
const rollupAddress = addresses.rollupAddress ?? await governanceProposer.getRollupAddress();
|
|
7
12
|
const rollup = new RollupContract(publicClient, rollupAddress.toString());
|
|
8
13
|
const slasherProposer = await rollup.getSlashingProposer();
|
|
9
|
-
const
|
|
14
|
+
const slasher = await rollup.getSlasherContract();
|
|
15
|
+
const rollupAddresses = await rollup.getRollupAddresses();
|
|
16
|
+
const inboxContract = new InboxContract(publicClient, rollupAddresses.inboxAddress.toString());
|
|
17
|
+
const [l1StartBlock, l1GenesisTime, aztecEpochDuration, aztecSlotDuration, aztecProofSubmissionEpochs, aztecTargetCommitteeSize, lagInEpochsForValidatorSet, lagInEpochsForRandao, inboxLag, activationThreshold, ejectionThreshold, localEjectionThreshold, governanceProposerQuorum, governanceProposerRoundSize, slashingQuorum, slashingRoundSize, slashingLifetimeInRounds, slashingExecutionDelayInRounds, slashingOffsetInRounds, slashingAmounts, slashingVetoer, slashingDisableDuration, manaTarget, provingCostPerMana, rollupVersion, genesisArchiveTreeRoot, exitDelay] = await Promise.all([
|
|
10
18
|
rollup.getL1StartBlock(),
|
|
11
19
|
rollup.getL1GenesisTime(),
|
|
12
20
|
rollup.getEpochDuration(),
|
|
13
|
-
rollup.getProofSubmissionWindow(),
|
|
14
21
|
rollup.getSlotDuration(),
|
|
22
|
+
rollup.getProofSubmissionEpochs(),
|
|
15
23
|
rollup.getTargetCommitteeSize(),
|
|
16
|
-
rollup.
|
|
24
|
+
rollup.getLagInEpochsForValidatorSet(),
|
|
25
|
+
rollup.getLagInEpochsForRandao(),
|
|
26
|
+
inboxContract.getLag(),
|
|
27
|
+
rollup.getActivationThreshold(),
|
|
28
|
+
rollup.getEjectionThreshold(),
|
|
29
|
+
rollup.getLocalEjectionThreshold(),
|
|
17
30
|
governanceProposer.getQuorumSize(),
|
|
18
31
|
governanceProposer.getRoundSize(),
|
|
19
|
-
slasherProposer
|
|
20
|
-
slasherProposer
|
|
32
|
+
slasherProposer?.getQuorumSize() ?? 0n,
|
|
33
|
+
slasherProposer?.getRoundSize() ?? 0n,
|
|
34
|
+
slasherProposer?.getLifetimeInRounds() ?? 0n,
|
|
35
|
+
slasherProposer?.getExecutionDelayInRounds() ?? 0n,
|
|
36
|
+
slasherProposer?.type === 'tally' ? slasherProposer.getSlashOffsetInRounds() : 0n,
|
|
37
|
+
slasherProposer?.type === 'tally' ? slasherProposer.getSlashingAmounts() : [
|
|
38
|
+
0n,
|
|
39
|
+
0n,
|
|
40
|
+
0n
|
|
41
|
+
],
|
|
42
|
+
slasher?.getVetoer() ?? EthAddress.ZERO,
|
|
43
|
+
slasher?.getSlashingDisableDuration() ?? 0,
|
|
44
|
+
rollup.getManaTarget(),
|
|
45
|
+
rollup.getProvingCostPerMana(),
|
|
46
|
+
rollup.getVersion(),
|
|
47
|
+
rollup.getGenesisArchiveTreeRoot(),
|
|
48
|
+
rollup.getExitDelay()
|
|
21
49
|
]);
|
|
22
50
|
return {
|
|
23
51
|
l1StartBlock,
|
|
24
52
|
l1GenesisTime,
|
|
25
53
|
aztecEpochDuration: Number(aztecEpochDuration),
|
|
26
|
-
aztecProofSubmissionWindow: Number(aztecProofSubmissionWindow),
|
|
27
54
|
aztecSlotDuration: Number(aztecSlotDuration),
|
|
55
|
+
aztecProofSubmissionEpochs: Number(aztecProofSubmissionEpochs),
|
|
28
56
|
aztecTargetCommitteeSize: Number(aztecTargetCommitteeSize),
|
|
57
|
+
lagInEpochsForValidatorSet: Number(lagInEpochsForValidatorSet),
|
|
58
|
+
lagInEpochsForRandao: Number(lagInEpochsForRandao),
|
|
59
|
+
inboxLag: Number(inboxLag),
|
|
29
60
|
governanceProposerQuorum: Number(governanceProposerQuorum),
|
|
30
61
|
governanceProposerRoundSize: Number(governanceProposerRoundSize),
|
|
31
|
-
|
|
62
|
+
governanceVotingDuration: DefaultL1ContractsConfig.governanceVotingDuration,
|
|
63
|
+
activationThreshold,
|
|
64
|
+
ejectionThreshold,
|
|
65
|
+
localEjectionThreshold,
|
|
32
66
|
slashingQuorum: Number(slashingQuorum),
|
|
33
|
-
|
|
67
|
+
slashingRoundSizeInEpochs: Number(Number(slashingRoundSize) / aztecEpochDuration),
|
|
68
|
+
slashingLifetimeInRounds: Number(slashingLifetimeInRounds),
|
|
69
|
+
slashingExecutionDelayInRounds: Number(slashingExecutionDelayInRounds),
|
|
70
|
+
slashingVetoer,
|
|
71
|
+
slashingDisableDuration,
|
|
72
|
+
manaTarget,
|
|
73
|
+
provingCostPerMana: provingCostPerMana,
|
|
74
|
+
rollupVersion: Number(rollupVersion),
|
|
75
|
+
genesisArchiveTreeRoot: genesisArchiveTreeRoot.toString(),
|
|
76
|
+
exitDelaySeconds: Number(exitDelay),
|
|
77
|
+
slasherFlavor: slasherProposer?.type ?? 'tally',
|
|
78
|
+
slashingOffsetInRounds: Number(slashingOffsetInRounds),
|
|
79
|
+
slashAmountSmall: slashingAmounts[0],
|
|
80
|
+
slashAmountMedium: slashingAmounts[1],
|
|
81
|
+
slashAmountLarge: slashingAmounts[2],
|
|
82
|
+
initialEthPerFeeAsset: DefaultL1ContractsConfig.initialEthPerFeeAsset
|
|
34
83
|
};
|
|
35
84
|
}
|