@aztec/ethereum 2.0.3 → 2.1.0-rc.2

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 (124) hide show
  1. package/dest/config.d.ts +10 -5
  2. package/dest/config.d.ts.map +1 -1
  3. package/dest/config.js +27 -39
  4. package/dest/contracts/empire_base.d.ts +1 -1
  5. package/dest/contracts/empire_base.d.ts.map +1 -1
  6. package/dest/contracts/empire_slashing_proposer.d.ts +1 -1
  7. package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
  8. package/dest/contracts/fee_asset_handler.d.ts +3 -3
  9. package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
  10. package/dest/contracts/governance.js +7 -3
  11. package/dest/contracts/governance_proposer.d.ts +1 -2
  12. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  13. package/dest/contracts/governance_proposer.js +1 -2
  14. package/dest/contracts/multicall.d.ts +3 -5
  15. package/dest/contracts/multicall.d.ts.map +1 -1
  16. package/dest/contracts/multicall.js +6 -4
  17. package/dest/contracts/rollup.d.ts +13 -14
  18. package/dest/contracts/rollup.d.ts.map +1 -1
  19. package/dest/contracts/rollup.js +25 -67
  20. package/dest/contracts/slasher_contract.d.ts +10 -0
  21. package/dest/contracts/slasher_contract.d.ts.map +1 -1
  22. package/dest/contracts/slasher_contract.js +18 -0
  23. package/dest/deploy_l1_contracts.d.ts +18 -4
  24. package/dest/deploy_l1_contracts.d.ts.map +1 -1
  25. package/dest/deploy_l1_contracts.js +316 -159
  26. package/dest/index.d.ts +1 -1
  27. package/dest/index.d.ts.map +1 -1
  28. package/dest/index.js +1 -1
  29. package/dest/l1_artifacts.d.ts +8019 -5948
  30. package/dest/l1_artifacts.d.ts.map +1 -1
  31. package/dest/l1_artifacts.js +6 -1
  32. package/dest/l1_contract_addresses.d.ts +5 -1
  33. package/dest/l1_contract_addresses.d.ts.map +1 -1
  34. package/dest/l1_contract_addresses.js +2 -1
  35. package/dest/l1_tx_utils/config.d.ts +59 -0
  36. package/dest/l1_tx_utils/config.d.ts.map +1 -0
  37. package/dest/l1_tx_utils/config.js +73 -0
  38. package/dest/l1_tx_utils/constants.d.ts +6 -0
  39. package/dest/l1_tx_utils/constants.d.ts.map +1 -0
  40. package/dest/l1_tx_utils/constants.js +14 -0
  41. package/dest/l1_tx_utils/factory.d.ts +24 -0
  42. package/dest/l1_tx_utils/factory.d.ts.map +1 -0
  43. package/dest/l1_tx_utils/factory.js +12 -0
  44. package/dest/l1_tx_utils/index.d.ts +10 -0
  45. package/dest/l1_tx_utils/index.d.ts.map +1 -0
  46. package/dest/l1_tx_utils/index.js +10 -0
  47. package/dest/l1_tx_utils/interfaces.d.ts +76 -0
  48. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
  49. package/dest/l1_tx_utils/interfaces.js +4 -0
  50. package/dest/l1_tx_utils/l1_tx_utils.d.ts +95 -0
  51. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
  52. package/dest/l1_tx_utils/l1_tx_utils.js +610 -0
  53. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +26 -0
  54. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
  55. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +26 -0
  56. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +81 -0
  57. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
  58. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +294 -0
  59. package/dest/l1_tx_utils/signer.d.ts +4 -0
  60. package/dest/l1_tx_utils/signer.d.ts.map +1 -0
  61. package/dest/l1_tx_utils/signer.js +16 -0
  62. package/dest/l1_tx_utils/types.d.ts +67 -0
  63. package/dest/l1_tx_utils/types.d.ts.map +1 -0
  64. package/dest/l1_tx_utils/types.js +26 -0
  65. package/dest/l1_tx_utils/utils.d.ts +4 -0
  66. package/dest/l1_tx_utils/utils.d.ts.map +1 -0
  67. package/dest/l1_tx_utils/utils.js +14 -0
  68. package/dest/publisher_manager.d.ts +7 -2
  69. package/dest/publisher_manager.d.ts.map +1 -1
  70. package/dest/publisher_manager.js +36 -8
  71. package/dest/queries.d.ts.map +1 -1
  72. package/dest/queries.js +8 -2
  73. package/dest/test/chain_monitor.js +2 -2
  74. package/dest/test/delayed_tx_utils.d.ts +2 -2
  75. package/dest/test/delayed_tx_utils.d.ts.map +1 -1
  76. package/dest/test/delayed_tx_utils.js +2 -2
  77. package/dest/test/eth_cheat_codes.d.ts +18 -1
  78. package/dest/test/eth_cheat_codes.d.ts.map +1 -1
  79. package/dest/test/eth_cheat_codes.js +101 -22
  80. package/dest/test/rollup_cheat_codes.d.ts +3 -1
  81. package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
  82. package/dest/test/rollup_cheat_codes.js +2 -2
  83. package/dest/test/upgrade_utils.js +1 -1
  84. package/package.json +6 -6
  85. package/src/config.ts +34 -44
  86. package/src/contracts/empire_base.ts +1 -1
  87. package/src/contracts/empire_slashing_proposer.ts +1 -1
  88. package/src/contracts/fee_asset_handler.ts +1 -1
  89. package/src/contracts/governance.ts +3 -3
  90. package/src/contracts/governance_proposer.ts +3 -4
  91. package/src/contracts/multicall.ts +12 -10
  92. package/src/contracts/rollup.ts +31 -86
  93. package/src/contracts/slasher_contract.ts +22 -0
  94. package/src/deploy_l1_contracts.ts +351 -178
  95. package/src/index.ts +1 -1
  96. package/src/l1_artifacts.ts +8 -0
  97. package/src/l1_contract_addresses.ts +3 -1
  98. package/src/l1_tx_utils/README.md +177 -0
  99. package/src/l1_tx_utils/config.ts +140 -0
  100. package/src/l1_tx_utils/constants.ts +18 -0
  101. package/src/l1_tx_utils/factory.ts +64 -0
  102. package/src/l1_tx_utils/index.ts +12 -0
  103. package/src/l1_tx_utils/interfaces.ts +86 -0
  104. package/src/l1_tx_utils/l1_tx_utils.ts +718 -0
  105. package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
  106. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +372 -0
  107. package/src/l1_tx_utils/signer.ts +28 -0
  108. package/src/l1_tx_utils/types.ts +85 -0
  109. package/src/l1_tx_utils/utils.ts +16 -0
  110. package/src/publisher_manager.ts +51 -9
  111. package/src/queries.ts +10 -1
  112. package/src/test/chain_monitor.ts +2 -2
  113. package/src/test/delayed_tx_utils.ts +2 -2
  114. package/src/test/eth_cheat_codes.ts +120 -20
  115. package/src/test/rollup_cheat_codes.ts +5 -2
  116. package/src/test/upgrade_utils.ts +1 -1
  117. package/dest/l1_tx_utils.d.ts +0 -252
  118. package/dest/l1_tx_utils.d.ts.map +0 -1
  119. package/dest/l1_tx_utils.js +0 -834
  120. package/dest/l1_tx_utils_with_blobs.d.ts +0 -20
  121. package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
  122. package/dest/l1_tx_utils_with_blobs.js +0 -87
  123. package/src/l1_tx_utils.ts +0 -1124
  124. package/src/l1_tx_utils_with_blobs.ts +0 -150
