Skip to content

Commit

Permalink
Refactored inline types to also use defined inferring types
Browse files Browse the repository at this point in the history
  • Loading branch information
rpanic committed Dec 20, 2024
1 parent 4de57a7 commit 464f170
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/lib/proof-system/zkprogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ type InferMethodSignatures<Config extends ConfigBaseType> = Config['methods'];
type InferPrivateInput<Config extends ConfigBaseType> = {
[I in keyof Config['methods']]: Config['methods'][I]['privateInputs'];
};
type InferAuxilaryOutputs<Config extends ConfigBaseType> = {
type InferAuxiliaryOutputs<Config extends ConfigBaseType> = {
[I in keyof InferMethodSignatures<Config>]: Get<
InferMethodSignatures<Config>[I],
'auxiliaryOutput'
Expand Down Expand Up @@ -248,7 +248,7 @@ function ZkProgram<Config extends ConfigBaseType>(
publicInputType: ProvableOrUndefined<Get<Config, 'publicInput'>>;
publicOutputType: ProvableOrVoid<Get<Config, 'publicOutput'>>;
privateInputTypes: InferPrivateInput<Config>;
auxiliaryOutputTypes: InferAuxilaryOutputs<Config>;
auxiliaryOutputTypes: InferAuxiliaryOutputs<Config>;
rawMethods: {
[I in keyof Config['methods']]: InferMethodType<Config>[I]['method'];
};
Expand All @@ -265,7 +265,7 @@ function ZkProgram<Config extends ConfigBaseType>(
InferProvableOrUndefined<Get<Config, 'publicInput'>>,
InferProvableOrVoid<Get<Config, 'publicOutput'>>,
InferPrivateInput<Config>[I],
InferProvableOrUndefined<InferAuxilaryOutputs<Config>[I]>
InferProvableOrUndefined<InferAuxiliaryOutputs<Config>[I]>
>;
} {
type Methods = {
Expand All @@ -276,13 +276,8 @@ function ZkProgram<Config extends ConfigBaseType>(
>;
};
// derived types for convenience
type MethodSignatures = Config['methods'];
type PrivateInputs = {
[I in keyof Config['methods']]: Config['methods'][I]['privateInputs'];
};
type AuxiliaryOutputs = {
[I in keyof MethodSignatures]: Get<MethodSignatures[I], 'auxiliaryOutput'>;
};
type PrivateInputs = InferPrivateInput<Config>
type AuxiliaryOutputs = InferAuxiliaryOutputs<Config>;

let doProving = true;

Expand Down

0 comments on commit 464f170

Please sign in to comment.