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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import type { EpochCacheInterface } from '@aztec/epoch-cache';
import type { BlockProposal, P2PValidator } from '@aztec/stdlib/p2p';
import type { BlockProposal, P2PValidator, ValidationResult } from '@aztec/stdlib/p2p';

import { ProposalValidator } from '../proposal_validator/proposal_validator.js';

export class BlockProposalValidator extends ProposalValidator<BlockProposal> implements P2PValidator<BlockProposal> {
export class BlockProposalValidator implements P2PValidator<BlockProposal> {
private proposalValidator: ProposalValidator;

constructor(epochCache: EpochCacheInterface, opts: { txsPermitted: boolean; maxTxsPerBlock?: number }) {
super(epochCache, opts, 'p2p:block_proposal_validator');
this.proposalValidator = new ProposalValidator(epochCache, opts, 'p2p:block_proposal_validator');
}

async validate(proposal: BlockProposal): Promise<ValidationResult> {
const headerResult = await this.proposalValidator.validate(proposal);
if (headerResult.result !== 'accept') {
return headerResult;
}
return this.proposalValidator.validateTxs(proposal);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
import type { EpochCacheInterface } from '@aztec/epoch-cache';
import type { CheckpointProposal, P2PValidator } from '@aztec/stdlib/p2p';
import type { CheckpointProposal, P2PValidator, ValidationResult } from '@aztec/stdlib/p2p';

import { ProposalValidator } from '../proposal_validator/proposal_validator.js';

export class CheckpointProposalValidator
extends ProposalValidator<CheckpointProposal>
implements P2PValidator<CheckpointProposal>
{
export class CheckpointProposalValidator implements P2PValidator<CheckpointProposal> {
private proposalValidator: ProposalValidator;

constructor(epochCache: EpochCacheInterface, opts: { txsPermitted: boolean; maxTxsPerBlock?: number }) {
super(epochCache, opts, 'p2p:checkpoint_proposal_validator');
this.proposalValidator = new ProposalValidator(epochCache, opts, 'p2p:checkpoint_proposal_validator');
}

async validate(proposal: CheckpointProposal): Promise<ValidationResult> {
const headerResult = await this.proposalValidator.validate(proposal);
if (headerResult.result !== 'accept') {
return headerResult;
}

const blockProposal = proposal.getBlockProposal();
if (blockProposal) {
return this.proposalValidator.validateTxs(blockProposal);
}

return { result: 'accept' };
}
}
Loading
Loading