zksync-sdk / zksync-python

Python 3.8 SDK for zkSync
MIT License
116 stars 64 forks source link

From SDK example send_raw_transaction raises ValueError " Account validation returned invalid magic value" #54

Closed Humble255 closed 1 year ago

Humble255 commented 1 year ago

It was checked on Era Mainnet using valid addresses and real founds. I am unable to send a transaction due to below ValueError. Traceback says that signature might be incorrect but verification returns true:

verify = signer.verify_typed_data(sig=singed_message.signature, typed_data=tx_712.to_eip712_struct(), domain=None)

True

Failing SDK example line: tx_hash = zksync_web3.zksync.send_raw_transaction(msg)

Traceback (most recent call last):
  File "D:\GIT\Python\zkSync\main.py", line 113, in <module>
    transfer_eth_(amount_eth=0.001,from_account=MAIN_ACCOUNT, to_account=ACC1_ACCOUNT)
  File "D:\GIT\Python\zkSync\main.py", line 94, in transfer_eth_
    tx_hash = zksync_web3.zksync.send_raw_transaction(msg)
  File "D:\GIT\Python\zkSync\venv\lib\site-packages\web3\eth.py", line 831, in send_raw_transaction
    return self._send_raw_transaction(transaction)
  File "D:\GIT\Python\zkSync\venv\lib\site-packages\web3\module.py", line 57, in caller
    result = w3.manager.request_blocking(method_str,
  File "D:\GIT\Python\zkSync\venv\lib\site-packages\web3\manager.py", line 198, in request_blocking
    return self.formatted_response(response,
  File "D:\GIT\Python\zkSync\venv\lib\site-packages\web3\manager.py", line 171, in formatted_response
    raise ValueError(response["error"])
ValueError: {'code': 3, 'message': 'Failed to submit transaction: failed to validate the transaction. reason: Validation revert: Account validation error: Account validation returned invalid magic value. Most often this means that the signature is incorrect', 'data': {'code': 104, 'message': 'failed to validate the transaction. reason: Validation revert: Account validation error: Account validation returned invalid magic value. Most often this means that the signature is incorrect'}}

Process finished with exit code 1
Humble255 commented 1 year ago

OK, after I migrated to package zksync2 0.4.0 and adjust datatypes it seems to work now.