Skip to content

Commit 647cf0e

Browse files
author
AztecBot
committed
Merge branch 'next' into merge-train/docs
2 parents 042a4e6 + 1f63a04 commit 647cf0e

File tree

12 files changed

+145
-44
lines changed

12 files changed

+145
-44
lines changed

.github/workflows/ensure-funded-environments.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,34 @@ concurrency:
2424
cancel-in-progress: false # Don't cancel funding operations
2525

2626
jobs:
27-
# fund-staging-public:
28-
# uses: ./.github/workflows/ensure-funded-environment.yml
29-
# with:
30-
# environment: staging-public
31-
# low_watermark: ${{ inputs.low_watermark || '0.5' }}
32-
# high_watermark: ${{ inputs.high_watermark || '1.0' }}
33-
# secrets: inherit
27+
fund-staging-public:
28+
uses: ./.github/workflows/ensure-funded-environment.yml
29+
with:
30+
environment: staging-public
31+
low_watermark: ${{ inputs.low_watermark || '5.0' }}
32+
high_watermark: ${{ inputs.high_watermark || '10.0' }}
33+
secrets: inherit
3434

3535
fund-next-net:
3636
uses: ./.github/workflows/ensure-funded-environment.yml
3737
with:
3838
environment: next-net
39-
low_watermark: ${{ inputs.low_watermark || '0.5' }}
40-
high_watermark: ${{ inputs.high_watermark || '1.0' }}
39+
low_watermark: ${{ inputs.low_watermark || '5.0' }}
40+
high_watermark: ${{ inputs.high_watermark || '10.0' }}
4141
secrets: inherit
4242

43-
# fund-staging-ignition:
44-
# uses: ./.github/workflows/ensure-funded-environment.yml
45-
# with:
46-
# environment: staging-ignition
47-
# low_watermark: ${{ inputs.low_watermark || '0.5' }}
48-
# high_watermark: ${{ inputs.high_watermark || '1.0' }}
49-
# secrets: inherit
43+
fund-staging-ignition:
44+
uses: ./.github/workflows/ensure-funded-environment.yml
45+
with:
46+
environment: staging-ignition
47+
low_watermark: ${{ inputs.low_watermark || '5.0' }}
48+
high_watermark: ${{ inputs.high_watermark || '10.0' }}
49+
secrets: inherit
5050

51-
# fund-testnet:
52-
# uses: ./.github/workflows/ensure-funded-environment.yml
53-
# with:
54-
# environment: testnet
55-
# low_watermark: ${{ inputs.low_watermark || '0.5' }}
56-
# high_watermark: ${{ inputs.high_watermark || '1.0' }}
57-
# secrets: inherit
51+
fund-testnet:
52+
uses: ./.github/workflows/ensure-funded-environment.yml
53+
with:
54+
environment: testnet
55+
low_watermark: ${{ inputs.low_watermark || '5.0' }}
56+
high_watermark: ${{ inputs.high_watermark || '10.0' }}
57+
secrets: inherit

.test_patterns.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ tests:
8686
error_regex: "combined_a.get_value() > fq_ct::modulus"
8787
owners:
8888
- *suyash
89+
# http://ci.aztec-labs.com/1593f7c89e22b51b
90+
- regex: stdlib_primitives_tests stdlibBiggroupSecp256k1/1.WnafSecp256k1StaggerOutOfRangeFails
91+
error_regex: "biggroup_nafs: stagger fragment is not in range"
92+
owners:
93+
- *luke
8994

9095
# noir
9196
# Something to do with how I run the tests now. Think these are fine in nextest.

spartan/metrics/grafana/alerts/rules.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ groups:
819819
conditions:
820820
- evaluator:
821821
params:
822-
- 10
822+
- 2
823823
type: lt
824824
operator:
825825
type: and

yarn-project/p2p/src/msg_validators/block_proposal_validator/block_proposal_validator.test.ts

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Secp256k1Signer } from '@aztec/foundation/crypto';
33
import { Fr } from '@aztec/foundation/fields';
44
import { PeerErrorSeverity } from '@aztec/stdlib/p2p';
55
import { makeBlockProposal, makeL2BlockHeader } from '@aztec/stdlib/testing';
6+
import { TxHash } from '@aztec/stdlib/tx';
67

78
import { mock } from 'jest-mock-extended';
89

