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

Define x/TokenFactory BeforeSend hook sentinel error #2570

Open
dalmirel opened this issue Sep 1, 2022 · 4 comments
Open

Define x/TokenFactory BeforeSend hook sentinel error #2570

dalmirel opened this issue Sep 1, 2022 · 4 comments
Assignees
Labels
informal-audit Informal Systems' audit output

Comments

@dalmirel
Copy link
Contributor

dalmirel commented Sep 1, 2022

The BeforeSend hook implementation returns an error gained from the smart contract execution and depends on the info provided with the SC implementation.

Artifacts:

  • osmosis/cosmos sdk fork at commit hash: 6fcd25f
  • Full Token Factory branch holding new features

Analysis summary:

_, err = h.wasmkeeper.Sudo(ctx.WithEventManager(em), cwAddr, msgBz)
fmt.Println(err)
if err != nil {
return err
}
}

Suggestion:
Token factory module should ensure that the error returned from the module holds a unique error code, that will explain what happened.

  • Define a sentinel error that will hold information about the denomination triggering the hook
  • and wrap the error returned from the smart contract as well, in order to get the information about the reason - if provided in the smart contract (blocked from/to account address; the contract is frozen,...).
@dalmirel dalmirel added the informal-audit Informal Systems' audit output label Sep 1, 2022
@osmo-bot osmo-bot moved this to Needs Review 🔍 in Osmosis Chain Development Sep 1, 2022
@dalmirel
Copy link
Contributor Author

dalmirel commented Sep 6, 2022

Tagging audit collaboration team, to review issues as agreed. @ValarDragon @sunnya97

@ValarDragon
Copy link
Member

Agreed, we should wrap these error types, and make more meaningful wrapping info to indicate this is the source

Nice point!

@alexanderbez alexanderbez self-assigned this Sep 19, 2022
@mattverse
Copy link
Member

hey @alexanderbez are you stabbing this rn? If not, I'd like to PR this change with the other audit items!

@mattverse mattverse self-assigned this Sep 26, 2022
@alexanderbez
Copy link
Contributor

alexanderbez commented Sep 28, 2022

hey @alexanderbez are you stabbing this rn? If not, I'd like to PR this change with the other audit items!

@mattverse go for it homie!

I'll be happy to review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
informal-audit Informal Systems' audit output
Projects
Status: Needs Triage 🔍
Development

No branches or pull requests

4 participants