@aztec/ethereum 0.0.1-commit.fcb71a6 → 0.0.1-commit.fffb133c
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 +15 -28
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +46 -55
- package/dest/contracts/fee_asset_handler.d.ts +6 -5
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.js +9 -9
- package/dest/contracts/governance.d.ts +3 -1
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +9 -1
- package/dest/contracts/governance_proposer.js +382 -8
- package/dest/contracts/inbox.d.ts +18 -1
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +32 -1
- package/dest/contracts/index.d.ts +3 -1
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +2 -0
- package/dest/contracts/log.d.ts +13 -0
- package/dest/contracts/log.d.ts.map +1 -0
- package/dest/contracts/log.js +1 -0
- package/dest/contracts/outbox.d.ts +41 -0
- package/dest/contracts/outbox.d.ts.map +1 -0
- package/dest/contracts/outbox.js +86 -0
- package/dest/contracts/rollup.d.ts +160 -96
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +668 -129
- package/dest/deploy_aztec_l1_contracts.d.ts +15 -2
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_aztec_l1_contracts.js +74 -12
- package/dest/generated/l1-contracts-defaults.d.ts +30 -0
- package/dest/generated/l1-contracts-defaults.d.ts.map +1 -0
- package/dest/generated/l1-contracts-defaults.js +30 -0
- package/dest/l1_artifacts.d.ts +4866 -1513
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/index.d.ts +3 -2
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/index.js +2 -1
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +2 -12
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +35 -17
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +2 -11
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +36 -18
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +14 -27
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -1
- package/dest/l1_tx_utils/fee-strategies/types.js +0 -21
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +2 -2
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_fee_analyzer.js +3 -3
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +1 -5
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +14 -51
- package/dest/queries.d.ts +2 -2
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +6 -3
- package/dest/test/chain_monitor.js +1 -2
- package/dest/test/eth_cheat_codes.d.ts +13 -1
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.d.ts +3 -2
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +10 -2
- package/package.json +8 -7
- package/src/config.ts +55 -54
- package/src/contracts/README.md +157 -0
- package/src/contracts/fee_asset_handler.ts +8 -7
- package/src/contracts/governance.ts +8 -1
- package/src/contracts/inbox.ts +48 -1
- package/src/contracts/index.ts +2 -0
- package/src/contracts/log.ts +13 -0
- package/src/contracts/outbox.ts +98 -0
- package/src/contracts/rollup.ts +333 -93
- package/src/deploy_aztec_l1_contracts.ts +76 -14
- package/src/generated/l1-contracts-defaults.ts +32 -0
- package/src/l1_tx_utils/fee-strategies/index.ts +1 -1
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +45 -41
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +48 -44
- package/src/l1_tx_utils/fee-strategies/types.ts +14 -46
- package/src/l1_tx_utils/l1_fee_analyzer.ts +2 -3
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +20 -59
- package/src/queries.ts +5 -3
- package/src/test/chain_monitor.ts +1 -1
- package/src/test/rollup_cheat_codes.ts +12 -3
|
@@ -84,63 +84,31 @@ export class ReadOnlyL1TxUtils {
|
|
|
84
84
|
): Promise<GasPrice> {
|
|
85
85
|
const gasConfig = merge(this.config, gasConfigOverrides);
|
|
86
86
|
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
// Execute strategy - it handles all RPC calls internally and returns everything we need
|
|
88
|
+
const strategyResult = await retry(
|
|
89
|
+
() =>
|
|
90
|
+
CurrentStrategy.execute(this.client, {
|
|
91
|
+
gasConfig,
|
|
92
|
+
isBlobTx,
|
|
93
|
+
logger: this.logger,
|
|
94
|
+
}),
|
|
95
|
+
'Executing priority fee strategy',
|
|
96
|
+
makeBackoff(times(2, () => 0)),
|
|
97
|
+
this.logger,
|
|
98
|
+
true,
|
|
92
99
|
);
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
if (isBlobTx) {
|
|
96
|
-
blobBaseFeePromise = this.tryTwice(() => this.client.getBlobBaseFee(), 'Getting blob base fee');
|
|
97
|
-
}
|
|
101
|
+
const { latestBlock, blobBaseFee, priorityFee: strategyPriorityFee } = strategyResult;
|
|
98
102
|
|
|
99
|
-
//
|
|
100
|
-
const
|
|
101
|
-
const strategyPromiseKeys = [];
|
|
102
|
-
const strategyPromisesArr = [];
|
|
103
|
-
for (const [key, promise] of Object.entries(strategyPromises)) {
|
|
104
|
-
strategyPromiseKeys.push(key);
|
|
105
|
-
strategyPromisesArr.push(this.tryTwice(() => promise, `Getting strategy data for ${key}`));
|
|
106
|
-
}
|
|
103
|
+
// Extract base fee from latest block
|
|
104
|
+
const baseFee = latestBlock.baseFeePerGas ?? 0n;
|
|
107
105
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
blobBaseFeePromise ?? Promise.resolve(0n),
|
|
111
|
-
...strategyPromisesArr,
|
|
112
|
-
]);
|
|
113
|
-
|
|
114
|
-
// Extract results
|
|
115
|
-
const baseFee =
|
|
116
|
-
latestBlockResult.status === 'fulfilled' &&
|
|
117
|
-
typeof latestBlockResult.value === 'object' &&
|
|
118
|
-
latestBlockResult.value.baseFeePerGas
|
|
119
|
-
? latestBlockResult.value.baseFeePerGas
|
|
120
|
-
: 0n;
|
|
121
|
-
|
|
122
|
-
// Get blob base fee if available
|
|
123
|
-
let blobBaseFee = 0n;
|
|
124
|
-
if (isBlobTx && blobBaseFeeResult.status === 'fulfilled' && typeof blobBaseFeeResult.value === 'bigint') {
|
|
125
|
-
blobBaseFee = blobBaseFeeResult.value;
|
|
126
|
-
} else if (isBlobTx) {
|
|
106
|
+
// Handle blob base fee
|
|
107
|
+
if (isBlobTx && blobBaseFee === undefined) {
|
|
127
108
|
this.logger?.warn('Failed to get L1 blob base fee', attempt);
|
|
128
109
|
}
|
|
129
110
|
|
|
130
|
-
let priorityFee
|
|
131
|
-
// Get competitive priority fee using strategy
|
|
132
|
-
// Reconstruct the results object with the same keys as the promises
|
|
133
|
-
const resultsObject: Record<string, PromiseSettledResult<unknown>> = {};
|
|
134
|
-
strategyPromiseKeys.forEach((key, index) => {
|
|
135
|
-
resultsObject[key] = strategyResults[index];
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
const result = CurrentStrategy.calculate(resultsObject as any, {
|
|
139
|
-
gasConfig,
|
|
140
|
-
isBlobTx,
|
|
141
|
-
logger: this.logger,
|
|
142
|
-
});
|
|
143
|
-
priorityFee = result.priorityFee;
|
|
111
|
+
let priorityFee = strategyPriorityFee;
|
|
144
112
|
|
|
145
113
|
// Apply minimum priority fee floor if configured
|
|
146
114
|
if (gasConfig.minimumPriorityFeePerGas) {
|
|
@@ -156,7 +124,7 @@ export class ReadOnlyL1TxUtils {
|
|
|
156
124
|
}
|
|
157
125
|
let maxFeePerGas = baseFee;
|
|
158
126
|
|
|
159
|
-
let maxFeePerBlobGas = blobBaseFee;
|
|
127
|
+
let maxFeePerBlobGas = blobBaseFee ?? 0n;
|
|
160
128
|
|
|
161
129
|
// Bump base fee so it's valid for next blocks if it stalls
|
|
162
130
|
const numBlocks = Math.ceil(gasConfig.stallTimeMs! / BLOCK_TIME_MS);
|
|
@@ -250,7 +218,7 @@ export class ReadOnlyL1TxUtils {
|
|
|
250
218
|
baseFee: formatGwei(baseFee),
|
|
251
219
|
maxFeePerGas: formatGwei(maxFeePerGas),
|
|
252
220
|
maxPriorityFeePerGas: formatGwei(maxPriorityFeePerGas),
|
|
253
|
-
blobBaseFee: formatGwei(blobBaseFee),
|
|
221
|
+
blobBaseFee: formatGwei(blobBaseFee ?? 0n),
|
|
254
222
|
maxFeePerBlobGas: formatGwei(maxFeePerBlobGas),
|
|
255
223
|
},
|
|
256
224
|
);
|
|
@@ -448,11 +416,4 @@ export class ReadOnlyL1TxUtils {
|
|
|
448
416
|
});
|
|
449
417
|
return bumpedGasLimit;
|
|
450
418
|
}
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Helper function to retry RPC calls twice
|
|
454
|
-
*/
|
|
455
|
-
private tryTwice<T>(fn: () => Promise<T>, description: string): Promise<T> {
|
|
456
|
-
return retry<T>(fn, description, makeBackoff(times(2, () => 0)), this.logger, true);
|
|
457
|
-
}
|
|
458
419
|
}
|
package/src/queries.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { DefaultL1ContractsConfig, type L1ContractsConfig } from './config.js';
|
|
4
4
|
import { ReadOnlyGovernanceContract } from './contracts/governance.js';
|
|
5
5
|
import { GovernanceProposerContract } from './contracts/governance_proposer.js';
|
|
6
6
|
import { InboxContract } from './contracts/inbox.js';
|
|
@@ -99,11 +99,12 @@ export async function getL1ContractsConfig(
|
|
|
99
99
|
inboxLag: Number(inboxLag),
|
|
100
100
|
governanceProposerQuorum: Number(governanceProposerQuorum),
|
|
101
101
|
governanceProposerRoundSize: Number(governanceProposerRoundSize),
|
|
102
|
+
governanceVotingDuration: DefaultL1ContractsConfig.governanceVotingDuration,
|
|
102
103
|
activationThreshold,
|
|
103
104
|
ejectionThreshold,
|
|
104
105
|
localEjectionThreshold,
|
|
105
106
|
slashingQuorum: Number(slashingQuorum),
|
|
106
|
-
slashingRoundSizeInEpochs: Number(slashingRoundSize / aztecEpochDuration),
|
|
107
|
+
slashingRoundSizeInEpochs: Number(Number(slashingRoundSize) / aztecEpochDuration),
|
|
107
108
|
slashingLifetimeInRounds: Number(slashingLifetimeInRounds),
|
|
108
109
|
slashingExecutionDelayInRounds: Number(slashingExecutionDelayInRounds),
|
|
109
110
|
slashingVetoer,
|
|
@@ -111,12 +112,13 @@ export async function getL1ContractsConfig(
|
|
|
111
112
|
manaTarget,
|
|
112
113
|
provingCostPerMana: provingCostPerMana,
|
|
113
114
|
rollupVersion: Number(rollupVersion),
|
|
114
|
-
genesisArchiveTreeRoot,
|
|
115
|
+
genesisArchiveTreeRoot: genesisArchiveTreeRoot.toString(),
|
|
115
116
|
exitDelaySeconds: Number(exitDelay),
|
|
116
117
|
slasherFlavor: slasherProposer?.type ?? 'tally',
|
|
117
118
|
slashingOffsetInRounds: Number(slashingOffsetInRounds),
|
|
118
119
|
slashAmountSmall: slashingAmounts[0],
|
|
119
120
|
slashAmountMedium: slashingAmounts[1],
|
|
120
121
|
slashAmountLarge: slashingAmounts[2],
|
|
122
|
+
initialEthPerFeeAsset: DefaultL1ContractsConfig.initialEthPerFeeAsset,
|
|
121
123
|
};
|
|
122
124
|
}
|
|
@@ -156,7 +156,7 @@ export class ChainMonitor extends EventEmitter<ChainMonitorEventMap> {
|
|
|
156
156
|
let committee: EthAddress[] | undefined;
|
|
157
157
|
if (l2Epoch !== this.l2EpochNumber) {
|
|
158
158
|
this.l2EpochNumber = l2Epoch;
|
|
159
|
-
committee =
|
|
159
|
+
committee = await this.rollup.getCurrentEpochCommittee();
|
|
160
160
|
this.emit('l2-epoch', { l2EpochNumber: l2Epoch, timestamp, committee });
|
|
161
161
|
msg += ` starting new epoch ${this.l2EpochNumber} `;
|
|
162
162
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
1
|
+
import { OutboxContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
2
2
|
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
3
|
import type { ViemPublicClient } from '@aztec/ethereum/types';
|
|
4
4
|
import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
@@ -124,7 +124,7 @@ export class RollupCheatCodes {
|
|
|
124
124
|
} = {},
|
|
125
125
|
) {
|
|
126
126
|
const { epochDuration: slotsInEpoch } = await this.getConfig();
|
|
127
|
-
const slotNumber = SlotNumber(epoch * Number(slotsInEpoch));
|
|
127
|
+
const slotNumber = SlotNumber(Number(epoch) * Number(slotsInEpoch));
|
|
128
128
|
const timestamp = (await this.rollup.read.getTimestampForSlot([BigInt(slotNumber)])) + BigInt(opts.offset ?? 0);
|
|
129
129
|
try {
|
|
130
130
|
await this.ethCheatCodes.warp(Number(timestamp), { ...opts, silent: true, resetBlockInterval: true });
|
|
@@ -176,7 +176,7 @@ export class RollupCheatCodes {
|
|
|
176
176
|
* Marks the specified checkpoint (or latest if none) as proven
|
|
177
177
|
* @param maybeCheckpointNumber - The checkpoint number to mark as proven (defaults to latest pending)
|
|
178
178
|
*/
|
|
179
|
-
public markAsProven(maybeCheckpointNumber?:
|
|
179
|
+
public markAsProven(maybeCheckpointNumber?: CheckpointNumber) {
|
|
180
180
|
return this.ethCheatCodes.execWithPausedAnvil(async () => {
|
|
181
181
|
const tipsBefore = await this.getTips();
|
|
182
182
|
const { pending, proven } = tipsBefore;
|
|
@@ -250,6 +250,15 @@ export class RollupCheatCodes {
|
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
public insertOutbox(epoch: EpochNumber, outHash: bigint) {
|
|
254
|
+
return this.ethCheatCodes.execWithPausedAnvil(async () => {
|
|
255
|
+
const outboxAddress = await this.rollup.read.getOutbox();
|
|
256
|
+
const epochRootSlot = OutboxContract.getEpochRootStorageSlot(epoch);
|
|
257
|
+
await this.ethCheatCodes.store(EthAddress.fromString(outboxAddress), epochRootSlot, outHash);
|
|
258
|
+
this.logger.warn(`Advanced outbox to epoch ${epoch} with out hash ${outHash}`);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
253
262
|
/**
|
|
254
263
|
* Executes an action impersonated as the owner of the Rollup contract.
|
|
255
264
|
* @param action - The action to execute
|