예제 #1
0
 def deserialize_slot(self, key, value):
     value = super().deserialize_slot(key, value)
     if key == 'compute_task_def':
         value = ComputeTaskDef(value)
     if key in ('price', 'size'):
         validators.validate_integer(
             field_name=key,
             value=value,
         )
     return value
예제 #2
0
파일: message.py 프로젝트: dad1x/concent
 def deserialize_slot(self, key: str, value: Any) -> Any:
     value = super().deserialize_slot(key, value)
     if key == 'nonce':
         validate_integer(
             field_name=key,
             value=value,
         )
         validate_maximum_int_length(
             field_name=key,
             value=value,
             maximum_allowed_length=78,
         )
     return value
예제 #3
0
 def deserialize_slot(self, key: str, value: Any) -> Any:
     value = super().deserialize_slot(key, value)
     if key == 'to':
         validate_bytes(
             field_name=key,
             value=value,
             maximum_allowed_length=20,
         )
     if key == 'data':
         validate_bytes(
             field_name=key,
             value=value,
         )
     if key in TransactionAbstractMessage.SLOTS_TO_CONVERT:
         # Reverse conversion from string to integer
         value = int(value)
         validate_integer(field_name=key, value=value)
         validate_maximum_int_length(
             field_name=key,
             value=value,
             maximum_allowed_length=78,
         )
     return value
예제 #4
0
    def deserialize_slot(self, key: str, value: Any) -> Any:
        value = super().deserialize_slot(key, value)
        if key in SignedTransaction.SLOTS_TO_CONVERT:
            # Reverse conversion from string to integer
            value = int(value)
            validate_integer(
                field_name=key,
                value=value,
            )
        if key == 'v':
            validate_maximum_int_length(
                field_name=key,
                value=value,
                maximum_allowed_length=3,
            )
        if key in ('r', 's'):
            validate_maximum_int_length(
                field_name=key,
                value=value,
                maximum_allowed_length=78,
            )

        return value
예제 #5
0
파일: message.py 프로젝트: dad1x/concent
 def deserialize_slot(self, key: str, value: Any) -> Any:
     value = super().deserialize_slot(key, value)
     if key == 'to':
         validate_bytes(
             field_name=key,
             value=value,
             maximum_allowed_length=20,
         )
     if key == 'data':
         validate_bytes(
             field_name=key,
             value=value,
         )
     if key in ('gasprice', 'startgas', 'value'):
         validate_integer(
             field_name=key,
             value=value
         )
         validate_maximum_int_length(
             field_name=key,
             value=value,
             maximum_allowed_length=78,
         )
     return value
예제 #6
0
 def validate(self, value):
     return validators.validate_integer(
         field_name=self.field_name,
         value=value,
     )