Config

Config#

class rizemind.authentication.notary.model.config.ModelNotaryConfig(*, domain: EIP712DomainMinimal, round_id: int, model_hash: bytes, signature: Signature)[source]

Bases: BaseModel

Configuration for cryptographically attesting a model’s parameters verification.

This configuration bundles a model’s cryptographic hash with its digital signature and the EIP712 Domain, enabling verifiable notarization for a specific round.

domain

EIP712 Domain

Type:

rizemind.contracts.erc.erc5267.typings.EIP712DomainMinimal

round_id

The specific federated learning round number this notarization applies to.

Type:

int

model_hash

The cryptographic hash of the model’s parameters.

Type:

bytes

signature

The digital signature attesting to the model’s hash.

Type:

rizemind.authentication.signatures.signature.Signature

domain: EIP712DomainMinimal
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_hash: bytes
round_id: int
signature: Signature
rizemind.authentication.notary.model.config.parse_model_notary_config(config: dict[str, Any]) ModelNotaryConfig[source]

Parses a configuration dictionary into a ModelNotaryConfig object.

This function acts as the inverse of prepare_model_notary_config. It takes a standardized configuration dictionary, extracts the relevant MODEL_NOTARY_PREFIX section, and deserializes it into a structured ModelNotaryConfig.

Parameters:
  • config – The input configuration dictionary, expected to contain the

  • key. (notarization data under the 'MODEL_NOTARY_PREFIX')

Returns:

A`ModelNotaryConfig` populated with the data from the input dictionary.

Return type:

ModelNotaryConfig

Raises:

ParseException – If the notary configuration cannot be parsed.

rizemind.authentication.notary.model.config.prepare_model_notary_config(*, round_id: int, domain: EIP712DomainMinimal, signature: Signature, model_hash: bytes)[source]

Constructs and serializes a ModelNotaryConfig into a nested dictionary.

This function takes the core components of a model notarization, creates a ModelNotaryConfig object, and then transforms it into a standardized dictionary format prefixed with MODEL_NOTARY_PREFIX, to comply with flower’s Config.

Parameters:
  • round_id – The current federated learning round number.

  • domain – The EIP-712 domain.

  • signature – The digital signature of the model hash.

  • model_hash – The hash of the model’s parameters.

Returns:

The serialized ModelNotaryConfig data.

Return type:

Config