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
3 changes: 2 additions & 1 deletion spartan/environments/alpha-net.env
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ AZTEC_LOCAL_EJECTION_THRESHOLD=90000000000000000000
SPONSORED_FPC=true

SEQ_MAX_TX_PER_CHECKPOINT=72
SEQ_MIN_TX_PER_BLOCK=0
SEQ_MIN_TX_PER_BLOCK=1
SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER=1

# Override L1 tx utils bump percentages for scenario tests
VALIDATOR_L1_PRIORITY_FEE_BUMP_PERCENTAGE=0
Expand Down
3 changes: 2 additions & 1 deletion spartan/environments/devnet.env
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ VALIDATOR_MNEMONIC_START_INDEX=$((1 + MNEMONIC_INDEX_OFFSET))
VALIDATOR_INDICES=$(seq -s ',' $VALIDATOR_MNEMONIC_START_INDEX $((VALIDATOR_MNEMONIC_START_INDEX + TOTAL_VALIDATORS - 1)))
VALIDATOR_PUBLISHER_MNEMONIC_START_INDEX=$((5000 + MNEMONIC_INDEX_OFFSET))
VALIDATOR_PUBLISHERS_PER_REPLICA=8
SEQ_MIN_TX_PER_BLOCK=0
PUBLISHERS_PER_VALIDATOR_KEY=1
SEQ_MIN_TX_PER_BLOCK=1
SEQ_MAX_TX_PER_BLOCK=32

PROVER_PUBLISHER_MNEMONIC_START_INDEX=$((8000 + MNEMONIC_INDEX_OFFSET))
Expand Down
2 changes: 1 addition & 1 deletion spartan/environments/five-tps-long-epoch.env
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ AZTEC_SLASHING_OFFSET_IN_ROUNDS=1
AZTEC_LOCAL_EJECTION_THRESHOLD=90000000000000000000

SEQ_MAX_TX_PER_CHECKPOINT=180
SEQ_MIN_TX_PER_BLOCK=0
SEQ_MIN_TX_PER_BLOCK=1

# Override L1 tx utils bump percentages for scenario tests
VALIDATOR_L1_PRIORITY_FEE_BUMP_PERCENTAGE=0
Expand Down
2 changes: 1 addition & 1 deletion spartan/environments/five-tps-short-epoch.env
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ AZTEC_SLASHING_OFFSET_IN_ROUNDS=1
AZTEC_LOCAL_EJECTION_THRESHOLD=90000000000000000000

SEQ_MAX_TX_PER_CHECKPOINT=180
SEQ_MIN_TX_PER_BLOCK=0
SEQ_MIN_TX_PER_BLOCK=1

# Override L1 tx utils bump percentages for scenario tests
VALIDATOR_L1_PRIORITY_FEE_BUMP_PERCENTAGE=0
Expand Down
2 changes: 1 addition & 1 deletion spartan/environments/network-defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ _prodlike: &prodlike
# Sequencer Configuration
#---------------------------------------------------------------------------
# Minimum transactions to include in a block.
SEQ_MIN_TX_PER_BLOCK: 0
SEQ_MIN_TX_PER_BLOCK: 1
# Maximum transactions to include in a block
# Build checkpoint even if block is empty.
SEQ_BUILD_CHECKPOINT_IF_EMPTY: true
Expand Down
2 changes: 1 addition & 1 deletion spartan/environments/next-net.env
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ L1_TX_FAILED_STORE=gs://aztec-develop/next-net/failed-l1-txs
TEST_ACCOUNTS=true
SPONSORED_FPC=true

SEQ_MIN_TX_PER_BLOCK=0
SEQ_MIN_TX_PER_BLOCK=1

SEQ_MAX_TX_PER_CHECKPOINT=7

Expand Down
2 changes: 1 addition & 1 deletion spartan/environments/prove-n-tps-fake.env
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ PROVER_TEST_DELAY_TYPE=realistic
PROVER_TEST_VERIFICATION_DELAY_MS=250

SEQ_MAX_TX_PER_CHECKPOINT=80
SEQ_MIN_TX_PER_BLOCK=0
SEQ_BLOCK_DURATION_MS=6000
SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT=36
SEQ_BUILD_CHECKPOINT_IF_EMPTY=true
SEQ_MIN_TX_PER_BLOCK=1
P2P_MAX_TX_POOL_SIZE=1000000000
DEBUG_P2P_INSTRUMENT_MESSAGES=true

