@aztec/ethereum 0.0.1-commit.a072138 → 0.0.1-commit.a4600f49

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.
Files changed (176) hide show
  1. package/dest/client.d.ts +25 -3
  2. package/dest/client.d.ts.map +1 -1
  3. package/dest/client.js +60 -8
  4. package/dest/config.d.ts +29 -8
  5. package/dest/config.d.ts.map +1 -1
  6. package/dest/config.js +69 -14
  7. package/dest/contracts/chain_state_override.d.ts +78 -0
  8. package/dest/contracts/chain_state_override.d.ts.map +1 -0
  9. package/dest/contracts/chain_state_override.js +137 -0
  10. package/dest/contracts/fee_asset_price_oracle.d.ts +105 -0
  11. package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
  12. package/dest/contracts/fee_asset_price_oracle.js +656 -0
  13. package/dest/contracts/governance.d.ts +108 -33
  14. package/dest/contracts/governance.d.ts.map +1 -1
  15. package/dest/contracts/governance.js +196 -15
  16. package/dest/contracts/governance_proposer.d.ts +33 -1
  17. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  18. package/dest/contracts/governance_proposer.js +53 -2
  19. package/dest/contracts/gse.d.ts +4 -2
  20. package/dest/contracts/gse.d.ts.map +1 -1
  21. package/dest/contracts/gse.js +2 -2
  22. package/dest/contracts/inbox.d.ts +3 -3
  23. package/dest/contracts/inbox.d.ts.map +1 -1
  24. package/dest/contracts/inbox.js +12 -7
  25. package/dest/contracts/index.d.ts +4 -3
  26. package/dest/contracts/index.d.ts.map +1 -1
  27. package/dest/contracts/index.js +3 -2
  28. package/dest/contracts/multicall.d.ts +130 -13
  29. package/dest/contracts/multicall.d.ts.map +1 -1
  30. package/dest/contracts/multicall.js +203 -94
  31. package/dest/contracts/outbox.d.ts +27 -4
  32. package/dest/contracts/outbox.d.ts.map +1 -1
  33. package/dest/contracts/outbox.js +34 -7
  34. package/dest/contracts/registry.d.ts +3 -1
  35. package/dest/contracts/registry.d.ts.map +1 -1
  36. package/dest/contracts/registry.js +30 -1
  37. package/dest/contracts/rollup.d.ts +5420 -31
  38. package/dest/contracts/rollup.d.ts.map +1 -1
  39. package/dest/contracts/rollup.js +402 -75
  40. package/dest/contracts/{tally_slashing_proposer.d.ts → slashing_proposer.d.ts} +3 -4
  41. package/dest/contracts/slashing_proposer.d.ts.map +1 -0
  42. package/dest/contracts/{tally_slashing_proposer.js → slashing_proposer.js} +13 -15
  43. package/dest/deploy_aztec_l1_contracts.d.ts +19 -12
  44. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
  45. package/dest/deploy_aztec_l1_contracts.js +54 -35
  46. package/dest/deploy_l1_contract.js +3 -3
  47. package/dest/l1_artifacts.d.ts +15524 -15847
  48. package/dest/l1_artifacts.d.ts.map +1 -1
  49. package/dest/l1_artifacts.js +9 -24
  50. package/dest/l1_contract_addresses.d.ts +61 -65
  51. package/dest/l1_contract_addresses.d.ts.map +1 -1
  52. package/dest/l1_contract_addresses.js +101 -82
  53. package/dest/l1_reader.d.ts +5 -5
  54. package/dest/l1_reader.d.ts.map +1 -1
  55. package/dest/l1_reader.js +9 -7
  56. package/dest/l1_tx_utils/config.d.ts +7 -1
  57. package/dest/l1_tx_utils/config.d.ts.map +1 -1
  58. package/dest/l1_tx_utils/config.js +17 -4
  59. package/dest/l1_tx_utils/factory.d.ts +18 -10
  60. package/dest/l1_tx_utils/factory.d.ts.map +1 -1
  61. package/dest/l1_tx_utils/factory.js +17 -7
  62. package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +1 -1
  63. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +1 -1
  64. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +15 -15
  65. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -1
  66. package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +9 -15
  67. package/dest/l1_tx_utils/index-blobs.d.ts +3 -3
  68. package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -1
  69. package/dest/l1_tx_utils/index-blobs.js +2 -2
  70. package/dest/l1_tx_utils/index.d.ts +2 -1
  71. package/dest/l1_tx_utils/index.d.ts.map +1 -1
  72. package/dest/l1_tx_utils/index.js +1 -0
  73. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +23 -4
  74. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -1
  75. package/dest/l1_tx_utils/l1_fee_analyzer.js +65 -3
  76. package/dest/l1_tx_utils/l1_tx_utils.d.ts +26 -7
  77. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
  78. package/dest/l1_tx_utils/l1_tx_utils.js +179 -82
  79. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +1 -1
  80. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
  81. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +10 -5
  82. package/dest/l1_tx_utils/tx_delayer.d.ts +58 -0
  83. package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
  84. package/dest/{test → l1_tx_utils}/tx_delayer.js +67 -37
  85. package/dest/l1_tx_utils/types.d.ts +27 -1
  86. package/dest/l1_tx_utils/types.d.ts.map +1 -1
  87. package/dest/l1_tx_utils/types.js +10 -0
  88. package/dest/publisher_manager.d.ts +34 -8
  89. package/dest/publisher_manager.d.ts.map +1 -1
  90. package/dest/publisher_manager.js +119 -8
  91. package/dest/queries.d.ts +13 -2
  92. package/dest/queries.d.ts.map +1 -1
  93. package/dest/queries.js +69 -4
  94. package/dest/test/blob_kzg_warmup.d.ts +19 -0
  95. package/dest/test/blob_kzg_warmup.d.ts.map +1 -0
  96. package/dest/test/blob_kzg_warmup.js +64 -0
  97. package/dest/test/chain_monitor.d.ts +55 -4
  98. package/dest/test/chain_monitor.d.ts.map +1 -1
  99. package/dest/test/chain_monitor.js +104 -3
  100. package/dest/test/eth_cheat_codes.d.ts +37 -6
  101. package/dest/test/eth_cheat_codes.d.ts.map +1 -1
  102. package/dest/test/eth_cheat_codes.js +89 -41
  103. package/dest/test/index.d.ts +2 -3
  104. package/dest/test/index.d.ts.map +1 -1
  105. package/dest/test/index.js +1 -2
  106. package/dest/test/rollup_cheat_codes.d.ts +60 -3
  107. package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
  108. package/dest/test/rollup_cheat_codes.js +86 -7
  109. package/dest/test/start_anvil.d.ts +23 -3
  110. package/dest/test/start_anvil.d.ts.map +1 -1
  111. package/dest/test/start_anvil.js +143 -29
  112. package/dest/test/upgrade_utils.js +2 -2
  113. package/dest/utils.d.ts +9 -2
  114. package/dest/utils.d.ts.map +1 -1
  115. package/dest/utils.js +48 -16
  116. package/package.json +6 -9
  117. package/src/client.ts +66 -2
  118. package/src/config.ts +97 -18
  119. package/src/contracts/chain_state_override.ts +200 -0
  120. package/src/contracts/fee_asset_price_oracle.ts +285 -0
  121. package/src/contracts/governance.ts +269 -12
  122. package/src/contracts/governance_proposer.ts +54 -1
  123. package/src/contracts/gse.ts +7 -2
  124. package/src/contracts/inbox.ts +13 -5
  125. package/src/contracts/index.ts +3 -2
  126. package/src/contracts/multicall.ts +247 -106
  127. package/src/contracts/outbox.ts +42 -8
  128. package/src/contracts/registry.ts +31 -1
  129. package/src/contracts/rollup.ts +453 -78
  130. package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +14 -16
  131. package/src/deploy_aztec_l1_contracts.ts +76 -43
  132. package/src/deploy_l1_contract.ts +3 -3
  133. package/src/l1_artifacts.ts +12 -35
  134. package/src/l1_contract_addresses.ts +120 -94
  135. package/src/l1_reader.ts +17 -10
  136. package/src/l1_tx_utils/config.ts +23 -3
  137. package/src/l1_tx_utils/factory.ts +31 -31
  138. package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +1 -1
  139. package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +1 -1
  140. package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +43 -54
  141. package/src/l1_tx_utils/index-blobs.ts +2 -2
  142. package/src/l1_tx_utils/index.ts +1 -0
  143. package/src/l1_tx_utils/l1_fee_analyzer.ts +75 -3
  144. package/src/l1_tx_utils/l1_tx_utils.ts +164 -62
  145. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +10 -5
  146. package/src/{test → l1_tx_utils}/tx_delayer.ts +93 -56
  147. package/src/l1_tx_utils/types.ts +32 -0
  148. package/src/publisher_manager.ts +143 -12
  149. package/src/queries.ts +76 -4
  150. package/src/test/blob_kzg_warmup.ts +65 -0
  151. package/src/test/chain_monitor.ts +148 -3
  152. package/src/test/eth_cheat_codes.ts +82 -45
  153. package/src/test/index.ts +1 -2
  154. package/src/test/rollup_cheat_codes.ts +115 -6
  155. package/src/test/start_anvil.ts +177 -29
  156. package/src/test/upgrade_utils.ts +2 -2
  157. package/src/utils.ts +45 -18
  158. package/dest/contracts/empire_slashing_proposer.d.ts +0 -67
  159. package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
  160. package/dest/contracts/empire_slashing_proposer.js +0 -207
  161. package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
  162. package/dest/generated/l1-contracts-defaults.d.ts +0 -30
  163. package/dest/generated/l1-contracts-defaults.d.ts.map +0 -1
  164. package/dest/generated/l1-contracts-defaults.js +0 -30
  165. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +0 -26
  166. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +0 -1
  167. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +0 -26
  168. package/dest/test/delayed_tx_utils.d.ts +0 -13
  169. package/dest/test/delayed_tx_utils.d.ts.map +0 -1
  170. package/dest/test/delayed_tx_utils.js +0 -28
  171. package/dest/test/tx_delayer.d.ts +0 -36
  172. package/dest/test/tx_delayer.d.ts.map +0 -1
  173. package/src/contracts/empire_slashing_proposer.ts +0 -259
  174. package/src/generated/l1-contracts-defaults.ts +0 -32
  175. package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +0 -77
  176. package/src/test/delayed_tx_utils.ts +0 -52
