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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -900,12 +900,12 @@ workflows:
# Benchmark jobs.
- bench-publish-rollup: *e2e_test
- bench-process-history: *e2e_test
# - bench-tx-size: *e2e_test
- bench-tx-size: *e2e_test
- bench-summary:
requires:
- bench-publish-rollup
- bench-process-history
# - bench-tx-size
- bench-tx-size
<<: *defaults

# Production releases.
Expand Down
17 changes: 6 additions & 11 deletions yarn-project/end-to-end/src/benchmarks/bench_tx_size_fees.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
PublicFeePaymentMethod,
TxStatus,
} from '@aztec/aztec.js';
import { Fr, GasSettings } from '@aztec/circuits.js';
import { GasSettings } from '@aztec/circuits.js';
import { FPCContract, GasTokenContract, TokenContract } from '@aztec/noir-contracts.js';
import { getCanonicalGasTokenAddress } from '@aztec/protocol-contracts/gas-token';

Expand Down Expand Up @@ -54,11 +54,11 @@ describe('benchmarks/tx_size_fees', () => {
// mint tokens
beforeAll(async () => {
await Promise.all([
gas.methods.mint_public(aliceWallet.getAddress(), 1000n).send().wait(),
gas.methods.mint_public(fpc.address, 1000n).send().wait(),
gas.methods.mint_public(aliceWallet.getAddress(), 100e9).send().wait(),
gas.methods.mint_public(fpc.address, 100e9).send().wait(),
]);
await token.methods.privately_mint_private_note(1000n).send().wait();
await token.methods.mint_public(aliceWallet.getAddress(), 1000n).send().wait();
await token.methods.privately_mint_private_note(100e9).send().wait();
await token.methods.mint_public(aliceWallet.getAddress(), 100e9).send().wait();
});

it.each<() => Promise<FeePaymentMethod | undefined>>([
Expand All @@ -68,12 +68,7 @@ describe('benchmarks/tx_size_fees', () => {
() => Promise.resolve(new PrivateFeePaymentMethod(token.address, fpc.address, aliceWallet)),
])('sends a tx with a fee', async createPaymentMethod => {
const paymentMethod = await createPaymentMethod();
const gasSettings = GasSettings.from({
gasLimits: { daGas: 5, l1Gas: 5, l2Gas: 5 },
teardownGasLimits: { daGas: 3, l1Gas: 3, l2Gas: 3 },
maxFeesPerGas: { feePerDaGas: Fr.ONE, feePerL1Gas: Fr.ONE, feePerL2Gas: Fr.ONE },
inclusionFee: new Fr(6),
});
const gasSettings = GasSettings.default();
const tx = await token.methods
.transfer(aliceWallet.getAddress(), bobAddress, 1n, 0)
.send({ fee: paymentMethod ? { gasSettings, paymentMethod } : undefined })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,15 @@ describe('e2e_dapp_subscription', () => {
let bananasPublicBalances: BalancesFn;
let bananasPrivateBalances: BalancesFn;

const SUBSCRIPTION_AMOUNT = 100n;
const INITIAL_GAS_BALANCE = 1000n;
const PUBLICLY_MINTED_BANANAS = 500n;
const PRIVATELY_MINTED_BANANAS = 600n;
const SUBSCRIPTION_AMOUNT = BigInt(100e9);
const INITIAL_GAS_BALANCE = BigInt(1000e9);
const PUBLICLY_MINTED_BANANAS = BigInt(500e9);
const PRIVATELY_MINTED_BANANAS = BigInt(600e9);

const FEE_AMOUNT = 1n;
const REFUND = 29n; // intentionally overpay the gas fee. This is the expected refund.
const MAX_FEE = FEE_AMOUNT + REFUND;

const GAS_SETTINGS = GasSettings.from({
gasLimits: { daGas: 5, l1Gas: 5, l2Gas: 5 },
teardownGasLimits: { daGas: 3, l1Gas: 3, l2Gas: 3 },
maxFeesPerGas: { feePerDaGas: Fr.ONE, feePerL1Gas: Fr.ONE, feePerL2Gas: Fr.ONE },
inclusionFee: new Fr(6),
});
const MAX_FEE = BigInt(30e9);

const GAS_SETTINGS = GasSettings.default();

beforeAll(async () => {
process.env.PXE_URL = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ describe('e2e_fees', () => {
let bananaPublicBalances: BalancesFn;
let bananaPrivateBalances: BalancesFn;

const gasSettings = GasSettings.from({
gasLimits: { daGas: 5, l1Gas: 5, l2Gas: 5 },
teardownGasLimits: { daGas: 3, l1Gas: 3, l2Gas: 3 },
maxFeesPerGas: { feePerDaGas: Fr.ONE, feePerL1Gas: Fr.ONE, feePerL2Gas: Fr.ONE },
inclusionFee: new Fr(6),
});
const gasSettings = GasSettings.default();

beforeAll(async () => {
const ctx = await setup(3, {}, {}, true);
Expand Down Expand Up @@ -113,8 +108,8 @@ describe('e2e_fees', () => {
});

it('reverts transactions but still pays fees using PublicFeePaymentMethod', async () => {
const OutrageousPublicAmountAliceDoesNotHave = 10000n;
const PublicMintedAlicePublicBananas = 1000n;
const OutrageousPublicAmountAliceDoesNotHave = BigInt(1e15);
const PublicMintedAlicePublicBananas = BigInt(1e12);
const FeeAmount = 1n;

const [initialAlicePrivateBananas, initialFPCPrivateBananas] = await bananaPrivateBalances(
Expand Down Expand Up @@ -218,13 +213,13 @@ describe('e2e_fees', () => {

beforeAll(async () => {
// Fund Alice private and publicly
await mintPrivate(1000n, aliceAddress);
await bananaCoin.methods.mint_public(aliceAddress, 1000n).send().wait();
await mintPrivate(BigInt(1e12), aliceAddress);
await bananaCoin.methods.mint_public(aliceAddress, 1e12).send().wait();
});

beforeEach(async () => {
FeeAmount = 1n;
MaxFee = 30n;
MaxFee = BigInt(30e9);
RefundAmount = MaxFee - FeeAmount;
RefundSecret = Fr.random();

Expand All @@ -241,7 +236,7 @@ describe('e2e_fees', () => {
]);
});

it("pays fees for tx that don't run public app logic", async () => {
it('pays fees for tx that dont run public app logic', async () => {
/**
* PRIVATE SETUP
* check authwit
Expand Down Expand Up @@ -514,7 +509,7 @@ describe('e2e_fees', () => {
).resolves.toBeUndefined();
});

it("rejects txs that don't have enough balance to cover gas costs", async () => {
it('rejects txs that dont have enough balance to cover gas costs', async () => {
// deploy a copy of bananaFPC but don't fund it!
const bankruptFPC = await FPCContract.deploy(aliceWallet, bananaCoin.address, gasTokenContract.address)
.send()
Expand Down Expand Up @@ -544,7 +539,7 @@ describe('e2e_fees', () => {
});

it('fails transaction that error in setup', async () => {
const OutrageousPublicAmountAliceDoesNotHave = 10000n;
const OutrageousPublicAmountAliceDoesNotHave = BigInt(100e12);

// simulation throws an error when setup fails
await expect(
Expand Down Expand Up @@ -579,7 +574,7 @@ describe('e2e_fees', () => {
* We trigger an error in teardown by having the FPC authorize a transfer of its entire balance to Alice
* as part of app logic. This will cause the FPC to not have enough funds to pay the refund back to Alice.
*/
const PublicMintedAlicePublicBananas = 1000n;
const PublicMintedAlicePublicBananas = 100_000_000_000n;

const [initialAlicePrivateBananas, initialFPCPrivateBananas] = await bananaPrivateBalances(
aliceAddress,
Expand Down