@aztec/ethereum 1.0.0 → 1.1.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.
- package/dest/config.d.ts +27 -5
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +90 -9
- package/dest/contracts/empire_base.d.ts +3 -4
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +4 -8
- package/dest/contracts/governance_proposer.d.ts +2 -2
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +4 -9
- package/dest/contracts/multicall.d.ts +2 -1
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +79 -48
- package/dest/contracts/rollup.d.ts +13 -1
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +64 -0
- package/dest/contracts/slashing_proposer.d.ts +2 -2
- package/dest/contracts/slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/slashing_proposer.js +5 -10
- package/dest/deploy_l1_contracts.d.ts +837 -534
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +35 -19
- package/dest/l1_tx_utils.d.ts +7 -2
- package/dest/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils.js +41 -13
- package/dest/l1_tx_utils_with_blobs.d.ts +2 -1
- package/dest/l1_tx_utils_with_blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils_with_blobs.js +5 -3
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +5 -3
- package/dest/test/start_anvil.d.ts +2 -0
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +3 -0
- package/package.json +6 -4
- package/src/config.ts +102 -8
- package/src/contracts/empire_base.ts +10 -16
- package/src/contracts/governance_proposer.ts +10 -10
- package/src/contracts/multicall.ts +73 -46
- package/src/contracts/rollup.ts +82 -1
- package/src/contracts/slashing_proposer.ts +11 -11
- package/src/deploy_l1_contracts.ts +45 -18
- package/src/l1_tx_utils.ts +56 -19
- package/src/l1_tx_utils_with_blobs.ts +14 -3
- package/src/queries.ts +3 -0
- package/src/test/start_anvil.ts +5 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
1
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
3
|
import type { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
@@ -68,7 +69,13 @@ import { foundry } from 'viem/chains';
|
|
|
68
69
|
|
|
69
70
|
import { isAnvilTestChain } from './chain.js';
|
|
70
71
|
import { createExtendedL1Client } from './client.js';
|
|
71
|
-
import {
|
|
72
|
+
import {
|
|
73
|
+
type L1ContractsConfig,
|
|
74
|
+
getEntryQueueConfig,
|
|
75
|
+
getGovernanceConfiguration,
|
|
76
|
+
getRewardBoostConfig,
|
|
77
|
+
getRewardConfig,
|
|
78
|
+
} from './config.js';
|
|
72
79
|
import { RegistryContract } from './contracts/registry.js';
|
|
73
80
|
import { RollupContract } from './contracts/rollup.js';
|
|
74
81
|
import type { L1ContractAddresses } from './l1_contract_addresses.js';
|
|
@@ -85,6 +92,8 @@ import { ZK_PASSPORT_SCOPE, ZK_PASSPORT_SUB_SCOPE, ZK_PASSPORT_VERIFIER_ADDRESS
|
|
|
85
92
|
|
|
86
93
|
export const DEPLOYER_ADDRESS: Hex = '0x4e59b44847b379578588920cA78FbF26c0B4956C';
|
|
87
94
|
|
|
95
|
+
const networkName = getActiveNetworkName();
|
|
96
|
+
|
|
88
97
|
export type Operator = {
|
|
89
98
|
attester: EthAddress;
|
|
90
99
|
withdrawer: EthAddress;
|
|
@@ -278,6 +287,8 @@ export const deploySharedContracts = async (
|
|
|
278
287
|
args: DeployL1ContractsArgs,
|
|
279
288
|
logger: Logger,
|
|
280
289
|
) => {
|
|
290
|
+
logger.info(`Deploying shared contracts. Network configration: ${networkName}`);
|
|
291
|
+
|
|
281
292
|
const txHashes: Hex[] = [];
|
|
282
293
|
|
|
283
294
|
const feeAssetAddress = await deployer.deploy(l1Artifacts.feeAsset, [
|
|
@@ -320,6 +331,7 @@ export const deploySharedContracts = async (
|
|
|
320
331
|
stakingAssetAddress.toString(),
|
|
321
332
|
governanceProposerAddress.toString(),
|
|
322
333
|
gseAddress.toString(),
|
|
334
|
+
getGovernanceConfiguration(networkName),
|
|
323
335
|
]);
|
|
324
336
|
logger.verbose(`Deployed Governance at ${governanceAddress}`);
|
|
325
337
|
|
|
@@ -435,19 +447,26 @@ export const deploySharedContracts = async (
|
|
|
435
447
|
zkPassportVerifierAddress = await getZkPassportVerifierAddress(deployer, args);
|
|
436
448
|
const [scope, subscope] = getZkPassportScopes(args);
|
|
437
449
|
|
|
438
|
-
|
|
439
|
-
l1Client.account.address,
|
|
440
|
-
stakingAssetAddress.toString(),
|
|
441
|
-
registryAddress.toString(),
|
|
442
|
-
AMIN.toString(),
|
|
443
|
-
BigInt(60 * 60 * 24),
|
|
444
|
-
BigInt(10),
|
|
445
|
-
|
|
446
|
-
|
|
450
|
+
const stakingAssetHandlerDeployArgs = {
|
|
451
|
+
owner: l1Client.account.address,
|
|
452
|
+
stakingAsset: stakingAssetAddress.toString(),
|
|
453
|
+
registry: registryAddress.toString(),
|
|
454
|
+
withdrawer: AMIN.toString(),
|
|
455
|
+
mintInterval: BigInt(60 * 60 * 24),
|
|
456
|
+
depositsPerMint: BigInt(10),
|
|
457
|
+
depositMerkleRoot: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
458
|
+
zkPassportVerifier: zkPassportVerifierAddress.toString(),
|
|
459
|
+
unhinged: [AMIN.toString()], // isUnhinged,
|
|
447
460
|
// Scopes
|
|
448
|
-
scope,
|
|
449
|
-
subscope,
|
|
450
|
-
|
|
461
|
+
scope: scope,
|
|
462
|
+
subscope: subscope,
|
|
463
|
+
// Skip checks
|
|
464
|
+
skipBindCheck: args.zkPassportArgs?.mockZkPassportVerifier ?? false,
|
|
465
|
+
skipMerkleCheck: true, // skip merkle check - needed for testing without generating proofs
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
stakingAssetHandlerAddress = await deployer.deploy(l1Artifacts.stakingAssetHandler, [
|
|
469
|
+
stakingAssetHandlerDeployArgs,
|
|
451
470
|
]);
|
|
452
471
|
logger.verbose(`Deployed StakingAssetHandler at ${stakingAssetHandlerAddress}`);
|
|
453
472
|
|
|
@@ -608,6 +627,8 @@ export const deployRollup = async (
|
|
|
608
627
|
throw new Error('GSE address is required when deploying');
|
|
609
628
|
}
|
|
610
629
|
|
|
630
|
+
logger.info(`Deploying rollup using network configuration: ${networkName}`);
|
|
631
|
+
|
|
611
632
|
const txHashes: Hex[] = [];
|
|
612
633
|
|
|
613
634
|
let epochProofVerifier = EthAddress.ZERO;
|
|
@@ -620,6 +641,11 @@ export const deployRollup = async (
|
|
|
620
641
|
logger.verbose(`Rollup will use the mock verifier at ${epochProofVerifier}`);
|
|
621
642
|
}
|
|
622
643
|
|
|
644
|
+
const rewardConfig = {
|
|
645
|
+
...getRewardConfig(networkName),
|
|
646
|
+
rewardDistributor: addresses.rewardDistributorAddress.toString(),
|
|
647
|
+
};
|
|
648
|
+
|
|
623
649
|
const rollupConfigArgs = {
|
|
624
650
|
aztecSlotDuration: args.aztecSlotDuration,
|
|
625
651
|
aztecEpochDuration: args.aztecEpochDuration,
|
|
@@ -628,10 +654,11 @@ export const deployRollup = async (
|
|
|
628
654
|
slashingQuorum: args.slashingQuorum,
|
|
629
655
|
slashingRoundSize: args.slashingRoundSize,
|
|
630
656
|
manaTarget: args.manaTarget,
|
|
631
|
-
entryQueueFlushSizeMin: DefaultEntryQueueConfig.flushSizeMin,
|
|
632
|
-
entryQueueFlushSizeQuotient: DefaultEntryQueueConfig.flushSizeQuotient,
|
|
633
657
|
provingCostPerMana: args.provingCostPerMana,
|
|
634
|
-
rewardConfig:
|
|
658
|
+
rewardConfig: rewardConfig,
|
|
659
|
+
rewardBoostConfig: getRewardBoostConfig(networkName),
|
|
660
|
+
stakingQueueConfig: getEntryQueueConfig(networkName),
|
|
661
|
+
exitDelaySeconds: args.exitDelaySeconds,
|
|
635
662
|
};
|
|
636
663
|
const genesisStateArgs = {
|
|
637
664
|
vkTreeRoot: args.vkTreeRoot.toString(),
|
|
@@ -642,7 +669,6 @@ export const deployRollup = async (
|
|
|
642
669
|
|
|
643
670
|
const rollupArgs = [
|
|
644
671
|
addresses.feeJuiceAddress.toString(),
|
|
645
|
-
addresses.rewardDistributorAddress.toString(),
|
|
646
672
|
addresses.stakingAssetAddress.toString(),
|
|
647
673
|
addresses.gseAddress.toString(),
|
|
648
674
|
epochProofVerifier.toString(),
|
|
@@ -1221,9 +1247,10 @@ export async function deployL1Contract(
|
|
|
1221
1247
|
}
|
|
1222
1248
|
|
|
1223
1249
|
if (maybeSalt) {
|
|
1250
|
+
logger?.info(`Deploying contract with salt ${maybeSalt}`);
|
|
1224
1251
|
const { address, paddedSalt: salt, calldata } = getExpectedAddress(abi, bytecode, args, maybeSalt);
|
|
1225
1252
|
resultingAddress = address;
|
|
1226
|
-
const existing = await extendedClient.
|
|
1253
|
+
const existing = await extendedClient.getCode({ address: resultingAddress });
|
|
1227
1254
|
if (existing === undefined || existing === '0x') {
|
|
1228
1255
|
const res = await l1TxUtils.sendTransaction({
|
|
1229
1256
|
to: DEPLOYER_ADDRESS,
|
package/src/l1_tx_utils.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { compactArray, times } from '@aztec/foundation/collection';
|
|
|
2
2
|
import {
|
|
3
3
|
type ConfigMappingsType,
|
|
4
4
|
bigintConfigHelper,
|
|
5
|
+
booleanConfigHelper,
|
|
5
6
|
getConfigFromMappings,
|
|
6
7
|
getDefaultConfig,
|
|
7
8
|
numberConfigHelper,
|
|
@@ -11,6 +12,7 @@ import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
|
11
12
|
import { sleep } from '@aztec/foundation/sleep';
|
|
12
13
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
13
14
|
|
|
15
|
+
import pickBy from 'lodash.pickby';
|
|
14
16
|
import {
|
|
15
17
|
type Abi,
|
|
16
18
|
type Account,
|
|
@@ -99,6 +101,10 @@ export interface L1TxUtilsConfig {
|
|
|
99
101
|
* First attempt is done at 1s, second at 2s, third at 3s, etc.
|
|
100
102
|
*/
|
|
101
103
|
txPropagationMaxQueryAttempts?: number;
|
|
104
|
+
/**
|
|
105
|
+
* Whether to attempt to cancel a tx if it's not mined after txTimeoutMs
|
|
106
|
+
*/
|
|
107
|
+
cancelTxOnTimeout?: boolean;
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
export const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig> = {
|
|
@@ -145,18 +151,23 @@ export const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig> = {
|
|
|
145
151
|
stallTimeMs: {
|
|
146
152
|
description: 'How long before considering tx stalled',
|
|
147
153
|
env: 'L1_TX_MONITOR_STALL_TIME_MS',
|
|
148
|
-
...numberConfigHelper(
|
|
154
|
+
...numberConfigHelper(24_000), // 24s, 2 ethereum slots
|
|
149
155
|
},
|
|
150
156
|
txTimeoutMs: {
|
|
151
157
|
description: 'How long to wait for a tx to be mined before giving up. Set to 0 to disable.',
|
|
152
158
|
env: 'L1_TX_MONITOR_TX_TIMEOUT_MS',
|
|
153
|
-
...numberConfigHelper(
|
|
159
|
+
...numberConfigHelper(120_000), // 2 mins
|
|
154
160
|
},
|
|
155
161
|
txPropagationMaxQueryAttempts: {
|
|
156
162
|
description: 'How many attempts will be done to get a tx after it was sent',
|
|
157
163
|
env: 'L1_TX_PROPAGATION_MAX_QUERY_ATTEMPTS',
|
|
158
164
|
...numberConfigHelper(3),
|
|
159
165
|
},
|
|
166
|
+
cancelTxOnTimeout: {
|
|
167
|
+
description: "Whether to attempt to cancel a tx if it's not mined after txTimeoutMs",
|
|
168
|
+
env: 'L1_TX_MONITOR_CANCEL_TX_ON_TIMEOUT',
|
|
169
|
+
...booleanConfigHelper(true),
|
|
170
|
+
},
|
|
160
171
|
};
|
|
161
172
|
|
|
162
173
|
export const defaultL1TxUtilsConfig = getDefaultConfig<L1TxUtilsConfig>(l1TxUtilsConfigMappings);
|
|
@@ -480,7 +491,7 @@ export class ReadOnlyL1TxUtils {
|
|
|
480
491
|
) {
|
|
481
492
|
try {
|
|
482
493
|
const result = await this.client.simulateBlocks({
|
|
483
|
-
validation:
|
|
494
|
+
validation: false,
|
|
484
495
|
blocks: [
|
|
485
496
|
{
|
|
486
497
|
blockOverrides,
|
|
@@ -522,7 +533,9 @@ export class ReadOnlyL1TxUtils {
|
|
|
522
533
|
public bumpGasLimit(gasLimit: bigint, _gasConfig?: L1TxUtilsConfig): bigint {
|
|
523
534
|
const gasConfig = { ...this.config, ..._gasConfig };
|
|
524
535
|
const bumpedGasLimit = gasLimit + (gasLimit * BigInt((gasConfig?.gasLimitBufferPercentage || 0) * 1_00)) / 100_00n;
|
|
525
|
-
|
|
536
|
+
|
|
537
|
+
const cleanGasConfig = pickBy(gasConfig, (_, key) => key in l1TxUtilsConfigMappings);
|
|
538
|
+
this.logger?.debug('Bumping gas limit', { gasLimit, gasConfig: cleanGasConfig, bumpedGasLimit });
|
|
526
539
|
return bumpedGasLimit;
|
|
527
540
|
}
|
|
528
541
|
}
|
|
@@ -600,10 +613,12 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
600
613
|
maxPriorityFeePerGas: gasPrice.maxPriorityFeePerGas,
|
|
601
614
|
});
|
|
602
615
|
}
|
|
616
|
+
const cleanGasConfig = pickBy(gasConfig, (_, key) => key in l1TxUtilsConfigMappings);
|
|
603
617
|
this.logger?.verbose(`Sent L1 transaction ${txHash}`, {
|
|
604
618
|
gasLimit,
|
|
605
619
|
maxFeePerGas: formatGwei(gasPrice.maxFeePerGas),
|
|
606
620
|
maxPriorityFeePerGas: formatGwei(gasPrice.maxPriorityFeePerGas),
|
|
621
|
+
gasConfig: cleanGasConfig,
|
|
607
622
|
...(gasPrice.maxFeePerBlobGas && { maxFeePerBlobGas: formatGwei(gasPrice.maxFeePerBlobGas) }),
|
|
608
623
|
});
|
|
609
624
|
|
|
@@ -748,7 +763,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
748
763
|
},
|
|
749
764
|
);
|
|
750
765
|
|
|
751
|
-
|
|
766
|
+
const newHash = await this.client.sendTransaction({
|
|
752
767
|
...request,
|
|
753
768
|
...blobInputs,
|
|
754
769
|
nonce,
|
|
@@ -757,6 +772,17 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
757
772
|
maxPriorityFeePerGas: newGasPrice.maxPriorityFeePerGas,
|
|
758
773
|
});
|
|
759
774
|
|
|
775
|
+
const cleanGasConfig = pickBy(gasConfig, (_, key) => key in l1TxUtilsConfigMappings);
|
|
776
|
+
this.logger?.verbose(`Sent L1 speed-up tx ${newHash}, replacing ${currentTxHash}`, {
|
|
777
|
+
gasLimit: params.gasLimit,
|
|
778
|
+
maxFeePerGas: formatGwei(newGasPrice.maxFeePerGas),
|
|
779
|
+
maxPriorityFeePerGas: formatGwei(newGasPrice.maxPriorityFeePerGas),
|
|
780
|
+
gasConfig: cleanGasConfig,
|
|
781
|
+
...(newGasPrice.maxFeePerBlobGas && { maxFeePerBlobGas: formatGwei(newGasPrice.maxFeePerBlobGas) }),
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
currentTxHash = newHash;
|
|
785
|
+
|
|
760
786
|
txHashes.add(currentTxHash);
|
|
761
787
|
lastAttemptSent = Date.now();
|
|
762
788
|
}
|
|
@@ -773,18 +799,14 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
773
799
|
txTimedOut = isTimedOut();
|
|
774
800
|
}
|
|
775
801
|
|
|
776
|
-
if (!isCancelTx) {
|
|
802
|
+
if (!isCancelTx && gasConfig.cancelTxOnTimeout) {
|
|
777
803
|
// Fire cancellation without awaiting to avoid blocking the main thread
|
|
778
|
-
this.attemptTxCancellation(nonce, isBlobTx, lastGasPrice, attempts)
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
.catch(err => {
|
|
783
|
-
const viemError = formatViemError(err);
|
|
784
|
-
this.logger?.error(`Failed to send cancellation for timed out tx ${currentTxHash}:`, viemError.message, {
|
|
785
|
-
metaMessages: viemError.metaMessages,
|
|
786
|
-
});
|
|
804
|
+
this.attemptTxCancellation(currentTxHash, nonce, isBlobTx, lastGasPrice, attempts).catch(err => {
|
|
805
|
+
const viemError = formatViemError(err);
|
|
806
|
+
this.logger?.error(`Failed to send cancellation for timed out tx ${currentTxHash}:`, viemError.message, {
|
|
807
|
+
metaMessages: viemError.metaMessages,
|
|
787
808
|
});
|
|
809
|
+
});
|
|
788
810
|
|
|
789
811
|
this.logger?.error(`L1 transaction ${currentTxHash} timed out`, {
|
|
790
812
|
txHash: currentTxHash,
|
|
@@ -812,11 +834,12 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
812
834
|
|
|
813
835
|
public override async simulate(
|
|
814
836
|
request: L1TxRequest & { gas?: bigint; from?: Hex },
|
|
815
|
-
|
|
837
|
+
_blockOverrides: BlockOverrides<bigint, number> = {},
|
|
816
838
|
stateOverrides: StateOverride = [],
|
|
817
839
|
abi: Abi = RollupAbi,
|
|
818
|
-
_gasConfig?: L1TxUtilsConfig & { fallbackGasEstimate?: bigint },
|
|
840
|
+
_gasConfig?: L1TxUtilsConfig & { fallbackGasEstimate?: bigint; ignoreBlockGasLimit?: boolean },
|
|
819
841
|
): Promise<{ gasUsed: bigint; result: `0x${string}` }> {
|
|
842
|
+
const blockOverrides = { ..._blockOverrides };
|
|
820
843
|
const gasConfig = { ...this.config, ..._gasConfig };
|
|
821
844
|
const gasPrice = await this.getGasPrice(gasConfig, false);
|
|
822
845
|
|
|
@@ -829,6 +852,11 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
829
852
|
gas: request.gas ?? LARGE_GAS_LIMIT,
|
|
830
853
|
};
|
|
831
854
|
|
|
855
|
+
if (!request.gas && !gasConfig.ignoreBlockGasLimit) {
|
|
856
|
+
// LARGE_GAS_LIMIT is set as call.gas, increase block gasLimit
|
|
857
|
+
blockOverrides.gasLimit = LARGE_GAS_LIMIT * 2n;
|
|
858
|
+
}
|
|
859
|
+
|
|
832
860
|
return this._simulate(call, blockOverrides, stateOverrides, gasConfig, abi);
|
|
833
861
|
}
|
|
834
862
|
|
|
@@ -839,7 +867,13 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
839
867
|
* @param attempts - The number of attempts to cancel the transaction
|
|
840
868
|
* @returns The hash of the cancellation transaction
|
|
841
869
|
*/
|
|
842
|
-
protected async attemptTxCancellation(
|
|
870
|
+
protected async attemptTxCancellation(
|
|
871
|
+
currentTxHash: Hex,
|
|
872
|
+
nonce: number,
|
|
873
|
+
isBlobTx = false,
|
|
874
|
+
previousGasPrice?: GasPrice,
|
|
875
|
+
attempts = 0,
|
|
876
|
+
) {
|
|
843
877
|
if (isBlobTx) {
|
|
844
878
|
throw new Error('Cannot cancel blob transactions, please use L1TxUtilsWithBlobsClass');
|
|
845
879
|
}
|
|
@@ -858,7 +892,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
858
892
|
previousGasPrice,
|
|
859
893
|
);
|
|
860
894
|
|
|
861
|
-
this.logger?.debug(`Attempting to cancel transaction with nonce ${nonce}`, {
|
|
895
|
+
this.logger?.debug(`Attempting to cancel L1 transaction ${currentTxHash} with nonce ${nonce}`, {
|
|
862
896
|
maxFeePerGas: formatGwei(cancelGasPrice.maxFeePerGas),
|
|
863
897
|
maxPriorityFeePerGas: formatGwei(cancelGasPrice.maxPriorityFeePerGas),
|
|
864
898
|
});
|
|
@@ -875,6 +909,9 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
875
909
|
maxFeePerGas: cancelGasPrice.maxFeePerGas,
|
|
876
910
|
maxPriorityFeePerGas: cancelGasPrice.maxPriorityFeePerGas,
|
|
877
911
|
});
|
|
912
|
+
|
|
913
|
+
this.logger?.debug(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`, { nonce });
|
|
914
|
+
|
|
878
915
|
const receipt = await this.monitorTransaction(
|
|
879
916
|
request,
|
|
880
917
|
cancelTxHash,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Blob } from '@aztec/blob-lib';
|
|
2
2
|
|
|
3
|
-
import { formatGwei } from 'viem';
|
|
3
|
+
import { type Hex, formatGwei } from 'viem';
|
|
4
4
|
|
|
5
5
|
import { type GasPrice, L1TxUtils } from './l1_tx_utils.js';
|
|
6
6
|
|
|
@@ -12,7 +12,13 @@ export class L1TxUtilsWithBlobs extends L1TxUtils {
|
|
|
12
12
|
* @param attempts - The number of attempts to cancel the transaction
|
|
13
13
|
* @returns The hash of the cancellation transaction
|
|
14
14
|
*/
|
|
15
|
-
override async attemptTxCancellation(
|
|
15
|
+
override async attemptTxCancellation(
|
|
16
|
+
currentTxHash: Hex,
|
|
17
|
+
nonce: number,
|
|
18
|
+
isBlobTx = false,
|
|
19
|
+
previousGasPrice?: GasPrice,
|
|
20
|
+
attempts = 0,
|
|
21
|
+
) {
|
|
16
22
|
const account = this.client.account;
|
|
17
23
|
|
|
18
24
|
// Get gas price with higher priority fee for cancellation
|
|
@@ -27,9 +33,11 @@ export class L1TxUtilsWithBlobs extends L1TxUtils {
|
|
|
27
33
|
previousGasPrice,
|
|
28
34
|
);
|
|
29
35
|
|
|
30
|
-
this.logger?.debug(`Attempting to cancel transaction with nonce ${nonce}`, {
|
|
36
|
+
this.logger?.debug(`Attempting to cancel blob L1 transaction ${currentTxHash} with nonce ${nonce}`, {
|
|
31
37
|
maxFeePerGas: formatGwei(cancelGasPrice.maxFeePerGas),
|
|
32
38
|
maxPriorityFeePerGas: formatGwei(cancelGasPrice.maxPriorityFeePerGas),
|
|
39
|
+
maxFeePerBlobGas:
|
|
40
|
+
cancelGasPrice.maxFeePerBlobGas === undefined ? undefined : formatGwei(cancelGasPrice.maxFeePerBlobGas),
|
|
33
41
|
});
|
|
34
42
|
const request = {
|
|
35
43
|
to: account.address,
|
|
@@ -71,6 +79,9 @@ export class L1TxUtilsWithBlobs extends L1TxUtils {
|
|
|
71
79
|
maxFeePerGas: cancelGasPrice.maxFeePerGas,
|
|
72
80
|
maxPriorityFeePerGas: cancelGasPrice.maxPriorityFeePerGas,
|
|
73
81
|
});
|
|
82
|
+
|
|
83
|
+
this.logger?.debug(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`);
|
|
84
|
+
|
|
74
85
|
const receipt = await this.monitorTransaction(
|
|
75
86
|
request,
|
|
76
87
|
cancelTxHash,
|
package/src/queries.ts
CHANGED
|
@@ -45,6 +45,7 @@ export async function getL1ContractsConfig(
|
|
|
45
45
|
provingCostPerMana,
|
|
46
46
|
rollupVersion,
|
|
47
47
|
genesisArchiveTreeRoot,
|
|
48
|
+
exitDelay,
|
|
48
49
|
] = await Promise.all([
|
|
49
50
|
rollup.getL1StartBlock(),
|
|
50
51
|
rollup.getL1GenesisTime(),
|
|
@@ -62,6 +63,7 @@ export async function getL1ContractsConfig(
|
|
|
62
63
|
rollup.getProvingCostPerMana(),
|
|
63
64
|
rollup.getVersion(),
|
|
64
65
|
rollup.getGenesisArchiveTreeRoot(),
|
|
66
|
+
rollup.getExitDelay(),
|
|
65
67
|
] as const);
|
|
66
68
|
|
|
67
69
|
return {
|
|
@@ -81,6 +83,7 @@ export async function getL1ContractsConfig(
|
|
|
81
83
|
provingCostPerMana: provingCostPerMana,
|
|
82
84
|
rollupVersion: Number(rollupVersion),
|
|
83
85
|
genesisArchiveTreeRoot,
|
|
86
|
+
exitDelaySeconds: Number(exitDelay),
|
|
84
87
|
};
|
|
85
88
|
}
|
|
86
89
|
|
package/src/test/start_anvil.ts
CHANGED
|
@@ -11,9 +11,11 @@ export async function startAnvil(
|
|
|
11
11
|
opts: {
|
|
12
12
|
port?: number;
|
|
13
13
|
l1BlockTime?: number;
|
|
14
|
+
captureMethodCalls?: boolean;
|
|
14
15
|
} = {},
|
|
15
|
-
): Promise<{ anvil: Anvil; rpcUrl: string; stop: () => Promise<void> }> {
|
|
16
|
+
): Promise<{ anvil: Anvil; methodCalls?: string[]; rpcUrl: string; stop: () => Promise<void> }> {
|
|
16
17
|
const anvilBinary = resolve(dirname(fileURLToPath(import.meta.url)), '../../', 'scripts/anvil_kill_wrapper.sh');
|
|
18
|
+
const methodCalls = opts.captureMethodCalls ? ([] as string[]) : undefined;
|
|
17
19
|
|
|
18
20
|
let port: number | undefined;
|
|
19
21
|
|
|
@@ -31,13 +33,13 @@ export async function startAnvil(
|
|
|
31
33
|
|
|
32
34
|
// Listen to the anvil output to get the port.
|
|
33
35
|
const removeHandler = anvil.on('message', (message: string) => {
|
|
36
|
+
methodCalls?.push(...(message.match(/eth_[^\s]+/g) || []));
|
|
34
37
|
if (port === undefined && message.includes('Listening on')) {
|
|
35
38
|
port = parseInt(message.match(/Listening on ([^:]+):(\d+)/)![2]);
|
|
36
39
|
}
|
|
37
40
|
});
|
|
38
41
|
await anvil.start();
|
|
39
42
|
removeHandler();
|
|
40
|
-
|
|
41
43
|
return anvil;
|
|
42
44
|
},
|
|
43
45
|
'Start anvil',
|
|
@@ -50,5 +52,5 @@ export async function startAnvil(
|
|
|
50
52
|
|
|
51
53
|
// Monkeypatch the anvil instance to include the actually assigned port
|
|
52
54
|
// Object.defineProperty(anvil, 'port', { value: port, writable: false });
|
|
53
|
-
return { anvil, stop: () => anvil.stop(), rpcUrl: `http://127.0.0.1:${port}` };
|
|
55
|
+
return { anvil, methodCalls, stop: () => anvil.stop(), rpcUrl: `http://127.0.0.1:${port}` };
|
|
54
56
|
}
|