def __call__(self, transaction: BaseTransactionFields) -> bool: transaction_class = self.get_appropriate_tx_class() tx = transaction_class(**transaction.as_dict()) try: tx.validate() except ValidationError: return False else: return True
def mk_transaction(): return BaseTransactionFields( nonce=0, gas=21000, gas_price=1, to=os.urandom(20), value=random.randint(0, 100), data=b'', v=27, r=big_endian_to_int(os.urandom(32)), s=big_endian_to_int(os.urandom(32)), )