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

fix(contracts): CosmWasm schema validation #227

Closed
2 tasks done
aelesbao opened this issue Sep 8, 2023 · 0 comments · Fixed by #252
Closed
2 tasks done

fix(contracts): CosmWasm schema validation #227

aelesbao opened this issue Sep 8, 2023 · 0 comments · Fixed by #252
Assignees
Labels
bug Something isn't working
Milestone

Comments

@aelesbao
Copy link
Member

aelesbao commented Sep 8, 2023

Description

During the deployment of a CW20 contract, the CLI failed to validate the schema of the Instantiate message because it contains an uint8 type, which is a primitive Rust numeric type and not supported by default on JSON Schema v7.

Since the JSON Schema generated by the schemars crate doesn't provide the format for those primitive types in the output file, the validation using ajv fails (as in this example).

Technical Description

The fixes for some of those primitive types were applied in #214, but we should find other types that the validation might fail and populate the custom formats in the SchemaValidator.

Tasks

  • Create a contract containing a message with:
    • All Rust primitive types
    • All possible CosmWasm types from cosmwasm-std
  • Generate the schemas and, in case of error, extend the SchemaValidator with the ajv validations.
@aelesbao aelesbao added this to the v2.0.0 milestone Sep 8, 2023
@aelesbao aelesbao added the bug Something isn't working label Oct 5, 2023
aelesbao pushed a commit that referenced this issue Oct 11, 2023
Deployed and tested messages with the following types:

- boolean
- u8
- u16
- u32
- u64
- i8
- i16
- i32
- i64
- char
- str
- tuple
- array
- Box
- Vec
- Option
- cosmwasm_std::Addr
- cosmwasm_std::CanonicalAddr
- cosmwasm_std::Coin
- cosmwasm_std::DecCoin
- cosmwasm_std::Decimal
- cosmwasm_std::Decimal256
- cosmwasm_std::DenomUnit
- cosmwasm_std::Empty
- cosmwasm_std::IbcChannel
- cosmwasm_std::IbcEndpoint
- cosmwasm_std::Int64
- cosmwasm_std::Int128
- cosmwasm_std::Int256
- cosmwasm_std::Int512
- cosmwasm_std::Timestamp
- cosmwasm_std::Uint64
- cosmwasm_std::Uint128
- cosmwasm_std::Uint256
- cosmwasm_std::Uint512
- cosmwasm_std::WeightedVoteOption

Closes #227
@aelesbao aelesbao linked a pull request Oct 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants