Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 55 additions & 22 deletions docs/docs-developers/docs/resources/migration_notes.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions yarn-project/ethereum/src/deploy_l1_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { RegisterNewRollupVersionPayloadArtifact } from './l1_artifacts.js';
import { type L1TxUtilsConfig, getL1TxUtilsConfigEnvVars } from './l1_tx_utils/config.js';
import { createL1TxUtils } from './l1_tx_utils/factory.js';
import type { L1TxUtils } from './l1_tx_utils/l1_tx_utils.js';
import type { GasPrice, L1TxConfig, L1TxRequest } from './l1_tx_utils/types.js';
import type { FeesPerGas, L1TxConfig, L1TxRequest } from './l1_tx_utils/types.js';
import type { ExtendedViemWalletClient } from './types.js';
import { formatViemError } from './utils.js';

Expand Down Expand Up @@ -131,11 +131,11 @@ export class L1Deployer {
sendTransaction(
tx: L1TxRequest,
options?: L1TxConfig,
): Promise<{ txHash: Hex; gasLimit: bigint; gasPrice: GasPrice }> {
): Promise<{ txHash: Hex; gasLimit: bigint; feesPerGas: FeesPerGas }> {
return this.l1TxUtils.sendTransaction(tx, options).then(({ txHash, state }) => ({
txHash,
gasLimit: state.gasLimit,
gasPrice: state.gasPrice,
feesPerGas: state.feesPerGas,
}));
}
}
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/ethereum/src/l1_tx_utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def send_and_monitor_tx(tx_request):

# Speed up if stalled and have retries left
if time_since_last_sent > stall_time and attempts < max_attempts:
replacement_tx = make_tx(tx_request, nonce, bump_gas_price(state.gasPrice))
replacement_tx = make_tx(tx_request, nonce, bump_fees_per_gas(state.feesPerGas))
state.status = is_cancel_tx ? 'cancelled' : 'speed-up'
state.tx_hashes.push(send_tx(replacement_tx))
state.last_sent_at = now
Expand All @@ -144,7 +144,7 @@ def attempt_tx_cancellation(state):
return

# Send noop tx with same nonce but higher gas
cancel_tx = make_noop_tx(state.nonce, bump_gas_price(state.gasPrice))
cancel_tx = make_noop_tx(state.nonce, bump_fees_per_gas(state.feesPerGas))
state.cancelTxHashes.push(send_tx(cancel_tx))
state.status = 'cancelled'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { type L1TxRequest, L1TxTimeoutError } from './types.js';

const MNEMONIC = 'test test test test test test test test test test test junk';
const WEI_CONST = 1_000_000_000n;
const logger = createLogger('ethereum:test:gas-price-ladder');
const logger = createLogger('ethereum:test:fees-per-gas-ladder');

const REQUEST: L1TxRequest = {
to: '0x1234567890123456789012345678901234567890',
Expand Down Expand Up @@ -49,7 +49,7 @@ async function runUntilTimeout(gasUtils: L1TxUtils, cheatCodes: EthCheatCodes):
return promise;
}

describe('L1TxUtils gas-price ladder capture (integration)', () => {
describe('L1TxUtils fees-per-gas ladder capture (integration)', () => {
const initialBaseFee = WEI_CONST; // 1 gwei
let l1Client: ExtendedViemWalletClient;
let anvil: Anvil;
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('L1TxUtils gas-price ladder capture (integration)', () => {
await anvil.stop().catch(err => createLogger('cleanup').error(err));
}, 10_000);

it('captures the escalating gas-price ladder and surfaces it on timeout', async () => {
it('captures the escalating fees-per-gas ladder and surfaces it on timeout', async () => {
const gasUtils = makeGasUtils({ maxSpeedUpAttempts: 3 });

const err = await runUntilTimeout(gasUtils, cheatCodes);
Expand All @@ -107,18 +107,18 @@ describe('L1TxUtils gas-price ladder capture (integration)', () => {
const { txState } = err as L1TxTimeoutError;

// Initial send plus at least one speed-up.
expect(txState.gasPriceHistory).toBeDefined();
expect(txState.gasPriceHistory!.length).toBeGreaterThanOrEqual(2);
expect(txState.feesPerGasHistory).toBeDefined();
expect(txState.feesPerGasHistory!.length).toBeGreaterThanOrEqual(2);

// Priority fees strictly escalate across the ladder.
const priorityFees = txState.gasPriceHistory!.map(g => g.maxPriorityFeePerGas);
const priorityFees = txState.feesPerGasHistory!.map(g => g.maxPriorityFeePerGas);
for (let i = 1; i < priorityFees.length; i++) {
expect(priorityFees[i]).toBeGreaterThan(priorityFees[i - 1]);
}

// attempts == number of sent txs == ladder length; other snapshot fields are populated.
expect(txState.attempts).toBe(txState.gasPriceHistory!.length);
expect(txState.finalGasPrice.maxPriorityFeePerGas).toBe(priorityFees[priorityFees.length - 1]);
expect(txState.attempts).toBe(txState.feesPerGasHistory!.length);
expect(txState.finalFeesPerGas.maxPriorityFeePerGas).toBe(priorityFees[priorityFees.length - 1]);
expect(txState.gasLimit).toBeGreaterThan(0n);
expect(txState.nonce).toBeGreaterThanOrEqual(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { L1TxTimeoutError, type TimedOutTxState } from './types.js';

describe('L1TxTimeoutError', () => {
const txState: TimedOutTxState = {
gasPriceHistory: [
feesPerGasHistory: [
{ maxFeePerGas: 100n, maxPriorityFeePerGas: 1n },
{ maxFeePerGas: 120n, maxPriorityFeePerGas: 2n },
],
finalGasPrice: { maxFeePerGas: 120n, maxPriorityFeePerGas: 2n },
finalFeesPerGas: { maxFeePerGas: 120n, maxPriorityFeePerGas: 2n },
attempts: 2,
nonce: 7,
gasLimit: 21_000n,
Expand All @@ -22,7 +22,7 @@ describe('L1TxTimeoutError', () => {
expect(err instanceof Error).toBe(true);
});

it('carries the gas-price ladder snapshot and message', () => {
it('carries the fees-per-gas ladder snapshot and message', () => {
const err = new L1TxTimeoutError('timed out', txState);
expect(err.message).toBe('timed out');
expect(err.txState).toEqual(txState);
Expand Down
Loading
Loading