@@ -14,7 +15,7 @@ describe('BlockProposalValidator', () => {
1415

1516
beforeEach(() => {
1617
epochCache = mock<EpochCache>();
17-
validator = new BlockProposalValidator(epochCache);
18+
validator = new BlockProposalValidator(epochCache, { txsPermitted: true });
1819
});
1920

2021
it('returns high tolerance error if slot number is not current or next slot', async () => {
@@ -146,4 +147,75 @@ describe('BlockProposalValidator', () => {
146147
const result = await validator.validate(mockProposal);
147148
expect(result).toBeUndefined();
148149
});
150+
151+
describe('transaction permission validation', () => {
152+
it('returns mid tolerance error if txs not permitted and proposal contains txHashes', async () => {
153+
const currentProposer = Secp256k1Signer.random();
154+
const validatorWithTxsDisabled = new BlockProposalValidator(epochCache, { txsPermitted: false });
155+
156+
// Create a block proposal with transaction hashes
157+
const mockProposal = makeBlockProposal({
158+
header: makeL2BlockHeader(1, 100, 100),
159+
signer: currentProposer,
160+
txHashes: [TxHash.random(), TxHash.random()], // Include some tx hashes
161+
});
162+
163+
// Mock epoch cache to return valid proposer (so only tx permission check fails)
164+
(epochCache.getProposerAttesterAddressInCurrentOrNextSlot as jest.Mock).mockResolvedValue({
165+
currentSlot: 100n,
166+
nextSlot: 101n,
167+
currentProposer: currentProposer.address,
168+
nextProposer: Fr.random(),
169+
});
170+
171+
const result = await validatorWithTxsDisabled.validate(mockProposal);
172+
expect(result).toBe(PeerErrorSeverity.MidToleranceError);
173+
});
174+
175+
it('returns undefined if txs not permitted but proposal has no txHashes', async () => {
176+
const currentProposer = Secp256k1Signer.random();
177+
const validatorWithTxsDisabled = new BlockProposalValidator(epochCache, { txsPermitted: false });
178+
179+
// Create a block proposal without transaction hashes
180+
const mockProposal = makeBlockProposal({
181+
header: makeL2BlockHeader(1, 100, 100),
182+
signer: currentProposer,
183+
txHashes: [], // Empty tx hashes array
184+
});
185+
186+
// Mock epoch cache for valid case
187+
(epochCache.getProposerAttesterAddressInCurrentOrNextSlot as jest.Mock).mockResolvedValue({
188+
currentSlot: 100n,
189+
nextSlot: 101n,
190+
currentProposer: currentProposer.address,
191+
nextProposer: Fr.random(),
192+
});
193+
194+
const result = await validatorWithTxsDisabled.validate(mockProposal);
195+
expect(result).toBeUndefined();
196+
});
197+
198+
it('returns undefined if txs permitted and proposal contains txHashes', async () => {
199+
const currentProposer = Secp256k1Signer.random();
200+
// validator already created with txsPermitted = true in beforeEach
201+
202+
// Create a block proposal with transaction hashes
203+
const mockProposal = makeBlockProposal({
204+
header: makeL2BlockHeader(1, 100, 100),
205+
signer: currentProposer,
206+
txHashes: [TxHash.random(), TxHash.random()], // Include some tx hashes
207+
});
208+
209+
// Mock epoch cache for valid case
210+
(epochCache.getProposerAttesterAddressInCurrentOrNextSlot as jest.Mock).mockResolvedValue({
211+
currentSlot: 100n,
212+
nextSlot: 101n,
213+
currentProposer: currentProposer.address,
214+
nextProposer: Fr.random(),
215+
});
216+
217+
const result = await validator.validate(mockProposal);
218+
expect(result).toBeUndefined();
219+
});
220+
});
149221
});

yarn-project/p2p/src/msg_validators/block_proposal_validator/block_proposal_validator.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import { type BlockProposal, type P2PValidator, PeerErrorSeverity } from '@aztec
66
export class BlockProposalValidator implements P2PValidator<BlockProposal> {
77
private epochCache: EpochCacheInterface;
88
private logger: Logger;
9+
private txsPermitted: boolean;
910

10-
constructor(epochCache: EpochCacheInterface) {
11+
constructor(epochCache: EpochCacheInterface, opts: { txsPermitted: boolean }) {
1112
this.epochCache = epochCache;
13+
this.txsPermitted = opts.txsPermitted;
1214
this.logger = createLogger('p2p:block_proposal_validator');
1315
}
1416

@@ -21,6 +23,14 @@ export class BlockProposalValidator implements P2PValidator<BlockProposal> {
2123
return PeerErrorSeverity.MidToleranceError;
2224
}
2325

26+
// Check if transactions are permitted when the proposal contains transaction hashes
27+
if (!this.txsPermitted && block.txHashes.length > 0) {
28+
this.logger.debug(
29+
`Penalizing peer for block proposal with ${block.txHashes.length} transaction(s) when transactions are not permitted`,
30+
);
31+
return PeerErrorSeverity.MidToleranceError;
32+
}
33+
2434
const { currentProposer, nextProposer, currentSlot, nextSlot } =
2535
await this.epochCache.getProposerAttesterAddressInCurrentOrNextSlot();
2636

yarn-project/p2p/src/services/libp2p/libp2p_service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class LibP2PService<T extends P2PClientType = P2PClientType.Full> extends
170170
);
171171

172172
this.attestationValidator = new AttestationValidator(epochCache);
173-
this.blockProposalValidator = new BlockProposalValidator(epochCache);
173+
this.blockProposalValidator = new BlockProposalValidator(epochCache, { txsPermitted: !config.disableTransactions });
174174

175175
this.gossipSubEventHandler = this.handleGossipSubEvent.bind(this);
176176

yarn-project/stdlib/src/interfaces/aztec-node-admin.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { type Offense, OffenseType, type SlashPayloadRound } from '../slashing/i
55
import { type AztecNodeAdmin, AztecNodeAdminApiSchema } from './aztec-node-admin.js';
66
import type { SequencerConfig } from './configs.js';
77
import type { ProverConfig } from './prover-client.js';
8-
import type { ValidatorClientConfig } from './server.js';
8+
import type { ValidatorClientFullConfig } from './server.js';
99
import type { SlasherConfig } from './slasher.js';
1010

1111
describe('AztecNodeAdminApiSchema', () => {
@@ -126,7 +126,7 @@ class MockAztecNodeAdmin implements AztecNodeAdmin {
126126
]);
127127
}
128128
getConfig(): Promise<
129-
ValidatorClientConfig & SequencerConfig & ProverConfig & SlasherConfig & { maxTxPoolSize: number }
129+
ValidatorClientFullConfig & SequencerConfig & ProverConfig & SlasherConfig & { maxTxPoolSize: number }
130130
> {
131131
return Promise.resolve({
132132
realProofs: false,
@@ -164,6 +164,7 @@ class MockAztecNodeAdmin implements AztecNodeAdmin {
164164
attestationPollingIntervalMs: 1000,
165165
validatorReexecute: true,
166166
validatorReexecuteDeadlineMs: 1000,
167+
disableTransactions: false,
167168
});
168169
}
169170
startSnapshotUpload(_location: string): Promise<void> {

yarn-project/stdlib/src/interfaces/aztec-node-admin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { type ArchiverSpecificConfig, ArchiverSpecificConfigSchema } from './arc
99
import { type SequencerConfig, SequencerConfigSchema } from './configs.js';
1010
import { type ProverConfig, ProverConfigSchema } from './prover-client.js';
1111
import { type SlasherConfig, SlasherConfigSchema } from './slasher.js';
12-
import { ValidatorClientConfigSchema, type ValidatorClientFullConfig } from './validator.js';
12+
import { type ValidatorClientFullConfig, ValidatorClientFullConfigSchema } from './validator.js';
1313

1414
/**
1515
* Aztec node admin API.
@@ -62,7 +62,7 @@ export type AztecNodeAdminConfig = ValidatorClientFullConfig &
6262

6363
export const AztecNodeAdminConfigSchema = SequencerConfigSchema.merge(ProverConfigSchema)
6464
.merge(SlasherConfigSchema)
65-
.merge(ValidatorClientConfigSchema)
65+
.merge(ValidatorClientFullConfigSchema)
6666
.merge(
6767
ArchiverSpecificConfigSchema.pick({
6868
archiverPollingIntervalMS: true,

yarn-project/stdlib/src/interfaces/validator.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { z } from 'zod';
1212

1313
import type { CommitteeAttestationsAndSigners } from '../block/index.js';
1414
import type { CheckpointHeader } from '../rollup/checkpoint_header.js';
15+
import { AllowedElementSchema } from './allowed_element.js';
1516

1617
/**
1718
* Validator client configuration
@@ -44,7 +45,13 @@ export interface ValidatorClientConfig {
4445

4546
export type ValidatorClientFullConfig = ValidatorClientConfig &
4647
Pick<SequencerConfig, 'txPublicSetupAllowList' | 'broadcastInvalidBlockProposal'> &
47-
Pick<SlasherConfig, 'slashBroadcastedInvalidBlockPenalty'>;
48+
Pick<SlasherConfig, 'slashBroadcastedInvalidBlockPenalty'> & {
49+
/**
50+
* Whether transactions are disabled for this node
51+
* @remarks This should match the property in P2PConfig. It's not picked from there to avoid circular dependencies.
52+
*/
53+
disableTransactions?: boolean;
54+
};
4855

4956
export const ValidatorClientConfigSchema = z.object({
5057
validatorAddresses: z.array(schemas.EthAddress).optional(),
@@ -56,6 +63,13 @@ export const ValidatorClientConfigSchema = z.object({
5663
alwaysReexecuteBlockProposals: z.boolean().optional(),
5764
}) satisfies ZodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>;
5865

66+
export const ValidatorClientFullConfigSchema = ValidatorClientConfigSchema.extend({
67+
txPublicSetupAllowList: z.array(AllowedElementSchema).optional(),
68+
broadcastInvalidBlockProposal: z.boolean().optional(),
69+
slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
70+
disableTransactions: z.boolean().optional(),
71+
}) satisfies ZodFor<Omit<ValidatorClientFullConfig, 'validatorPrivateKeys'>>;
72+
5973
export interface Validator {
6074
start(): Promise<void>;
6175
updateConfig(config: Partial<ValidatorClientFullConfig>): void;

yarn-project/validator-client/src/factory.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ export function createBlockProposalHandler(
2424
},
2525
) {
2626
const metrics = new ValidatorMetrics(deps.telemetry);
27-
const blockProposalValidator = new BlockProposalValidator(deps.epochCache);
27+
const blockProposalValidator = new BlockProposalValidator(deps.epochCache, {
28+
txsPermitted: !config.disableTransactions,
29+
});
2830
return new BlockProposalHandler(
2931
deps.blockBuilder,
3032
deps.blockSource,

0 commit comments

Comments
 (0)