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

Feature request: show text along with codespace numbers #1740

Open
taitruong opened this issue Nov 26, 2023 · 7 comments
Open

Feature request: show text along with codespace numbers #1740

taitruong opened this issue Nov 26, 2023 · 7 comments

Comments

@taitruong
Copy link

afaik sei chain does this, but many Cosmos chains doesnt. Ngl, would save a lot of time for devs.
It's quite tedious figuring out all the time what these codespace errors mean:
https://github.com/CosmWasm/wasmd/blob/7ea00e2ea858ed599141e322bd68171998a3259a/x/wasm/types/errors.go

@alpe
Copy link
Contributor

alpe commented Nov 28, 2023

Thanks for the feature request!
Errors are a bigger topic. We have to redact them for contracts to not contain host specific and therefore consensus breaking information. It is also quite easy to break backwards compatibility if a contract builds upon an error message and then this text is changed for some reason. Other than this, errors are handled by the SDK for IO.
Can you elaborate more on your scenario so that I can understand the use case better?
I could imagine a CLI command for example that can help to translate the codespace/ code into the error message...

@BHIIKTOR
Copy link

i think that's what Sei did (but im not 100% sure), they used the CLI to interpret the error msgs, instead of adding them directly to the chain.

i could not agree more with @alpe solution of adding it to the CLI instead of anywhere else
this way we can keep things more agnostic at chain level

@taitruong
Copy link
Author

CLI helps, but in case of IBC, this wont help. Like errors are passed through ACK message.

@webmaster128
Copy link
Member

webmaster128 commented Jan 25, 2024

There are two related topics here and we need to address them separately:

Errors in submessage replies

Currently redacted due to consensus problems. This will change for all errors coming from CosmWasm contracts with 2.0. The change is already implemented here and will be integrated into wasmd soon.

Errors in acknowledgements

channeltypes.NewErrorAcknowledgement from ibc-go which is used here does not even contain the codespace. We only get a code X and don't know if it is sdk/X or wasm/X or any other module:

func NewErrorAcknowledgement(err error) Acknowledgement {
	// the ABCI code is included in the abcitypes.ResponseDeliverTx hash
	// constructed in Tendermint and is therefore deterministic
	_, code, _ := errorsmod.ABCIInfo(err, false) // discard non-determinstic codespace and log values

	return Acknowledgement{
		Response: &Acknowledgement_Error{
			Error: fmt.Sprintf("ABCI code: %d: %s", code, ackErrorString),
		},
	}
}

This is because codespace is not part of consesus for some reason.

I think a wasmd port of NewErrorAcknowledgement replacing the call to ack = channeltypes.NewErrorAcknowledgement(err) from ibc-go would allow us to provide much more insights into the error acknowledgement. We must be extra careful to not introduce non-determinism. But I think we can do much better than just having the error code number there.

@BHIIKTOR
Copy link

amazing!, good to know this is being worked on.

for new comers (devs with experience in other fields) and general new devs that are starting directly in blockchain and in cosmwasm it can be a bit frustrating and challenging to figure out what broke with the current errors.

i believe this change can help improve dev UX by a lot and be more welcoming to devs without tons of experience

thank you Simon

cheers!

@taitruong
Copy link
Author

taitruong commented Jun 21, 2024

Just catching up. So this is fixed in ibc-go v8.3.0?

Seems to be so: cosmos/ibc-go#5736 (comment)

@webmaster128
Copy link
Member

webmaster128 commented Jun 27, 2024

#1911 will bring the codespace to error acks. I will keep this ticket open until we have full error texts in error acks.

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

4 participants