Closed wilwade closed 2 years ago
I just wanted to chime in on this since I just encountered this myself. This seems like an unnecessary speed bump for new people when trying to send their first transaction.
I might be inclined to help out with this issue as it seems fairly straightforward, but I think there is need for some clarity on the correct behavior before I dive into this.
As @wilwade mentioned in the issue there is a mismatch between what is being scaffolded and the default value.
I would imagine the "obivous" easy fix is to change the default value so it matches what is being scaffolded. But I wonder if it is intended (or wanted) that the chain-id should strip dashes? If yes: would be great to the context/why (and then I suppose the fix is to change the default value, and perhaps some kind of notice to the user upon scaffolding that the chain-id was stripped) If no: Is the fix then to update what starport scaffolds as the chain-id (to include the dashes)
Thanks for this it saved me a lot of head scratching .
Maybe an easy solution would be to add more details in the error
from :
signature verification failed; please verify account number (0) and chain-id
to :
signature verification failed; please verify account number (0) and chain-id (with-dash) current value is (withdash)
@ilgooz (tagging you since I see you often in the Discord 😁 )
Adding my voice here too - this just ate several hours of my life. As a newcomer, I had basically no idea how to solve this and assumed I must be doing something wrong. It was only after three hours or so that I got the "crazy" idea that it might be due to the dashes in my project name - which ultimately turned out to be correct.
Putting dashes in your project name is not unusual at all - in fact I would argue it is quite common, especially for GitHub projects (e.g. cosmos-sdk
).
While trying to figure this out, I also found an additional workaround - you can explicitly set the chain-id in config.yml
like so:
...
genesis:
chain_id: "with-dashd"
Given that this works, it seems like chain-ids can have dashes in them so in response to @bjaanes 's excellent question, it seems like dashes don't need to be stripped.
My theory is that the stripping was originally intended for Go package names, which do not allow dashes, but it wound up affecting more than necessary.
I think the problem might here: https://github.com/ignite/cli/blob/develop/ignite/services/chain/chain.go#L248
(.N()
strips out dashes)
cc @tbruyelle @jeronimoalbi
Describe the bug I scaffold a chain where the package name has dashes, then use the generated chain to create a transaction without the --chain-id parameter. The default hash dashes, but the actually generated chain id does not. The resulting error is just a signing failure due to account of chain id.
To Reproduce Steps to reproduce the behavior: Setup
starport scaffold module thisisamodule
starport scaffold list saveastring str --module thisisamodule
starport chain serve
Error Case 1: No Chain Id set
with-dashd tx thisisamodule create-saveastring "hello world" --from alice
Expected: Success
Result:
Works:
Error Case 2: Bad Default
See the default is set to
with-dash
instead of what apparently was scaffolded waswithdash
.Expected: Either
with-dash
is the chain id, or the default is set towithdash
.Please provide the version output
starport version
:Thanks everyone. Starport really is great and just wanted to add something that tripped me up getting started with it.
Search terms for those who want a different name for a
-
char: chain id with hyphen, hyphenation, bar