Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clean env vars #12356

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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 yarn-project/aztec/terraform/node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ resource "aws_ecs_task_definition" "aztec-node" {
value = tostring(var.P2P_TX_POOL_KEEP_PROVEN_FOR)
},
{
name = "P2P_SEVERE_PEER_PENALTY_BLOCK_LENGTH"
value = tostring(var.P2P_SEVERE_PEER_PENALTY_BLOCK_LENGTH)
name = "P2P_DOUBLE_SPEND_SEVERE_PEER_PENALTY_WINDOW"
value = tostring(var.P2P_DOUBLE_SPEND_SEVERE_PEER_PENALTY_WINDOW)
},
{
name = "P2P_GOSSIPSUB_INTERVAL_MS"
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/terraform/node/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ variable "P2P_GOSSIPSUB_MCACHE_GOSSIP" {
default = 3
}

variable "P2P_SEVERE_PEER_PENALTY_BLOCK_LENGTH" {
variable "P2P_DOUBLE_SPEND_SEVERE_PEER_PENALTY_WINDOW" {
type = number
default = 30
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export LOG_LEVEL=${LOG_LEVEL:-"verbose"}
export BOT_TX_INTERVAL_SECONDS="5"
export BOT_PRIVATE_TRANSFERS_PER_TX="1"
export BOT_PUBLIC_TRANSFERS_PER_TX="0"
export BOT_NO_WAIT_FOR_TRANSFERS="true"
export BOT_FOLLOW_CHAIN="NONE"
export BOT_NO_START="false"
export PXE_PROVER_ENABLED="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ describe('L1Publisher integration', () => {
publisher = new SequencerPublisher(
{
l1RpcUrls: config.l1RpcUrls,
requiredConfirmations: 1,
l1Contracts: l1ContractAddresses,
publisherPrivateKey: sequencerPK,
l1PublishRetryIntervalMS: 100,
Expand Down
1 change: 0 additions & 1 deletion yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ export class P2PNetworkTest {
{
gasLimitBufferPercentage: 20,
maxGwei: 500n,
minGwei: 1n,
maxAttempts: 3,
checkIntervalMs: 100,
stallTimeMs: 1000,
Expand Down
1 change: 0 additions & 1 deletion yarn-project/end-to-end/src/e2e_synching.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ describe('e2e_synching', () => {
const publisher = new SequencerPublisher(
{
l1RpcUrls: config.l1RpcUrls,
requiredConfirmations: 1,
l1Contracts: deployL1ContractsValues.l1ContractAddresses,
publisherPrivateKey: sequencerPK,
l1PublishRetryIntervalMS: 100,
Expand Down
1 change: 0 additions & 1 deletion yarn-project/end-to-end/src/fixtures/setup_p2p_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export async function createValidatorConfig(
p2pEnabled: true,
peerCheckIntervalMS: TEST_PEER_CHECK_INTERVAL_MS,
blockCheckIntervalMS: 1000,
transactionProtocol: '',
dataDirectory,
bootstrapNodes: bootstrapNodeEnr ? [bootstrapNodeEnr] : [],
};
Expand Down
3 changes: 0 additions & 3 deletions yarn-project/ethereum/src/l1_tx_utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ describe('GasUtils', () => {
gasUtils = new L1TxUtilsWithBlobs(publicClient, walletClient, logger, {
gasLimitBufferPercentage: 20,
maxGwei: 500n,
minGwei: 1n,
maxAttempts: 3,
checkIntervalMs: 100,
stallTimeMs: 1000,
Expand Down Expand Up @@ -196,7 +195,6 @@ describe('GasUtils', () => {
const baselineGasUtils = new L1TxUtilsWithBlobs(publicClient, walletClient, logger, {
gasLimitBufferPercentage: 0,
maxGwei: 500n,
minGwei: 10n, // Increased minimum gas price
maxAttempts: 5,
checkIntervalMs: 100,
stallTimeMs: 1000,
Expand All @@ -216,7 +214,6 @@ describe('GasUtils', () => {
const bufferedGasUtils = new L1TxUtilsWithBlobs(publicClient, walletClient, logger, {
gasLimitBufferPercentage: 20,
maxGwei: 500n,
minGwei: 1n,
maxAttempts: 3,
checkIntervalMs: 100,
stallTimeMs: 1000,
Expand Down
9 changes: 0 additions & 9 deletions yarn-project/ethereum/src/l1_tx_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ export interface L1TxUtilsConfig {
* Maximum gas price in gwei
*/
maxGwei?: bigint;
/**
* Minimum gas price in gwei
*/
minGwei?: bigint;
/**
* Maximum blob fee per gas in gwei
*/
Expand Down Expand Up @@ -108,11 +104,6 @@ export const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig> = {
env: 'L1_GAS_LIMIT_BUFFER_PERCENTAGE',
...numberConfigHelper(20),
},
minGwei: {
description: 'Minimum gas price in gwei',
env: 'L1_GAS_PRICE_MIN',
...bigintConfigHelper(1n),
},
maxGwei: {
description: 'Maximum gas price in gwei',
env: 'L1_GAS_PRICE_MAX',
Expand Down
14 changes: 1 addition & 13 deletions yarn-project/foundation/src/config/env_var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ export type EnvVar =
| 'L1_CONSENSUS_HOST_API_KEY'
| 'L1_CONSENSUS_HOST_API_KEY_HEADER'
| 'L1_PRIVATE_KEY'
| 'L2_QUEUE_SIZE'
| 'LOG_ELAPSED_TIME'
| 'LOG_JSON'
| 'LOG_MULTILINE'
| 'LOG_LEVEL'
Expand Down Expand Up @@ -102,18 +100,15 @@ export type EnvVar =
| 'P2P_QUERY_FOR_IP'
| 'P2P_REQRESP_INDIVIDUAL_REQUEST_TIMEOUT_MS'
| 'P2P_REQRESP_OVERALL_REQUEST_TIMEOUT_MS'
| 'P2P_SEVERE_PEER_PENALTY_BLOCK_LENGTH'
| 'P2P_DOUBLE_SPEND_SEVERE_PEER_PENALTY_WINDOW'
| 'P2P_TCP_LISTEN_ADDR'
| 'P2P_TCP_ANNOUNCE_ADDR'
| 'P2P_TX_POOL_KEEP_PROVEN_FOR'
| 'P2P_ATTESTATION_POOL_KEEP_FOR'
| 'P2P_TX_PROTOCOL'
| 'P2P_UDP_ANNOUNCE_ADDR'
| 'P2P_UDP_LISTEN_ADDR'
| 'P2P_ARCHIVED_TX_LIMIT'
| 'PEER_ID_PRIVATE_KEY'
| 'PROOF_VERIFIER_L1_START_BLOCK'
| 'PROVER_AGENT_ENABLED'
| 'PROVER_AGENT_CONCURRENCY'
| 'PROVER_AGENT_COUNT'
| 'PROVER_AGENT_PROOF_TYPES'
Expand All @@ -127,10 +122,8 @@ export type EnvVar =
| 'PROVER_BROKER_BATCH_SIZE'
| 'PROVER_BROKER_MAX_EPOCHS_TO_KEEP_RESULTS_FOR'
| 'PROVER_COORDINATION_NODE_URL'
| 'PROVER_DISABLED'
| 'PROVER_FAILED_PROOF_STORE'
| 'PROVER_ID'
| 'PROVER_JOB_POLL_INTERVAL_MS'
| 'PROVER_JOB_TIMEOUT_MS'
| 'PROVER_NODE_POLLING_INTERVAL_MS'
| 'PROVER_NODE_MAX_PENDING_JOBS'
Expand All @@ -141,14 +134,11 @@ export type EnvVar =
| 'PROVER_PUBLISH_RETRY_INTERVAL_MS'
| 'PROVER_PUBLISHER_PRIVATE_KEY'
| 'PROVER_REAL_PROOFS'
| 'PROVER_REQUIRED_CONFIRMATIONS'
| 'PROVER_TEST_DELAY_FACTOR'
| 'PROVER_TEST_DELAY_MS'
| 'PROVER_TEST_DELAY_TYPE'
| 'PXE_L2_STARTING_BLOCK'
| 'PXE_PROVER_ENABLED'
| 'PROVER_TARGET_ESCROW_AMOUNT'
| 'PROVER_MINIMUM_ESCROW_AMOUNT'
| 'REGISTRY_CONTRACT_ADDRESS'
| 'ROLLUP_CONTRACT_ADDRESS'
| 'SEQ_ALLOWED_SETUP_FN'
Expand All @@ -159,7 +149,6 @@ export type EnvVar =
| 'SEQ_MAX_L2_BLOCK_GAS'
| 'SEQ_PUBLISH_RETRY_INTERVAL_MS'
| 'SEQ_PUBLISHER_PRIVATE_KEY'
| 'SEQ_REQUIRED_CONFIRMATIONS'
| 'SEQ_TX_POLLING_INTERVAL_MS'
| 'SEQ_ENFORCE_TIME_TABLE'
| 'SEQ_MAX_L1_TX_INCLUSION_TIME_INTO_SLOT'
Expand Down Expand Up @@ -196,7 +185,6 @@ export type EnvVar =
| 'AZTEC_GOVERNANCE_PROPOSER_QUORUM'
| 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE'
| 'L1_GAS_LIMIT_BUFFER_PERCENTAGE'
| 'L1_GAS_LIMIT_BUFFER_FIXED'
| 'L1_GAS_PRICE_MIN'
| 'L1_GAS_PRICE_MAX'
| 'L1_BLOB_FEE_PER_GAS_MAX'
Expand Down
18 changes: 4 additions & 14 deletions yarn-project/p2p/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ export interface P2PConfig extends P2PReqRespConfig, ChainConfig {
/** Whether to execute the version check in the bootstrap node ENR. */
bootstrapNodeEnrVersionCheck: boolean;

/**
* Protocol identifier for transaction gossiping.
*/
transactionProtocol: string;

/**
* The maximum number of peers (a peer count above this will cause the node to refuse connection attempts)
*/
Expand Down Expand Up @@ -142,7 +137,7 @@ export interface P2PConfig extends P2PReqRespConfig, ChainConfig {
/**
* The 'age' (in # of L2 blocks) of a processed tx after which we heavily penalize a peer for re-sending it.
*/
severePeerPenaltyBlockLength: number;
doubleSpendSeverePeerPenaltyWindow: number;

/**
* The weight of the tx topic for the gossipsub protocol. This determines how much the score for this specific topic contributes to the overall peer score.
Expand Down Expand Up @@ -228,11 +223,6 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
description: 'Whether to check the version of the bootstrap node ENR.',
...booleanConfigHelper(),
},
transactionProtocol: {
env: 'P2P_TX_PROTOCOL',
description: 'Protocol identifier for transaction gossiping.',
defaultValue: '/aztec/0.1.0',
},
maxPeerCount: {
env: 'P2P_MAX_PEERS',
description: 'The maximum number of peers to connect to.',
Expand Down Expand Up @@ -278,7 +268,7 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
gossipsubDLazy: {
env: 'P2P_GOSSIPSUB_DLAZY',
description: 'The Dlazy parameter for the gossipsub protocol.',
...numberConfigHelper(6),
...numberConfigHelper(8),
},
gossipsubFloodPublish: {
env: 'P2P_GOSSIPSUB_FLOOD_PUBLISH',
Expand Down Expand Up @@ -317,8 +307,8 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
'The values for the peer scoring system. Passed as a comma separated list of values in order: low, mid, high tolerance errors.',
defaultValue: [2, 10, 50],
},
severePeerPenaltyBlockLength: {
env: 'P2P_SEVERE_PEER_PENALTY_BLOCK_LENGTH',
doubleSpendSeverePeerPenaltyWindow: {
env: 'P2P_DOUBLE_SPEND_SEVERE_PEER_PENALTY_WINDOW',
description: 'The "age" (in L2 blocks) of a tx after which we heavily penalize a peer for sending it.',
...numberConfigHelper(30),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ describe('Discv5Service', () => {
bootstrapNodes: [bootnodeAddr],
blockCheckIntervalMS: 50,
peerCheckIntervalMS: 50,
transactionProtocol: 'aztec/1.0.0',
p2pEnabled: true,
l2QueueSize: 100,
keepProvenTxsInPoolFor: 0,
Expand Down
24 changes: 10 additions & 14 deletions yarn-project/p2p/src/services/libp2p/libp2p_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,15 +679,12 @@ export class LibP2PService<T extends P2PClientType> extends WithTracer implement
if (outcome.allPassed) {
return true;
}

const { name, severity } = outcome.failure;
const { name } = outcome.failure;
let { severity } = outcome.failure;

// Double spend validator has a special case handler
if (name === 'doubleSpendValidator') {
const isValid = await this.handleDoubleSpendFailure(tx, blockNumber, peerId);
if (isValid) {
return true;
}
severity = await this.handleDoubleSpendFailure(tx, blockNumber);
}

this.peerManager.penalizePeer(peerId, severity);
Expand Down Expand Up @@ -775,17 +772,17 @@ export class LibP2PService<T extends P2PClientType> extends WithTracer implement
* @param tx - The tx that failed the double spend validator.
* @param blockNumber - The block number of the tx.
* @param peerId - The peer ID of the peer that sent the tx.
* @returns True if the tx is valid, false otherwise.
* @returns Severity
*/
private async handleDoubleSpendFailure(tx: Tx, blockNumber: number, peerId: PeerId): Promise<boolean> {
if (blockNumber <= this.config.severePeerPenaltyBlockLength) {
return false;
private async handleDoubleSpendFailure(tx: Tx, blockNumber: number): Promise<PeerErrorSeverity> {
if (blockNumber <= this.config.doubleSpendSeverePeerPenaltyWindow) {
return PeerErrorSeverity.HighToleranceError;
}

const snapshotValidator = new DoubleSpendTxValidator({
nullifiersExist: async (nullifiers: Buffer[]) => {
const merkleTree = this.worldStateSynchronizer.getSnapshot(
blockNumber - this.config.severePeerPenaltyBlockLength,
blockNumber - this.config.doubleSpendSeverePeerPenaltyWindow,
);
const indices = await merkleTree.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, nullifiers);
return indices.map(index => index !== undefined);
Expand All @@ -794,11 +791,10 @@ export class LibP2PService<T extends P2PClientType> extends WithTracer implement

const validSnapshot = await snapshotValidator.validateTx(tx);
if (validSnapshot.result !== 'valid') {
this.peerManager.penalizePeer(peerId, PeerErrorSeverity.LowToleranceError);
return false;
return PeerErrorSeverity.LowToleranceError;
}

return true;
return PeerErrorSeverity.HighToleranceError;
}

/**
Expand Down
11 changes: 0 additions & 11 deletions yarn-project/sequencer-client/src/publisher/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ export type TxSenderConfig = L1ReaderConfig & {
*/
publisherPrivateKey: `0x${string}`;

/**
* The number of confirmations required.
*/
requiredConfirmations: number;

/**
* The address of the custom forwarder contract.
*/
Expand Down Expand Up @@ -56,12 +51,6 @@ export const getTxSenderConfigMappings: (
parseEnv: (val: string) => (val ? `0x${val.replace('0x', '')}` : NULL_KEY),
defaultValue: NULL_KEY,
},
requiredConfirmations: {
env: `${scope}_REQUIRED_CONFIRMATIONS`,
parseEnv: (val: string) => +val,
defaultValue: 1,
description: 'The number of confirmations required.',
},
});

export function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'> {
Expand Down
Loading