Expand Down
2 changes: 1 addition & 1 deletion spartan/environments/prove-n-tps-real.env
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROVER_AGENT_POLL_INTERVAL_MS=10000
PUBLISHERS_PER_PROVER=1

SEQ_MAX_TX_PER_CHECKPOINT=72
SEQ_MIN_TX_PER_BLOCK=0
SEQ_MIN_TX_PER_BLOCK=1
SEQ_BLOCK_DURATION_MS=6000
SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT=36
SEQ_BUILD_CHECKPOINT_IF_EMPTY=true
Expand Down
2 changes: 1 addition & 1 deletion spartan/environments/staging-public.env
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ R2_SECRET_ACCESS_KEY=REPLACE_WITH_GCP_SECRET
TEST_ACCOUNTS=false
SPONSORED_FPC=true

SEQ_MIN_TX_PER_BLOCK=0
SEQ_MIN_TX_PER_BLOCK=1
SEQ_MAX_TX_PER_CHECKPOINT=7 # 0.1 TPS

# Build checkpoint even if block is empty.
Expand Down
2 changes: 1 addition & 1 deletion spartan/environments/ten-tps-long-epoch.env
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ AZTEC_SLASHING_OFFSET_IN_ROUNDS=1
AZTEC_LOCAL_EJECTION_THRESHOLD=90000000000000000000

SEQ_MAX_TX_PER_CHECKPOINT=360
SEQ_MIN_TX_PER_BLOCK=0
SEQ_MIN_TX_PER_BLOCK=1

# Override L1 tx utils bump percentages for scenario tests
VALIDATOR_L1_PRIORITY_FEE_BUMP_PERCENTAGE=0
Expand Down
2 changes: 1 addition & 1 deletion spartan/environments/ten-tps-short-epoch.env
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ AZTEC_SLASHING_OFFSET_IN_ROUNDS=1
AZTEC_LOCAL_EJECTION_THRESHOLD=90000000000000000000

SEQ_MAX_TX_PER_CHECKPOINT=360
SEQ_MIN_TX_PER_BLOCK=0
SEQ_MIN_TX_PER_BLOCK=1

# Override L1 tx utils bump percentages for scenario tests
VALIDATOR_L1_PRIORITY_FEE_BUMP_PERCENTAGE=0
Expand Down
2 changes: 1 addition & 1 deletion spartan/environments/tps-scenario.env
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ AZTEC_SLASHING_OFFSET_IN_ROUNDS=1
AZTEC_LOCAL_EJECTION_THRESHOLD=90000000000000000000

SEQ_MAX_TX_PER_CHECKPOINT=15 # approx 0.2 TPS
SEQ_MIN_TX_PER_BLOCK=0
SEQ_MIN_TX_PER_BLOCK=1

# Override L1 tx utils bump percentages for scenario tests
VALIDATOR_L1_PRIORITY_FEE_BUMP_PERCENTAGE=0
Expand Down
4 changes: 3 additions & 1 deletion spartan/scripts/deploy_network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ else
fi

