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

Transaction signing fails with the Ergo dApp connector #2157

Open
anon-real opened this issue Jun 3, 2021 · 16 comments
Open

Transaction signing fails with the Ergo dApp connector #2157

anon-real opened this issue Jun 3, 2021 · 16 comments

Comments

@anon-real
Copy link

anon-real commented Jun 3, 2021

When trying to sign an unsigned transaction, I get the following error:

Error: genLookupOrFail no token info for {"identifier":"d58b85b6e6319796d42feccfee4f80086efbd4d9098dd435f205750845d501f9","amount":"-1","networkId":200}
    at Object.getTokenInfo (ergo.bundle.js:1)
    at Vn.renderAmountDisplay (ergo.bundle.js:1)
    at s (ergo.bundle.js:1)
    at ergo.bundle.js:1
    at Array.map (<anonymous>)
    at Vn.renderRow (ergo.bundle.js:1)
    at ergo.bundle.js:1
    at Array.map (<anonymous>)
    at Vn.render (ergo.bundle.js:1)
    at Se (813.bundle.js:2)
rs @ 587.bundle.js:2

The unsigned transaction is perfectly fine because the node is able to sign it (with the same secrets as my Yoroi wallet).
The d58b85b6e6319796d42feccfee4f80086efbd4d9098dd435f205750845d501f9 is a token in one of the inputs of the transaction (not related to my wallet's UTXOs).

@anon-real
Copy link
Author

@rooooooooob I don't know who should check this out.

@rooooooooob
Copy link
Contributor

@anon-real I'm confused about the context when you say "not related to my wallet's UTXOs". So the box is not owned by your wallet? How is it going to be able to be signed by the wallet then? Is it a data input? Or is this something that should fail to sign but should provide a nice error message?

Or are you using the sign_tx_input() endpoint and only want to sign the input that belongs to you, but another input has this token in it (which then maybe fails when the UI tries to show info on it)? Could you please tell me if you're using sign_tx() or sign_tx_input().

Thanks for the report.

@anon-real
Copy link
Author

@rooooooooob dApp connector should also be able to sign dApp boxes like auctions, SigmaUSD bank box, ...
These boxes don't require secrets and only some condition in the spending tx should be preserved for them to be spendable. So for example, to place a bid for an auction, the user uses the dApp connector to sign some of his own boxes along with the auction box to place the bid. sigma-rust already supports signing these boxes (auctions, SigmaUSD) but dApp connector throws the error that I sent here.

@rooooooooob
Copy link
Contributor

Okay, so it's a P2S input with an asset? That makes more sense now, I was assuming P2PK earlier I guess, hence my confusion. I think Yoroi only tracks asset info (the stuff in the other registers when it was created) over ones you own, and then it goes to look that up to show on the UI but it can't. I'll look into it. Maybe we can fall back to querying it on the backend if we don't own it during the signing process.

@anon-real
Copy link
Author

Thanks! Yes, that is correct. But why does it even need to look it up? The tx is already assembled and should be signable without any additional info needed, right?

@anon-real
Copy link
Author

Sorry, I understand now, it is for showing tx info to the user.

@rooooooooob
Copy link
Contributor

It can be signed as is, yes. When an asset is initially minted it also stores info like a friendly name, how many decimal places it has, etc. We use this information to display a more user-friendly tx signing screen since I guess we hadn't considered this when the UI was written. Worst case we could just only show the ID, but I'm not familiar with the UI code. I've informed the guy who did it though so we'll see.

@rooooooooob
Copy link
Contributor

@anon-real Sorry for the delay, but can you post the JSON contents of the TX you sent to get this issue? I took a look at the UI code for assets and it turns out my intuition earlier was incorrect, and we actually query the ergo explorer backend for asset info. I'm thinking that this might be related to #2162. Is the TX minting a new asset? If so I'm working on #2170 to fix it. If not, maybe the JSON can help shed some light on what is happening.

@anon-real
Copy link
Author

@rooooooooob That is weird because my testing confirmed your initial intuition!
No, I am not issuing new tokens, it crashes for tokens that are not a part of the wallet (at least Yoroi hasn't seen them in the wallet ever.)

I think you can figure out about this issue and #2160 at the same time. If you follow the procedure that I posted, then your Yoroi will crash because it doesn't know about the token that is in the transaction. Then I will send you the token to your wallet and you'll see that Yoroi won't crash anymore (but removes the first input of the tx.)
Please let me know if you need anything else.

@rooooooooob
Copy link
Contributor

@anon-real We just released a new Yoroi nightly. It has a fix for #2170 among other issues so it might be worth seeing if for some reason this issue is resolved. If it still happens, could you find the assets in the tx on the explorer and post the link here?

@vsubhuman
Copy link
Contributor

There are now nighly versions available: Yoroi = 4.5.7002 and dapp-connector = 0.4.0. Please confirm if the issue is still present there, or this might be closed?

@anon-real
Copy link
Author

@rooooooooob @vsubhuman No this issue is not resolved - it still crashes.

@anon-real
Copy link
Author

I am also experiencing some other issues like "Uncaught (in promise) Error: [mobx] An invariant failed, however the error is obfuscated because this is a production build." when trying to connect to my wallet.
I have set up a test auction house so you can see the issues for yourselves: https://yoroi.ergoauctions.org/

You can produce all these issues (#2157 #2160 and the error above) by following these steps:

The requested unsigned tx will be printed, the source code which you may find useful: https://github.com/anon-real/ErgoAuctionHouse/blob/yoroi/src/auction/bidYoroi.js#L123

@vsubhuman
Copy link
Contributor

You can produce all these issues (#2157 #2160 and the error above) by following these steps:

Hi, @anon-real! Thank you for that great hosted resource and the instruction to reproduce the problems!

  • connect to your Yoroi wallet with "Configure wallet" then "connect" - this should produce the "Uncaught (in promise) Error: [mobx] An invariant failed, however the error is obfuscated because this is a production build." error

Regarding this first problem - I am now releasing a new nightly version of Yoroi 4.5.7005 - please update to that version and try it again, this should be fixed there. I have got connection to wallet working on your page with no problems with that fix.

To be able to reproduce other problems you will have to upgrade to the changes in the latest Yoroi, tho, because the dapp-connector now requires all the output values and asset amounts to be specified as strings always, see this PR (the nightly is now built from this branch) - #2246

I am getting to the point where your page receives utxos, but their values are now strings, so things seem to be breaking after that. This update will be needed in any way as we are positively making this change for safe value exchange going forward.

Once you page is updated to the strings - I will look into any further errors ASAP.

cc @oskin1 for more details if needed.

@anon-real
Copy link
Author

@vsubhuman Hey! Sorry for the delay, somehow I haven't received notifications!
I will update the page ASAP and get back to you.

@anon-real
Copy link
Author

@vsubhuman https://yoroi.ergoauctions.org/ is updated!
Now it gets to where the user enters his password, but sign_tx seems to do nothing.
For reference: https://github.com/anon-real/ErgoAuctionHouse/blob/yoroi/src/auction/bidYoroi.js#L156

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

No branches or pull requests

3 participants