def _build_contract_creation_tx_with_valid_signature(self, tx_dict: Dict[str, None], s: int) -> Transaction:
        """
        Use pyethereum `Transaction` to generate valid tx using a random signature
        :param tx_dict: Web3 tx dictionary
        :param s: Signature s value
        :return: PyEthereum creation tx for the proxy contract
        """
        zero_address = HexBytes('0x' + '0' * 40)
        f_address = HexBytes('0x' + 'f' * 40)
        nonce = tx_dict['nonce']
        gas_price = tx_dict['gasPrice']
        gas = tx_dict['gas']
        to = tx_dict.get('to', b'')  # Contract creation should always have `to` empty
        value = tx_dict['value']
        data = tx_dict['data']
        for _ in range(100):
            try:
                v, r = self.find_valid_random_signature(s)
                contract_creation_tx = Transaction(nonce, gas_price, gas, to, value, HexBytes(data), v=v, r=r, s=s)
                sender_address = contract_creation_tx.sender
                contract_address = contract_creation_tx.creates
                if sender_address in (zero_address, f_address) or contract_address in (zero_address, f_address):
                    raise InvalidTransaction
                return contract_creation_tx
            except InvalidTransaction:
                pass
        raise ValueError('Valid signature not found with s=%d', s)
def _build_contract_creation_tx_with_valid_signature(self, tx_dict: Dict[str, None], s: int) -> Transaction:
        """
        Use pyethereum `Transaction` to generate valid tx using a random signature
        :param tx_dict: Web3 tx dictionary
        :param s: Signature s value
        :return: PyEthereum creation tx for the proxy contract
        """
        zero_address = HexBytes('0x' + '0' * 40)
        f_address = HexBytes('0x' + 'f' * 40)
        nonce = tx_dict['nonce']
        gas_price = tx_dict['gasPrice']
        gas = tx_dict['gas']
        to = tx_dict.get('to', b'')  # Contract creation should always have `to` empty
        value = tx_dict['value']
        data = tx_dict['data']
        for _ in range(100):
            try:
                v, r = self.find_valid_random_signature(s)
                contract_creation_tx = Transaction(nonce, gas_price, gas, to, value, HexBytes(data), v=v, r=r, s=s)
                sender_address = contract_creation_tx.sender
                contract_address = contract_creation_tx.creates
                if sender_address in (zero_address, f_address) or contract_address in (zero_address, f_address):
                    raise InvalidTransaction
                return contract_creation_tx
            except InvalidTransaction:
                pass
        raise ValueError('Valid signature not found with s=%d', s)
def _build_contract_creation_tx_with_valid_signature ( self , tx_dict : Dict [ str , None ] , s : int ) -> Transaction : zero_address = HexBytes ( '0x' + '0' * 40 ) f_address = HexBytes ( '0x' + 'f' * 40 ) nonce = tx_dict [ 'nonce' ] gas_price = tx_dict [ 'gasPrice' ] gas = tx_dict [ 'gas' ] to = tx_dict . get ( 'to' , b'' ) # Contract creation should always have `to` empty value = tx_dict [ 'value' ] data = tx_dict [ 'data' ] for _ in range ( 100 ) : try : v , r = self . find_valid_random_signature ( s ) contract_creation_tx = Transaction ( nonce , gas_price , gas , to , value , HexBytes ( data ) , v = v , r = r , s = s ) sender_address = contract_creation_tx . sender contract_address = contract_creation_tx . creates if sender_address in ( zero_address , f_address ) or contract_address in ( zero_address , f_address ) : raise InvalidTransaction return contract_creation_tx except InvalidTransaction : pass raise ValueError ( 'Valid signature not found with s=%d' , s )
Use pyethereum `Transaction` to generate valid tx using a random signature
        :param tx_dict: Web3 tx dictionary
        :param s: Signature s value
        :return: PyEthereum creation tx for the proxy contract
Use pyethereum Transaction to generate valid tx using a random signature : param tx_dict : Web3 tx dictionary : param s : Signature s value : return : PyEthereum creation tx for the proxy contract