@@ -1,20 +0,0 @@
1
- import { type Logger } from '@aztec/foundation/log';
2
- import { DateProvider } from '@aztec/foundation/timer';
3
- import { type Hex } from 'viem';
4
- import type { EthSigner } from './eth-signer/eth-signer.js';
5
- import { type GasPrice, L1TxUtils, type L1TxUtilsConfig } from './l1_tx_utils.js';
6
- import type { ExtendedViemWalletClient, ViemClient } from './types.js';
7
- export declare class L1TxUtilsWithBlobs extends L1TxUtils {
8
- /**
9
- * Attempts to cancel a transaction by sending a 0-value tx to self with same nonce but higher gas prices
10
- * @param nonce - The nonce of the transaction to cancel
11
- * @param allVersions - Hashes of all transactions submitted under the same nonce (any of them could mine)
12
- * @param previousGasPrice - The gas price of the previous transaction
13
- * @param attempts - The number of attempts to cancel the transaction
14
- * @returns The hash of the cancellation transaction
15
- */
16
- attemptTxCancellation(currentTxHash: Hex, nonce: number, allVersions: Set<Hex>, isBlobTx?: boolean, previousGasPrice?: GasPrice, attempts?: number): Promise<`0x${string}`>;
17
- }
18
- export declare function createL1TxUtilsWithBlobsFromViemWallet(client: ExtendedViemWalletClient, logger?: Logger, dateProvider?: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): L1TxUtilsWithBlobs;
19
- export declare function createL1TxUtilsWithBlobsFromEthSigner(client: ViemClient, signer: EthSigner, logger?: Logger, dateProvider?: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): L1TxUtilsWithBlobs;
20
- //# sourceMappingURL=l1_tx_utils_with_blobs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"l1_tx_utils_with_blobs.d.ts","sourceRoot":"","sources":["../src/l1_tx_utils_with_blobs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,KAAK,GAAG,EAA4C,MAAM,MAAM,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,KAAK,QAAQ,EACb,SAAS,EACT,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvE,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C;;;;;;;OAOG;IACY,qBAAqB,CAClC,aAAa,EAAE,GAAG,EAClB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,EACrB,QAAQ,UAAQ,EAChB,gBAAgB,CAAC,EAAE,QAAQ,EAC3B,QAAQ,SAAI;CAoFf;AAED,wBAAgB,sCAAsC,CACpD,MAAM,EAAE,wBAAwB,EAChC,MAAM,GAAE,MAAkC,EAC1C,YAAY,GAAE,YAAiC,EAC/C,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,EACjC,gBAAgB,GAAE,OAAe,sBAWlC;AAED,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,MAAM,GAAE,MAAkC,EAC1C,YAAY,GAAE,YAAiC,EAC/C,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,EACjC,gBAAgB,GAAE,OAAe,sBAOlC"}
@@ -1,87 +0,0 @@
1
- import { Blob } from '@aztec/blob-lib';
2
- import { EthAddress } from '@aztec/foundation/eth-address';
3
- import { createLogger } from '@aztec/foundation/log';
4
- import { DateProvider } from '@aztec/foundation/timer';
5
- import { formatGwei } from 'viem';
6
- import { L1TxUtils, createViemSigner } from './l1_tx_utils.js';
7
- export class L1TxUtilsWithBlobs extends L1TxUtils {
8
- /**
9
- * Attempts to cancel a transaction by sending a 0-value tx to self with same nonce but higher gas prices
10
- * @param nonce - The nonce of the transaction to cancel
11
- * @param allVersions - Hashes of all transactions submitted under the same nonce (any of them could mine)
12
- * @param previousGasPrice - The gas price of the previous transaction
13
- * @param attempts - The number of attempts to cancel the transaction
14
- * @returns The hash of the cancellation transaction
15
- */ async attemptTxCancellation(currentTxHash, nonce, allVersions, isBlobTx = false, previousGasPrice, attempts = 0) {
16
- // Get gas price with higher priority fee for cancellation
17
- const cancelGasPrice = await this.getGasPrice({
18
- ...this.config,
19
- // Use high bump for cancellation to ensure it replaces the original tx
20
- priorityFeeRetryBumpPercentage: 150
21
- }, isBlobTx, attempts + 1, previousGasPrice);
22
- this.logger?.info(`Attempting to cancel blob L1 transaction ${currentTxHash} with nonce ${nonce}`, {
23
- maxFeePerGas: formatGwei(cancelGasPrice.maxFeePerGas),
24
- maxPriorityFeePerGas: formatGwei(cancelGasPrice.maxPriorityFeePerGas),
25
- maxFeePerBlobGas: cancelGasPrice.maxFeePerBlobGas === undefined ? undefined : formatGwei(cancelGasPrice.maxFeePerBlobGas)
26
- });
27
- const request = {
28
- to: this.getSenderAddress().toString(),
29
- value: 0n
30
- };
31
- // Send 0-value tx to self with higher gas price
32
- if (!isBlobTx) {
33
- const txData = {
34
- ...request,
35
- nonce,
36
- gas: 21_000n,
37
- maxFeePerGas: cancelGasPrice.maxFeePerGas,
38
- maxPriorityFeePerGas: cancelGasPrice.maxPriorityFeePerGas
39
- };
40
- const signedRequest = await this.prepareSignedTransaction(txData);
41
- const cancelTxHash = await this.client.sendRawTransaction({
42
- serializedTransaction: signedRequest
43
- });
44
- this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`);
45
- const receipt = await this.monitorTransaction(request, cancelTxHash, allVersions, {
46
- gasLimit: 21_000n
47
- }, undefined, undefined, true);
48
- return receipt.transactionHash;
49
- } else {
50
- const blobData = new Uint8Array(131072).fill(0);
51
- const kzg = Blob.getViemKzgInstance();
52
- const blobInputs = {
53
- blobs: [
54
- blobData
55
- ],
56
- kzg,
57
- maxFeePerBlobGas: cancelGasPrice.maxFeePerBlobGas
58
- };
59
- const txData = {
60
- ...request,
61
- ...blobInputs,
62
- nonce,
63
- gas: 21_000n,
64
- maxFeePerGas: cancelGasPrice.maxFeePerGas,
65
- maxPriorityFeePerGas: cancelGasPrice.maxPriorityFeePerGas
66
- };
67
- const signedRequest = await this.prepareSignedTransaction(txData);
68
- const cancelTxHash = await this.client.sendRawTransaction({
69
- serializedTransaction: signedRequest
70
- });
71
- this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`);
72
- const receipt = await this.monitorTransaction(request, cancelTxHash, allVersions, {
73
- gasLimit: 21_000n
74
- }, undefined, blobInputs, true);
75
- return receipt.transactionHash;
76
- }
77
- }
78
- }
79
- export function createL1TxUtilsWithBlobsFromViemWallet(client, logger = createLogger('L1TxUtils'), dateProvider = new DateProvider(), config, debugMaxGasLimit = false) {
80
- return new L1TxUtilsWithBlobs(client, EthAddress.fromString(client.account.address), createViemSigner(client), logger, dateProvider, config, debugMaxGasLimit);
81
- }
82
- export function createL1TxUtilsWithBlobsFromEthSigner(client, signer, logger = createLogger('L1TxUtils'), dateProvider = new DateProvider(), config, debugMaxGasLimit = false) {
83
- const callback = async (transaction, _signingAddress)=>{
84
- return (await signer.signTransaction(transaction)).toViemTransactionSignature();
85
- };
86
- return new L1TxUtilsWithBlobs(client, signer.address, callback, logger, dateProvider, config, debugMaxGasLimit);
87
- }