Support web3.py v6
1, change the function in web3py to the latest version 2, block the type of tx in FlashbotsPrivateTransactionResponse class 3, Flashbots class set the type of w3
is_async = False
w3: "Web3"
4, headers in provider.py is set by
headers = self.get_request_headers() | {
"X-Flashbots-Signature": f"{self.signature_account.address}:{signed_message.signature.hex()}"
}
modified to
headers = self.get_request_headers()
headers["X-Flashbots-Signature"] = f"{self.signature_account.address}:{signed_message.signature.hex()}"
to be compatible with python versions up to 3.9
Untested changes 1, cancel_private_transaction_munger class return value type 2, mask the type of signed_transaction in the send_private_transaction_munger method
I tried this PR but I'm currently getting the error Simulation error {'code': -32000, 'message': 'err: %!w(<nil>); txhash 0xcd47867bc2d4c34ae36dcab067c513d9cfb3eb701438ee8435b799dd4f756730'} during w3.flashbots.simulate(bundle, block)
I'm printing everything on the simulate method:
evm_block_number 0x9f449f
evm_block_state_number 0x9f449e
evm_timestamp 1706290476
signed_bundled_transactions [HexBytes('0x02f86f058201958207d08207d082c73894b40e6efe4e4f08b0709fc160bff0570bca876e9687038d7ea4c6800080c080a0f55a40418b72e78c30317a318dfa62f0b164b7e813106241776615279b310ffea06a353e5604e1b00857074d355642cb8a7623df6e42a758b59152749c1efcf1b1'), HexBytes('0x02f86d050a8207d08207d082c73894740e764806a0ba1af2dd62f0004bf3a8403ff67e87071afd498d000080c001a0fbb1d1d7658877afb397b91f31721b0d9a3d91e465c1d29cb55872103f54f533a045b88b99ebfdc408fd35276d43f6334d1352471cdd9fbd21efc17a0ecacc7c65')]
Simulation error {'code': -32000, 'message': 'err: %!w(<nil>); txhash 0xcd47867bc2d4c34ae36dcab067c513d9cfb3eb701438ee8435b799dd4f756730'}
So it seems it's failing during:
call_result = self.call_bundle(
signed_bundled_transactions,
evm_block_number,
evm_block_state_number,
evm_timestamp,
)
Thanks a lot for the contribution. Sorry had to merge #87 because after trying it is a bit easier to merge.