|
1 | 1 | import { NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants'; |
2 | 2 | import { EpochNumber } from '@aztec/foundation/branded-types'; |
| 3 | +import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc'; |
3 | 4 | import { type JsonRpcTestContext, createJsonRpcTestSetup } from '@aztec/foundation/json-rpc/test'; |
4 | 5 |
|
5 | 6 | import { ProvingRequestType } from '../proofs/proving_request_type.js'; |
6 | 7 | import { makeRecursiveProof } from '../proofs/recursive_proof.js'; |
| 8 | +import { BlockRollupPublicInputs } from '../rollup/block_rollup_public_inputs.js'; |
7 | 9 | import { TxRollupPublicInputs } from '../rollup/tx_rollup_public_inputs.js'; |
| 10 | +import { makeBlockRollupPublicInputs } from '../tests/factories.js'; |
8 | 11 | import { VerificationKeyData } from '../vks/verification_key.js'; |
9 | 12 | import { type ProvingJobSource, ProvingJobSourceSchema } from './proving-job-source.js'; |
10 | 13 | import { |
11 | 14 | type ProofUri, |
12 | 15 | type ProvingJob, |
13 | | - type ProvingJobResult, |
| 16 | + ProvingJobResult, |
14 | 17 | type ProvingRequestResultFor, |
15 | 18 | makePublicInputsAndRecursiveProof, |
16 | 19 | } from './proving-job.js'; |
@@ -63,6 +66,28 @@ describe('ProvingJobSourceSchema', () => { |
63 | 66 | }); |
64 | 67 | }); |
65 | 68 |
|
| 69 | +describe('ProvingJobResult', () => { |
| 70 | + it('round-trips a message-only block-root rollup result through the schema', () => { |
| 71 | + // The message-only block-root proof type must survive serialization: a checkpoint that builds a message-only |
| 72 | + // block produces this result, and the proof store decodes it via the ProvingJobResult schema. Omitting it from |
| 73 | + // the union throws "Invalid discriminator value" and stalls proving. |
| 74 | + const result: ProvingJobResult = { |
| 75 | + type: ProvingRequestType.BLOCK_ROOT_MSGS_ONLY_ROLLUP, |
| 76 | + result: makePublicInputsAndRecursiveProof< |
| 77 | + BlockRollupPublicInputs, |
| 78 | + typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH |
| 79 | + >( |
| 80 | + makeBlockRollupPublicInputs(), |
| 81 | + makeRecursiveProof(NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH), |
| 82 | + VerificationKeyData.makeFakeRollupHonk(), |
| 83 | + ), |
| 84 | + }; |
| 85 | + |
| 86 | + const roundTripped = jsonParseWithSchema<ProvingJobResult>(jsonStringify(result), ProvingJobResult); |
| 87 | + expect(roundTripped.type).toEqual(ProvingRequestType.BLOCK_ROOT_MSGS_ONLY_ROLLUP); |
| 88 | + }); |
| 89 | +}); |
| 90 | + |
66 | 91 | class MockProvingJobSource implements ProvingJobSource { |
67 | 92 | getProvingJob(): Promise<ProvingJob | undefined> { |
68 | 93 | return Promise.resolve({ |
|
0 commit comments