Module: ezkl_codec
Utilities for encoding and decoding ezkl proof requests. These are
meant to be used in the context of solidity contracts.
These utilities are used in the ezkl_proof_service
service.
encode_processed_fields_hex(field_elements)
Helper function to encode a processed field element array
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field_elements |
Optional[list[int]]
|
list of field elements |
required |
Returns:
Type | Description |
---|---|
Optional[HexStr]
|
Optional[HexStr]: field elements encoded as an int256[] hex string or None if field_elements is None |
Source code in src/infernet_ml/utils/codec/ezkl_codec.py
encode_proof_request(vk_addr, input_vector_bytes, output_vector_bytes)
Helper function to encode an EZKL Proof Request. Note that vectors should
be encoded using the infernet_ml.utils.codec.vector.encode_vector
function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vk_addr |
Optional[HexStr]
|
the verifying key address |
required |
input_vector_bytes |
Optional[bytes]
|
the encoded input vector |
required |
output_vector_bytes |
Optional[bytes]
|
the encoded output bector |
required |
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
encoded proof request bytes |
Source code in src/infernet_ml/utils/codec/ezkl_codec.py
extract_io_from_proof_execution(settings, witness)
Helper to extract processed i/o from a witness.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
settings |
str | Path
|
path to the settings file |
required |
witness |
dict[str, Any]
|
the generated witness dict |
required |
Returns:
Type | Description |
---|---|
Optional[list[int]]
|
tuple[Optional[list[int]], Optional[list[int]]]: processed input list, |
Optional[list[int]]
|
processed output list |
Source code in src/infernet_ml/utils/codec/ezkl_codec.py
extract_proof_request(infernet_input)
Helper function to extract a ProofRequest from an EZKL Service InfernetInput payload.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
infernet_input |
InfernetInput
|
input to extract a ProofRequest from |
required |
Raises:
Type | Description |
---|---|
ValueError
|
thrown if an Unsupported source is provided |
Returns:
Name | Type | Description |
---|---|---|
EZKLGenerateProofRequest |
EZKLGenerateProofRequest
|
the EZKLGenerateProofRequest, either decoded from the onchain bytes, or extracted directly. |
Source code in src/infernet_ml/utils/codec/ezkl_codec.py
extract_visibilities_from_settings(settings)
Helper function to extract visibilities from a generated settings file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
settings |
str | Path | dict[str, Any]
|
path to the settings file or the settings dict |
required |
Returns:
Type | Description |
---|---|
str
|
tuple[str, str, str]: input visibility, output visibility, |
str
|
and param visibility |