@aztec/ethereum 3.0.0-nightly.20250910 → 3.0.0-nightly.20250911
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 +3 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +6 -30
- package/dest/contracts/empire_slashing_proposer.d.ts +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +1 -1
- package/dest/contracts/rollup.d.ts +3 -2
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +22 -21
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +6 -6
- package/dest/l1_artifacts.d.ts +630 -61
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_tx_utils.d.ts +4 -2
- package/dest/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils.js +17 -12
- 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 +7 -5
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +6 -11
- package/package.json +5 -5
- package/src/config.ts +9 -35
- package/src/contracts/empire_slashing_proposer.ts +6 -2
- package/src/contracts/rollup.ts +21 -18
- package/src/deploy_l1_contracts.ts +4 -6
- package/src/l1_tx_utils.ts +17 -7
- package/src/l1_tx_utils_with_blobs.ts +8 -2
- package/src/queries.ts +6 -7
package/dest/queries.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import { SlasherAbi } from '@aztec/l1-artifacts/SlasherAbi';
|
|
3
|
-
import { getContract } from 'viem';
|
|
4
2
|
import { ReadOnlyGovernanceContract } from './contracts/governance.js';
|
|
5
3
|
import { GovernanceProposerContract } from './contracts/governance_proposer.js';
|
|
6
4
|
import { RollupContract } from './contracts/rollup.js';
|
|
@@ -11,13 +9,8 @@ import { RollupContract } from './contracts/rollup.js';
|
|
|
11
9
|
const rollupAddress = addresses.rollupAddress ?? await governanceProposer.getRollupAddress();
|
|
12
10
|
const rollup = new RollupContract(publicClient, rollupAddress.toString());
|
|
13
11
|
const slasherProposer = await rollup.getSlashingProposer();
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
address: slasherAddress,
|
|
17
|
-
abi: SlasherAbi,
|
|
18
|
-
client: publicClient
|
|
19
|
-
});
|
|
20
|
-
const [l1StartBlock, l1GenesisTime, aztecEpochDuration, aztecSlotDuration, aztecProofSubmissionEpochs, aztecTargetCommitteeSize, activationThreshold, ejectionThreshold, governanceProposerQuorum, governanceProposerRoundSize, slashingQuorum, slashingRoundSize, slashingLifetimeInRounds, slashingExecutionDelayInRounds, slashingOffsetInRounds, slashingAmounts, slashingVetoer, manaTarget, provingCostPerMana, rollupVersion, genesisArchiveTreeRoot, exitDelay] = await Promise.all([
|
|
12
|
+
const slasher = await rollup.getSlasherContract();
|
|
13
|
+
const [l1StartBlock, l1GenesisTime, aztecEpochDuration, aztecSlotDuration, aztecProofSubmissionEpochs, aztecTargetCommitteeSize, activationThreshold, ejectionThreshold, localEjectionThreshold, governanceProposerQuorum, governanceProposerRoundSize, slashingQuorum, slashingRoundSize, slashingLifetimeInRounds, slashingExecutionDelayInRounds, slashingOffsetInRounds, slashingAmounts, slashingVetoer, manaTarget, provingCostPerMana, rollupVersion, genesisArchiveTreeRoot, exitDelay] = await Promise.all([
|
|
21
14
|
rollup.getL1StartBlock(),
|
|
22
15
|
rollup.getL1GenesisTime(),
|
|
23
16
|
rollup.getEpochDuration(),
|
|
@@ -26,6 +19,7 @@ import { RollupContract } from './contracts/rollup.js';
|
|
|
26
19
|
rollup.getTargetCommitteeSize(),
|
|
27
20
|
rollup.getActivationThreshold(),
|
|
28
21
|
rollup.getEjectionThreshold(),
|
|
22
|
+
rollup.getLocalEjectionThreshold(),
|
|
29
23
|
governanceProposer.getQuorumSize(),
|
|
30
24
|
governanceProposer.getRoundSize(),
|
|
31
25
|
slasherProposer?.getQuorumSize() ?? 0n,
|
|
@@ -38,7 +32,7 @@ import { RollupContract } from './contracts/rollup.js';
|
|
|
38
32
|
0n,
|
|
39
33
|
0n
|
|
40
34
|
],
|
|
41
|
-
slasher
|
|
35
|
+
slasher?.getVetoer() ?? EthAddress.ZERO,
|
|
42
36
|
rollup.getManaTarget(),
|
|
43
37
|
rollup.getProvingCostPerMana(),
|
|
44
38
|
rollup.getVersion(),
|
|
@@ -56,11 +50,12 @@ import { RollupContract } from './contracts/rollup.js';
|
|
|
56
50
|
governanceProposerRoundSize: Number(governanceProposerRoundSize),
|
|
57
51
|
activationThreshold,
|
|
58
52
|
ejectionThreshold,
|
|
53
|
+
localEjectionThreshold,
|
|
59
54
|
slashingQuorum: Number(slashingQuorum),
|
|
60
55
|
slashingRoundSizeInEpochs: Number(slashingRoundSize / aztecEpochDuration),
|
|
61
56
|
slashingLifetimeInRounds: Number(slashingLifetimeInRounds),
|
|
62
57
|
slashingExecutionDelayInRounds: Number(slashingExecutionDelayInRounds),
|
|
63
|
-
slashingVetoer
|
|
58
|
+
slashingVetoer,
|
|
64
59
|
manaTarget: manaTarget,
|
|
65
60
|
provingCostPerMana: provingCostPerMana,
|
|
66
61
|
rollupVersion: Number(rollupVersion),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/ethereum",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20250911",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"../package.common.json"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
35
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
36
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
37
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
34
|
+
"@aztec/blob-lib": "3.0.0-nightly.20250911",
|
|
35
|
+
"@aztec/constants": "3.0.0-nightly.20250911",
|
|
36
|
+
"@aztec/foundation": "3.0.0-nightly.20250911",
|
|
37
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250911",
|
|
38
38
|
"@viem/anvil": "^0.0.10",
|
|
39
39
|
"dotenv": "^16.0.3",
|
|
40
40
|
"lodash.chunk": "^4.2.0",
|
package/src/config.ts
CHANGED
|
@@ -34,6 +34,8 @@ export type L1ContractsConfig = {
|
|
|
34
34
|
activationThreshold: bigint;
|
|
35
35
|
/** The minimum stake for a validator. */
|
|
36
36
|
ejectionThreshold: bigint;
|
|
37
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
|
|
38
|
+
localEjectionThreshold: bigint;
|
|
37
39
|
/** The slashing quorum, i.e. how many slots must signal for the same payload in a round for it to be submittable to the Slasher (defaults to slashRoundSize / 2 + 1) */
|
|
38
40
|
slashingQuorum?: number;
|
|
39
41
|
/** The slashing round size, i.e. how many epochs are in a slashing round */
|
|
@@ -74,6 +76,7 @@ export const DefaultL1ContractsConfig = {
|
|
|
74
76
|
aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends
|
|
75
77
|
activationThreshold: BigInt(100e18),
|
|
76
78
|
ejectionThreshold: BigInt(50e18),
|
|
79
|
+
localEjectionThreshold: BigInt(98e18),
|
|
77
80
|
slashAmountSmall: BigInt(10e18),
|
|
78
81
|
slashAmountMedium: BigInt(20e18),
|
|
79
82
|
slashAmountLarge: BigInt(50e18),
|
|
@@ -161,41 +164,6 @@ export const getGovernanceConfiguration = (networkName: NetworkNames) => {
|
|
|
161
164
|
}
|
|
162
165
|
};
|
|
163
166
|
|
|
164
|
-
const LocalGSEConfiguration = {
|
|
165
|
-
activationThreshold: BigInt(100e18),
|
|
166
|
-
ejectionThreshold: BigInt(50e18),
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const StagingPublicGSEConfiguration = {
|
|
170
|
-
activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
171
|
-
ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const TestnetGSEConfiguration = {
|
|
175
|
-
activationThreshold: BigInt(100e18),
|
|
176
|
-
ejectionThreshold: BigInt(50e18),
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
const StagingIgnitionGSEConfiguration = {
|
|
180
|
-
activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
181
|
-
ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export const getGSEConfiguration = (networkName: NetworkNames) => {
|
|
185
|
-
switch (networkName) {
|
|
186
|
-
case 'local':
|
|
187
|
-
return LocalGSEConfiguration;
|
|
188
|
-
case 'staging-public':
|
|
189
|
-
return StagingPublicGSEConfiguration;
|
|
190
|
-
case 'testnet':
|
|
191
|
-
return TestnetGSEConfiguration;
|
|
192
|
-
case 'staging-ignition':
|
|
193
|
-
return StagingIgnitionGSEConfiguration;
|
|
194
|
-
default:
|
|
195
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
167
|
// Making a default config here as we are only using it thought the deployment
|
|
200
168
|
// and do not expect to be using different setups, so having environment variables
|
|
201
169
|
// for it seems overkill
|
|
@@ -350,6 +318,12 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
350
318
|
description: 'The minimum stake for a validator.',
|
|
351
319
|
...bigintConfigHelper(DefaultL1ContractsConfig.ejectionThreshold),
|
|
352
320
|
},
|
|
321
|
+
localEjectionThreshold: {
|
|
322
|
+
env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
|
|
323
|
+
description:
|
|
324
|
+
'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
|
|
325
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.localEjectionThreshold),
|
|
326
|
+
},
|
|
353
327
|
slashingOffsetInRounds: {
|
|
354
328
|
env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
|
|
355
329
|
description:
|
|
@@ -33,10 +33,14 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
33
33
|
|
|
34
34
|
constructor(
|
|
35
35
|
public readonly client: ViemClient,
|
|
36
|
-
address: Hex,
|
|
36
|
+
address: Hex | EthAddress,
|
|
37
37
|
) {
|
|
38
38
|
super();
|
|
39
|
-
this.proposer = getContract({
|
|
39
|
+
this.proposer = getContract({
|
|
40
|
+
address: typeof address === 'string' ? address : address.toString(),
|
|
41
|
+
abi: EmpireSlashingProposerAbi,
|
|
42
|
+
client,
|
|
43
|
+
});
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
public get address() {
|
package/src/contracts/rollup.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import type { ViemSignature } from '@aztec/foundation/eth-signature';
|
|
4
4
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
5
5
|
import { RollupStorage } from '@aztec/l1-artifacts/RollupStorage';
|
|
6
|
-
import { SlasherAbi } from '@aztec/l1-artifacts/SlasherAbi';
|
|
7
6
|
|
|
8
7
|
import chunk from 'lodash.chunk';
|
|
9
8
|
import {
|
|
@@ -12,7 +11,6 @@ import {
|
|
|
12
11
|
type Hex,
|
|
13
12
|
type StateOverride,
|
|
14
13
|
encodeFunctionData,
|
|
15
|
-
getAddress,
|
|
16
14
|
getContract,
|
|
17
15
|
hexToBigInt,
|
|
18
16
|
keccak256,
|
|
@@ -160,13 +158,12 @@ export class RollupContract {
|
|
|
160
158
|
public async getSlashingProposer(): Promise<
|
|
161
159
|
EmpireSlashingProposerContract | TallySlashingProposerContract | undefined
|
|
162
160
|
> {
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
161
|
+
const slasher = await this.getSlasherContract();
|
|
162
|
+
if (!slasher) {
|
|
165
163
|
return undefined;
|
|
166
164
|
}
|
|
167
165
|
|
|
168
|
-
const
|
|
169
|
-
const proposerAddress = await slasher.read.PROPOSER();
|
|
166
|
+
const proposerAddress = await slasher.getProposer();
|
|
170
167
|
const proposerAbi = [
|
|
171
168
|
{
|
|
172
169
|
type: 'function',
|
|
@@ -177,7 +174,7 @@ export class RollupContract {
|
|
|
177
174
|
},
|
|
178
175
|
] as const;
|
|
179
176
|
|
|
180
|
-
const proposer = getContract({ address: proposerAddress, abi: proposerAbi, client: this.client });
|
|
177
|
+
const proposer = getContract({ address: proposerAddress.toString(), abi: proposerAbi, client: this.client });
|
|
181
178
|
const proposerType = await proposer.read.SLASHING_PROPOSER_TYPE();
|
|
182
179
|
if (proposerType === SlashingProposerType.Tally.valueOf()) {
|
|
183
180
|
return new TallySlashingProposerContract(this.client, proposerAddress);
|
|
@@ -223,6 +220,11 @@ export class RollupContract {
|
|
|
223
220
|
return this.rollup.read.getEjectionThreshold();
|
|
224
221
|
}
|
|
225
222
|
|
|
223
|
+
@memoize
|
|
224
|
+
getLocalEjectionThreshold() {
|
|
225
|
+
return this.rollup.read.getLocalEjectionThreshold();
|
|
226
|
+
}
|
|
227
|
+
|
|
226
228
|
@memoize
|
|
227
229
|
getActivationThreshold() {
|
|
228
230
|
return this.rollup.read.getActivationThreshold();
|
|
@@ -293,16 +295,19 @@ export class RollupContract {
|
|
|
293
295
|
};
|
|
294
296
|
}
|
|
295
297
|
|
|
296
|
-
|
|
298
|
+
getSlasherAddress() {
|
|
297
299
|
return this.rollup.read.getSlasher();
|
|
298
300
|
}
|
|
299
301
|
|
|
300
302
|
/**
|
|
301
303
|
* Returns a SlasherContract instance for interacting with the slasher contract.
|
|
302
304
|
*/
|
|
303
|
-
async getSlasherContract(): Promise<SlasherContract> {
|
|
304
|
-
const slasherAddress = await this.
|
|
305
|
-
|
|
305
|
+
async getSlasherContract(): Promise<SlasherContract | undefined> {
|
|
306
|
+
const slasherAddress = EthAddress.fromString(await this.getSlasherAddress());
|
|
307
|
+
if (slasherAddress.isZero()) {
|
|
308
|
+
return undefined;
|
|
309
|
+
}
|
|
310
|
+
return new SlasherContract(this.client, slasherAddress);
|
|
306
311
|
}
|
|
307
312
|
|
|
308
313
|
getOwner() {
|
|
@@ -314,13 +319,11 @@ export class RollupContract {
|
|
|
314
319
|
}
|
|
315
320
|
|
|
316
321
|
public async getSlashingProposerAddress() {
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
});
|
|
323
|
-
return EthAddress.fromString(await slasher.read.PROPOSER());
|
|
322
|
+
const slasher = await this.getSlasherContract();
|
|
323
|
+
if (!slasher) {
|
|
324
|
+
return EthAddress.ZERO;
|
|
325
|
+
}
|
|
326
|
+
return await slasher.getProposer();
|
|
324
327
|
}
|
|
325
328
|
|
|
326
329
|
getBlockReward() {
|
|
@@ -33,7 +33,6 @@ import { createExtendedL1Client } from './client.js';
|
|
|
33
33
|
import {
|
|
34
34
|
type L1ContractsConfig,
|
|
35
35
|
getEntryQueueConfig,
|
|
36
|
-
getGSEConfiguration,
|
|
37
36
|
getGovernanceConfiguration,
|
|
38
37
|
getRewardBoostConfig,
|
|
39
38
|
getRewardConfig,
|
|
@@ -193,13 +192,11 @@ export const deploySharedContracts = async (
|
|
|
193
192
|
const stakingAssetAddress = await deployer.deploy(StakingAssetArtifact, ['Staking', 'STK', l1Client.account.address]);
|
|
194
193
|
logger.verbose(`Deployed Staking Asset at ${stakingAssetAddress}`);
|
|
195
194
|
|
|
196
|
-
const gseConfiguration = getGSEConfiguration(networkName);
|
|
197
|
-
|
|
198
195
|
const gseAddress = await deployer.deploy(GSEArtifact, [
|
|
199
196
|
l1Client.account.address,
|
|
200
197
|
stakingAssetAddress.toString(),
|
|
201
|
-
|
|
202
|
-
|
|
198
|
+
args.activationThreshold,
|
|
199
|
+
args.ejectionThreshold,
|
|
203
200
|
]);
|
|
204
201
|
logger.verbose(`Deployed GSE at ${gseAddress}`);
|
|
205
202
|
|
|
@@ -549,6 +546,7 @@ export const deployRollup = async (
|
|
|
549
546
|
slasherFlavor: slasherFlavorToSolidityEnum(args.slasherFlavor),
|
|
550
547
|
slashingOffsetInRounds: BigInt(args.slashingOffsetInRounds),
|
|
551
548
|
slashAmounts: [args.slashAmountSmall, args.slashAmountMedium, args.slashAmountLarge],
|
|
549
|
+
localEjectionThreshold: args.localEjectionThreshold,
|
|
552
550
|
};
|
|
553
551
|
|
|
554
552
|
const genesisStateArgs = {
|
|
@@ -1145,7 +1143,7 @@ export const deployL1Contracts = async (
|
|
|
1145
1143
|
|
|
1146
1144
|
// Include Slasher and SlashingProposer (if deployed) in verification data
|
|
1147
1145
|
try {
|
|
1148
|
-
const slasherAddrHex = await rollup.
|
|
1146
|
+
const slasherAddrHex = await rollup.getSlasherAddress();
|
|
1149
1147
|
const slasherAddr = EthAddress.fromString(slasherAddrHex);
|
|
1150
1148
|
if (!slasherAddr.isZero()) {
|
|
1151
1149
|
// Slasher constructor: (address _vetoer, address _governance)
|
package/src/l1_tx_utils.ts
CHANGED
|
@@ -706,12 +706,14 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
706
706
|
* Monitors a transaction until completion, handling speed-ups if needed
|
|
707
707
|
* @param request - Original transaction request (needed for speed-ups)
|
|
708
708
|
* @param initialTxHash - Hash of the initial transaction
|
|
709
|
+
* @param allVersions - Hashes of all transactions submitted under the same nonce (any of them could mine)
|
|
709
710
|
* @param params - Parameters used in the initial transaction
|
|
710
711
|
* @param gasConfig - Optional gas configuration
|
|
711
712
|
*/
|
|
712
713
|
public async monitorTransaction(
|
|
713
714
|
request: L1TxRequest,
|
|
714
715
|
initialTxHash: Hex,
|
|
716
|
+
allVersions: Set<Hex>,
|
|
715
717
|
params: { gasLimit: bigint },
|
|
716
718
|
_gasConfig?: Partial<L1TxUtilsConfig> & { txTimeoutAt?: Date },
|
|
717
719
|
_blobInputs?: L1BlobInputs,
|
|
@@ -743,7 +745,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
743
745
|
}
|
|
744
746
|
const nonce = tx.nonce;
|
|
745
747
|
|
|
746
|
-
|
|
748
|
+
allVersions.add(initialTxHash);
|
|
747
749
|
let currentTxHash = initialTxHash;
|
|
748
750
|
let attempts = 0;
|
|
749
751
|
let lastAttemptSent = this.dateProvider.now();
|
|
@@ -776,8 +778,9 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
776
778
|
}));
|
|
777
779
|
|
|
778
780
|
const currentNonce = await this.client.getTransactionCount({ address: account });
|
|
781
|
+
// If the current nonce on our account is greater than our transaction's nonce then a tx with the same nonce has been mined.
|
|
779
782
|
if (currentNonce > nonce) {
|
|
780
|
-
for (const hash of
|
|
783
|
+
for (const hash of allVersions) {
|
|
781
784
|
try {
|
|
782
785
|
const receipt = await this.client.getTransactionReceipt({ hash });
|
|
783
786
|
if (receipt) {
|
|
@@ -796,6 +799,10 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
796
799
|
}
|
|
797
800
|
}
|
|
798
801
|
}
|
|
802
|
+
// If we get here then we have checked all of our tx versions and not found anything.
|
|
803
|
+
// We should consider the nonce as MINED
|
|
804
|
+
this.state = TxUtilsState.MINED;
|
|
805
|
+
throw new Error(`Nonce ${nonce} is MINED but not by one of our expected transactions`);
|
|
799
806
|
}
|
|
800
807
|
|
|
801
808
|
this.logger?.trace(`Tx timeout check for ${currentTxHash}: ${isTimedOut()}`, {
|
|
@@ -882,7 +889,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
882
889
|
|
|
883
890
|
currentTxHash = newHash;
|
|
884
891
|
|
|
885
|
-
|
|
892
|
+
allVersions.add(currentTxHash);
|
|
886
893
|
lastAttemptSent = this.dateProvider.now();
|
|
887
894
|
}
|
|
888
895
|
await sleep(gasConfig.checkIntervalMs!);
|
|
@@ -904,7 +911,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
904
911
|
this.state = TxUtilsState.NOT_MINED;
|
|
905
912
|
} else if (gasConfig.cancelTxOnTimeout) {
|
|
906
913
|
// Fire cancellation without awaiting to avoid blocking the main thread
|
|
907
|
-
this.attemptTxCancellation(currentTxHash, nonce, isBlobTx, lastGasPrice, attempts).catch(err => {
|
|
914
|
+
this.attemptTxCancellation(currentTxHash, nonce, allVersions, isBlobTx, lastGasPrice, attempts).catch(err => {
|
|
908
915
|
const viemError = formatViemError(err);
|
|
909
916
|
this.logger?.error(`Failed to send cancellation for timed out tx ${currentTxHash}:`, viemError.message, {
|
|
910
917
|
metaMessages: viemError.metaMessages,
|
|
@@ -938,7 +945,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
938
945
|
blobInputs?: L1BlobInputs,
|
|
939
946
|
): Promise<{ receipt: TransactionReceipt; gasPrice: GasPrice }> {
|
|
940
947
|
const { txHash, gasLimit, gasPrice } = await this.sendTransaction(request, gasConfig, blobInputs);
|
|
941
|
-
const receipt = await this.monitorTransaction(request, txHash, { gasLimit }, gasConfig, blobInputs);
|
|
948
|
+
const receipt = await this.monitorTransaction(request, txHash, new Set(), { gasLimit }, gasConfig, blobInputs);
|
|
942
949
|
return { receipt, gasPrice };
|
|
943
950
|
}
|
|
944
951
|
|
|
@@ -973,6 +980,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
973
980
|
/**
|
|
974
981
|
* Attempts to cancel a transaction by sending a 0-value tx to self with same nonce but higher gas prices
|
|
975
982
|
* @param nonce - The nonce of the transaction to cancel
|
|
983
|
+
* @param allVersions - Hashes of all transactions submitted under the same nonce (any of them could mine)
|
|
976
984
|
* @param previousGasPrice - The gas price of the previous transaction
|
|
977
985
|
* @param attempts - The number of attempts to cancel the transaction
|
|
978
986
|
* @returns The hash of the cancellation transaction
|
|
@@ -980,6 +988,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
980
988
|
protected async attemptTxCancellation(
|
|
981
989
|
currentTxHash: Hex,
|
|
982
990
|
nonce: number,
|
|
991
|
+
allVersions: Set<Hex>,
|
|
983
992
|
isBlobTx = false,
|
|
984
993
|
previousGasPrice?: GasPrice,
|
|
985
994
|
attempts = 0,
|
|
@@ -1000,7 +1009,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
1000
1009
|
previousGasPrice,
|
|
1001
1010
|
);
|
|
1002
1011
|
|
|
1003
|
-
this.logger?.
|
|
1012
|
+
this.logger?.info(`Attempting to cancel L1 transaction ${currentTxHash} with nonce ${nonce}`, {
|
|
1004
1013
|
maxFeePerGas: formatGwei(cancelGasPrice.maxFeePerGas),
|
|
1005
1014
|
maxPriorityFeePerGas: formatGwei(cancelGasPrice.maxPriorityFeePerGas),
|
|
1006
1015
|
});
|
|
@@ -1022,11 +1031,12 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
1022
1031
|
|
|
1023
1032
|
this.state = TxUtilsState.CANCELLED;
|
|
1024
1033
|
|
|
1025
|
-
this.logger?.
|
|
1034
|
+
this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`, { nonce });
|
|
1026
1035
|
|
|
1027
1036
|
const receipt = await this.monitorTransaction(
|
|
1028
1037
|
request,
|
|
1029
1038
|
cancelTxHash,
|
|
1039
|
+
allVersions,
|
|
1030
1040
|
{ gasLimit: 21_000n },
|
|
1031
1041
|
undefined,
|
|
1032
1042
|
undefined,
|
|
@@ -19,6 +19,7 @@ export class L1TxUtilsWithBlobs extends L1TxUtils {
|
|
|
19
19
|
/**
|
|
20
20
|
* Attempts to cancel a transaction by sending a 0-value tx to self with same nonce but higher gas prices
|
|
21
21
|
* @param nonce - The nonce of the transaction to cancel
|
|
22
|
+
* @param allVersions - Hashes of all transactions submitted under the same nonce (any of them could mine)
|
|
22
23
|
* @param previousGasPrice - The gas price of the previous transaction
|
|
23
24
|
* @param attempts - The number of attempts to cancel the transaction
|
|
24
25
|
* @returns The hash of the cancellation transaction
|
|
@@ -26,6 +27,7 @@ export class L1TxUtilsWithBlobs extends L1TxUtils {
|
|
|
26
27
|
override async attemptTxCancellation(
|
|
27
28
|
currentTxHash: Hex,
|
|
28
29
|
nonce: number,
|
|
30
|
+
allVersions: Set<Hex>,
|
|
29
31
|
isBlobTx = false,
|
|
30
32
|
previousGasPrice?: GasPrice,
|
|
31
33
|
attempts = 0,
|
|
@@ -42,7 +44,7 @@ export class L1TxUtilsWithBlobs extends L1TxUtils {
|
|
|
42
44
|
previousGasPrice,
|
|
43
45
|
);
|
|
44
46
|
|
|
45
|
-
this.logger?.
|
|
47
|
+
this.logger?.info(`Attempting to cancel blob L1 transaction ${currentTxHash} with nonce ${nonce}`, {
|
|
46
48
|
maxFeePerGas: formatGwei(cancelGasPrice.maxFeePerGas),
|
|
47
49
|
maxPriorityFeePerGas: formatGwei(cancelGasPrice.maxPriorityFeePerGas),
|
|
48
50
|
maxFeePerBlobGas:
|
|
@@ -65,9 +67,12 @@ export class L1TxUtilsWithBlobs extends L1TxUtils {
|
|
|
65
67
|
const signedRequest = await this.prepareSignedTransaction(txData);
|
|
66
68
|
const cancelTxHash = await this.client.sendRawTransaction({ serializedTransaction: signedRequest });
|
|
67
69
|
|
|
70
|
+
this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`);
|
|
71
|
+
|
|
68
72
|
const receipt = await this.monitorTransaction(
|
|
69
73
|
request,
|
|
70
74
|
cancelTxHash,
|
|
75
|
+
allVersions,
|
|
71
76
|
{ gasLimit: 21_000n },
|
|
72
77
|
undefined,
|
|
73
78
|
undefined,
|
|
@@ -94,11 +99,12 @@ export class L1TxUtilsWithBlobs extends L1TxUtils {
|
|
|
94
99
|
const signedRequest = await this.prepareSignedTransaction(txData);
|
|
95
100
|
const cancelTxHash = await this.client.sendRawTransaction({ serializedTransaction: signedRequest });
|
|
96
101
|
|
|
97
|
-
this.logger?.
|
|
102
|
+
this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`);
|
|
98
103
|
|
|
99
104
|
const receipt = await this.monitorTransaction(
|
|
100
105
|
request,
|
|
101
106
|
cancelTxHash,
|
|
107
|
+
allVersions,
|
|
102
108
|
{ gasLimit: 21_000n },
|
|
103
109
|
undefined,
|
|
104
110
|
blobInputs,
|
package/src/queries.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import { SlasherAbi } from '@aztec/l1-artifacts/SlasherAbi';
|
|
3
|
-
|
|
4
|
-
import { getContract } from 'viem';
|
|
5
2
|
|
|
6
3
|
import type { L1ContractsConfig } from './config.js';
|
|
7
4
|
import { ReadOnlyGovernanceContract } from './contracts/governance.js';
|
|
@@ -27,8 +24,7 @@ export async function getL1ContractsConfig(
|
|
|
27
24
|
const rollupAddress = addresses.rollupAddress ?? (await governanceProposer.getRollupAddress());
|
|
28
25
|
const rollup = new RollupContract(publicClient, rollupAddress.toString());
|
|
29
26
|
const slasherProposer = await rollup.getSlashingProposer();
|
|
30
|
-
const
|
|
31
|
-
const slasher = getContract({ address: slasherAddress, abi: SlasherAbi, client: publicClient });
|
|
27
|
+
const slasher = await rollup.getSlasherContract();
|
|
32
28
|
|
|
33
29
|
const [
|
|
34
30
|
l1StartBlock,
|
|
@@ -39,6 +35,7 @@ export async function getL1ContractsConfig(
|
|
|
39
35
|
aztecTargetCommitteeSize,
|
|
40
36
|
activationThreshold,
|
|
41
37
|
ejectionThreshold,
|
|
38
|
+
localEjectionThreshold,
|
|
42
39
|
governanceProposerQuorum,
|
|
43
40
|
governanceProposerRoundSize,
|
|
44
41
|
slashingQuorum,
|
|
@@ -62,6 +59,7 @@ export async function getL1ContractsConfig(
|
|
|
62
59
|
rollup.getTargetCommitteeSize(),
|
|
63
60
|
rollup.getActivationThreshold(),
|
|
64
61
|
rollup.getEjectionThreshold(),
|
|
62
|
+
rollup.getLocalEjectionThreshold(),
|
|
65
63
|
governanceProposer.getQuorumSize(),
|
|
66
64
|
governanceProposer.getRoundSize(),
|
|
67
65
|
slasherProposer?.getQuorumSize() ?? 0n,
|
|
@@ -70,7 +68,7 @@ export async function getL1ContractsConfig(
|
|
|
70
68
|
slasherProposer?.getExecutionDelayInRounds() ?? 0n,
|
|
71
69
|
slasherProposer?.type === 'tally' ? slasherProposer.getSlashOffsetInRounds() : 0n,
|
|
72
70
|
slasherProposer?.type === 'tally' ? slasherProposer.getSlashingAmounts() : [0n, 0n, 0n],
|
|
73
|
-
slasher
|
|
71
|
+
slasher?.getVetoer() ?? EthAddress.ZERO,
|
|
74
72
|
rollup.getManaTarget(),
|
|
75
73
|
rollup.getProvingCostPerMana(),
|
|
76
74
|
rollup.getVersion(),
|
|
@@ -89,11 +87,12 @@ export async function getL1ContractsConfig(
|
|
|
89
87
|
governanceProposerRoundSize: Number(governanceProposerRoundSize),
|
|
90
88
|
activationThreshold,
|
|
91
89
|
ejectionThreshold,
|
|
90
|
+
localEjectionThreshold,
|
|
92
91
|
slashingQuorum: Number(slashingQuorum),
|
|
93
92
|
slashingRoundSizeInEpochs: Number(slashingRoundSize / aztecEpochDuration),
|
|
94
93
|
slashingLifetimeInRounds: Number(slashingLifetimeInRounds),
|
|
95
94
|
slashingExecutionDelayInRounds: Number(slashingExecutionDelayInRounds),
|
|
96
|
-
slashingVetoer
|
|
95
|
+
slashingVetoer,
|
|
97
96
|
manaTarget: manaTarget,
|
|
98
97
|
provingCostPerMana: provingCostPerMana,
|
|
99
98
|
rollupVersion: Number(rollupVersion),
|