ApeWorX / ape-bsc

Binance Smart Chain (BSC) ecosystem plugin for the Ape Framework
https://www.apeworx.io/
Apache License 2.0
0 stars 6 forks source link

BSC Testnet scripts not running due to transaction type [APE-920] #13

Closed jmanywhere closed 1 year ago

jmanywhere commented 1 year ago

Environment information

$ ape --version
0.6.8

$ ape plugins list
Installed Plugins:
  solidity     0.6.3
  etherscan    0.6.3
  hardhat      0.6.4
  bsc          0.6.0

What went wrong?

Tried to run a script on the bsc-testnet and all transactions failed using a loaded address. Please include information like:

def main(): owner = accounts.load("dev_test") print(f"Owner'{owner.address}'") usdt = project.TestToken.deploy("tUSDT", "TUSDT", sender=owner, publish=True)

- full output of the error you received

DynamicFeeTransaction: chainId: 97 from: 0x7Ff20b4E1Ad27C5266a929FC87b00F5cCB456374 gas: 711654 nonce: 1211 value: 0 data: 0x608060...000000 type: 2 maxFeePerGas: 10000000000 maxPriorityFeePerGas: 10000000000 accessList: []

Sign: [y/N]: y Enter passphrase to unlock 'dev_test' []: Leave 'dev_test' unlocked? [y/N]: y DEBUG: Making request. Method: eth_sendRawTransaction DEBUG: Making request HTTP. URI: https://data-seed-prebsc-1-s1.binance.org:8545, Method: eth_sendRawTransaction DEBUG: Getting response HTTP. URI: https://data-seed-prebsc-1-s1.binance.org:8545, Method: eth_sendRawTransaction, Response: {'jsonrpc': '2.0', 'id': 13, 'error': {'code': -32000, 'message': 'invalid sender'}} ERROR: (VirtualMachineError) Traceback (most recent call last): File "/Users/jmf/dev/apeEnv/lib/python3.10/site-packages/ape/api/providers.py", line 1141, in send_transaction txn_hash = self.web3.eth.send_raw_transaction(txn.serialize_transaction()) File "/Users/jmf/dev/apeEnv/lib/python3.10/site-packages/web3/eth/eth.py", line 372, in send_raw_transaction return self._send_raw_transaction(transaction) File "/Users/jmf/dev/apeEnv/lib/python3.10/site-packages/web3/module.py", line 68, in caller result = w3.manager.request_blocking( File "/Users/jmf/dev/apeEnv/lib/python3.10/site-packages/web3/manager.py", line 232, in request_blocking return self.formatted_response( File "/Users/jmf/dev/apeEnv/lib/python3.10/site-packages/web3/manager.py", line 205, in formatted_response raise ValueError(response["error"]) ValueError: {'code': -32000, 'message': 'invalid sender'}

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/jmf/dev/apeEnv/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3460, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in usdt = project.TestToken.deploy("tUSDT", "TUSDT", sender=owner) File "/Users/jmf/dev/apeEnv/lib/python3.10/site-packages/ape/contracts/base.py", line 1186, in deploy receipt = kwargs["sender"].call(txn, **kwargs) File "/Users/jmf/dev/apeEnv/lib/python3.10/site-packages/ape/api/accounts.py", line 142, in call return self.provider.send_transaction(signed_txn) File "/Users/jmf/dev/apeEnv/lib/python3.10/site-packages/ape/api/providers.py", line 1153, in send_transaction raise vm_err from err ape.exceptions.VirtualMachineError: (-32000) invalid sender



### How can it be fixed?
Spoke with @fubuloubu and he suggested to run all transactions with the arg `type=0` and that seemed to work.

If we're using bsc or any non EIP-1559 evm, type should be fixed to 0 when creating transactions.
antazoey commented 1 year ago

which networks are still pre 1559 and which ones arent, do you know?

fubuloubu commented 1 year ago

which networks are still pre 1559 and which ones arent, do you know?

out of the ones we support, I think BSC may be the only one. But I am not sure about that.

antazoey commented 1 year ago

i mean in BSC, is it both testnet and mainnet or just testnet?

fubuloubu commented 1 year ago

i mean in BSC, is it both testnet and mainnet or just testnet?

think both