Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy contract? #562

Open
Subway2023 opened this issue Jan 25, 2025 · 2 comments
Open

Unable to deploy contract? #562

Subway2023 opened this issue Jan 25, 2025 · 2 comments

Comments

@Subway2023
Copy link

🐛 Bug Report for anvil-zksync

Normally, deploying a contract does not require specifying a to address. However, an error occurs when using Anvil-zksync. So, how should the contract be deployed?

curl --request POST \
  --url http://localhost:8011/ \
  --header 'content-type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "eth_sendTransaction",
    "params": [{
      "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
      "data": "0x0000008003000039000000400030043f0000000100200190000000110000c13d0000000900100198000000190000613d000000000101043b0000000a011001970000000b0010009c000000190000c13d0000000001000416000000000001004b000000190000c13d0000002a01000039000000800010043f0000000c010000410000001c0001042e0000000001000416000000000001004b000000190000c13d00000020010000390000010000100443000001200000044300000008010000410000001c0001042e00000000010000190000001d000104300000001b000004320000001c0001042e0000001d0001043000000000000000000000000000000000000000020000000000000000000000000000004000000100000000000000000000000000000000000000000000000000fffffffc000000000000000000000000ffffffff00000000000000000000000000000000000000000000000000000000f2c9ecd80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000008000000000000000000000000000000000000000000000000000000000000000000000000000000000e5ea178ec36d0e479feb3139689b557f7d04dfc3b23ee745476203692dc1fa11",
      "gas": "0x200b20",
      "gasPrice": "0x09184e72a000",
      "value": "0x0"
    }]
  }'
{"jsonrpc":"2.0","error":{"code":3,"message":"Failed to serialize transaction: toAddressIsNull"},"id":"1"}
@Subway2023 Subway2023 changed the title How to deploy contract? Unable to deploy contract? Jan 26, 2025
@Subway2023
Copy link
Author

I used the program from link to deploy the contract, and it also failed.

gas_price 45250000
Fee for transaction is: 0.000091943113 ETH
Traceback (most recent call last):
  File "/mnt/sdd1/sbw/crossCompilerFuzz/virtualMachine/zksync_python/test3.py", line 110, in <module>
    deploy_contract(zk_web3, account, contract_path)
  File "/mnt/sdd1/sbw/crossCompilerFuzz/virtualMachine/zksync_python/test3.py", line 77, in deploy_contract
    tx_hash = zk_web3.zksync.send_raw_transaction(msg)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/lib/python3.12/site-packages/web3/eth/eth.py", line 381, in send_raw_transaction
    return self._send_raw_transaction(transaction)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/lib/python3.12/site-packages/web3/module.py", line 112, in caller
    result = w3.manager.request_blocking(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/lib/python3.12/site-packages/web3/manager.py", line 400, in request_blocking
    return self.formatted_response(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/lib/python3.12/site-packages/web3/manager.py", line 366, in formatted_response
    _validate_response(
  File "/root/anaconda3/lib/python3.12/site-packages/web3/manager.py", line 263, in _validate_response
    raise web3_rpc_error
web3.exceptions.Web3RPCError: {'code': 3, 'message': 'Execution error: max priority fee per gas higher than max fee per gas', 'data': '0xe3a4e2d0c475feea45c3fa3b902f2cbf8c55567e1b74f04a212fce297d426664'}

@dutterbutter
Copy link
Collaborator

dutterbutter commented Jan 27, 2025

The error Failed to serialize transaction: toAddressIsNull is expected in the above mentioned case with eth_sendTransaction as ZKsync contract deployments are in the form of EIP712 transaction. You can see the differences in deployment here.

That being said I suggest using forge create --zksync --rpc-url http://localhost:8011 to deploy contracts against anvil-zksync and be sure to use the latest anvil-zksync version (e.g. 0.2.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants