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

"Error: zkSync API response error: code 103; message: Tx is incorrect" #254

Closed
miguelmota opened this issue Nov 11, 2020 · 8 comments
Closed

Comments

@miguelmota
Copy link

Getting an invalid tx error after the transfer signature request.

Screenshot from 2020-11-10 16-12-01

wallet: Authereum via WalletConnect
network: rinkeby
account (contract-based-account): 0xe0DBe2703FB3fC9Cd36fb5717437e738F4002681
message (hex): 0x5472616e7366657220302e30303031204554480a546f3a203078346363613566326630313734366231633133636137613364616230343632643232353739356433610a4e6f6e63653a2033350a4665653a20302e3030303031333338204554480a4163636f756e742049643a203334
message (utf8):

Transfer 0.0001 ETH
To: 0x4cca5f2f01746b1c13ca7a3dab0462d225795d3a
Nonce: 35
Fee: 0.00001338 ETH
Account Id: 34

signature: 0x1a1997812a419ae57e68d8f4d3f375e0b7b2a036f0a58e838bbd5ec931dfddd80d0875b60940248b043e41c1239e5fc06a6e940b610c13431130fd9a082f2e7d1c

The isValidSignature on-chain check appears to be valid:

request:

{"id":2,"jsonrpc":"2.0","params":[{"data":"0x20c13b0b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000006f5472616e7366657220302e30303031204554480a546f3a203078346363613566326630313734366231633133636137613364616230343632643232353739356433610a4e6f6e63653a2033350a4665653a20302e3030303031333338204554480a4163636f756e742049643a203334000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000411a1997812a419ae57e68d8f4d3f375e0b7b2a036f0a58e838bbd5ec931dfddd80d0875b60940248b043e41c1239e5fc06a6e940b610c13431130fd9a082f2e7d1c00000000000000000000000000000000000000000000000000000000000000","to":"0xe0dbe2703fb3fc9cd36fb5717437e738f4002681"},"latest"],"method":"eth_call"}

response:

{"jsonrpc":"2.0","id":2,"result":"0x20c13b0b00000000000000000000000000000000000000000000000000000000"}

Thanks in advance for any help

@dvush
Copy link
Contributor

dvush commented Nov 12, 2020

We are working on it now, we upgraded to the latest EIP1271 standard spec and it stopped working.

@dvush
Copy link
Contributor

dvush commented Nov 18, 2020

It turned out it was bug in Argent with EIP1271 where it is broken. I am not sure why it does not work in Authereum - I'll ask someone to check.

@miguelmota
Copy link
Author

For reference here's the EIP1271 implementation in Authereum contracts. The interesting thing is that transfers work with the zksync sdk but not when using the zksync UI.

@dvush
Copy link
Contributor

dvush commented Dec 1, 2020

I believe it should work now, please reopen if not.

@dvush dvush closed this as completed Dec 1, 2020
@dvush
Copy link
Contributor

dvush commented Dec 4, 2020

We fixed similar issue for argent but there is another similar issue with Authereum since it has different signing procedure

@dvush dvush reopened this Dec 4, 2020
@dvush
Copy link
Contributor

dvush commented Dec 4, 2020

@miguelmota Hi, I just noticed that your are also a developer of the authereum! Can you help us figure out why there are may be problems with authereum?

I have question here authereum/contracts#7

Also, I don't understand this from your doc: Authereum, Dapper wallet, 0xProject, and a few others are already using EIP1271 to verify signatures where the "recovered address" is a contract address. Do you mean that if I do ecrecover on the signature I'll get contract address? How it this possible?

@miguelmota
Copy link
Author

@dvush sorry about the confusing wording. Authereum has the concept of two types of keys: admin keys (known as 'auth' keys in contract) and dapp keys (known as 'login' keys in contract).

Admin keys have full control of the account contract and can add or remove other admin keys.

Dapp keys are keys that are generated on dapp login. The public key is attested by an admin key (by using a similar login flow to oauth). When a transaction is signed on a dapp using the authereum provider, the signature includes both the transaction signature and the admin key attestation signature (so this 'signature' is actually two signatures).

The 65 byte long signature is the regular admin key signature. The longer signature is the dapp key 'signature'.

Verifying the admin key signature is simple and done using ecrecover and then comparing to the contracts list of admin keys.

The dapp key 'signature' is decoded into 2 signatures (the transaction signature and attestation signature). The dapp key address is recovered from the first signature and then that address is used as the message data to ecrecover the admin key signature, which then the admin key is compared to the contracts list of admin keys. If any of this fails then the signature is invalid.

More details can be found in this blog post but hope this cleared up some questions!

@imcda
Copy link

imcda commented Apr 29, 2022

I use zksync to transfer DAI, but the account need activated. I use the blew code to unlock the wallet, only change the parameters "ETH " to "DAI".

if not asyncio.run(wallet.is_signing_key_set()): tx = asyncio.run(wallet.set_signing_key("DAI", eth_auth_data=ChangePubKeyEcdsa())) status = asyncio.run(tx.await_committed()) print(status)

I got this error,

zksync_sdk.transport.ResponseError: Response error with code 103 Tx is incorrect: L2 signature is incorrect

I need update the zksync_sdk?

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

3 participants