Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 committed Dec 13, 2024
1 parent 1493142 commit 9e17522
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions yarn-project/circuit-types/src/interfaces/p2p.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { type P2PApi, P2PApiSchema, type PeerInfo } from './p2p.js';

describe('P2PApiSchema', () => {
let handler: MockP2P;
let context: JsonRpcTestContext<P2PApi<P2PClientType.Full>>;
let context: JsonRpcTestContext<P2PApi>;

const tested = new Set<string>();

beforeEach(async () => {
handler = new MockP2P();
context = await createJsonRpcTestSetup<P2PApi<P2PClientType.Full>>(handler, P2PApiSchema);
context = await createJsonRpcTestSetup<P2PApi>(handler, P2PApiSchema);
});

afterEach(() => {
Expand Down Expand Up @@ -66,7 +66,7 @@ const peers: PeerInfo[] = [
{ status: 'cached', id: 'id', addresses: ['address'], enr: 'enr', dialAttempts: 1 },
];

class MockP2P implements P2PApi<P2PClientType.Full> {
class MockP2P implements P2PApi {
getAttestationsForSlot(slot: bigint, proposalId?: string | undefined): Promise<BlockAttestation[]> {
expect(slot).toEqual(1n);
expect(proposalId).toEqual('proposalId');
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/circuit-types/src/interfaces/p2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ export interface P2PClient extends P2PApiWithoutAttestations {
getAttestationsForSlot(slot: bigint, proposalId?: string): Promise<BlockAttestation[]>;
}

export type P2PApi<T extends P2PClientType> = T extends P2PClientType.Full
export type P2PApi<T extends P2PClientType = P2PClientType.Full> = T extends P2PClientType.Full
? P2PClient & P2PApiWithoutAttestations
: P2PApiWithoutAttestations;

export const P2PApiSchema: ApiSchemaFor<P2PApi<P2PClientType.Full>> = {
export const P2PApiSchema: ApiSchemaFor<P2PApi> = {
getAttestationsForSlot: z
.function()
.args(schemas.BigInt, optional(z.string()))
Expand Down

0 comments on commit 9e17522

Please sign in to comment.