PROVER_FAILED_PROOF_STORE=${PROVER_FAILED_PROOF_STORE:-}
SEQ_MIN_TX_PER_BLOCK=${SEQ_MIN_TX_PER_BLOCK:-0}
SEQ_MIN_TX_PER_BLOCK=${SEQ_MIN_TX_PER_BLOCK:-1}
SEQ_MAX_TX_PER_BLOCK=${SEQ_MAX_TX_PER_BLOCK:-null}
SEQ_MAX_TX_PER_CHECKPOINT=${SEQ_MAX_TX_PER_CHECKPOINT:-8}
SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER=${SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER:-2}
SEQ_BLOCK_DURATION_MS=${SEQ_BLOCK_DURATION_MS:-}
SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT=${SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT:-}
SEQ_BUILD_CHECKPOINT_IF_EMPTY=${SEQ_BUILD_CHECKPOINT_IF_EMPTY:-}
Expand Down Expand Up @@ -532,6 +533,7 @@ VALIDATOR_HA_REPLICAS = ${VALIDATOR_HA_REPLICAS}
SEQ_MIN_TX_PER_BLOCK = ${SEQ_MIN_TX_PER_BLOCK}
SEQ_MAX_TX_PER_BLOCK = ${SEQ_MAX_TX_PER_BLOCK}
SEQ_MAX_TX_PER_CHECKPOINT = ${SEQ_MAX_TX_PER_CHECKPOINT}
SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER = ${SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER}
SEQ_BLOCK_DURATION_MS = ${SEQ_BLOCK_DURATION_MS:-null}
SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT = ${SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT:-null}
SEQ_BUILD_CHECKPOINT_IF_EMPTY = ${SEQ_BUILD_CHECKPOINT_IF_EMPTY:-null}
Expand Down
1 change: 1 addition & 0 deletions spartan/terraform/deploy-aztec-infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ locals {
"validator.node.env.SEQ_MIN_TX_PER_BLOCK" = var.SEQ_MIN_TX_PER_BLOCK
"validator.node.env.SEQ_MAX_TX_PER_BLOCK" = var.SEQ_MAX_TX_PER_BLOCK
"validator.node.env.SEQ_MAX_TX_PER_CHECKPOINT" = var.SEQ_MAX_TX_PER_CHECKPOINT
"validator.node.env.SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER" = var.SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER
"validator.node.env.SEQ_BLOCK_DURATION_MS" = var.SEQ_BLOCK_DURATION_MS
"validator.node.env.SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT" = var.SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT
"validator.node.env.SEQ_BUILD_CHECKPOINT_IF_EMPTY" = var.SEQ_BUILD_CHECKPOINT_IF_EMPTY
Expand Down
10 changes: 8 additions & 2 deletions spartan/terraform/deploy-aztec-infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ variable "TEST_ACCOUNTS" {
variable "SEQ_MIN_TX_PER_BLOCK" {
description = "Minimum number of sequencer transactions per block"
type = string
default = "0"
default = "1"
}

variable "SEQ_MAX_TX_PER_BLOCK" {
Expand Down Expand Up @@ -389,6 +389,12 @@ variable "SEQ_BUILD_CHECKPOINT_IF_EMPTY" {
default = null
}

variable "SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER" {
description = "Per-block gas budget multiplier for both L2 and DA gas."
type = string
default = null
}

variable "SENTINEL_ENABLED" {
description = "Whether to enable sentinel"
type = string
Expand Down Expand Up @@ -771,7 +777,7 @@ variable "FISHERMAN_MODE" {
variable "P2P_GOSSIPSUB_D" {
description = "The P2P Gossipsub D parameter"
type = string
default = "6"
default = "8"
}

variable "P2P_GOSSIPSUB_DLO" {
Expand Down
29 changes: 25 additions & 4 deletions yarn-project/end-to-end/src/spartan/n_tps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { RunningPromise } from '@aztec/foundation/promise';
import { retryUntil } from '@aztec/foundation/retry';
import { sleep } from '@aztec/foundation/sleep';
import { BenchmarkingContract } from '@aztec/noir-test-contracts.js/Benchmarking';
import { GasFees } from '@aztec/stdlib/gas';
import { type Gas, GasFees } from '@aztec/stdlib/gas';
import { TopicType } from '@aztec/stdlib/p2p';
import { Tx, TxHash } from '@aztec/stdlib/tx';

Expand Down Expand Up @@ -293,7 +293,7 @@ describe('sustained N TPS test', () => {

// this function creates n + 1 accounts. We only want one for each wallet
const localTestAccounts = await Promise.all(
testWallets.map(lw => deploySponsoredTestAccounts(lw.wallet, aztecNode, logger, 0)),
testWallets.map(lw => deploySponsoredTestAccounts(lw.wallet, aztecNode, logger, 0, { estimateGas: true })),
);

lowValueWallets = localTestAccounts.slice(0, lowValueAccounts).map(({ wallet }) => wallet);
Expand All @@ -306,23 +306,44 @@ describe('sustained N TPS test', () => {

logger.info('Deploying benchmark contract...');
const sponsor = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
({ contract: benchmarkContract } = await BenchmarkingContract.deploy(localTestAccounts[0].wallet).send({
const deployInteraction = BenchmarkingContract.deploy(localTestAccounts[0].wallet);
const deploySim = await deployInteraction.simulate({
from: localTestAccounts[0].recipientAddress,
fee: { paymentMethod: sponsor },
});
logger.info('Benchmark contract deploy estimated gas', { gasLimits: deploySim.estimatedGas?.gasLimits });
({ contract: benchmarkContract } = await deployInteraction.send({
from: localTestAccounts[0].recipientAddress,
fee: { paymentMethod: sponsor, gasSettings: deploySim.estimatedGas },
}));
logger.info('Benchmark contract deployed', { address: benchmarkContract.address.toString() });

logger.info(`Test setup complete`);
});

let benchmarkGasEstimate: { gasLimits: Gas; teardownGasLimits: Gas } | undefined;

const submitProven = async (
wallet: TestWallet,
maxPriorityFeesPerGas: GasFees = GasFees.empty(),
): Promise<ProvenTx> => {
const sponsor = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());

if (!benchmarkGasEstimate) {
const sim = await benchmarkContract.methods.sha256_hash_1024(Array(1024).fill(42)).simulate({
from: (await benchmarkContract.wallet.getAccounts())[0].item,
fee: { paymentMethod: sponsor, estimateGas: true },
});
benchmarkGasEstimate = sim.estimatedGas;
logger.info('Benchmark tx estimated gas', { gasLimits: benchmarkGasEstimate?.gasLimits });
}

const tx = await proveInteraction(wallet, benchmarkContract.methods.sha256_hash_1024(Array(1024).fill(42)), {
from: (await wallet.getAccounts())[0].item,
fee: { paymentMethod: sponsor, gasSettings: { maxPriorityFeesPerGas } },
fee: {
paymentMethod: sponsor,
gasSettings: { maxPriorityFeesPerGas, ...benchmarkGasEstimate },
},
});

return tx;
Expand Down
50 changes: 44 additions & 6 deletions yarn-project/end-to-end/src/spartan/setup_test_wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,27 @@ export async function deploySponsoredTestAccountsWithTokens(
}

async function deployAccountWithDiagnostics(
account: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any },
account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
paymentMethod: SponsoredFeePaymentMethod,
aztecNode: AztecNode,
logger: Logger,
accountLabel: string,
estimateGas?: boolean,
): Promise<void> {
const deployMethod = await account.getDeployMethod();
let txHash;
try {
const deployResult = await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: NO_WAIT });
let gasSettings;
if (estimateGas) {
const sim = await deployMethod.simulate({ from: AztecAddress.ZERO, fee: { paymentMethod } });
gasSettings = sim.estimatedGas;
logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
}
const deployResult = await deployMethod.send({
from: AztecAddress.ZERO,
fee: { paymentMethod, gasSettings },
wait: NO_WAIT,
});
txHash = deployResult.txHash;
await waitForTx(aztecNode, txHash, { timeout: 2400 });
logger.info(`${accountLabel} deployed at ${account.address}`);
Expand All @@ -161,18 +172,29 @@ async function deployAccountWithDiagnostics(
}

async function deployAccountsInBatches(
accounts: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any }[],
accounts: {
getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
address: any;
}[],
paymentMethod: SponsoredFeePaymentMethod,
aztecNode: AztecNode,
logger: Logger,
labelPrefix: string,
batchSize = 2,
estimateGas?: boolean,
): Promise<void> {
for (let i = 0; i < accounts.length; i += batchSize) {
const batch = accounts.slice(i, i + batchSize);
await Promise.all(
batch.map((account, idx) =>
deployAccountWithDiagnostics(account, paymentMethod, aztecNode, logger, `${labelPrefix}${i + idx + 1}`),
deployAccountWithDiagnostics(
account,
paymentMethod,
aztecNode,
logger,
`${labelPrefix}${i + idx + 1}`,
estimateGas,
),
),
);
}
Expand All @@ -183,6 +205,7 @@ export async function deploySponsoredTestAccounts(
aztecNode: AztecNode,
logger: Logger,
numberOfFundedWallets = 1,
opts?: { estimateGas?: boolean },
): Promise<TestAccountsWithoutTokens> {
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
Expand All @@ -192,8 +215,23 @@ export async function deploySponsoredTestAccounts(

const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());

await deployAccountWithDiagnostics(recipientAccount, paymentMethod, aztecNode, logger, 'Recipient account');
await deployAccountsInBatches(fundedAccounts, paymentMethod, aztecNode, logger, 'Funded account ', 2);
await deployAccountWithDiagnostics(
recipientAccount,
paymentMethod,
aztecNode,
logger,
'Recipient account',
opts?.estimateGas,
);
await deployAccountsInBatches(
fundedAccounts,
paymentMethod,
aztecNode,
logger,
'Funded account ',
2,
opts?.estimateGas,
);

return {
aztecNode,
Expand Down
Loading