forked from visoftsolutions/noir_rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rename kernel circuits and disambiguate inputs (AztecProtocol#…
- Loading branch information
1 parent
fea8e2e
commit 71c7743
Showing
100 changed files
with
2,285 additions
and
2,066 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export * from './contract_instance.js'; | ||
export * from './contract_tree/index.js'; | ||
export * from './contract_class_id.js'; | ||
export * from './contract_class.js'; | ||
export * from './artifact_hash.js'; | ||
export * from './contract_address.js'; | ||
export * from './private_function.js'; | ||
export * from './public_bytecode.js'; | ||
export * from './contract_class.js'; | ||
export * from './contract_class_id.js'; | ||
export * from './contract_class_registered_event.js'; | ||
export * from './contract_instance.js'; | ||
export * from './contract_instance_deployed_event.js'; | ||
export * from './contract_tree/index.js'; | ||
export * from './private_function.js'; | ||
export * from './public_bytecode.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export * from './structs/index.js'; | ||
export * from './constants.gen.js'; | ||
export * from './contract/index.js'; | ||
export * from './keys/index.js'; | ||
export * from './structs/index.js'; | ||
export * from './types/index.js'; | ||
export * from './constants.gen.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
yarn-project/circuits.js/src/structs/kernel/previous_kernel_data.test.ts
This file was deleted.
Oops, something went wrong.
135 changes: 135 additions & 0 deletions
135
yarn-project/circuits.js/src/structs/kernel/private_call_data.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import { Fr } from '@aztec/foundation/fields'; | ||
import { BufferReader, Tuple, serializeToBuffer } from '@aztec/foundation/serialize'; | ||
import { FieldsOf } from '@aztec/foundation/types'; | ||
|
||
import { | ||
FUNCTION_TREE_HEIGHT, | ||
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, | ||
MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, | ||
MAX_READ_REQUESTS_PER_CALL, | ||
} from '../../constants.gen.js'; | ||
import { CallRequest } from '../call_request.js'; | ||
import { MembershipWitness } from '../membership_witness.js'; | ||
import { PrivateCallStackItem } from '../private_call_stack_item.js'; | ||
import { Proof } from '../proof.js'; | ||
import { ReadRequestMembershipWitness } from '../read_request_membership_witness.js'; | ||
import { VerificationKey } from '../verification_key.js'; | ||
|
||
/** | ||
* Private call data. | ||
*/ | ||
export class PrivateCallData { | ||
constructor( | ||
/** | ||
* The call stack item currently being processed. | ||
*/ | ||
public callStackItem: PrivateCallStackItem, | ||
/** | ||
* Other private call stack items to be processed. | ||
*/ | ||
public privateCallStack: Tuple<CallRequest, typeof MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL>, | ||
/** | ||
* Other public call stack items to be processed. | ||
*/ | ||
public publicCallStack: Tuple<CallRequest, typeof MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL>, | ||
/** | ||
* The proof of the execution of this private call. | ||
*/ | ||
public proof: Proof, | ||
/** | ||
* The verification key for the function being invoked. | ||
*/ | ||
public vk: VerificationKey, | ||
/** | ||
* Artifact hash of the contract class for this private call. | ||
*/ | ||
public contractClassArtifactHash: Fr, | ||
/** | ||
* Public bytecode commitment for the contract class for this private call. | ||
*/ | ||
public contractClassPublicBytecodeCommitment: Fr, | ||
/** | ||
* Public keys hash of the contract instance. | ||
*/ | ||
public publicKeysHash: Fr, | ||
/** | ||
* Salted initialization hash of the contract instance. | ||
*/ | ||
public saltedInitializationHash: Fr, | ||
/** | ||
* The membership witness for the function leaf corresponding to the function being invoked. | ||
*/ | ||
public functionLeafMembershipWitness: MembershipWitness<typeof FUNCTION_TREE_HEIGHT>, | ||
/** | ||
* The membership witnesses for read requests created by the function being invoked. | ||
*/ | ||
public readRequestMembershipWitnesses: Tuple<ReadRequestMembershipWitness, typeof MAX_READ_REQUESTS_PER_CALL>, | ||
/** | ||
* The address of the portal contract corresponding to the contract on which the function is being invoked. | ||
*/ | ||
public portalContractAddress: Fr, | ||
/** | ||
* The hash of the ACIR of the function being invoked. | ||
*/ | ||
public acirHash: Fr, | ||
) {} | ||
|
||
/** | ||
* Serialize into a field array. Low-level utility. | ||
* @param fields - Object with fields. | ||
* @returns The array. | ||
*/ | ||
static getFields(fields: FieldsOf<PrivateCallData>) { | ||
return [ | ||
fields.callStackItem, | ||
fields.privateCallStack, | ||
fields.publicCallStack, | ||
fields.proof, | ||
fields.vk, | ||
fields.contractClassArtifactHash, | ||
fields.contractClassPublicBytecodeCommitment, | ||
fields.publicKeysHash, | ||
fields.saltedInitializationHash, | ||
fields.functionLeafMembershipWitness, | ||
fields.readRequestMembershipWitnesses, | ||
fields.portalContractAddress, | ||
fields.acirHash, | ||
] as const; | ||
} | ||
|
||
static from(fields: FieldsOf<PrivateCallData>): PrivateCallData { | ||
return new PrivateCallData(...PrivateCallData.getFields(fields)); | ||
} | ||
|
||
/** | ||
* Serialize this as a buffer. | ||
* @returns The buffer. | ||
*/ | ||
toBuffer(): Buffer { | ||
return serializeToBuffer(...PrivateCallData.getFields(this)); | ||
} | ||
|
||
/** | ||
* Deserializes from a buffer or reader. | ||
* @param buffer - Buffer or reader to read from. | ||
* @returns The deserialized instance. | ||
*/ | ||
static fromBuffer(buffer: Buffer | BufferReader): PrivateCallData { | ||
const reader = BufferReader.asReader(buffer); | ||
return new PrivateCallData( | ||
reader.readObject(PrivateCallStackItem), | ||
reader.readArray(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, CallRequest), | ||
reader.readArray(MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL, CallRequest), | ||
reader.readObject(Proof), | ||
reader.readObject(VerificationKey), | ||
reader.readObject(Fr), | ||
reader.readObject(Fr), | ||
reader.readObject(Fr), | ||
reader.readObject(Fr), | ||
reader.readObject(MembershipWitness.deserializer(FUNCTION_TREE_HEIGHT)), | ||
reader.readArray(MAX_READ_REQUESTS_PER_CALL, ReadRequestMembershipWitness), | ||
reader.readObject(Fr), | ||
reader.readObject(Fr), | ||
); | ||
} | ||
} |
Oops, something went wrong.