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

[Bug]: Sending an Authz MsgExec with an invalid contract execution msg gets included in block #16685

Closed
javiersuweijie opened this issue Jun 26, 2023 · 2 comments
Labels

Comments

@javiersuweijie
Copy link
Contributor

Summary of Bug

Sending an Authz MsgExec with an invalid contract execution msg does not get invalidated and is included in a block.
E.g transaction

{
    "type_url": "/cosmos.authz.v1beta1.MsgExec",
    "value": "Cix0ZXJyYTE4OXZ0a2swczR6Z3htbjdsazZ1MGNuZng4czhlM2d4ZXh5NDJwMxKnAQokL2Nvc213YXNtLndhc20udjEuTXNnRXhlY3V0ZUNvbnRyYWN0En8KLHRlcnJhMTg5dnRrazBzNHpneG1uN2xrNnUwY25meDhzOGUzZ3hleHk0MnAzEkB0ZXJyYTF4bTB5aDhjdjhyd3c2Zzg3aDNxMG1lZ3Q2bnR4cXp3NnA2aGdoNWw0anJoZWQ0ZmU3aG5xOWN2em01Gg17IGNsYWltOiB7fSB9"
}

In the above message, the issue with the contract execution msg is that the JSON is missing the double quotes. Instead of sending {"claim": {}}, {claim: {}} was sent instead. This ended up on a block and causes the http server to fail when decoding the transaction. (gRPC works but http fails). The error message is:

{
  "code": 2,
  "message": "json: error calling MarshalJSON for type types.RawContractMessage: invalid character 'c' looking for beginning of object key string",
  "details": [
  ]
}

Version

v0.46.13

Steps to Reproduce

  1. Create a wasm smart contract with an ExecuteMsg e.g. Claim
  2. Grant an authorization with the following
{
  "expiration": "2023-07-09T16:41:00Z",
  "authorization": {
    "@type": "/cosmwasm.wasm.v1.ContractExecutionAuthorization",
    "grants": [
      {
        "limit": {
          "@type": "/cosmwasm.wasm.v1.MaxCallsLimit",
          "remaining": "3"
        },
        "filter": {
          "keys": [
            "claim"
          ],
          "@type": "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter"
        },
        "contract": "contract"
      }
    ]
  }
  1. Build, sign and broadcast a transaction using gRPC and set contract execute msg to be encode the following into bytes {claim:{}}
@javiersuweijie
Copy link
Contributor Author

On closer inspection, could be an issue specific to our codebase. Will be checking first before re-opening this.

@javiersuweijie javiersuweijie closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2023
@javiersuweijie
Copy link
Contributor Author

Fixed by #12184

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

No branches or pull requests

1 participant