confio / cosmjs-types

JS and TS types relating to Protocol Buffers used by Cosmos-SDK and other related projects
Apache License 2.0
36 stars 42 forks source link

Granting multiple ContractExecutionAuthorization causes grants to be replaced. #60

Closed blushingchives closed 1 year ago

blushingchives commented 1 year ago

When granting ContractExecutionAuthorization to 2 different contract, the 2nd grant replaces the 1st one.

1st grant message:

authorization: {
                    typeUrl: '/cosmwasm.wasm.v1.ContractExecutionAuthorization',
                    value: ContractExecutionAuthorization.encode(ContractExecutionAuthorization.fromPartial({
                        grants: [{
                            contract: "contract1",
                            filter: {
                                typeUrl: '/cosmwasm.wasm.v1.AcceptedMessageKeysFilter',
                                value: AcceptedMessageKeysFilter.encode(AcceptedMessageKeysFilter.fromPartial({ keys: ["action"] })).finish()
                            },
                            limit: {
                                typeUrl: '/cosmwasm.wasm.v1.MaxFundsLimit',
                                value: MaxFundsLimit.encode(MaxFundsLimit.fromPartial({ amounts: [{ denom: "NOTOKEN", amount: "1" }] })).finish()
                            },
                        }]
                    }),).finish(),
                }

2nd grant message:

authorization: {
                    typeUrl: '/cosmwasm.wasm.v1.ContractExecutionAuthorization',
                    value: ContractExecutionAuthorization.encode(ContractExecutionAuthorization.fromPartial({
                        grants: [{
                            contract: "contract2",
                            filter: {
                                typeUrl: '/cosmwasm.wasm.v1.AcceptedMessageKeysFilter',
                                value: AcceptedMessageKeysFilter.encode(AcceptedMessageKeysFilter.fromPartial({ keys: ["action"] })).finish()
                            },
                            limit: {
                                typeUrl: '/cosmwasm.wasm.v1.MaxFundsLimit',
                                value: MaxFundsLimit.encode(MaxFundsLimit.fromPartial({ amounts: [{ denom: "NOTOKEN", amount: "1" }] })).finish()
                            },
                        }]
                    }),).finish(),
                }
webmaster128 commented 1 year ago

Do you mind opening a ticket in the wasm repo where this is implemented? Here we only do code generation for the types and don't control this sort of things.