@@ -1,30 +0,0 @@
1
- /** Default L1 contracts configuration values from network-defaults.yml */
2
- export declare const l1ContractsDefaultEnv: {
3
- readonly ETHEREUM_SLOT_DURATION: 12;
4
- readonly AZTEC_SLOT_DURATION: 36;
5
- readonly AZTEC_EPOCH_DURATION: 32;
6
- readonly AZTEC_TARGET_COMMITTEE_SIZE: 48;
7
- readonly AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: 2;
8
- readonly AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: 2;
9
- readonly AZTEC_ACTIVATION_THRESHOLD: 100000000000000000000;
10
- readonly AZTEC_EJECTION_THRESHOLD: 50000000000000000000;
11
- readonly AZTEC_LOCAL_EJECTION_THRESHOLD: 98000000000000000000;
12
- readonly AZTEC_EXIT_DELAY_SECONDS: 172800;
13
- readonly AZTEC_INBOX_LAG: 1;
14
- readonly AZTEC_PROOF_SUBMISSION_EPOCHS: 1;
15
- readonly AZTEC_MANA_TARGET: 100000000;
16
- readonly AZTEC_PROVING_COST_PER_MANA: 100;
17
- readonly AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000;
18
- readonly AZTEC_SLASHER_FLAVOR: "tally";
19
- readonly AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: 4;
20
- readonly AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 5;
21
- readonly AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS: 0;
22
- readonly AZTEC_SLASHING_OFFSET_IN_ROUNDS: 2;
23
- readonly AZTEC_SLASHING_VETOER: "0x0000000000000000000000000000000000000000";
24
- readonly AZTEC_SLASHING_DISABLE_DURATION: 432000;
25
- readonly AZTEC_SLASH_AMOUNT_SMALL: 10000000000000000000;
26
- readonly AZTEC_SLASH_AMOUNT_MEDIUM: 20000000000000000000;
27
- readonly AZTEC_SLASH_AMOUNT_LARGE: 50000000000000000000;
28
- readonly AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: 300;
29
- };
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDEtY29udHJhY3RzLWRlZmF1bHRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZ2VuZXJhdGVkL2wxLWNvbnRyYWN0cy1kZWZhdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSwwRUFBMEU7QUFDMUUsZUFBTyxNQUFNLHFCQUFxQjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0NBMkJ4QixDQUFDIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"l1-contracts-defaults.d.ts","sourceRoot":"","sources":["../../src/generated/l1-contracts-defaults.ts"],"names":[],"mappings":"AAGA,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BxB,CAAC"}
@@ -1,30 +0,0 @@
1
- // Auto-generated from spartan/environments/network-defaults.yml
2
- // Do not edit manually - run yarn generate to regenerate
3
- /** Default L1 contracts configuration values from network-defaults.yml */ export const l1ContractsDefaultEnv = {
4
- ETHEREUM_SLOT_DURATION: 12,
5
- AZTEC_SLOT_DURATION: 36,
6
- AZTEC_EPOCH_DURATION: 32,
7
- AZTEC_TARGET_COMMITTEE_SIZE: 48,
8
- AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: 2,
9
- AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: 2,
10
- AZTEC_ACTIVATION_THRESHOLD: 100000000000000000000,
11
- AZTEC_EJECTION_THRESHOLD: 50000000000000000000,
12
- AZTEC_LOCAL_EJECTION_THRESHOLD: 98000000000000000000,
13
- AZTEC_EXIT_DELAY_SECONDS: 172800,
14
- AZTEC_INBOX_LAG: 1,
15
- AZTEC_PROOF_SUBMISSION_EPOCHS: 1,
16
- AZTEC_MANA_TARGET: 100000000,
17
- AZTEC_PROVING_COST_PER_MANA: 100,
18
- AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
19
- AZTEC_SLASHER_FLAVOR: 'tally',
20
- AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: 4,
21
- AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 5,
22
- AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS: 0,
23
- AZTEC_SLASHING_OFFSET_IN_ROUNDS: 2,
24
- AZTEC_SLASHING_VETOER: '0x0000000000000000000000000000000000000000',
25
- AZTEC_SLASHING_DISABLE_DURATION: 432000,
26
- AZTEC_SLASH_AMOUNT_SMALL: 10000000000000000000,
27
- AZTEC_SLASH_AMOUNT_MEDIUM: 20000000000000000000,
28
- AZTEC_SLASH_AMOUNT_LARGE: 50000000000000000000,
29
- AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: 300
30
- };
@@ -1,26 +0,0 @@
1
- import type { Logger } from '@aztec/foundation/log';
2
- import { DateProvider } from '@aztec/foundation/timer';
3
- import type { EthSigner } from '../eth-signer/eth-signer.js';
4
- import type { ExtendedViemWalletClient, ViemClient } from '../types.js';
5
- import type { L1TxUtilsConfig } from './config.js';
6
- import type { IL1TxMetrics, IL1TxStore } from './interfaces.js';
7
- import { L1TxUtils } from './l1_tx_utils.js';
8
- import type { L1BlobInputs } from './types.js';
9
- /** Extends L1TxUtils with the capability to cancel blobs. This needs to be a separate class so we don't require a dependency on blob-lib unnecessarily. */
10
- export declare class L1TxUtilsWithBlobs extends L1TxUtils {
11
- /** Makes empty blob inputs for the cancellation tx. */
12
- protected makeEmptyBlobInputs(maxFeePerBlobGas: bigint): Required<L1BlobInputs>;
13
- }
14
- export declare function createL1TxUtilsWithBlobsFromViemWallet(client: ExtendedViemWalletClient, deps?: {
15
- logger?: Logger;
16
- dateProvider?: DateProvider;
17
- store?: IL1TxStore;
18
- metrics?: IL1TxMetrics;
19
- }, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): L1TxUtilsWithBlobs;
20
- export declare function createL1TxUtilsWithBlobsFromEthSigner(client: ViemClient, signer: EthSigner, deps?: {
21
- logger?: Logger;
22
- dateProvider?: DateProvider;
23
- store?: IL1TxStore;
24
- metrics?: IL1TxMetrics;
25
- }, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): L1TxUtilsWithBlobs;
26
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDFfdHhfdXRpbHNfd2l0aF9ibG9icy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2wxX3R4X3V0aWxzL2wxX3R4X3V0aWxzX3dpdGhfYmxvYnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDcEQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBSXZELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLHdCQUF3QixFQUFFLFVBQVUsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDbkQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLFVBQVUsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQ2hFLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUU3QyxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQW1CLE1BQU0sWUFBWSxDQUFDO0FBRWhFLDJKQUEySjtBQUMzSixxQkFBYSxrQkFBbUIsU0FBUSxTQUFTO0lBQy9DLHVEQUF1RDtJQUN2RCxVQUFtQixtQkFBbUIsQ0FBQyxnQkFBZ0IsRUFBRSxNQUFNLEdBQUcs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a,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;AAEhE,2JAA2J;AAC3J,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,uDAAuD;IACvD,UAAmB,mBAAmB,CAAC,gBAAgB,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAIvF;CACF;AAED,wBAAgB,sCAAsC,CACpD,MAAM,EAAE,wBAAwB,EAChC,IAAI,GAAE;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,YAAY,CAAC;CACnB,EACN,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,EACrC,gBAAgB,GAAE,OAAe,sBAalC;AAED,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,IAAI,GAAE;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,YAAY,CAAC;CACnB,EACN,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,EACrC,gBAAgB,GAAE,OAAe,sBAiBlC"}
@@ -1,26 +0,0 @@
1
- import { Blob } from '@aztec/blob-lib';
2
- import { EthAddress } from '@aztec/foundation/eth-address';
3
- import { L1TxUtils } from './l1_tx_utils.js';
4
- import { createViemSigner } from './signer.js';
5
- /** Extends L1TxUtils with the capability to cancel blobs. This needs to be a separate class so we don't require a dependency on blob-lib unnecessarily. */ export class L1TxUtilsWithBlobs extends L1TxUtils {
6
- /** Makes empty blob inputs for the cancellation tx. */ makeEmptyBlobInputs(maxFeePerBlobGas) {
7
- const blobData = new Uint8Array(131072).fill(0);
8
- const kzg = Blob.getViemKzgInstance();
9
- return {
10
- blobs: [
11
- blobData
12
- ],
13
- kzg,
14
- maxFeePerBlobGas
15
- };
16
- }
17
- }
18
- export function createL1TxUtilsWithBlobsFromViemWallet(client, deps = {}, config = {}, debugMaxGasLimit = false) {
19
- return new L1TxUtilsWithBlobs(client, EthAddress.fromString(client.account.address), createViemSigner(client), deps.logger, deps.dateProvider, config, debugMaxGasLimit, deps.store, deps.metrics);
20
- }
21
- export function createL1TxUtilsWithBlobsFromEthSigner(client, signer, deps = {}, config = {}, debugMaxGasLimit = false) {
22
- const callback = async (transaction, _signingAddress)=>{
23
- return (await signer.signTransaction(transaction)).toViemTransactionSignature();
24
- };
25
- return new L1TxUtilsWithBlobs(client, signer.address, callback, deps.logger, deps.dateProvider, config, debugMaxGasLimit, deps.store, deps.metrics);
26
- }
@@ -1,13 +0,0 @@
1
- import { type Logger } from '@aztec/foundation/log';
2
- import { DateProvider } from '@aztec/foundation/timer';
3
- import { type L1TxUtilsConfig } from '../l1_tx_utils/index.js';
4
- import { L1TxUtilsWithBlobs } from '../l1_tx_utils/l1_tx_utils_with_blobs.js';
5
- import type { ExtendedViemWalletClient } from '../types.js';
6
- import { type Delayer } from './tx_delayer.js';
7
- export declare class DelayedTxUtils extends L1TxUtilsWithBlobs {
8
- delayer: Delayer | undefined;
9
- static fromL1TxUtils(l1TxUtils: L1TxUtilsWithBlobs, ethereumSlotDuration: number, wallet: ExtendedViemWalletClient): DelayedTxUtils;
10
- enableDelayer(ethereumSlotDuration: number): void;
11
- }
12
- export declare function createDelayedL1TxUtilsFromViemWallet(client: ExtendedViemWalletClient, logger?: Logger, dateProvider?: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): DelayedTxUtils;
13
- //# sourceMappingURL=data:application/json;base64,ey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
- {"version":3,"file":"delayed_tx_utils.d.ts","sourceRoot":"","sources":["../../src/test/delayed_tx_utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,KAAK,OAAO,EAAe,MAAM,iBAAiB,CAAC;AAE5D,qBAAa,cAAe,SAAQ,kBAAkB;IAC7C,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAEpC,OAAc,aAAa,CACzB,SAAS,EAAE,kBAAkB,EAC7B,oBAAoB,EAAE,MAAM,EAC5B,MAAM,EAAE,wBAAwB,kBASjC;IAEM,aAAa,CAAC,oBAAoB,EAAE,MAAM,QAMhD;CACF;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,wBAAwB,EAChC,MAAM,GAAE,MAAkC,EAC1C,YAAY,GAAE,YAAiC,EAC/C,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,EACjC,gBAAgB,GAAE,OAAe,kBAWlC"}
@@ -1,28 +0,0 @@
1
- import { EthAddress } from '@aztec/foundation/eth-address';
2
- import { createLogger } from '@aztec/foundation/log';
3
- import { DateProvider } from '@aztec/foundation/timer';
4
- import { createViemSigner } from '../l1_tx_utils/index.js';
5
- import { L1TxUtilsWithBlobs } from '../l1_tx_utils/l1_tx_utils_with_blobs.js';
6
- import { withDelayer } from './tx_delayer.js';
7
- export class DelayedTxUtils extends L1TxUtilsWithBlobs {
8
- delayer;
9
- static fromL1TxUtils(l1TxUtils, ethereumSlotDuration, wallet) {
10
- const { client, delayer } = withDelayer(wallet, l1TxUtils.dateProvider, {
11
- ethereumSlotDuration
12
- });
13
- const casted = l1TxUtils;
14
- casted.delayer = delayer;
15
- casted.client = client;
16
- return casted;
17
- }
18
- enableDelayer(ethereumSlotDuration) {
19
- const { client, delayer } = withDelayer(this.client, this.dateProvider, {
20
- ethereumSlotDuration
21
- });
22
- this.delayer = delayer;
23
- this.client = client;
24
- }
25
- }
26
- export function createDelayedL1TxUtilsFromViemWallet(client, logger = createLogger('L1TxUtils'), dateProvider = new DateProvider(), config, debugMaxGasLimit = false) {
27
- return new DelayedTxUtils(client, EthAddress.fromString(client.account.address), createViemSigner(client), logger, dateProvider, config, debugMaxGasLimit);
28
- }
@@ -1,36 +0,0 @@
1
- import { type Logger } from '@aztec/foundation/log';
2
- import type { DateProvider } from '@aztec/foundation/timer';
3
- import { type Client, type Hex } from 'viem';
4
- import { type ViemClient } from '../types.js';
5
- export declare function waitUntilBlock<T extends Client>(client: T, blockNumber: number | bigint, logger?: Logger, timeout?: number): Promise<boolean>;
6
- export declare function waitUntilL1Timestamp<T extends Client>(client: T, timestamp: number | bigint, logger?: Logger, timeout?: number): Promise<boolean>;
7
- export interface Delayer {
8
- /** Returns the hashes of all effectively sent txs. */
9
- getSentTxHashes(): Hex[];
10
- /** Returns the raw hex for all cancelled txs. */
11
- getCancelledTxs(): Hex[];
12
- /** Delays the next tx to be sent so it lands on the given L1 block number. */
13
- pauseNextTxUntilBlock(l1BlockNumber: number | bigint | undefined): void;
14
- /** Delays the next tx to be sent so it lands on the given timestamp. */
15
- pauseNextTxUntilTimestamp(l1Timestamp: number | bigint | undefined): void;
16
- /** Delays the next tx to be sent indefinitely. */
17
- cancelNextTx(): void;
18
- /**
19
- * Sets max inclusion time into slot. If more than this many seconds have passed
20
- * since the last L1 block was mined, then any tx will not be mined in the current
21
- * L1 slot but will be deferred for the next one.
22
- */
23
- setMaxInclusionTimeIntoSlot(seconds: number | bigint | undefined): void;
24
- }
25
- /**
26
- * Returns a new client (without modifying the one passed in) with an injected tx delayer.
27
- * The delayer can be used to hold off the next tx to be sent until a given block number.
28
- * TODO(#10824): This doesn't play along well with blob txs for some reason.
29
- */
30
- export declare function withDelayer<T extends ViemClient>(client: T, dateProvider: DateProvider, opts: {
31
- ethereumSlotDuration: bigint | number;
32
- }): {
33
- client: T;
34
- delayer: Delayer;
35
- };
36
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfZGVsYXllci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3QvdHhfZGVsYXllci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFFbEUsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFHNUQsT0FBTyxFQUNMLEtBQUssTUFBTSxFQUNYLEtBQUssR0FBRyxFQVFULE1BQU0sTUFBTSxDQUFDO0FBRWQsT0FBTyxFQUFFLEtBQUssVUFBVSxFQUFvQixNQUFNLGFBQWEsQ0FBQztBQUloRSx3QkFBZ0IsY0FBYyxDQUFDLENBQUMsU0FBUyxNQUFNLEVBQzdDLE1BQU0sRUFBRSxDQUFDLEVBQ1QsV0FBVyxFQUFFLE1BQU0sR0FBRyxNQUFNLEVBQzVCLE1BQU0sQ0FBQyxFQUFFLE1BQU0sRUFDZixPQUFPLENBQUMsRUFBRSxNQUFNLG9CQWlCakI7QUFFRCx3QkFBZ0Isb0JBQW9CLENBQUMsQ0FBQyxTQUFTLE1BQU0sRUFDbkQsTUFBTSxFQUFFLENBQUMsRUFDVCxTQUFTLEVBQUUsTUFBTSxHQUFHLE1BQU0sRUFDMUIsTUFBTSxDQUFDLEVBQUUsTUFBTSxFQUNmLE9BQU8sQ0FBQyxFQUFFLE1BQU0sb0JBd0JqQjtBQUVELE1BQU0sV0FBVyxPQUFPO0lBQ3RCLHNEQUFzRDtJQU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AAa,CAAC;AAIhE,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,MAAM,EAAE,CAAC,EACT,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,oBAiBjB;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EACnD,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,MAAM,GAAG,MAAM,EAC1B,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,oBAwBjB;AAED,MAAM,WAAW,OAAO;IACtB,sDAAsD;IACtD,eAAe,IAAI,GAAG,EAAE,CAAC;IACzB,iDAAiD;IACjD,eAAe,IAAI,GAAG,EAAE,CAAC;IACzB,8EAA8E;IAC9E,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACxE,wEAAwE;IACxE,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1E,kDAAkD;IAClD,YAAY,IAAI,IAAI,CAAC;IACrB;;;;OAIG;IACH,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CACzE;AA0CD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,EAC9C,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE;IAAE,oBAAoB,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAC9C;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CA0GjC"}
@@ -1,259 +0,0 @@
1
- import { SlotNumber } from '@aztec/foundation/branded-types';
2
- import { EthAddress } from '@aztec/foundation/eth-address';
3
- import { createLogger } from '@aztec/foundation/log';
4
- import { retryUntil } from '@aztec/foundation/retry';
5
- import { EmpireSlashingProposerAbi } from '@aztec/l1-artifacts/EmpireSlashingProposerAbi';
6
-
7
- import EventEmitter from 'events';
8
- import {
9
- type GetContractReturnType,
10
- type Hex,
11
- type Log,
12
- type TypedDataDefinition,
13
- encodeFunctionData,
14
- getContract,
15
- } from 'viem';
16
-
17
- import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
18
- import type { ViemClient } from '../types.js';
19
- import { FormattedViemError, tryExtractEvent } from '../utils.js';
20
- import { type IEmpireBase, encodeSignal, encodeSignalWithSignature, signSignalWithSig } from './empire_base.js';
21
-
22
- export class ProposalAlreadyExecutedError extends Error {
23
- constructor(round: bigint) {
24
- super(`Proposal already executed: ${round}`);
25
- }
26
- }
27
-
28
- export class EmpireSlashingProposerContract extends EventEmitter implements IEmpireBase {
29
- private readonly logger = createLogger('ethereum:contracts:empire_slashing_proposer');
30
- private readonly proposer: GetContractReturnType<typeof EmpireSlashingProposerAbi, ViemClient>;
31
-
32
- public readonly type = 'empire' as const;
33
-
34
- constructor(
35
- public readonly client: ViemClient,
36
- address: Hex | EthAddress,
37
- ) {
38
- super();
39
- this.proposer = getContract({
40
- address: typeof address === 'string' ? address : address.toString(),
41
- abi: EmpireSlashingProposerAbi,
42
- client,
43
- });
44
- }
45
-
46
- public get address() {
47
- return EthAddress.fromString(this.proposer.address);
48
- }
49
-
50
- public getQuorumSize() {
51
- return this.proposer.read.QUORUM_SIZE();
52
- }
53
-
54
- public getRoundSize() {
55
- return this.proposer.read.ROUND_SIZE();
56
- }
57
-
58
- public getLifetimeInRounds() {
59
- return this.proposer.read.LIFETIME_IN_ROUNDS();
60
- }
61
-
62
- public getExecutionDelayInRounds() {
63
- return this.proposer.read.EXECUTION_DELAY_IN_ROUNDS();
64
- }
65
-
66
- public getCurrentRound() {
67
- return this.proposer.read.getCurrentRound();
68
- }
69
-
70
- public computeRound(slot: SlotNumber): Promise<bigint> {
71
- return this.proposer.read.computeRound([BigInt(slot)]);
72
- }
73
-
74
- public getInstance() {
75
- return this.proposer.read.getInstance();
76
- }
77
-
78
- public async getRoundInfo(
79
- rollupAddress: Hex,
80
- round: bigint,
81
- ): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; quorumReached: boolean; executed: boolean }> {
82
- const result = await this.proposer.read.getRoundData([rollupAddress, round]);
83
- const [signalCount, quorum] = await Promise.all([
84
- this.proposer.read.signalCount([rollupAddress, round, result.payloadWithMostSignals]),
85
- this.getQuorumSize(),
86
- ]);
87
- return {
88
- lastSignalSlot: SlotNumber.fromBigInt(result.lastSignalSlot),
89
- payloadWithMostSignals: result.payloadWithMostSignals,
90
- quorumReached: signalCount >= quorum,
91
- executed: result.executed,
92
- };
93
- }
94
-
95
- public getPayloadSignals(rollupAddress: Hex, round: bigint, payload: Hex): Promise<bigint> {
96
- return this.proposer.read.signalCount([rollupAddress, round, payload]);
97
- }
98
-
99
- public createSignalRequest(payload: Hex): L1TxRequest {
100
- return {
101
- to: this.address.toString(),
102
- abi: EmpireSlashingProposerAbi,
103
- data: encodeSignal(payload),
104
- };
105
- }
106
-
107
- public async createSignalRequestWithSignature(
108
- payload: Hex,
109
- slot: SlotNumber,
110
- chainId: number,
111
- signerAddress: Hex,
112
- signer: (msg: TypedDataDefinition) => Promise<Hex>,
113
- ): Promise<L1TxRequest> {
114
- const signature = await signSignalWithSig(
115
- signer,
116
- payload,
117
- slot,
118
- await this.getInstance(),
119
- this.address.toString(),
120
- chainId,
121
- );
122
- return {
123
- to: this.address.toString(),
124
- abi: EmpireSlashingProposerAbi,
125
- data: encodeSignalWithSignature(payload, signature),
126
- };
127
- }
128
-
129
- public listenToSubmittablePayloads(callback: (args: { payload: `0x${string}`; round: bigint }) => unknown) {
130
- return this.proposer.watchEvent.PayloadSubmittable(
131
- {},
132
- {
133
- strict: true,
134
- onLogs: logs => {
135
- for (const log of logs) {
136
- const { payload, round } = log.args;
137
- if (payload && round) {
138
- callback({ payload, round });
139
- }
140
- }
141
- },
142
- },
143
- );
144
- }
145
-
146
- public listenToPayloadSubmitted(callback: (args: { round: bigint; payload: `0x${string}` }) => unknown) {
147
- return this.proposer.watchEvent.PayloadSubmitted(
148
- {},
149
- {
150
- onLogs: logs => {
151
- for (const log of logs) {
152
- const { payload, round } = log.args;
153
- if (round && payload) {
154
- callback({ round, payload });
155
- }
156
- }
157
- },
158
- },
159
- );
160
- }
161
-
162
- public listenToSignalCasted(
163
- callback: (args: { round: bigint; payload: `0x${string}`; signaler: `0x${string}` }) => unknown,
164
- ) {
165
- return this.proposer.watchEvent.SignalCast(
166
- {},
167
- {
168
- onLogs: logs => {
169
- for (const log of logs) {
170
- const { round, payload, signaler } = log.args;
171
- if (round && payload && signaler) {
172
- callback({ round, payload, signaler });
173
- }
174
- }
175
- },
176
- },
177
- );
178
- }
179
-
180
- /** Creates an L1TxRequest to submit the round winner for the given round. */
181
- public buildExecuteRoundRequest(round: bigint): L1TxRequest {
182
- return {
183
- to: this.address.toString(),
184
- abi: EmpireSlashingProposerAbi,
185
- data: encodeFunctionData({
186
- abi: EmpireSlashingProposerAbi,
187
- functionName: 'submitRoundWinner',
188
- args: [round],
189
- }),
190
- };
191
- }
192
-
193
- /** Tries to extract a PayloadSubmitted event from the given logs. */
194
- public tryExtractPayloadSubmittedEvent(logs: Log[]) {
195
- return tryExtractEvent(logs, this.address.toString(), EmpireSlashingProposerAbi, 'PayloadSubmitted');
196
- }
197
-
198
- /**
199
- * Wait for a round to be reached.
200
- *
201
- * @param round - The round to wait for.
202
- * @param pollingIntervalSeconds - The interval in seconds to poll for the round.
203
- * @returns True if the round was reached, false otherwise.
204
- */
205
- public waitForRound(round: bigint, pollingIntervalSeconds: number = 1): Promise<boolean> {
206
- return retryUntil(
207
- async () => {
208
- const currentRound = await this.proposer.read.getCurrentRound().catch(e => {
209
- this.logger.error('Error getting current round', e);
210
- return undefined;
211
- });
212
- return currentRound !== undefined && currentRound >= round;
213
- },
214
- `Waiting for round ${round} to be reached`,
215
- 0, // no timeout
216
- pollingIntervalSeconds,
217
- ).catch(() => false);
218
- }
219
-
220
- public async executeRound(
221
- txUtils: L1TxUtils,
222
- round: bigint | number,
223
- ): ReturnType<typeof txUtils.sendAndMonitorTransaction> {
224
- if (typeof round === 'number') {
225
- round = BigInt(round);
226
- }
227
- const request = this.buildExecuteRoundRequest(round);
228
- const response = await txUtils
229
- .sendAndMonitorTransaction(request, {
230
- // Gas estimation is way off for this, likely because we are creating the contract/selector to call
231
- // for the actual slashing dynamically.
232
- gasLimitBufferPercentage: 50, // +50% gas
233
- })
234
- .catch(err => {
235
- if (err instanceof FormattedViemError && err.message.includes('ProposalAlreadyExecuted')) {
236
- throw new ProposalAlreadyExecutedError(round);
237
- }
238
- throw err;
239
- });
240
-
241
- if (response.receipt.status === 'reverted') {
242
- const args = {
243
- abi: EmpireSlashingProposerAbi,
244
- functionName: 'submitRoundWinner' as const,
245
- args: [round] as const,
246
- address: this.address.toString(),
247
- };
248
- const error = await txUtils.tryGetErrorFromRevertedTx(request.data!, args, undefined, []);
249
- if (error?.includes('ProposalAlreadyExecuted')) {
250
- throw new ProposalAlreadyExecutedError(round);
251
- }
252
- const errorMessage = `Failed to execute round ${round}, TxHash: ${response.receipt.transactionHash}, Error: ${
253
- error ?? 'Unknown error'
254
- }`;
255
- throw new Error(errorMessage);
256
- }
257
- return response;
258
- }
259
- }
@@ -1,32 +0,0 @@
1
- // Auto-generated from spartan/environments/network-defaults.yml
2
- // Do not edit manually - run yarn generate to regenerate
3
-
4
- /** Default L1 contracts configuration values from network-defaults.yml */
5
- export const l1ContractsDefaultEnv = {
6
- ETHEREUM_SLOT_DURATION: 12,
7
- AZTEC_SLOT_DURATION: 36,
8
- AZTEC_EPOCH_DURATION: 32,
9
- AZTEC_TARGET_COMMITTEE_SIZE: 48,
10
- AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: 2,
11
- AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: 2,
12
- AZTEC_ACTIVATION_THRESHOLD: 100000000000000000000,
13
- AZTEC_EJECTION_THRESHOLD: 50000000000000000000,
14
- AZTEC_LOCAL_EJECTION_THRESHOLD: 98000000000000000000,
15
- AZTEC_EXIT_DELAY_SECONDS: 172800,
16
- AZTEC_INBOX_LAG: 1,
17
- AZTEC_PROOF_SUBMISSION_EPOCHS: 1,
18
- AZTEC_MANA_TARGET: 100000000,
19
- AZTEC_PROVING_COST_PER_MANA: 100,
20
- AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
21
- AZTEC_SLASHER_FLAVOR: 'tally',
22
- AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: 4,
23
- AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 5,
24
- AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS: 0,
25
- AZTEC_SLASHING_OFFSET_IN_ROUNDS: 2,
26
- AZTEC_SLASHING_VETOER: '0x0000000000000000000000000000000000000000',
27
- AZTEC_SLASHING_DISABLE_DURATION: 432000,
28
- AZTEC_SLASH_AMOUNT_SMALL: 10000000000000000000,
29
- AZTEC_SLASH_AMOUNT_MEDIUM: 20000000000000000000,
30
- AZTEC_SLASH_AMOUNT_LARGE: 50000000000000000000,
31
- AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: 300,
32
- } as const;
@@ -1,77 +0,0 @@
1
- import { Blob } from '@aztec/blob-lib';
2
- import { EthAddress } from '@aztec/foundation/eth-address';
3
- import type { Logger } from '@aztec/foundation/log';
4
- import { DateProvider } from '@aztec/foundation/timer';
5
-
6
- import type { TransactionSerializable } from 'viem';
7
-
8
- import type { EthSigner } from '../eth-signer/eth-signer.js';
9
- import type { ExtendedViemWalletClient, ViemClient } from '../types.js';
10
- import type { L1TxUtilsConfig } from './config.js';
11
- import type { IL1TxMetrics, IL1TxStore } from './interfaces.js';
12
- import { L1TxUtils } from './l1_tx_utils.js';
13
- import { createViemSigner } from './signer.js';
14
- import type { L1BlobInputs, SigningCallback } from './types.js';
15
-
16
- /** Extends L1TxUtils with the capability to cancel blobs. This needs to be a separate class so we don't require a dependency on blob-lib unnecessarily. */
17
- export class L1TxUtilsWithBlobs extends L1TxUtils {
18
- /** Makes empty blob inputs for the cancellation tx. */
19
- protected override makeEmptyBlobInputs(maxFeePerBlobGas: bigint): Required<L1BlobInputs> {
20
- const blobData = new Uint8Array(131072).fill(0);
21
- const kzg = Blob.getViemKzgInstance();
22
- return { blobs: [blobData], kzg, maxFeePerBlobGas };
23
- }
24
- }
25
-
26
- export function createL1TxUtilsWithBlobsFromViemWallet(
27
- client: ExtendedViemWalletClient,
28
- deps: {
29
- logger?: Logger;
30
- dateProvider?: DateProvider;
31
- store?: IL1TxStore;
32
- metrics?: IL1TxMetrics;
33
- } = {},
34
- config: Partial<L1TxUtilsConfig> = {},
35
- debugMaxGasLimit: boolean = false,
36
- ) {
37
- return new L1TxUtilsWithBlobs(
38
- client,
39
- EthAddress.fromString(client.account.address),
40
- createViemSigner(client),
41
- deps.logger,
42
- deps.dateProvider,
43
- config,
44
- debugMaxGasLimit,
45
- deps.store,
46
- deps.metrics,
47
- );
48
- }
49
-
50
- export function createL1TxUtilsWithBlobsFromEthSigner(
51
- client: ViemClient,
52
- signer: EthSigner,
53
- deps: {
54
- logger?: Logger;
55
- dateProvider?: DateProvider;
56
- store?: IL1TxStore;
57
- metrics?: IL1TxMetrics;
58
- } = {},
59
- config: Partial<L1TxUtilsConfig> = {},
60
- debugMaxGasLimit: boolean = false,
61
- ) {
62
- const callback: SigningCallback = async (transaction: TransactionSerializable, _signingAddress) => {
63
- return (await signer.signTransaction(transaction)).toViemTransactionSignature();
64
- };
65
-
66
- return new L1TxUtilsWithBlobs(
67
- client,
68
- signer.address,
69
- callback,
70
- deps.logger,
71
- deps.dateProvider,
72
- config,
73
- debugMaxGasLimit,
74
- deps.store,
75
- deps.metrics,
76
- );
77
- }
@@ -1,52 +0,0 @@
1
- import { EthAddress } from '@aztec/foundation/eth-address';
2
- import { type Logger, createLogger } from '@aztec/foundation/log';
3
- import { DateProvider } from '@aztec/foundation/timer';
4
-
5
- import { type L1TxUtilsConfig, createViemSigner } from '../l1_tx_utils/index.js';
6
- import { L1TxUtilsWithBlobs } from '../l1_tx_utils/l1_tx_utils_with_blobs.js';
7
- import type { ExtendedViemWalletClient } from '../types.js';
8
- import { type Delayer, withDelayer } from './tx_delayer.js';
9
-
10
- export class DelayedTxUtils extends L1TxUtilsWithBlobs {
11
- public delayer: Delayer | undefined;
12
-
13
- public static fromL1TxUtils(
14
- l1TxUtils: L1TxUtilsWithBlobs,
15
- ethereumSlotDuration: number,
16
- wallet: ExtendedViemWalletClient,
17
- ) {
18
- const { client, delayer } = withDelayer(wallet, l1TxUtils.dateProvider, {
19
- ethereumSlotDuration,
20
- });
21
- const casted = l1TxUtils as unknown as DelayedTxUtils;
22
- casted.delayer = delayer;
23
- casted.client = client;
24
- return casted;
25
- }
26
-
27
- public enableDelayer(ethereumSlotDuration: number) {
28
- const { client, delayer } = withDelayer(this.client, this.dateProvider, {
29
- ethereumSlotDuration,
30
- });
31
- this.delayer = delayer;
32
- this.client = client;
33
- }
34
- }
35
-
36
- export function createDelayedL1TxUtilsFromViemWallet(
37
- client: ExtendedViemWalletClient,
38
- logger: Logger = createLogger('L1TxUtils'),
39
- dateProvider: DateProvider = new DateProvider(),
40
- config?: Partial<L1TxUtilsConfig>,
41
- debugMaxGasLimit: boolean = false,
42
- ) {
43
- return new DelayedTxUtils(
44
- client,
45
- EthAddress.fromString(client.account.address),
46
- createViemSigner(client),
47
- logger,
48
- dateProvider,
49
- config,
50
- debugMaxGasLimit,
51
- );
52
- }