class RevocDefValueField(MessageValidator): schema = ( (ISSUANCE_TYPE, NonEmptyStringField()), (MAX_CRED_NUM, IntegerField()), (PUBLIC_KEYS, AnyMapField()), (TAILS_HASH, NonEmptyStringField()), (TAILS_LOCATION, NonEmptyStringField()), )
class MessageRep(MessageBase): """ Purpose: respond to a node for any requested message """ # TODO: support a setter for `msg` to create an instance of a type # according to `msg_type` typename = MESSAGE_RESPONSE schema = ((f.MSG_TYPE.nm, ChooseField(values=MessageReq.allowed_types)), (f.PARAMS.nm, AnyMapField()), (f.MSG.nm, AnyField()))
class RevocDefValueField(MessageValidator): schema = ( (ISSUANCE_TYPE, ChooseField(values=(ISSUANCE_BY_DEFAULT, ISSUANCE_ON_DEMAND))), (MAX_CRED_NUM, IntegerField()), (PUBLIC_KEYS, AnyMapField()), (TAILS_HASH, NonEmptyStringField()), (TAILS_LOCATION, NonEmptyStringField()), )
class ConstraintEntityField(MessageValidator): schema = ( (CONSTRAINT_ID, ChooseField(values=ConstraintsEnum.values())), (ROLE, RoleField()), (SIG_COUNT, NonNegativeNumberField()), (NEED_TO_BE_OWNER, BooleanField(optional=True)), (OFF_LEDGER_SIGNATURE, BooleanField(optional=True)), (METADATA, AnyMapField(optional=True)) )
class ClientTxnAuthorAgreementOperationAML(MessageValidator): schema = ((TXN_TYPE, ConstantField(TXN_AUTHOR_AGREEMENT_AML)), (AML_VERSION, LimitedLengthStringField( max_length=TXN_AUTHOR_AGREEMENT_AML_VERSION_SIZE_LIMIT)), (AML, AnyMapField()), (AML_CONTEXT, LimitedLengthStringField( max_length=TXN_AUTHOR_AGREEMENT_AML_CONTEXT_LIMIT, optional=True)))
class MessageReq(MessageBase): """ Purpose: ask node for any message """ allowed_types = { LEDGER_STATUS, CONSISTENCY_PROOF, PREPREPARE, PROPAGATE, PREPARE } typename = MESSAGE_REQUEST schema = ((f.MSG_TYPE.nm, ChooseField(values=allowed_types)), (f.PARAMS.nm, AnyMapField()))
class Commit(MessageBase): typename = COMMIT schema = ( (f.INST_ID.nm, NonNegativeNumberField()), (f.VIEW_NO.nm, NonNegativeNumberField()), (f.PP_SEQ_NO.nm, NonNegativeNumberField()), (f.BLS_SIG.nm, LimitedLengthStringField(max_length=BLS_SIG_LIMIT, optional=True)), # PLUGIN_FIELDS is not used in Commit as of now but adding for # consistency (f.PLUGIN_FIELDS.nm, AnyMapField(optional=True, nullable=True)))
class Prepare(MessageBase): typename = PREPARE schema = ( (f.INST_ID.nm, NonNegativeNumberField()), (f.VIEW_NO.nm, NonNegativeNumberField()), (f.PP_SEQ_NO.nm, NonNegativeNumberField()), (f.PP_TIME.nm, TimestampField()), (f.DIGEST.nm, LimitedLengthStringField(max_length=DIGEST_FIELD_LIMIT)), (f.STATE_ROOT.nm, MerkleRootField(nullable=True)), (f.TXN_ROOT.nm, MerkleRootField(nullable=True)), (f.PLUGIN_FIELDS.nm, AnyMapField(optional=True, nullable=True)) )
class Ordered(MessageBase): typename = ORDERED schema = ( (f.INST_ID.nm, NonNegativeNumberField()), (f.VIEW_NO.nm, NonNegativeNumberField()), (f.REQ_IDR.nm, IterableField(RequestIdentifierField())), (f.PP_SEQ_NO.nm, NonNegativeNumberField()), (f.PP_TIME.nm, TimestampField()), (f.LEDGER_ID.nm, LedgerIdField()), (f.STATE_ROOT.nm, MerkleRootField(nullable=True)), (f.TXN_ROOT.nm, MerkleRootField(nullable=True)), (f.PLUGIN_FIELDS.nm, AnyMapField(optional=True, nullable=True)) )
class PrePrepare(MessageBase): schema = ( (f.INST_ID.nm, NonNegativeNumberField()), (f.VIEW_NO.nm, NonNegativeNumberField()), (f.PP_SEQ_NO.nm, NonNegativeNumberField()), (f.PP_TIME.nm, TimestampField()), (f.REQ_IDR.nm, IterableField( LimitedLengthStringField(max_length=DIGEST_FIELD_LIMIT))), (f.DISCARDED.nm, SerializedValueField(nullable=True)), (f.DIGEST.nm, LimitedLengthStringField(max_length=DIGEST_FIELD_LIMIT)), (f.LEDGER_ID.nm, LedgerIdField()), (f.STATE_ROOT.nm, MerkleRootField(nullable=True)), (f.TXN_ROOT.nm, MerkleRootField(nullable=True)), (f.SUB_SEQ_NO.nm, NonNegativeNumberField()), (f.FINAL.nm, BooleanField()), (f.POOL_STATE_ROOT_HASH.nm, MerkleRootField(optional=True, nullable=True)), (f.AUDIT_TXN_ROOT_HASH.nm, MerkleRootField(optional=True, nullable=True)), # TODO: support multiple multi-sigs for multiple previous batches (f.BLS_MULTI_SIG.nm, BlsMultiSignatureField(optional=True, nullable=True)), (f.BLS_MULTI_SIGS.nm, IterableField(optional=True, inner_field_type=BlsMultiSignatureField( optional=True, nullable=True))), (f.ORIGINAL_VIEW_NO.nm, NonNegativeNumberField(optional=True, nullable=True)), (f.PLUGIN_FIELDS.nm, AnyMapField(optional=True, nullable=True)), ) typename = PREPREPARE def _post_process(self, input_as_dict: Dict) -> Dict: # make validated input hashable input_as_dict[f.REQ_IDR.nm] = tuple(input_as_dict[f.REQ_IDR.nm]) bls = input_as_dict.get(f.BLS_MULTI_SIG.nm, None) if bls is not None: input_as_dict[f.BLS_MULTI_SIG.nm] = (bls[0], tuple(bls[1]), tuple(bls[2])) bls_sigs = input_as_dict.get(f.BLS_MULTI_SIGS.nm, None) if bls_sigs is not None: sub = [] for sig in bls_sigs: sub.append((sig[0], tuple(sig[1]), tuple(sig[2]))) input_as_dict[f.BLS_MULTI_SIGS.nm] = tuple(sub) return input_as_dict
class Ordered(MessageBase): typename = ORDERED schema = ( (f.INST_ID.nm, NonNegativeNumberField()), (f.VIEW_NO.nm, NonNegativeNumberField()), (f.VALID_REQ_IDR.nm, IterableField(LimitedLengthStringField( max_length=DIGEST_FIELD_LIMIT))), (f.INVALID_REQ_IDR.nm, IterableField(LimitedLengthStringField( max_length=DIGEST_FIELD_LIMIT))), (f.PP_SEQ_NO.nm, NonNegativeNumberField()), (f.PP_TIME.nm, TimestampField()), (f.LEDGER_ID.nm, LedgerIdField()), (f.STATE_ROOT.nm, MerkleRootField(nullable=True)), (f.TXN_ROOT.nm, MerkleRootField(nullable=True)), (f.PLUGIN_FIELDS.nm, AnyMapField(optional=True, nullable=True)) )
class PrePrepare(MessageBase): typename = PREPREPARE schema = ( (f.INST_ID.nm, NonNegativeNumberField()), (f.VIEW_NO.nm, NonNegativeNumberField()), (f.PP_SEQ_NO.nm, NonNegativeNumberField()), (f.PP_TIME.nm, TimestampField()), (f.REQ_IDR.nm, IterableField(RequestIdentifierField())), (f.DISCARDED.nm, NonNegativeNumberField()), (f.DIGEST.nm, LimitedLengthStringField(max_length=DIGEST_FIELD_LIMIT)), (f.LEDGER_ID.nm, LedgerIdField()), (f.STATE_ROOT.nm, MerkleRootField(nullable=True)), (f.TXN_ROOT.nm, MerkleRootField(nullable=True)), # TODO: support multiple multi-sigs for multiple previous batches (f.BLS_MULTI_SIG.nm, BlsMultiSignatureField(optional=True, nullable=True)), (f.PLUGIN_FIELDS.nm, AnyMapField(optional=True, nullable=True)), )
class ClaimDefField(MessageValidator): schema = ( (CLAIM_DEF_PRIMARY, AnyMapField()), (CLAIM_DEF_REVOCATION, AnyMapField(optional=True)), )
class ClaimDefField(MessageValidator): schema = ( (PRIMARY, AnyMapField()), (REVOCATION, AnyMapField()), )