From 9224bc96bcb48825ef9d25dbc52fa0d6662b89c1 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Tue, 11 Oct 2022 22:16:51 -0700 Subject: [PATCH 1/4] [acl] Refactor aclkeeper to use wasm contract address --- x/accesscontrol/keeper/keeper.go | 21 ++++----------------- x/accesscontrol/keeper/keeper_test.go | 8 ++++---- x/accesscontrol/types/keys.go | 19 ++++++++----------- 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/x/accesscontrol/keeper/keeper.go b/x/accesscontrol/keeper/keeper.go index 9a3041779..3822b2d4a 100644 --- a/x/accesscontrol/keeper/keeper.go +++ b/x/accesscontrol/keeper/keeper.go @@ -112,9 +112,9 @@ func (k Keeper) SetDependencyMappingDynamicFlag(ctx sdk.Context, messageKey type return k.SetResourceDependencyMapping(ctx, dependencyMapping) } -func (k Keeper) GetWasmFunctionDependencyMapping(ctx sdk.Context, codeID uint64, wasmFunction string) (acltypes.WasmFunctionDependencyMapping, error) { +func (k Keeper) GetWasmFunctionDependencyMapping(ctx sdk.Context, contractAddress sdk.AccAddress, wasmFunction string) (acltypes.WasmFunctionDependencyMapping, error) { store := ctx.KVStore(k.storeKey) - b := store.Get(types.GetWasmFunctionDependencyKey(codeID, wasmFunction)) + b := store.Get(types.GetWasmFunctionDependencyKey(contractAddress, wasmFunction)) if b == nil { return acltypes.WasmFunctionDependencyMapping{}, ErrWasmFunctionDependencyMappingNotFound } @@ -125,7 +125,7 @@ func (k Keeper) GetWasmFunctionDependencyMapping(ctx sdk.Context, codeID uint64, func (k Keeper) SetWasmFunctionDependencyMapping( ctx sdk.Context, - codeID uint64, + contractAddress sdk.AccAddress, dependencyMapping acltypes.WasmFunctionDependencyMapping, ) error { err := types.ValidateWasmFunctionDependencyMapping(dependencyMapping) @@ -134,24 +134,11 @@ func (k Keeper) SetWasmFunctionDependencyMapping( } store := ctx.KVStore(k.storeKey) b := k.cdc.MustMarshal(&dependencyMapping) - resourceKey := types.GetWasmFunctionDependencyKey(codeID, dependencyMapping.WasmFunction) + resourceKey := types.GetWasmFunctionDependencyKey(contractAddress, dependencyMapping.WasmFunction) store.Set(resourceKey, b) return nil } -func (k Keeper) IterateWasmDependenciesForCodeID(ctx sdk.Context, codeID uint64, handler func(wasmDependencyMapping acltypes.WasmFunctionDependencyMapping) (stop bool)) { - store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.GetKeyForCodeID(codeID)) - defer iter.Close() - for ; iter.Valid(); iter.Next() { - dependencyMapping := acltypes.WasmFunctionDependencyMapping{} - k.cdc.MustUnmarshal(iter.Value(), &dependencyMapping) - if handler(dependencyMapping) { - break - } - } -} - func (k Keeper) IterateWasmDependencies(ctx sdk.Context, handler func(wasmDependencyMapping acltypes.WasmFunctionDependencyMapping) (stop bool)) { store := ctx.KVStore(k.storeKey) iter := sdk.KVStorePrefixIterator(store, types.GetWasmMappingKey()) diff --git a/x/accesscontrol/keeper/keeper_test.go b/x/accesscontrol/keeper/keeper_test.go index 7697bb712..558a4a644 100644 --- a/x/accesscontrol/keeper/keeper_test.go +++ b/x/accesscontrol/keeper/keeper_test.go @@ -91,7 +91,7 @@ func TestWasmFunctionDependencyMapping(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - wasmCodeID := uint64(1) + wasmContractAddress := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(30000000))[0] wasmFunction := "execute_wasm_testfunction" wasmMapping := acltypes.WasmFunctionDependencyMapping{ WasmFunction: wasmFunction, @@ -102,14 +102,14 @@ func TestWasmFunctionDependencyMapping(t *testing.T) { }, } // set the dependency mapping - err := app.AccessControlKeeper.SetWasmFunctionDependencyMapping(ctx, wasmCodeID, wasmMapping) + err := app.AccessControlKeeper.SetWasmFunctionDependencyMapping(ctx, wasmContractAddress, wasmMapping) require.NoError(t, err) // test getting the dependency mapping - mapping, err := app.AccessControlKeeper.GetWasmFunctionDependencyMapping(ctx, wasmCodeID, wasmFunction) + mapping, err := app.AccessControlKeeper.GetWasmFunctionDependencyMapping(ctx, wasmContractAddress, wasmFunction) require.NoError(t, err) require.Equal(t, wasmMapping, mapping) // test getting a dependency mapping for something function that isn't present - _, err = app.AccessControlKeeper.GetWasmFunctionDependencyMapping(ctx, wasmCodeID, "some_other_function") + _, err = app.AccessControlKeeper.GetWasmFunctionDependencyMapping(ctx, wasmContractAddress, "some_other_function") require.Error(t, aclkeeper.ErrWasmFunctionDependencyMappingNotFound, err) } diff --git a/x/accesscontrol/types/keys.go b/x/accesscontrol/types/keys.go index 029b9fad6..7f2fdb088 100644 --- a/x/accesscontrol/types/keys.go +++ b/x/accesscontrol/types/keys.go @@ -1,6 +1,9 @@ package types -import "encoding/binary" +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" +) // ResourceDependencyMappingKey is the key used for the keeper store var ( @@ -32,17 +35,11 @@ func GetWasmMappingKey() []byte { return []byte{byte(WasmMappingKey)} } -func GetKeyForCodeID(codeID uint64) []byte { - key := make([]byte, 8) - binary.BigEndian.PutUint64(key, codeID) - return key -} - -func GetWasmCodeIDPrefix(codeID uint64) []byte { - return append(GetWasmMappingKey(), GetKeyForCodeID(codeID)...) +func GetWasmContractAddressPrefix(contractAddress sdk.AccAddress) []byte { + return append(GetWasmMappingKey(), address.MustLengthPrefix(contractAddress)...) } // wasmFunctionName is the top level object key in the execute JSON payload -func GetWasmFunctionDependencyKey(codeID uint64, wasmFunctionName string) []byte { - return append(GetWasmCodeIDPrefix(codeID), []byte(wasmFunctionName)...) +func GetWasmFunctionDependencyKey(contractAddress sdk.AccAddress, wasmFunctionName string) []byte { + return append(GetWasmContractAddressPrefix(contractAddress), []byte(wasmFunctionName)...) } From 59a1bb7bf85a6cf57258f7d2295170e2390b9fda Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Wed, 12 Oct 2022 11:59:39 -0700 Subject: [PATCH 2/4] [acl] refactor to remove wasm function from contract dep mapping --- .../cosmos/accesscontrol/accesscontrol.proto | 7 +- proto/cosmos/accesscontrol_x/genesis.proto | 4 +- proto/cosmos/accesscontrol_x/query.proto | 31 +- types/accesscontrol/accesscontrol.pb.go | 163 +++---- types/accesscontrol/resource.go | 42 +- x/accesscontrol/keeper/genesis.go | 10 +- x/accesscontrol/keeper/grpc_query.go | 18 +- x/accesscontrol/keeper/keeper.go | 22 +- x/accesscontrol/keeper/keeper_test.go | 20 +- x/accesscontrol/types/genesis.go | 18 +- x/accesscontrol/types/genesis.pb.go | 71 ++- x/accesscontrol/types/keys.go | 7 +- .../types/message_dependency_mapping.go | 6 +- x/accesscontrol/types/query.pb.go | 435 ++++++++---------- x/accesscontrol/types/query.pb.gw.go | 94 ++-- 15 files changed, 417 insertions(+), 531 deletions(-) diff --git a/proto/cosmos/accesscontrol/accesscontrol.proto b/proto/cosmos/accesscontrol/accesscontrol.proto index 219f777a8..299aa2356 100644 --- a/proto/cosmos/accesscontrol/accesscontrol.proto +++ b/proto/cosmos/accesscontrol/accesscontrol.proto @@ -20,10 +20,9 @@ message MessageDependencyMapping { bool dynamic_enabled = 3; } -message WasmFunctionDependencyMapping { - string wasm_function = 1; - bool enabled = 2; - repeated AccessOperation access_ops = 3 [ +message WasmDependencyMapping { + bool enabled = 1; + repeated AccessOperation access_ops = 2 [ (gogoproto.nullable) = false ]; } \ No newline at end of file diff --git a/proto/cosmos/accesscontrol_x/genesis.proto b/proto/cosmos/accesscontrol_x/genesis.proto index c2e8095f1..ecb9270b3 100644 --- a/proto/cosmos/accesscontrol_x/genesis.proto +++ b/proto/cosmos/accesscontrol_x/genesis.proto @@ -15,9 +15,9 @@ message GenesisState { (gogoproto.moretags) = "yaml:\"message_dependency_mapping\"" ]; - repeated cosmos.accesscontrol.v1beta1.WasmFunctionDependencyMapping wasm_function_dependency_mappings = 3 [ + repeated cosmos.accesscontrol.v1beta1.WasmDependencyMapping wasm_dependency_mappings = 3 [ (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"wasm_function_dependency_mappings\"" + (gogoproto.moretags) = "yaml:\"wasm_dependency_mappings\"" ]; } diff --git a/proto/cosmos/accesscontrol_x/query.proto b/proto/cosmos/accesscontrol_x/query.proto index bb9992230..3c6dc669f 100644 --- a/proto/cosmos/accesscontrol_x/query.proto +++ b/proto/cosmos/accesscontrol_x/query.proto @@ -27,16 +27,16 @@ service Query { "/cosmos/cosmos-sdk/accesscontrol/list_resource_dependency_mapping"; } - rpc WasmFunctionDependencyMapping(WasmFunctionDependencyMappingRequest) - returns (WasmFunctionDependencyMappingResponse) { + rpc WasmDependencyMapping(WasmDependencyMappingRequest) + returns (WasmDependencyMappingResponse) { option (google.api.http).get = - "/cosmos/cosmos-sdk/accesscontrol/wasm_function_dependency_mapping/{code_id}/{wasm_function}"; + "/cosmos/cosmos-sdk/accesscontrol/wasm_dependency_mapping/{contract_address}"; } - rpc ListWasmFunctionDependencyMapping(ListWasmFunctionDependencyMappingRequest) - returns (ListWasmFunctionDependencyMappingResponse) { + rpc ListWasmDependencyMapping(ListWasmDependencyMappingRequest) + returns (ListWasmDependencyMappingResponse) { option (google.api.http).get = - "/cosmos/cosmos-sdk/accesscontrol/list_wasm_function_dependency_mapping"; + "/cosmos/cosmos-sdk/accesscontrol/list_wasm_dependency_mapping"; } } @@ -60,15 +60,14 @@ message ResourceDependencyMappingFromMessageKeyResponse { ]; } -message WasmFunctionDependencyMappingRequest { - uint64 code_id = 1 [ (gogoproto.moretags) = "yaml:\"code_id\"" ]; - string wasm_function = 2 [ (gogoproto.moretags) = "yaml:\"wasm_function\"" ]; +message WasmDependencyMappingRequest { + string contract_address = 1 [ (gogoproto.moretags) = "yaml:\"contract_address\"" ]; } -message WasmFunctionDependencyMappingResponse { - cosmos.accesscontrol.v1beta1.WasmFunctionDependencyMapping wasm_function_dependency_mapping = 1 [ +message WasmDependencyMappingResponse { + cosmos.accesscontrol.v1beta1.WasmDependencyMapping wasm_dependency_mapping = 1 [ (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"wasm_function_dependency_mapping\"" + (gogoproto.moretags) = "yaml:\"wasm_dependency_mapping\"" ]; } @@ -82,11 +81,11 @@ message ListResourceDependencyMappingResponse { ]; } -message ListWasmFunctionDependencyMappingRequest {} +message ListWasmDependencyMappingRequest {} -message ListWasmFunctionDependencyMappingResponse { - repeated cosmos.accesscontrol.v1beta1.WasmFunctionDependencyMapping wasm_function_dependency_mapping_list = 1 [ +message ListWasmDependencyMappingResponse { + repeated cosmos.accesscontrol.v1beta1.WasmDependencyMapping wasm_dependency_mapping_list = 1 [ (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"wasm_function_dependency_mapping_list\"" + (gogoproto.moretags) = "yaml:\"wasm_dependency_mapping_list\"" ]; } diff --git a/types/accesscontrol/accesscontrol.pb.go b/types/accesscontrol/accesscontrol.pb.go index 7128bc756..64d5f3c49 100644 --- a/types/accesscontrol/accesscontrol.pb.go +++ b/types/accesscontrol/accesscontrol.pb.go @@ -143,24 +143,23 @@ func (m *MessageDependencyMapping) GetDynamicEnabled() bool { return false } -type WasmFunctionDependencyMapping struct { - WasmFunction string `protobuf:"bytes,1,opt,name=wasm_function,json=wasmFunction,proto3" json:"wasm_function,omitempty"` - Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` - AccessOps []AccessOperation `protobuf:"bytes,3,rep,name=access_ops,json=accessOps,proto3" json:"access_ops"` +type WasmDependencyMapping struct { + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + AccessOps []AccessOperation `protobuf:"bytes,2,rep,name=access_ops,json=accessOps,proto3" json:"access_ops"` } -func (m *WasmFunctionDependencyMapping) Reset() { *m = WasmFunctionDependencyMapping{} } -func (m *WasmFunctionDependencyMapping) String() string { return proto.CompactTextString(m) } -func (*WasmFunctionDependencyMapping) ProtoMessage() {} -func (*WasmFunctionDependencyMapping) Descriptor() ([]byte, []int) { +func (m *WasmDependencyMapping) Reset() { *m = WasmDependencyMapping{} } +func (m *WasmDependencyMapping) String() string { return proto.CompactTextString(m) } +func (*WasmDependencyMapping) ProtoMessage() {} +func (*WasmDependencyMapping) Descriptor() ([]byte, []int) { return fileDescriptor_d636a082612ba091, []int{2} } -func (m *WasmFunctionDependencyMapping) XXX_Unmarshal(b []byte) error { +func (m *WasmDependencyMapping) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *WasmFunctionDependencyMapping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *WasmDependencyMapping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_WasmFunctionDependencyMapping.Marshal(b, m, deterministic) + return xxx_messageInfo_WasmDependencyMapping.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -170,33 +169,26 @@ func (m *WasmFunctionDependencyMapping) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *WasmFunctionDependencyMapping) XXX_Merge(src proto.Message) { - xxx_messageInfo_WasmFunctionDependencyMapping.Merge(m, src) +func (m *WasmDependencyMapping) XXX_Merge(src proto.Message) { + xxx_messageInfo_WasmDependencyMapping.Merge(m, src) } -func (m *WasmFunctionDependencyMapping) XXX_Size() int { +func (m *WasmDependencyMapping) XXX_Size() int { return m.Size() } -func (m *WasmFunctionDependencyMapping) XXX_DiscardUnknown() { - xxx_messageInfo_WasmFunctionDependencyMapping.DiscardUnknown(m) +func (m *WasmDependencyMapping) XXX_DiscardUnknown() { + xxx_messageInfo_WasmDependencyMapping.DiscardUnknown(m) } -var xxx_messageInfo_WasmFunctionDependencyMapping proto.InternalMessageInfo +var xxx_messageInfo_WasmDependencyMapping proto.InternalMessageInfo -func (m *WasmFunctionDependencyMapping) GetWasmFunction() string { - if m != nil { - return m.WasmFunction - } - return "" -} - -func (m *WasmFunctionDependencyMapping) GetEnabled() bool { +func (m *WasmDependencyMapping) GetEnabled() bool { if m != nil { return m.Enabled } return false } -func (m *WasmFunctionDependencyMapping) GetAccessOps() []AccessOperation { +func (m *WasmDependencyMapping) GetAccessOps() []AccessOperation { if m != nil { return m.AccessOps } @@ -206,7 +198,7 @@ func (m *WasmFunctionDependencyMapping) GetAccessOps() []AccessOperation { func init() { proto.RegisterType((*AccessOperation)(nil), "cosmos.accesscontrol.v1beta1.AccessOperation") proto.RegisterType((*MessageDependencyMapping)(nil), "cosmos.accesscontrol.v1beta1.MessageDependencyMapping") - proto.RegisterType((*WasmFunctionDependencyMapping)(nil), "cosmos.accesscontrol.v1beta1.WasmFunctionDependencyMapping") + proto.RegisterType((*WasmDependencyMapping)(nil), "cosmos.accesscontrol.v1beta1.WasmDependencyMapping") } func init() { @@ -214,34 +206,32 @@ func init() { } var fileDescriptor_d636a082612ba091 = []byte{ - // 424 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0xdd, 0x8a, 0x13, 0x31, - 0x14, 0x9e, 0xb4, 0xa2, 0x36, 0xdd, 0x1f, 0x88, 0x5e, 0x0c, 0x8b, 0xce, 0x96, 0x2a, 0x38, 0x08, - 0x3b, 0xe3, 0xae, 0x4f, 0xe0, 0xa2, 0x82, 0xca, 0xb2, 0x30, 0x2c, 0x08, 0xde, 0x0c, 0x99, 0xcc, - 0xd9, 0x71, 0x68, 0x27, 0x09, 0x93, 0xd4, 0x32, 0x6f, 0xe1, 0xb3, 0x78, 0xe5, 0x23, 0xf4, 0xb2, - 0x97, 0x5e, 0x15, 0x69, 0x5f, 0x44, 0x9a, 0xa4, 0xb5, 0xad, 0x52, 0xbc, 0xf0, 0x2a, 0x39, 0xe7, - 0x7c, 0xdf, 0x97, 0xf3, 0x85, 0x0f, 0x87, 0x4c, 0xa8, 0x4a, 0xa8, 0x98, 0x32, 0x06, 0x4a, 0x31, - 0xc1, 0x75, 0x2d, 0x86, 0xdb, 0x55, 0x24, 0x6b, 0xa1, 0x05, 0x79, 0x64, 0x91, 0xd1, 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d, 0x45, 0x9e, 0xe1, 0xe3, 0xbc, 0xe1, 0xb4, 0x2a, 0x59, 0x0a, 0x9c, - 0x66, 0x43, 0xc8, 0xcd, 0xfa, 0xf7, 0x93, 0x23, 0xd7, 0x7e, 0x63, 0xbb, 0xfd, 0x6f, 0x08, 0x3f, - 0xfe, 0x48, 0x55, 0xf5, 0x76, 0xc4, 0xd9, 0x52, 0xea, 0xcf, 0xfd, 0x9f, 0xe0, 0xc3, 0x31, 0x55, - 0x55, 0x7a, 0xeb, 0x10, 0xce, 0xc1, 0xc1, 0x78, 0x83, 0x45, 0x7c, 0x7c, 0x6f, 0xf5, 0x4e, 0xcb, - 0xbc, 0xb3, 0x2a, 0x77, 0xdc, 0xb5, 0xff, 0x87, 0xbb, 0xcb, 0xf7, 0x93, 0x79, 0x80, 0xa6, 0xf3, - 0x00, 0xfd, 0x9c, 0x07, 0xe8, 0xeb, 0x22, 0xf0, 0xa6, 0x8b, 0xc0, 0xfb, 0xb1, 0x08, 0xbc, 0x4f, - 0x2f, 0x8a, 0x52, 0x7f, 0x1e, 0x65, 0x11, 0x13, 0x55, 0xec, 0xb2, 0x69, 0x8f, 0x33, 0x95, 0x0f, - 0xe2, 0x65, 0x3a, 0x76, 0xc2, 0x9a, 0xdd, 0x35, 0x19, 0x7d, 0xf9, 0x2b, 0x00, 0x00, 0xff, 0xff, - 0xf2, 0xdc, 0x22, 0xf3, 0x29, 0x03, 0x00, 0x00, + // 394 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x52, 0xcf, 0xea, 0xd3, 0x30, + 0x1c, 0x6f, 0x36, 0x51, 0x97, 0xe9, 0x06, 0x51, 0xa1, 0x0c, 0xe9, 0xc6, 0x10, 0x2c, 0xc2, 0x5a, + 0x37, 0x9f, 0xc0, 0xa1, 0x07, 0x95, 0x31, 0x28, 0x03, 0xc1, 0x4b, 0x49, 0xd3, 0xaf, 0x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xcd, 0xe0, 0x15, 0x48, 0xe0, 0x29, 0x70, 0x56, 0xcd, 0xa8, 0x94, + 0x39, 0xcf, 0x48, 0x1f, 0xb7, 0x0b, 0xcb, 0xc5, 0x4b, 0xa8, 0xcc, 0x4d, 0x5b, 0x11, 0xae, 0xa1, + 0x77, 0x50, 0x91, 0x08, 0xd7, 0xb7, 0x89, 0x85, 0x54, 0x6e, 0x63, 0xd0, 0xf4, 0xdb, 0x93, 0xd1, + 0xff, 0xbc, 0xc4, 0xf9, 0x35, 0xa7, 0xb7, 0x36, 0xbb, 0xbe, 0x13, 0xb5, 0x68, 0x0d, 0x2b, 0xf2, + 0x14, 0x77, 0xd3, 0x8a, 0xd3, 0x22, 0x67, 0x31, 0x70, 0x9a, 0xac, 0x20, 0x35, 0xf5, 0xef, 0x46, + 0x9d, 0x1a, 0x7e, 0x6d, 0xd1, 0xe1, 0x17, 0x84, 0x1f, 0xbd, 0xa7, 0xaa, 0xf8, 0xbb, 0xb7, 0x8b, + 0xef, 0x9c, 0xac, 0xc8, 0x58, 0x4f, 0xe3, 0x4d, 0x14, 0x9e, 0xbe, 0xdd, 0xec, 0x3d, 0xb4, 0xdd, + 0x7b, 0xe8, 0xc7, 0xde, 0x43, 0x5f, 0x0f, 0x9e, 0xb3, 0x3d, 0x78, 0xce, 0xf7, 0x83, 0xe7, 0x7c, + 0x78, 0x9e, 0xe5, 0xfa, 0xd3, 0x3a, 0x09, 0x98, 0x28, 0xc2, 0x7a, 0xdd, 0xec, 0x67, 0xa4, 0xd2, + 0x65, 0x78, 0xfc, 0xe1, 0x7f, 0xec, 0x5f, 0x72, 0xdb, 0xac, 0xdd, 0x8b, 0x9f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x6f, 0xc2, 0xe2, 0x58, 0xfc, 0x02, 0x00, 0x00, } func (m *AccessOperation) Marshal() (dAtA []byte, err error) { @@ -338,7 +328,7 @@ func (m *MessageDependencyMapping) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *WasmFunctionDependencyMapping) Marshal() (dAtA []byte, err error) { +func (m *WasmDependencyMapping) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -348,12 +338,12 @@ func (m *WasmFunctionDependencyMapping) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *WasmFunctionDependencyMapping) MarshalTo(dAtA []byte) (int, error) { +func (m *WasmDependencyMapping) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *WasmFunctionDependencyMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *WasmDependencyMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -369,7 +359,7 @@ func (m *WasmFunctionDependencyMapping) MarshalToSizedBuffer(dAtA []byte) (int, i = encodeVarintAccesscontrol(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } } if m.Enabled { @@ -380,14 +370,7 @@ func (m *WasmFunctionDependencyMapping) MarshalToSizedBuffer(dAtA []byte) (int, dAtA[i] = 0 } i-- - dAtA[i] = 0x10 - } - if len(m.WasmFunction) > 0 { - i -= len(m.WasmFunction) - copy(dAtA[i:], m.WasmFunction) - i = encodeVarintAccesscontrol(dAtA, i, uint64(len(m.WasmFunction))) - i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -444,16 +427,12 @@ func (m *MessageDependencyMapping) Size() (n int) { return n } -func (m *WasmFunctionDependencyMapping) Size() (n int) { +func (m *WasmDependencyMapping) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.WasmFunction) - if l > 0 { - n += 1 + l + sovAccesscontrol(uint64(l)) - } if m.Enabled { n += 2 } @@ -728,7 +707,7 @@ func (m *MessageDependencyMapping) Unmarshal(dAtA []byte) error { } return nil } -func (m *WasmFunctionDependencyMapping) Unmarshal(dAtA []byte) error { +func (m *WasmDependencyMapping) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -751,45 +730,13 @@ func (m *WasmFunctionDependencyMapping) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: WasmFunctionDependencyMapping: wiretype end group for non-group") + return fmt.Errorf("proto: WasmDependencyMapping: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: WasmFunctionDependencyMapping: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: WasmDependencyMapping: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WasmFunction", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAccesscontrol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAccesscontrol - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAccesscontrol - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.WasmFunction = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) } @@ -809,7 +756,7 @@ func (m *WasmFunctionDependencyMapping) Unmarshal(dAtA []byte) error { } } m.Enabled = bool(v != 0) - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AccessOps", wireType) } diff --git a/types/accesscontrol/resource.go b/types/accesscontrol/resource.go index 3e43bfe03..5e60c688a 100644 --- a/types/accesscontrol/resource.go +++ b/types/accesscontrol/resource.go @@ -5,37 +5,45 @@ type TreeNode struct { Children []ResourceType } +var ResourceTree = map[ResourceType]TreeNode{ + ResourceType_ANY: {ResourceType_ANY, []ResourceType{ResourceType_KV, ResourceType_Mem}}, + ResourceType_KV: {ResourceType_ANY, []ResourceType{}}, + ResourceType_Mem: {ResourceType_ANY, []ResourceType{ResourceType_DexMem}}, + ResourceType_DexMem: {ResourceType_Mem, []ResourceType{}}, +} + // This returns a slice of all resource types that are dependent to a specific resource type // Travel up the parents to add them all, and add all children as well. // TODO: alternatively, hardcode all dependencies (parent and children) for a specific resource type, so we don't need to do a traversal when building dag func (r ResourceType) GetResourceDependencies() []ResourceType { // resource is its own dependency - resources := []ResourceType{r} - resourceTree := map[ResourceType]TreeNode{ - ResourceType_ANY: {ResourceType_ANY, []ResourceType{ResourceType_KV, ResourceType_Mem}}, - ResourceType_KV: {ResourceType_ANY, []ResourceType{}}, - ResourceType_Mem: {ResourceType_ANY, []ResourceType{ResourceType_DexMem}}, - ResourceType_DexMem: {ResourceType_Mem, []ResourceType{}}, - } - // traverse up the parents chain - currResource := r - for currResource != ResourceType_ANY { - parentResource := resourceTree[currResource].Parent - // add parent resource - resources = append(resources, parentResource) - currResource = parentResource - } + resources := r.GetParentResources() // traverse children - queue := resourceTree[r].Children + queue := ResourceTree[r].Children for len(queue) > 0 { curr := queue[0] queue = queue[1:] // add child to resource deps resources = append(resources, curr) // also need to traverse nested children - queue = append(queue, resourceTree[curr].Children...) + queue = append(queue, ResourceTree[curr].Children...) } return resources } + +func (r ResourceType) GetParentResources() []ResourceType { + parentResources := []ResourceType{r} + + // traverse up the parents chain + currResource := r + for currResource != ResourceType_ANY { + parentResource := ResourceTree[currResource].Parent + // add parent resource + parentResources = append(parentResources, parentResource) + currResource = parentResource + } + + return parentResources +} diff --git a/x/accesscontrol/keeper/genesis.go b/x/accesscontrol/keeper/genesis.go index 19734e48f..17eae8567 100644 --- a/x/accesscontrol/keeper/genesis.go +++ b/x/accesscontrol/keeper/genesis.go @@ -19,14 +19,14 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { resourceDependencyMappings = append(resourceDependencyMappings, dependencyMapping) return false }) - wasmDependencyMappings := []acltypes.WasmFunctionDependencyMapping{} - k.IterateWasmDependencies(ctx, func(dependencyMapping acltypes.WasmFunctionDependencyMapping) (stop bool) { + wasmDependencyMappings := []acltypes.WasmDependencyMapping{} + k.IterateWasmDependencies(ctx, func(dependencyMapping acltypes.WasmDependencyMapping) (stop bool) { wasmDependencyMappings = append(wasmDependencyMappings, dependencyMapping) return false }) return &types.GenesisState{ - Params: k.GetParams(ctx), - MessageDependencyMapping: resourceDependencyMappings, - WasmFunctionDependencyMappings: wasmDependencyMappings, + Params: k.GetParams(ctx), + MessageDependencyMapping: resourceDependencyMappings, + WasmDependencyMappings: wasmDependencyMappings, } } diff --git a/x/accesscontrol/keeper/grpc_query.go b/x/accesscontrol/keeper/grpc_query.go index 47d9ace83..d292858f6 100644 --- a/x/accesscontrol/keeper/grpc_query.go +++ b/x/accesscontrol/keeper/grpc_query.go @@ -24,14 +24,18 @@ func (k Keeper) ResourceDependencyMappingFromMessageKey(ctx context.Context, req return &types.ResourceDependencyMappingFromMessageKeyResponse{MessageDependencyMapping: resourceDependency}, nil } -func (k Keeper) WasmFunctionDependencyMapping(ctx context.Context, req *types.WasmFunctionDependencyMappingRequest) (*types.WasmFunctionDependencyMappingResponse, error) { +func (k Keeper) WasmDependencyMapping(ctx context.Context, req *types.WasmDependencyMappingRequest) (*types.WasmDependencyMappingResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - wasmDependency, err := k.GetWasmFunctionDependencyMapping(sdkCtx, req.CodeId, req.WasmFunction) + address, err := sdk.AccAddressFromBech32(req.ContractAddress) if err != nil { return nil, err } - return &types.WasmFunctionDependencyMappingResponse{WasmFunctionDependencyMapping: wasmDependency}, nil + wasmDependency, err := k.GetWasmDependencyMapping(sdkCtx, address) + if err != nil { + return nil, err + } + return &types.WasmDependencyMappingResponse{WasmDependencyMapping: wasmDependency}, nil } func (k Keeper) ListResourceDependencyMapping(ctx context.Context, req *types.ListResourceDependencyMappingRequest) (*types.ListResourceDependencyMappingResponse, error) { @@ -45,13 +49,13 @@ func (k Keeper) ListResourceDependencyMapping(ctx context.Context, req *types.Li return &types.ListResourceDependencyMappingResponse{MessageDependencyMappingList: resourceDependencyMappings}, nil } -func (k Keeper) ListWasmFunctionDependencyMapping(ctx context.Context, req *types.ListWasmFunctionDependencyMappingRequest) (*types.ListWasmFunctionDependencyMappingResponse, error) { +func (k Keeper) ListWasmDependencyMapping(ctx context.Context, req *types.ListWasmDependencyMappingRequest) (*types.ListWasmDependencyMappingResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - wasmDependencyMappings := []acltypes.WasmFunctionDependencyMapping{} - k.IterateWasmDependencies(sdkCtx, func(dependencyMapping acltypes.WasmFunctionDependencyMapping) (stop bool) { + wasmDependencyMappings := []acltypes.WasmDependencyMapping{} + k.IterateWasmDependencies(sdkCtx, func(dependencyMapping acltypes.WasmDependencyMapping) (stop bool) { wasmDependencyMappings = append(wasmDependencyMappings, dependencyMapping) return false }) - return &types.ListWasmFunctionDependencyMappingResponse{WasmFunctionDependencyMappingList: wasmDependencyMappings}, nil + return &types.ListWasmDependencyMappingResponse{WasmDependencyMappingList: wasmDependencyMappings}, nil } diff --git a/x/accesscontrol/keeper/keeper.go b/x/accesscontrol/keeper/keeper.go index 3822b2d4a..476c77070 100644 --- a/x/accesscontrol/keeper/keeper.go +++ b/x/accesscontrol/keeper/keeper.go @@ -35,7 +35,7 @@ type ( } ) -var ErrWasmFunctionDependencyMappingNotFound = fmt.Errorf("wasm function dependency mapping not found") +var ErrWasmDependencyMappingNotFound = fmt.Errorf("wasm dependency mapping not found") func NewKeeper( cdc codec.Codec, @@ -112,39 +112,39 @@ func (k Keeper) SetDependencyMappingDynamicFlag(ctx sdk.Context, messageKey type return k.SetResourceDependencyMapping(ctx, dependencyMapping) } -func (k Keeper) GetWasmFunctionDependencyMapping(ctx sdk.Context, contractAddress sdk.AccAddress, wasmFunction string) (acltypes.WasmFunctionDependencyMapping, error) { +func (k Keeper) GetWasmDependencyMapping(ctx sdk.Context, contractAddress sdk.AccAddress) (acltypes.WasmDependencyMapping, error) { store := ctx.KVStore(k.storeKey) - b := store.Get(types.GetWasmFunctionDependencyKey(contractAddress, wasmFunction)) + b := store.Get(types.GetWasmContractAddressKey(contractAddress)) if b == nil { - return acltypes.WasmFunctionDependencyMapping{}, ErrWasmFunctionDependencyMappingNotFound + return acltypes.WasmDependencyMapping{}, ErrWasmDependencyMappingNotFound } - dependencyMapping := acltypes.WasmFunctionDependencyMapping{} + dependencyMapping := acltypes.WasmDependencyMapping{} k.cdc.MustUnmarshal(b, &dependencyMapping) return dependencyMapping, nil } -func (k Keeper) SetWasmFunctionDependencyMapping( +func (k Keeper) SetWasmDependencyMapping( ctx sdk.Context, contractAddress sdk.AccAddress, - dependencyMapping acltypes.WasmFunctionDependencyMapping, + dependencyMapping acltypes.WasmDependencyMapping, ) error { - err := types.ValidateWasmFunctionDependencyMapping(dependencyMapping) + err := types.ValidateWasmDependencyMapping(dependencyMapping) if err != nil { return err } store := ctx.KVStore(k.storeKey) b := k.cdc.MustMarshal(&dependencyMapping) - resourceKey := types.GetWasmFunctionDependencyKey(contractAddress, dependencyMapping.WasmFunction) + resourceKey := types.GetWasmContractAddressKey(contractAddress) store.Set(resourceKey, b) return nil } -func (k Keeper) IterateWasmDependencies(ctx sdk.Context, handler func(wasmDependencyMapping acltypes.WasmFunctionDependencyMapping) (stop bool)) { +func (k Keeper) IterateWasmDependencies(ctx sdk.Context, handler func(wasmDependencyMapping acltypes.WasmDependencyMapping) (stop bool)) { store := ctx.KVStore(k.storeKey) iter := sdk.KVStorePrefixIterator(store, types.GetWasmMappingKey()) defer iter.Close() for ; iter.Valid(); iter.Next() { - dependencyMapping := acltypes.WasmFunctionDependencyMapping{} + dependencyMapping := acltypes.WasmDependencyMapping{} k.cdc.MustUnmarshal(iter.Value(), &dependencyMapping) if handler(dependencyMapping) { break diff --git a/x/accesscontrol/keeper/keeper_test.go b/x/accesscontrol/keeper/keeper_test.go index 558a4a644..9cbe3ef3c 100644 --- a/x/accesscontrol/keeper/keeper_test.go +++ b/x/accesscontrol/keeper/keeper_test.go @@ -87,30 +87,30 @@ func TestResourceDependencyMapping(t *testing.T) { require.Equal(t, 1, counter) } -func TestWasmFunctionDependencyMapping(t *testing.T) { +func TestWasmDependencyMapping(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - wasmContractAddress := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(30000000))[0] - wasmFunction := "execute_wasm_testfunction" - wasmMapping := acltypes.WasmFunctionDependencyMapping{ - WasmFunction: wasmFunction, - Enabled: true, + wasmContractAddresses := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.NewInt(30000000)) + wasmContractAddress := wasmContractAddresses[0] + otherContractAddress := wasmContractAddresses[1] + wasmMapping := acltypes.WasmDependencyMapping{ + Enabled: true, AccessOps: []acltypes.AccessOperation{ {ResourceType: acltypes.ResourceType_KV, AccessType: acltypes.AccessType_WRITE, IdentifierTemplate: "someResource"}, types.CommitAccessOp(), }, } // set the dependency mapping - err := app.AccessControlKeeper.SetWasmFunctionDependencyMapping(ctx, wasmContractAddress, wasmMapping) + err := app.AccessControlKeeper.SetWasmDependencyMapping(ctx, wasmContractAddress, wasmMapping) require.NoError(t, err) // test getting the dependency mapping - mapping, err := app.AccessControlKeeper.GetWasmFunctionDependencyMapping(ctx, wasmContractAddress, wasmFunction) + mapping, err := app.AccessControlKeeper.GetWasmDependencyMapping(ctx, wasmContractAddress) require.NoError(t, err) require.Equal(t, wasmMapping, mapping) // test getting a dependency mapping for something function that isn't present - _, err = app.AccessControlKeeper.GetWasmFunctionDependencyMapping(ctx, wasmContractAddress, "some_other_function") - require.Error(t, aclkeeper.ErrWasmFunctionDependencyMappingNotFound, err) + _, err = app.AccessControlKeeper.GetWasmDependencyMapping(ctx, otherContractAddress) + require.Error(t, aclkeeper.ErrWasmDependencyMappingNotFound, err) } func (suite *KeeperTestSuite) TestMessageDependencies() { diff --git a/x/accesscontrol/types/genesis.go b/x/accesscontrol/types/genesis.go index f91d5f696..98a68fd73 100644 --- a/x/accesscontrol/types/genesis.go +++ b/x/accesscontrol/types/genesis.go @@ -8,20 +8,20 @@ import ( ) // NewGenesisState creates a new GenesisState object -func NewGenesisState(params Params, messageDependencyMapping []acltypes.MessageDependencyMapping, wasmDependencyMappings []acltypes.WasmFunctionDependencyMapping) *GenesisState { +func NewGenesisState(params Params, messageDependencyMapping []acltypes.MessageDependencyMapping, wasmDependencyMappings []acltypes.WasmDependencyMapping) *GenesisState { return &GenesisState{ - Params: params, - MessageDependencyMapping: messageDependencyMapping, - WasmFunctionDependencyMappings: wasmDependencyMappings, + Params: params, + MessageDependencyMapping: messageDependencyMapping, + WasmDependencyMappings: wasmDependencyMappings, } } // DefaultGenesisState - default GenesisState used by columbus-2 func DefaultGenesisState() *GenesisState { return &GenesisState{ - Params: DefaultParams(), - MessageDependencyMapping: DefaultMessageDependencyMapping(), - WasmFunctionDependencyMappings: DefaultWasmDependencyMappings(), + Params: DefaultParams(), + MessageDependencyMapping: DefaultMessageDependencyMapping(), + WasmDependencyMappings: DefaultWasmDependencyMappings(), } } @@ -33,8 +33,8 @@ func ValidateGenesis(data GenesisState) error { return err } } - for _, mapping := range data.WasmFunctionDependencyMappings { - err := ValidateWasmFunctionDependencyMapping(mapping) + for _, mapping := range data.WasmDependencyMappings { + err := ValidateWasmDependencyMapping(mapping) if err != nil { return err } diff --git a/x/accesscontrol/types/genesis.pb.go b/x/accesscontrol/types/genesis.pb.go index d2878b97f..b20927191 100644 --- a/x/accesscontrol/types/genesis.pb.go +++ b/x/accesscontrol/types/genesis.pb.go @@ -27,8 +27,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // mapping between every message type and its predetermined resource read/write sequence - MessageDependencyMapping []accesscontrol.MessageDependencyMapping `protobuf:"bytes,2,rep,name=message_dependency_mapping,json=messageDependencyMapping,proto3" json:"message_dependency_mapping" yaml:"message_dependency_mapping"` - WasmFunctionDependencyMappings []accesscontrol.WasmFunctionDependencyMapping `protobuf:"bytes,3,rep,name=wasm_function_dependency_mappings,json=wasmFunctionDependencyMappings,proto3" json:"wasm_function_dependency_mappings" yaml:"wasm_function_dependency_mappings"` + MessageDependencyMapping []accesscontrol.MessageDependencyMapping `protobuf:"bytes,2,rep,name=message_dependency_mapping,json=messageDependencyMapping,proto3" json:"message_dependency_mapping" yaml:"message_dependency_mapping"` + WasmDependencyMappings []accesscontrol.WasmDependencyMapping `protobuf:"bytes,3,rep,name=wasm_dependency_mappings,json=wasmDependencyMappings,proto3" json:"wasm_dependency_mappings" yaml:"wasm_dependency_mappings"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -78,9 +78,9 @@ func (m *GenesisState) GetMessageDependencyMapping() []accesscontrol.MessageDepe return nil } -func (m *GenesisState) GetWasmFunctionDependencyMappings() []accesscontrol.WasmFunctionDependencyMapping { +func (m *GenesisState) GetWasmDependencyMappings() []accesscontrol.WasmDependencyMapping { if m != nil { - return m.WasmFunctionDependencyMappings + return m.WasmDependencyMappings } return nil } @@ -130,30 +130,29 @@ func init() { } var fileDescriptor_35812e6814a64fba = []byte{ - // 353 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xbf, 0x4e, 0xc2, 0x40, - 0x1c, 0xc7, 0x7b, 0x42, 0x18, 0x8a, 0x71, 0x68, 0x1c, 0x1a, 0x86, 0x03, 0x1a, 0x63, 0xea, 0x60, - 0x2b, 0x98, 0x38, 0xe0, 0x46, 0x88, 0x2e, 0x92, 0x18, 0x1c, 0x4c, 0x5c, 0x9a, 0xe3, 0x38, 0x6b, - 0x23, 0x77, 0xd7, 0xf0, 0x3b, 0x04, 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 0x40, 0x66, 0x79, - 0x40, 0x80, 0x07, 0xf7, 0x7d, 0x41, 0x55, 0x24, 0xc5, 0x1a, 0x3f, 0xd8, 0x99, 0x04, 0xf4, 0x7c, - 0x3b, 0xe8, 0x2d, 0x01, 0x7e, 0x91, 0xa6, 0xfc, 0xa5, 0x3d, 0x49, 0x69, 0x5d, 0x4d, 0xfb, 0x6f, - 0xa7, 0xd3, 0xc2, 0x83, 0x6d, 0x81, 0xe0, 0xec, 0x99, 0x39, 0xfd, 0xe9, 0xb5, 0xec, 0xcb, 0x5b, - 0xd1, 0xa8, 0x5f, 0x8d, 0x67, 0x18, 0x4d, 0x66, 0x18, 0x7d, 0xcd, 0x30, 0x7a, 0x9e, 0x63, 0x63, - 0x32, 0xc7, 0xc6, 0xe7, 0x1c, 0x1b, 0x77, 0xd5, 0x30, 0x52, 0x0f, 0xfd, 0xb6, 0x47, 0x25, 0xf7, - 0xd3, 0x49, 0xe8, 0xe3, 0x18, 0x3a, 0x8f, 0xfe, 0x70, 0x65, 0x1f, 0x6a, 0x14, 0x33, 0x68, 0xe7, - 0x92, 0x61, 0x9c, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xba, 0x86, 0xfb, 0x10, 0xa0, 0x02, 0x00, - 0x00, + // 340 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x41, 0x4b, 0x02, 0x41, + 0x1c, 0xc5, 0x77, 0x52, 0x3c, 0xac, 0xd1, 0x61, 0x89, 0x58, 0x3c, 0xcc, 0xda, 0x12, 0x65, 0x87, + 0x66, 0x51, 0xa1, 0x83, 0x47, 0x11, 0xba, 0x24, 0x84, 0x1d, 0x82, 0x2e, 0x32, 0x8e, 0xc3, 0x24, + 0x39, 0x3b, 0x83, 0xff, 0x29, 0xf5, 0x53, 0xd4, 0x29, 0xba, 0xd5, 0xc7, 0xf1, 0xe8, 0xb1, 0x93, + 0x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x47, 0x41, 0xfe, 0x2f, 0x77, 0xb6, 0x2a, 0x17, + 0xd8, 0x72, 0xdb, 0x22, 0xc2, 0xd6, 0xd1, 0x30, 0x8d, 0x87, 0xf0, 0xc0, 0xcd, 0xd9, 0x2f, 0xad, + 0x65, 0xdf, 0x3f, 0x03, 0xa7, 0x7e, 0x3d, 0x99, 0x63, 0x34, 0x9d, 0x63, 0xf4, 0x3d, 0xc7, 0xe8, + 0x75, 0x81, 0x9d, 0xe9, 0x02, 0x3b, 0x5f, 0x0b, 0xec, 0xdc, 0x57, 0x44, 0xcf, 0x3c, 0x3c, 0x75, + 0x08, 0x53, 0x32, 0x5a, 0x0d, 0x6e, 0x8f, 0x0b, 0xe8, 0x3e, 0x46, 0xa3, 0x8d, 0xf5, 0xcd, 0x58, + 0x73, 0xe8, 0xe4, 0x92, 0xd9, 0xab, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x42, 0x1c, 0x49, 0x84, + 0x7e, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -176,10 +175,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.WasmFunctionDependencyMappings) > 0 { - for iNdEx := len(m.WasmFunctionDependencyMappings) - 1; iNdEx >= 0; iNdEx-- { + if len(m.WasmDependencyMappings) > 0 { + for iNdEx := len(m.WasmDependencyMappings) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.WasmFunctionDependencyMappings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.WasmDependencyMappings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -265,8 +264,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.WasmFunctionDependencyMappings) > 0 { - for _, e := range m.WasmFunctionDependencyMappings { + if len(m.WasmDependencyMappings) > 0 { + for _, e := range m.WasmDependencyMappings { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -387,7 +386,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WasmFunctionDependencyMappings", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WasmDependencyMappings", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -414,8 +413,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.WasmFunctionDependencyMappings = append(m.WasmFunctionDependencyMappings, accesscontrol.WasmFunctionDependencyMapping{}) - if err := m.WasmFunctionDependencyMappings[len(m.WasmFunctionDependencyMappings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.WasmDependencyMappings = append(m.WasmDependencyMappings, accesscontrol.WasmDependencyMapping{}) + if err := m.WasmDependencyMappings[len(m.WasmDependencyMappings)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/accesscontrol/types/keys.go b/x/accesscontrol/types/keys.go index 7f2fdb088..217124b9e 100644 --- a/x/accesscontrol/types/keys.go +++ b/x/accesscontrol/types/keys.go @@ -35,11 +35,6 @@ func GetWasmMappingKey() []byte { return []byte{byte(WasmMappingKey)} } -func GetWasmContractAddressPrefix(contractAddress sdk.AccAddress) []byte { +func GetWasmContractAddressKey(contractAddress sdk.AccAddress) []byte { return append(GetWasmMappingKey(), address.MustLengthPrefix(contractAddress)...) } - -// wasmFunctionName is the top level object key in the execute JSON payload -func GetWasmFunctionDependencyKey(contractAddress sdk.AccAddress, wasmFunctionName string) []byte { - return append(GetWasmContractAddressPrefix(contractAddress), []byte(wasmFunctionName)...) -} diff --git a/x/accesscontrol/types/message_dependency_mapping.go b/x/accesscontrol/types/message_dependency_mapping.go index a7da46ae8..e714f619e 100644 --- a/x/accesscontrol/types/message_dependency_mapping.go +++ b/x/accesscontrol/types/message_dependency_mapping.go @@ -50,11 +50,11 @@ func DefaultMessageDependencyMapping() []acltypes.MessageDependencyMapping { } } -func DefaultWasmDependencyMappings() []acltypes.WasmFunctionDependencyMapping { - return []acltypes.WasmFunctionDependencyMapping{} +func DefaultWasmDependencyMappings() []acltypes.WasmDependencyMapping { + return []acltypes.WasmDependencyMapping{} } -func ValidateWasmFunctionDependencyMapping(mapping acltypes.WasmFunctionDependencyMapping) error { +func ValidateWasmDependencyMapping(mapping acltypes.WasmDependencyMapping) error { lastAccessOp := mapping.AccessOps[len(mapping.AccessOps)-1] if lastAccessOp.AccessType != acltypes.AccessType_COMMIT { return ErrNoCommitAccessOp diff --git a/x/accesscontrol/types/query.pb.go b/x/accesscontrol/types/query.pb.go index 7658a335d..9e90ab1c6 100644 --- a/x/accesscontrol/types/query.pb.go +++ b/x/accesscontrol/types/query.pb.go @@ -208,23 +208,22 @@ func (m *ResourceDependencyMappingFromMessageKeyResponse) GetMessageDependencyMa return accesscontrol.MessageDependencyMapping{} } -type WasmFunctionDependencyMappingRequest struct { - CodeId uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty" yaml:"code_id"` - WasmFunction string `protobuf:"bytes,2,opt,name=wasm_function,json=wasmFunction,proto3" json:"wasm_function,omitempty" yaml:"wasm_function"` +type WasmDependencyMappingRequest struct { + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty" yaml:"contract_address"` } -func (m *WasmFunctionDependencyMappingRequest) Reset() { *m = WasmFunctionDependencyMappingRequest{} } -func (m *WasmFunctionDependencyMappingRequest) String() string { return proto.CompactTextString(m) } -func (*WasmFunctionDependencyMappingRequest) ProtoMessage() {} -func (*WasmFunctionDependencyMappingRequest) Descriptor() ([]byte, []int) { +func (m *WasmDependencyMappingRequest) Reset() { *m = WasmDependencyMappingRequest{} } +func (m *WasmDependencyMappingRequest) String() string { return proto.CompactTextString(m) } +func (*WasmDependencyMappingRequest) ProtoMessage() {} +func (*WasmDependencyMappingRequest) Descriptor() ([]byte, []int) { return fileDescriptor_d83f2274e13e6a16, []int{4} } -func (m *WasmFunctionDependencyMappingRequest) XXX_Unmarshal(b []byte) error { +func (m *WasmDependencyMappingRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *WasmFunctionDependencyMappingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *WasmDependencyMappingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_WasmFunctionDependencyMappingRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_WasmDependencyMappingRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -234,48 +233,41 @@ func (m *WasmFunctionDependencyMappingRequest) XXX_Marshal(b []byte, determinist return b[:n], nil } } -func (m *WasmFunctionDependencyMappingRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_WasmFunctionDependencyMappingRequest.Merge(m, src) +func (m *WasmDependencyMappingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_WasmDependencyMappingRequest.Merge(m, src) } -func (m *WasmFunctionDependencyMappingRequest) XXX_Size() int { +func (m *WasmDependencyMappingRequest) XXX_Size() int { return m.Size() } -func (m *WasmFunctionDependencyMappingRequest) XXX_DiscardUnknown() { - xxx_messageInfo_WasmFunctionDependencyMappingRequest.DiscardUnknown(m) +func (m *WasmDependencyMappingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_WasmDependencyMappingRequest.DiscardUnknown(m) } -var xxx_messageInfo_WasmFunctionDependencyMappingRequest proto.InternalMessageInfo +var xxx_messageInfo_WasmDependencyMappingRequest proto.InternalMessageInfo -func (m *WasmFunctionDependencyMappingRequest) GetCodeId() uint64 { +func (m *WasmDependencyMappingRequest) GetContractAddress() string { if m != nil { - return m.CodeId - } - return 0 -} - -func (m *WasmFunctionDependencyMappingRequest) GetWasmFunction() string { - if m != nil { - return m.WasmFunction + return m.ContractAddress } return "" } -type WasmFunctionDependencyMappingResponse struct { - WasmFunctionDependencyMapping accesscontrol.WasmFunctionDependencyMapping `protobuf:"bytes,1,opt,name=wasm_function_dependency_mapping,json=wasmFunctionDependencyMapping,proto3" json:"wasm_function_dependency_mapping" yaml:"wasm_function_dependency_mapping"` +type WasmDependencyMappingResponse struct { + WasmDependencyMapping accesscontrol.WasmDependencyMapping `protobuf:"bytes,1,opt,name=wasm_dependency_mapping,json=wasmDependencyMapping,proto3" json:"wasm_dependency_mapping" yaml:"wasm_dependency_mapping"` } -func (m *WasmFunctionDependencyMappingResponse) Reset() { *m = WasmFunctionDependencyMappingResponse{} } -func (m *WasmFunctionDependencyMappingResponse) String() string { return proto.CompactTextString(m) } -func (*WasmFunctionDependencyMappingResponse) ProtoMessage() {} -func (*WasmFunctionDependencyMappingResponse) Descriptor() ([]byte, []int) { +func (m *WasmDependencyMappingResponse) Reset() { *m = WasmDependencyMappingResponse{} } +func (m *WasmDependencyMappingResponse) String() string { return proto.CompactTextString(m) } +func (*WasmDependencyMappingResponse) ProtoMessage() {} +func (*WasmDependencyMappingResponse) Descriptor() ([]byte, []int) { return fileDescriptor_d83f2274e13e6a16, []int{5} } -func (m *WasmFunctionDependencyMappingResponse) XXX_Unmarshal(b []byte) error { +func (m *WasmDependencyMappingResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *WasmFunctionDependencyMappingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *WasmDependencyMappingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_WasmFunctionDependencyMappingResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_WasmDependencyMappingResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -285,23 +277,23 @@ func (m *WasmFunctionDependencyMappingResponse) XXX_Marshal(b []byte, determinis return b[:n], nil } } -func (m *WasmFunctionDependencyMappingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_WasmFunctionDependencyMappingResponse.Merge(m, src) +func (m *WasmDependencyMappingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_WasmDependencyMappingResponse.Merge(m, src) } -func (m *WasmFunctionDependencyMappingResponse) XXX_Size() int { +func (m *WasmDependencyMappingResponse) XXX_Size() int { return m.Size() } -func (m *WasmFunctionDependencyMappingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_WasmFunctionDependencyMappingResponse.DiscardUnknown(m) +func (m *WasmDependencyMappingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_WasmDependencyMappingResponse.DiscardUnknown(m) } -var xxx_messageInfo_WasmFunctionDependencyMappingResponse proto.InternalMessageInfo +var xxx_messageInfo_WasmDependencyMappingResponse proto.InternalMessageInfo -func (m *WasmFunctionDependencyMappingResponse) GetWasmFunctionDependencyMapping() accesscontrol.WasmFunctionDependencyMapping { +func (m *WasmDependencyMappingResponse) GetWasmDependencyMapping() accesscontrol.WasmDependencyMapping { if m != nil { - return m.WasmFunctionDependencyMapping + return m.WasmDependencyMapping } - return accesscontrol.WasmFunctionDependencyMapping{} + return accesscontrol.WasmDependencyMapping{} } type ListResourceDependencyMappingRequest struct { @@ -384,23 +376,21 @@ func (m *ListResourceDependencyMappingResponse) GetMessageDependencyMappingList( return nil } -type ListWasmFunctionDependencyMappingRequest struct { +type ListWasmDependencyMappingRequest struct { } -func (m *ListWasmFunctionDependencyMappingRequest) Reset() { - *m = ListWasmFunctionDependencyMappingRequest{} -} -func (m *ListWasmFunctionDependencyMappingRequest) String() string { return proto.CompactTextString(m) } -func (*ListWasmFunctionDependencyMappingRequest) ProtoMessage() {} -func (*ListWasmFunctionDependencyMappingRequest) Descriptor() ([]byte, []int) { +func (m *ListWasmDependencyMappingRequest) Reset() { *m = ListWasmDependencyMappingRequest{} } +func (m *ListWasmDependencyMappingRequest) String() string { return proto.CompactTextString(m) } +func (*ListWasmDependencyMappingRequest) ProtoMessage() {} +func (*ListWasmDependencyMappingRequest) Descriptor() ([]byte, []int) { return fileDescriptor_d83f2274e13e6a16, []int{8} } -func (m *ListWasmFunctionDependencyMappingRequest) XXX_Unmarshal(b []byte) error { +func (m *ListWasmDependencyMappingRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ListWasmFunctionDependencyMappingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ListWasmDependencyMappingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ListWasmFunctionDependencyMappingRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_ListWasmDependencyMappingRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -410,38 +400,34 @@ func (m *ListWasmFunctionDependencyMappingRequest) XXX_Marshal(b []byte, determi return b[:n], nil } } -func (m *ListWasmFunctionDependencyMappingRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListWasmFunctionDependencyMappingRequest.Merge(m, src) +func (m *ListWasmDependencyMappingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListWasmDependencyMappingRequest.Merge(m, src) } -func (m *ListWasmFunctionDependencyMappingRequest) XXX_Size() int { +func (m *ListWasmDependencyMappingRequest) XXX_Size() int { return m.Size() } -func (m *ListWasmFunctionDependencyMappingRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListWasmFunctionDependencyMappingRequest.DiscardUnknown(m) +func (m *ListWasmDependencyMappingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListWasmDependencyMappingRequest.DiscardUnknown(m) } -var xxx_messageInfo_ListWasmFunctionDependencyMappingRequest proto.InternalMessageInfo +var xxx_messageInfo_ListWasmDependencyMappingRequest proto.InternalMessageInfo -type ListWasmFunctionDependencyMappingResponse struct { - WasmFunctionDependencyMappingList []accesscontrol.WasmFunctionDependencyMapping `protobuf:"bytes,1,rep,name=wasm_function_dependency_mapping_list,json=wasmFunctionDependencyMappingList,proto3" json:"wasm_function_dependency_mapping_list" yaml:"wasm_function_dependency_mapping_list"` +type ListWasmDependencyMappingResponse struct { + WasmDependencyMappingList []accesscontrol.WasmDependencyMapping `protobuf:"bytes,1,rep,name=wasm_dependency_mapping_list,json=wasmDependencyMappingList,proto3" json:"wasm_dependency_mapping_list" yaml:"wasm_dependency_mapping_list"` } -func (m *ListWasmFunctionDependencyMappingResponse) Reset() { - *m = ListWasmFunctionDependencyMappingResponse{} -} -func (m *ListWasmFunctionDependencyMappingResponse) String() string { - return proto.CompactTextString(m) -} -func (*ListWasmFunctionDependencyMappingResponse) ProtoMessage() {} -func (*ListWasmFunctionDependencyMappingResponse) Descriptor() ([]byte, []int) { +func (m *ListWasmDependencyMappingResponse) Reset() { *m = ListWasmDependencyMappingResponse{} } +func (m *ListWasmDependencyMappingResponse) String() string { return proto.CompactTextString(m) } +func (*ListWasmDependencyMappingResponse) ProtoMessage() {} +func (*ListWasmDependencyMappingResponse) Descriptor() ([]byte, []int) { return fileDescriptor_d83f2274e13e6a16, []int{9} } -func (m *ListWasmFunctionDependencyMappingResponse) XXX_Unmarshal(b []byte) error { +func (m *ListWasmDependencyMappingResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ListWasmFunctionDependencyMappingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ListWasmDependencyMappingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ListWasmFunctionDependencyMappingResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_ListWasmDependencyMappingResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -451,21 +437,21 @@ func (m *ListWasmFunctionDependencyMappingResponse) XXX_Marshal(b []byte, determ return b[:n], nil } } -func (m *ListWasmFunctionDependencyMappingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListWasmFunctionDependencyMappingResponse.Merge(m, src) +func (m *ListWasmDependencyMappingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListWasmDependencyMappingResponse.Merge(m, src) } -func (m *ListWasmFunctionDependencyMappingResponse) XXX_Size() int { +func (m *ListWasmDependencyMappingResponse) XXX_Size() int { return m.Size() } -func (m *ListWasmFunctionDependencyMappingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListWasmFunctionDependencyMappingResponse.DiscardUnknown(m) +func (m *ListWasmDependencyMappingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListWasmDependencyMappingResponse.DiscardUnknown(m) } -var xxx_messageInfo_ListWasmFunctionDependencyMappingResponse proto.InternalMessageInfo +var xxx_messageInfo_ListWasmDependencyMappingResponse proto.InternalMessageInfo -func (m *ListWasmFunctionDependencyMappingResponse) GetWasmFunctionDependencyMappingList() []accesscontrol.WasmFunctionDependencyMapping { +func (m *ListWasmDependencyMappingResponse) GetWasmDependencyMappingList() []accesscontrol.WasmDependencyMapping { if m != nil { - return m.WasmFunctionDependencyMappingList + return m.WasmDependencyMappingList } return nil } @@ -475,12 +461,12 @@ func init() { proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.accesscontrol_x.v1beta1.QueryParamsResponse") proto.RegisterType((*ResourceDependencyMappingFromMessageKeyRequest)(nil), "cosmos.accesscontrol_x.v1beta1.ResourceDependencyMappingFromMessageKeyRequest") proto.RegisterType((*ResourceDependencyMappingFromMessageKeyResponse)(nil), "cosmos.accesscontrol_x.v1beta1.ResourceDependencyMappingFromMessageKeyResponse") - proto.RegisterType((*WasmFunctionDependencyMappingRequest)(nil), "cosmos.accesscontrol_x.v1beta1.WasmFunctionDependencyMappingRequest") - proto.RegisterType((*WasmFunctionDependencyMappingResponse)(nil), "cosmos.accesscontrol_x.v1beta1.WasmFunctionDependencyMappingResponse") + proto.RegisterType((*WasmDependencyMappingRequest)(nil), "cosmos.accesscontrol_x.v1beta1.WasmDependencyMappingRequest") + proto.RegisterType((*WasmDependencyMappingResponse)(nil), "cosmos.accesscontrol_x.v1beta1.WasmDependencyMappingResponse") proto.RegisterType((*ListResourceDependencyMappingRequest)(nil), "cosmos.accesscontrol_x.v1beta1.ListResourceDependencyMappingRequest") proto.RegisterType((*ListResourceDependencyMappingResponse)(nil), "cosmos.accesscontrol_x.v1beta1.ListResourceDependencyMappingResponse") - proto.RegisterType((*ListWasmFunctionDependencyMappingRequest)(nil), "cosmos.accesscontrol_x.v1beta1.ListWasmFunctionDependencyMappingRequest") - proto.RegisterType((*ListWasmFunctionDependencyMappingResponse)(nil), "cosmos.accesscontrol_x.v1beta1.ListWasmFunctionDependencyMappingResponse") + proto.RegisterType((*ListWasmDependencyMappingRequest)(nil), "cosmos.accesscontrol_x.v1beta1.ListWasmDependencyMappingRequest") + proto.RegisterType((*ListWasmDependencyMappingResponse)(nil), "cosmos.accesscontrol_x.v1beta1.ListWasmDependencyMappingResponse") } func init() { @@ -488,58 +474,56 @@ func init() { } var fileDescriptor_d83f2274e13e6a16 = []byte{ - // 808 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x4f, 0x13, 0x41, - 0x14, 0xee, 0x54, 0xac, 0x61, 0x50, 0x0f, 0x23, 0x31, 0x4d, 0x03, 0x5b, 0x98, 0xf0, 0x5b, 0xdd, - 0x0d, 0xc5, 0x68, 0xa2, 0xf1, 0x60, 0x45, 0x02, 0x11, 0x50, 0xf7, 0x62, 0x22, 0x31, 0x9b, 0xed, - 0x76, 0x58, 0x37, 0x74, 0x77, 0x96, 0x9d, 0xad, 0xd0, 0x10, 0x2e, 0x9e, 0x3c, 0xfa, 0xe3, 0x0f, - 0x30, 0xf1, 0x6e, 0x3c, 0xf9, 0x17, 0x78, 0xe1, 0x48, 0xc2, 0x41, 0x4f, 0xd5, 0x80, 0xff, 0x80, - 0xbd, 0x70, 0x35, 0xbb, 0x3b, 0x90, 0x96, 0xb6, 0x3b, 0x4b, 0xe0, 0xd4, 0xdd, 0x9d, 0xf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 0xb6, 0x7a, 0xd5, 0xa3, 0xb6, 0xd6, 0x74, 0x9d, 0x28, 0x5b, 0x4d, 0x2f, 0xdb, 0xe8, 0x10, 0xc0, - 0xc1, 0xd8, 0xa3, 0x8d, 0x66, 0x45, 0xbc, 0x92, 0x8c, 0x90, 0xdc, 0xe3, 0x33, 0x56, 0xe1, 0x9a, - 0x2c, 0x84, 0x9a, 0x3c, 0x42, 0x0f, 0x85, 0x9a, 0x04, 0x16, 0xd7, 0x62, 0x84, 0x41, 0x1f, 0xd2, - 0x70, 0x30, 0xf6, 0x54, 0x89, 0x99, 0x27, 0x19, 0x1b, 0x62, 0xe6, 0x89, 0xe6, 0xc9, 0x29, 0xdc, - 0x20, 0x3a, 0xfd, 0xca, 0x16, 0xbf, 0x29, 0xb7, 0x95, 0xad, 0x96, 0xd8, 0x6d, 0xf4, 0x2e, 0x0d, - 0x87, 0x85, 0x23, 0x0e, 0xcd, 0x27, 0xd9, 0xcb, 0x44, 0xda, 0x2c, 0x9c, 0x43, 0x25, 0xae, 0xcf, - 0x72, 0xa8, 0xcf, 0x3c, 0x9a, 0x4b, 0xe6, 0x0c, 0x91, 0x48, 0xc5, 0xc5, 0x9d, 0x7d, 0x09, 0xec, - 0xee, 0x4b, 0xe0, 0xcf, 0xbe, 0x04, 0xde, 0x1f, 0x48, 0xa9, 0xdd, 0x03, 0x29, 0xf5, 0xeb, 0x40, - 0x4a, 0xbd, 0x2c, 0x98, 0x96, 0xff, 0xba, 0x5a, 0x92, 0x0d, 0x6a, 0x77, 0xc0, 0xda, 0x3c, 0x81, - 0xe6, 0xd7, 0x5c, 0xc2, 0x4a, 0x99, 0xf0, 0xbf, 0xe9, 0xcc, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x45, 0x1a, 0xb4, 0x14, 0x91, 0x0b, 0x00, 0x00, + // 781 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac,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xae, 0x05, 0x78, 0xc1, 0x6f, 0x88, 0x68, + 0x6e, 0x91, 0x94, 0xcb, 0x0e, 0xe5, 0x5c, 0x68, 0x76, 0xf9, 0xa8, 0x9e, 0x1d, 0x08, 0xa0, 0x5b, + 0x23, 0xb0, 0xfa, 0x7f, 0xe3, 0x68, 0x56, 0x9c, 0x7c, 0x06, 0x70, 0x38, 0x02, 0x48, 0x68, 0xb5, + 0x03, 0xe0, 0xc0, 0x06, 0xe1, 0x66, 0xb4, 0x50, 0xd3, 0xf1, 0x42, 0x85, 0x96, 0x2f, 0xe4, 0x84, + 0x4a, 0x52, 0xd0, 0x6a, 0x04, 0x02, 0x56, 0xfb, 0x37, 0xc2, 0xd2, 0x71, 0x0e, 0x8e, 0x2d, 0x19, + 0xdc, 0x8d, 0x1c, 0x7c, 0x63, 0xcb, 0xbf, 0x02, 0x78, 0x35, 0x21, 0x50, 0xf0, 0xfc, 0x00, 0x60, + 0x36, 0x7a, 0x56, 0xc5, 0x8a, 0xc1, 0xdd, 0x41, 0x30, 0xf2, 0xcf, 0x39, 0x16, 0x43, 0x16, 0x94, + 0x73, 0x49, 0x8b, 0xe1, 0x83, 0x61, 0x35, 0x13, 0xb5, 0x1d, 0x1e, 0x21, 0x8c, 0xe1, 0x88, 0xf7, + 0x8c, 0xdb, 0x12, 0xfc, 0x05, 0xc0, 0xd1, 0x98, 0x20, 0xc1, 0xfc, 0x1d, 0x80, 0x99, 0x08, 0xfd, + 0x9b, 0x69, 0x9f, 0x69, 0xcc, 0xd7, 0x05, 0xe7, 0x2b, 0xb1, 0x63, 0x16, 0x84, 0x87, 0x42, 0x67, + 0xed, 0x11, 0xc8, 0x7f, 0xec, 0x81, 0xff, 0xf9, 0x76, 0x85, 0xde, 0x03, 0xd8, 0x1d, 0x78, 0x0e, + 0xca, 0x27, 0x79, 0x53, 0xbb, 0xed, 0xa5, 0xa7, 0x4f, 0x95, 0x13, 0x28, 0x84, 0x95, 0xd7, 0xfb, + 0x3f, 0x76,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xf3, 0xba, 0xe1, 0xbe, 0xac, 0x96, 0x64, 0x8d, + 0x99, 0x21, 0x10, 0x9b, 0x2d, 0x20, 0x6e, 0xcd, 0xa6, 0xbc, 0xd4, 0xed, 0xff, 0x92, 0x9b, 0xfe, + 0x13, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x74, 0x69, 0xa8, 0xbf, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -557,8 +541,8 @@ type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) ResourceDependencyMappingFromMessageKey(ctx context.Context, in *ResourceDependencyMappingFromMessageKeyRequest, opts ...grpc.CallOption) (*ResourceDependencyMappingFromMessageKeyResponse, error) ListResourceDependencyMapping(ctx context.Context, in *ListResourceDependencyMappingRequest, opts ...grpc.CallOption) (*ListResourceDependencyMappingResponse, error) - WasmFunctionDependencyMapping(ctx context.Context, in *WasmFunctionDependencyMappingRequest, opts ...grpc.CallOption) (*WasmFunctionDependencyMappingResponse, error) - ListWasmFunctionDependencyMapping(ctx context.Context, in *ListWasmFunctionDependencyMappingRequest, opts ...grpc.CallOption) (*ListWasmFunctionDependencyMappingResponse, error) + WasmDependencyMapping(ctx context.Context, in *WasmDependencyMappingRequest, opts ...grpc.CallOption) (*WasmDependencyMappingResponse, error) + ListWasmDependencyMapping(ctx context.Context, in *ListWasmDependencyMappingRequest, opts ...grpc.CallOption) (*ListWasmDependencyMappingResponse, error) } type queryClient struct { @@ -596,18 +580,18 @@ func (c *queryClient) ListResourceDependencyMapping(ctx context.Context, in *Lis return out, nil } -func (c *queryClient) WasmFunctionDependencyMapping(ctx context.Context, in *WasmFunctionDependencyMappingRequest, opts ...grpc.CallOption) (*WasmFunctionDependencyMappingResponse, error) { - out := new(WasmFunctionDependencyMappingResponse) - err := c.cc.Invoke(ctx, "/cosmos.accesscontrol_x.v1beta1.Query/WasmFunctionDependencyMapping", in, out, opts...) +func (c *queryClient) WasmDependencyMapping(ctx context.Context, in *WasmDependencyMappingRequest, opts ...grpc.CallOption) (*WasmDependencyMappingResponse, error) { + out := new(WasmDependencyMappingResponse) + err := c.cc.Invoke(ctx, "/cosmos.accesscontrol_x.v1beta1.Query/WasmDependencyMapping", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) ListWasmFunctionDependencyMapping(ctx context.Context, in *ListWasmFunctionDependencyMappingRequest, opts ...grpc.CallOption) (*ListWasmFunctionDependencyMappingResponse, error) { - out := new(ListWasmFunctionDependencyMappingResponse) - err := c.cc.Invoke(ctx, "/cosmos.accesscontrol_x.v1beta1.Query/ListWasmFunctionDependencyMapping", in, out, opts...) +func (c *queryClient) ListWasmDependencyMapping(ctx context.Context, in *ListWasmDependencyMappingRequest, opts ...grpc.CallOption) (*ListWasmDependencyMappingResponse, error) { + out := new(ListWasmDependencyMappingResponse) + err := c.cc.Invoke(ctx, "/cosmos.accesscontrol_x.v1beta1.Query/ListWasmDependencyMapping", in, out, opts...) if err != nil { return nil, err } @@ -619,8 +603,8 @@ type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) ResourceDependencyMappingFromMessageKey(context.Context, *ResourceDependencyMappingFromMessageKeyRequest) (*ResourceDependencyMappingFromMessageKeyResponse, error) ListResourceDependencyMapping(context.Context, *ListResourceDependencyMappingRequest) (*ListResourceDependencyMappingResponse, error) - WasmFunctionDependencyMapping(context.Context, *WasmFunctionDependencyMappingRequest) (*WasmFunctionDependencyMappingResponse, error) - ListWasmFunctionDependencyMapping(context.Context, *ListWasmFunctionDependencyMappingRequest) (*ListWasmFunctionDependencyMappingResponse, error) + WasmDependencyMapping(context.Context, *WasmDependencyMappingRequest) (*WasmDependencyMappingResponse, error) + ListWasmDependencyMapping(context.Context, *ListWasmDependencyMappingRequest) (*ListWasmDependencyMappingResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -636,11 +620,11 @@ func (*UnimplementedQueryServer) ResourceDependencyMappingFromMessageKey(ctx con func (*UnimplementedQueryServer) ListResourceDependencyMapping(ctx context.Context, req *ListResourceDependencyMappingRequest) (*ListResourceDependencyMappingResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListResourceDependencyMapping not implemented") } -func (*UnimplementedQueryServer) WasmFunctionDependencyMapping(ctx context.Context, req *WasmFunctionDependencyMappingRequest) (*WasmFunctionDependencyMappingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WasmFunctionDependencyMapping not implemented") +func (*UnimplementedQueryServer) WasmDependencyMapping(ctx context.Context, req *WasmDependencyMappingRequest) (*WasmDependencyMappingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WasmDependencyMapping not implemented") } -func (*UnimplementedQueryServer) ListWasmFunctionDependencyMapping(ctx context.Context, req *ListWasmFunctionDependencyMappingRequest) (*ListWasmFunctionDependencyMappingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListWasmFunctionDependencyMapping not implemented") +func (*UnimplementedQueryServer) ListWasmDependencyMapping(ctx context.Context, req *ListWasmDependencyMappingRequest) (*ListWasmDependencyMappingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListWasmDependencyMapping not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -701,38 +685,38 @@ func _Query_ListResourceDependencyMapping_Handler(srv interface{}, ctx context.C return interceptor(ctx, in, info, handler) } -func _Query_WasmFunctionDependencyMapping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(WasmFunctionDependencyMappingRequest) +func _Query_WasmDependencyMapping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(WasmDependencyMappingRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).WasmFunctionDependencyMapping(ctx, in) + return srv.(QueryServer).WasmDependencyMapping(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.accesscontrol_x.v1beta1.Query/WasmFunctionDependencyMapping", + FullMethod: "/cosmos.accesscontrol_x.v1beta1.Query/WasmDependencyMapping", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).WasmFunctionDependencyMapping(ctx, req.(*WasmFunctionDependencyMappingRequest)) + return srv.(QueryServer).WasmDependencyMapping(ctx, req.(*WasmDependencyMappingRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_ListWasmFunctionDependencyMapping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListWasmFunctionDependencyMappingRequest) +func _Query_ListWasmDependencyMapping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListWasmDependencyMappingRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).ListWasmFunctionDependencyMapping(ctx, in) + return srv.(QueryServer).ListWasmDependencyMapping(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.accesscontrol_x.v1beta1.Query/ListWasmFunctionDependencyMapping", + FullMethod: "/cosmos.accesscontrol_x.v1beta1.Query/ListWasmDependencyMapping", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ListWasmFunctionDependencyMapping(ctx, req.(*ListWasmFunctionDependencyMappingRequest)) + return srv.(QueryServer).ListWasmDependencyMapping(ctx, req.(*ListWasmDependencyMappingRequest)) } return interceptor(ctx, in, info, handler) } @@ -754,12 +738,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_ListResourceDependencyMapping_Handler, }, { - MethodName: "WasmFunctionDependencyMapping", - Handler: _Query_WasmFunctionDependencyMapping_Handler, + MethodName: "WasmDependencyMapping", + Handler: _Query_WasmDependencyMapping_Handler, }, { - MethodName: "ListWasmFunctionDependencyMapping", - Handler: _Query_ListWasmFunctionDependencyMapping_Handler, + MethodName: "ListWasmDependencyMapping", + Handler: _Query_ListWasmDependencyMapping_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -885,7 +869,7 @@ func (m *ResourceDependencyMappingFromMessageKeyResponse) MarshalToSizedBuffer(d return len(dAtA) - i, nil } -func (m *WasmFunctionDependencyMappingRequest) Marshal() (dAtA []byte, err error) { +func (m *WasmDependencyMappingRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -895,32 +879,27 @@ func (m *WasmFunctionDependencyMappingRequest) Marshal() (dAtA []byte, err error return dAtA[:n], nil } -func (m *WasmFunctionDependencyMappingRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *WasmDependencyMappingRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *WasmFunctionDependencyMappingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *WasmDependencyMappingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.WasmFunction) > 0 { - i -= len(m.WasmFunction) - copy(dAtA[i:], m.WasmFunction) - i = encodeVarintQuery(dAtA, i, uint64(len(m.WasmFunction))) - i-- - dAtA[i] = 0x12 - } - if m.CodeId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *WasmFunctionDependencyMappingResponse) Marshal() (dAtA []byte, err error) { +func (m *WasmDependencyMappingResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -930,18 +909,18 @@ func (m *WasmFunctionDependencyMappingResponse) Marshal() (dAtA []byte, err erro return dAtA[:n], nil } -func (m *WasmFunctionDependencyMappingResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *WasmDependencyMappingResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *WasmFunctionDependencyMappingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *WasmDependencyMappingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.WasmFunctionDependencyMapping.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.WasmDependencyMapping.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1013,7 +992,7 @@ func (m *ListResourceDependencyMappingResponse) MarshalToSizedBuffer(dAtA []byte return len(dAtA) - i, nil } -func (m *ListWasmFunctionDependencyMappingRequest) Marshal() (dAtA []byte, err error) { +func (m *ListWasmDependencyMappingRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1023,12 +1002,12 @@ func (m *ListWasmFunctionDependencyMappingRequest) Marshal() (dAtA []byte, err e return dAtA[:n], nil } -func (m *ListWasmFunctionDependencyMappingRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ListWasmDependencyMappingRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ListWasmFunctionDependencyMappingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ListWasmDependencyMappingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1036,7 +1015,7 @@ func (m *ListWasmFunctionDependencyMappingRequest) MarshalToSizedBuffer(dAtA []b return len(dAtA) - i, nil } -func (m *ListWasmFunctionDependencyMappingResponse) Marshal() (dAtA []byte, err error) { +func (m *ListWasmDependencyMappingResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1046,20 +1025,20 @@ func (m *ListWasmFunctionDependencyMappingResponse) Marshal() (dAtA []byte, err return dAtA[:n], nil } -func (m *ListWasmFunctionDependencyMappingResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *ListWasmDependencyMappingResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ListWasmFunctionDependencyMappingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ListWasmDependencyMappingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.WasmFunctionDependencyMappingList) > 0 { - for iNdEx := len(m.WasmFunctionDependencyMappingList) - 1; iNdEx >= 0; iNdEx-- { + if len(m.WasmDependencyMappingList) > 0 { + for iNdEx := len(m.WasmDependencyMappingList) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.WasmFunctionDependencyMappingList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.WasmDependencyMappingList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1128,29 +1107,26 @@ func (m *ResourceDependencyMappingFromMessageKeyResponse) Size() (n int) { return n } -func (m *WasmFunctionDependencyMappingRequest) Size() (n int) { +func (m *WasmDependencyMappingRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.CodeId != 0 { - n += 1 + sovQuery(uint64(m.CodeId)) - } - l = len(m.WasmFunction) + l = len(m.ContractAddress) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *WasmFunctionDependencyMappingResponse) Size() (n int) { +func (m *WasmDependencyMappingResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.WasmFunctionDependencyMapping.Size() + l = m.WasmDependencyMapping.Size() n += 1 + l + sovQuery(uint64(l)) return n } @@ -1179,7 +1155,7 @@ func (m *ListResourceDependencyMappingResponse) Size() (n int) { return n } -func (m *ListWasmFunctionDependencyMappingRequest) Size() (n int) { +func (m *ListWasmDependencyMappingRequest) Size() (n int) { if m == nil { return 0 } @@ -1188,14 +1164,14 @@ func (m *ListWasmFunctionDependencyMappingRequest) Size() (n int) { return n } -func (m *ListWasmFunctionDependencyMappingResponse) Size() (n int) { +func (m *ListWasmDependencyMappingResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.WasmFunctionDependencyMappingList) > 0 { - for _, e := range m.WasmFunctionDependencyMappingList { + if len(m.WasmDependencyMappingList) > 0 { + for _, e := range m.WasmDependencyMappingList { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -1507,7 +1483,7 @@ func (m *ResourceDependencyMappingFromMessageKeyResponse) Unmarshal(dAtA []byte) } return nil } -func (m *WasmFunctionDependencyMappingRequest) Unmarshal(dAtA []byte) error { +func (m *WasmDependencyMappingRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1530,34 +1506,15 @@ func (m *WasmFunctionDependencyMappingRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: WasmFunctionDependencyMappingRequest: wiretype end group for non-group") + return fmt.Errorf("proto: WasmDependencyMappingRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: WasmFunctionDependencyMappingRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: WasmDependencyMappingRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) - } - m.CodeId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CodeId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WasmFunction", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1585,7 +1542,7 @@ func (m *WasmFunctionDependencyMappingRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.WasmFunction = string(dAtA[iNdEx:postIndex]) + m.ContractAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1608,7 +1565,7 @@ func (m *WasmFunctionDependencyMappingRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *WasmFunctionDependencyMappingResponse) Unmarshal(dAtA []byte) error { +func (m *WasmDependencyMappingResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1631,15 +1588,15 @@ func (m *WasmFunctionDependencyMappingResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: WasmFunctionDependencyMappingResponse: wiretype end group for non-group") + return fmt.Errorf("proto: WasmDependencyMappingResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: WasmFunctionDependencyMappingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: WasmDependencyMappingResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WasmFunctionDependencyMapping", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WasmDependencyMapping", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1666,7 +1623,7 @@ func (m *WasmFunctionDependencyMappingResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.WasmFunctionDependencyMapping.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.WasmDependencyMapping.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1825,7 +1782,7 @@ func (m *ListResourceDependencyMappingResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *ListWasmFunctionDependencyMappingRequest) Unmarshal(dAtA []byte) error { +func (m *ListWasmDependencyMappingRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1848,10 +1805,10 @@ func (m *ListWasmFunctionDependencyMappingRequest) Unmarshal(dAtA []byte) error fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ListWasmFunctionDependencyMappingRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ListWasmDependencyMappingRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ListWasmFunctionDependencyMappingRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListWasmDependencyMappingRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1875,7 +1832,7 @@ func (m *ListWasmFunctionDependencyMappingRequest) Unmarshal(dAtA []byte) error } return nil } -func (m *ListWasmFunctionDependencyMappingResponse) Unmarshal(dAtA []byte) error { +func (m *ListWasmDependencyMappingResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1898,15 +1855,15 @@ func (m *ListWasmFunctionDependencyMappingResponse) Unmarshal(dAtA []byte) error fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ListWasmFunctionDependencyMappingResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ListWasmDependencyMappingResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ListWasmFunctionDependencyMappingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListWasmDependencyMappingResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WasmFunctionDependencyMappingList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WasmDependencyMappingList", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1933,8 +1890,8 @@ func (m *ListWasmFunctionDependencyMappingResponse) Unmarshal(dAtA []byte) error if postIndex > l { return io.ErrUnexpectedEOF } - m.WasmFunctionDependencyMappingList = append(m.WasmFunctionDependencyMappingList, accesscontrol.WasmFunctionDependencyMapping{}) - if err := m.WasmFunctionDependencyMappingList[len(m.WasmFunctionDependencyMappingList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.WasmDependencyMappingList = append(m.WasmDependencyMappingList, accesscontrol.WasmDependencyMapping{}) + if err := m.WasmDependencyMappingList[len(m.WasmDependencyMappingList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/accesscontrol/types/query.pb.gw.go b/x/accesscontrol/types/query.pb.gw.go index bcd9fca2b..1a697271e 100644 --- a/x/accesscontrol/types/query.pb.gw.go +++ b/x/accesscontrol/types/query.pb.gw.go @@ -123,8 +123,8 @@ func local_request_Query_ListResourceDependencyMapping_0(ctx context.Context, ma } -func request_Query_WasmFunctionDependencyMapping_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq WasmFunctionDependencyMappingRequest +func request_Query_WasmDependencyMapping_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq WasmDependencyMappingRequest var metadata runtime.ServerMetadata var ( @@ -134,35 +134,24 @@ func request_Query_WasmFunctionDependencyMapping_0(ctx context.Context, marshale _ = err ) - val, ok = pathParams["code_id"] + val, ok = pathParams["contract_address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "contract_address") } - protoReq.CodeId, err = runtime.Uint64(val) + protoReq.ContractAddress, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "contract_address", err) } - val, ok = pathParams["wasm_function"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "wasm_function") - } - - protoReq.WasmFunction, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "wasm_function", err) - } - - msg, err := client.WasmFunctionDependencyMapping(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.WasmDependencyMapping(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_WasmFunctionDependencyMapping_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq WasmFunctionDependencyMappingRequest +func local_request_Query_WasmDependencyMapping_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq WasmDependencyMappingRequest var metadata runtime.ServerMetadata var ( @@ -172,47 +161,36 @@ func local_request_Query_WasmFunctionDependencyMapping_0(ctx context.Context, ma _ = err ) - val, ok = pathParams["code_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_id") - } - - protoReq.CodeId, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) - } - - val, ok = pathParams["wasm_function"] + val, ok = pathParams["contract_address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "wasm_function") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "contract_address") } - protoReq.WasmFunction, err = runtime.String(val) + protoReq.ContractAddress, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "wasm_function", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "contract_address", err) } - msg, err := server.WasmFunctionDependencyMapping(ctx, &protoReq) + msg, err := server.WasmDependencyMapping(ctx, &protoReq) return msg, metadata, err } -func request_Query_ListWasmFunctionDependencyMapping_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListWasmFunctionDependencyMappingRequest +func request_Query_ListWasmDependencyMapping_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListWasmDependencyMappingRequest var metadata runtime.ServerMetadata - msg, err := client.ListWasmFunctionDependencyMapping(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ListWasmDependencyMapping(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_ListWasmFunctionDependencyMapping_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListWasmFunctionDependencyMappingRequest +func local_request_Query_ListWasmDependencyMapping_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListWasmDependencyMappingRequest var metadata runtime.ServerMetadata - msg, err := server.ListWasmFunctionDependencyMapping(ctx, &protoReq) + msg, err := server.ListWasmDependencyMapping(ctx, &protoReq) return msg, metadata, err } @@ -292,7 +270,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_WasmFunctionDependencyMapping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_WasmDependencyMapping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -303,7 +281,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_WasmFunctionDependencyMapping_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_WasmDependencyMapping_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -311,11 +289,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_WasmFunctionDependencyMapping_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_WasmDependencyMapping_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ListWasmFunctionDependencyMapping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ListWasmDependencyMapping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -326,7 +304,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ListWasmFunctionDependencyMapping_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ListWasmDependencyMapping_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -334,7 +312,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ListWasmFunctionDependencyMapping_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ListWasmDependencyMapping_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -439,7 +417,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_WasmFunctionDependencyMapping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_WasmDependencyMapping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -448,18 +426,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_WasmFunctionDependencyMapping_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_WasmDependencyMapping_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_WasmFunctionDependencyMapping_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_WasmDependencyMapping_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ListWasmFunctionDependencyMapping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ListWasmDependencyMapping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -468,14 +446,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ListWasmFunctionDependencyMapping_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ListWasmDependencyMapping_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ListWasmFunctionDependencyMapping_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ListWasmDependencyMapping_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -489,9 +467,9 @@ var ( pattern_Query_ListResourceDependencyMapping_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "cosmos-sdk", "accesscontrol", "list_resource_dependency_mapping"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_WasmFunctionDependencyMapping_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "cosmos-sdk", "accesscontrol", "wasm_function_dependency_mapping", "code_id", "wasm_function"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_WasmDependencyMapping_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "cosmos-sdk", "accesscontrol", "wasm_dependency_mapping", "contract_address"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ListWasmFunctionDependencyMapping_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "cosmos-sdk", "accesscontrol", "list_wasm_function_dependency_mapping"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ListWasmDependencyMapping_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "cosmos-sdk", "accesscontrol", "list_wasm_dependency_mapping"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -501,7 +479,7 @@ var ( forward_Query_ListResourceDependencyMapping_0 = runtime.ForwardResponseMessage - forward_Query_WasmFunctionDependencyMapping_0 = runtime.ForwardResponseMessage + forward_Query_WasmDependencyMapping_0 = runtime.ForwardResponseMessage - forward_Query_ListWasmFunctionDependencyMapping_0 = runtime.ForwardResponseMessage + forward_Query_ListWasmDependencyMapping_0 = runtime.ForwardResponseMessage ) From 465de6e0d19f0c81e9e70beb73109a7c30ee2ad8 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Wed, 12 Oct 2022 17:36:00 -0700 Subject: [PATCH 3/4] modify resource hierarchy behavior --- types/accesscontrol/resource.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/types/accesscontrol/resource.go b/types/accesscontrol/resource.go index 5e60c688a..10bf789cb 100644 --- a/types/accesscontrol/resource.go +++ b/types/accesscontrol/resource.go @@ -17,7 +17,10 @@ var ResourceTree = map[ResourceType]TreeNode{ // TODO: alternatively, hardcode all dependencies (parent and children) for a specific resource type, so we don't need to do a traversal when building dag func (r ResourceType) GetResourceDependencies() []ResourceType { // resource is its own dependency - resources := r.GetParentResources() + resources := []ResourceType{r} + + //get parents + resources = append(resources, r.GetParentResources()...) // traverse children queue := ResourceTree[r].Children @@ -34,7 +37,7 @@ func (r ResourceType) GetResourceDependencies() []ResourceType { } func (r ResourceType) GetParentResources() []ResourceType { - parentResources := []ResourceType{r} + parentResources := []ResourceType{} // traverse up the parents chain currResource := r From 5f6f31ad1745bfb47efdd158e1810ce93a4c07e7 Mon Sep 17 00:00:00 2001 From: Uday Patil Date: Fri, 14 Oct 2022 12:55:00 -0700 Subject: [PATCH 4/4] add additional resource types --- proto/cosmos/accesscontrol/constants.proto | 12 +++- types/accesscontrol/constants.pb.go | 71 ++++++++++++++-------- types/accesscontrol/resource.go | 14 +++-- 3 files changed, 66 insertions(+), 31 deletions(-) diff --git a/proto/cosmos/accesscontrol/constants.proto b/proto/cosmos/accesscontrol/constants.proto index 8c7a2e07d..020848e9b 100644 --- a/proto/cosmos/accesscontrol/constants.proto +++ b/proto/cosmos/accesscontrol/constants.proto @@ -12,8 +12,14 @@ enum AccessType { enum ResourceType { ANY = 0; - KV = 1; - Mem = 2; - DexMem = 3; + KV = 1; // child of ANY + Mem = 2; // child of ANY + DexMem = 3; // child of MEM + KV_BANK = 4; // child of KV + KV_STAKING = 5; // child of KV + KV_WASM = 6; // child of KV + KV_ORACLE = 7; // child of KV + KV_DEX = 8; // child of KV + KV_EPOCH = 9; // child of KV } diff --git a/types/accesscontrol/constants.pb.go b/types/accesscontrol/constants.pb.go index 1c0073a25..63688d25a 100644 --- a/types/accesscontrol/constants.pb.go +++ b/types/accesscontrol/constants.pb.go @@ -54,10 +54,16 @@ func (AccessType) EnumDescriptor() ([]byte, []int) { type ResourceType int32 const ( - ResourceType_ANY ResourceType = 0 - ResourceType_KV ResourceType = 1 - ResourceType_Mem ResourceType = 2 - ResourceType_DexMem ResourceType = 3 + ResourceType_ANY ResourceType = 0 + ResourceType_KV ResourceType = 1 + ResourceType_Mem ResourceType = 2 + ResourceType_DexMem ResourceType = 3 + ResourceType_KV_BANK ResourceType = 4 + ResourceType_KV_STAKING ResourceType = 5 + ResourceType_KV_WASM ResourceType = 6 + ResourceType_KV_ORACLE ResourceType = 7 + ResourceType_KV_DEX ResourceType = 8 + ResourceType_KV_EPOCH ResourceType = 9 ) var ResourceType_name = map[int32]string{ @@ -65,13 +71,25 @@ var ResourceType_name = map[int32]string{ 1: "KV", 2: "Mem", 3: "DexMem", + 4: "KV_BANK", + 5: "KV_STAKING", + 6: "KV_WASM", + 7: "KV_ORACLE", + 8: "KV_DEX", + 9: "KV_EPOCH", } var ResourceType_value = map[string]int32{ - "ANY": 0, - "KV": 1, - "Mem": 2, - "DexMem": 3, + "ANY": 0, + "KV": 1, + "Mem": 2, + "DexMem": 3, + "KV_BANK": 4, + "KV_STAKING": 5, + "KV_WASM": 6, + "KV_ORACLE": 7, + "KV_DEX": 8, + "KV_EPOCH": 9, } func (x ResourceType) String() string { @@ -92,20 +110,25 @@ func init() { } var fileDescriptor_36568f7561081112 = []byte{ - // 238 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0x4e, 0x4e, 0x2d, 0x2e, 0x4e, 0xce, 0xcf, 0x2b, 0x29, 0xca, 0xcf, - 0xd1, 0x4f, 0xce, 0xcf, 0x2b, 0x2e, 0x49, 0xcc, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, - 0x17, 0x92, 0x81, 0xa8, 0xd2, 0x43, 0x51, 0xa5, 0x57, 0x66, 0x98, 0x94, 0x5a, 0x92, 0x68, 0xa8, - 0x65, 0xc5, 0xc5, 0xe5, 0x08, 0x96, 0x08, 0xa9, 0x2c, 0x48, 0x15, 0xe2, 0xe6, 0x62, 0x0f, 0xf5, - 0xf3, 0xf6, 0xf3, 0x0f, 0xf7, 0x13, 0x60, 0x10, 0xe2, 0xe0, 0x62, 0x09, 0x72, 0x75, 0x74, 0x11, - 0x60, 0x14, 0xe2, 0xe4, 0x62, 0x0d, 0x0f, 0xf2, 0x0c, 0x71, 0x15, 0x60, 0x12, 0xe2, 0xe2, 0x62, - 0x73, 0xf6, 0xf7, 0xf5, 0xf5, 0x0c, 0x11, 0x60, 0xd6, 0x32, 0xe1, 0xe2, 0x09, 0x4a, 0x2d, 0xce, - 0x2f, 0x2d, 0x4a, 0x4e, 0x05, 0xeb, 0x66, 0xe7, 0x62, 0x76, 0xf4, 0x8b, 0x14, 0x60, 0x10, 0x62, - 0xe3, 0x62, 0xf2, 0x0e, 0x13, 0x60, 0x04, 0x09, 0xf8, 0xa6, 0xe6, 0x42, 0x74, 0xb9, 0xa4, 0x56, - 0x80, 0xd8, 0xcc, 0x4e, 0x5e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, - 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, - 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xf5, 0x1a, 0x84, 0xd2, - 0x2d, 0x4e, 0xc9, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x45, 0xf3, 0x6b, 0x12, 0x1b, 0xd8, 0x8b, 0xc6, - 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x34, 0xbb, 0x25, 0x71, 0x0a, 0x01, 0x00, 0x00, + // 307 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x4f, 0x4f, 0xc2, 0x40, + 0x10, 0xc5, 0x5b, 0xfe, 0x14, 0x18, 0xd1, 0x4c, 0xf6, 0x6c, 0x7a, 0xf2, 0x44, 0x62, 0x2b, 0xf1, + 0xe6, 0x6d, 0x81, 0x46, 0x71, 0x6d, 0x6b, 0x4a, 0x5d, 0xd4, 0x4b, 0x03, 0xeb, 0x46, 0x8d, 0xc2, + 0x12, 0x76, 0x31, 0xf2, 0x09, 0xbc, 0xfa, 0xb1, 0x3c, 0x72, 0xf4, 0x68, 0x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e, 0xbf, 0xd6, 0xae, 0xbd, 0x5a, 0xbb, 0xf6, 0xcf, 0xda, 0xb5, 0x3f, 0x37, + 0xae, 0xb5, 0xda, 0xb8, 0xd6, 0xf7, 0xc6, 0xb5, 0xee, 0x4f, 0x1e, 0x9f, 0xcd, 0xd3, 0x62, 0xec, + 0x09, 0x35, 0xf1, 0x77, 0xb8, 0x8a, 0x71, 0xac, 0x1f, 0x5e, 0x7c, 0xb3, 0x9c, 0xc9, 0x7f, 0xfc, + 0xc6, 0xce, 0x16, 0xdb, 0xe9, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x3c, 0xaa, 0x30, 0x5e, + 0x01, 0x00, 0x00, } diff --git a/types/accesscontrol/resource.go b/types/accesscontrol/resource.go index 10bf789cb..518bb734c 100644 --- a/types/accesscontrol/resource.go +++ b/types/accesscontrol/resource.go @@ -6,10 +6,16 @@ type TreeNode struct { } var ResourceTree = map[ResourceType]TreeNode{ - ResourceType_ANY: {ResourceType_ANY, []ResourceType{ResourceType_KV, ResourceType_Mem}}, - ResourceType_KV: {ResourceType_ANY, []ResourceType{}}, - ResourceType_Mem: {ResourceType_ANY, []ResourceType{ResourceType_DexMem}}, - ResourceType_DexMem: {ResourceType_Mem, []ResourceType{}}, + ResourceType_ANY: {ResourceType_ANY, []ResourceType{ResourceType_KV, ResourceType_Mem}}, + ResourceType_KV: {ResourceType_ANY, []ResourceType{}}, + ResourceType_Mem: {ResourceType_ANY, []ResourceType{ResourceType_DexMem}}, + ResourceType_DexMem: {ResourceType_Mem, []ResourceType{}}, + ResourceType_KV_BANK: {ResourceType_KV, []ResourceType{}}, + ResourceType_KV_STAKING: {ResourceType_KV, []ResourceType{}}, + ResourceType_KV_WASM: {ResourceType_KV, []ResourceType{}}, + ResourceType_KV_EPOCH: {ResourceType_KV, []ResourceType{}}, + ResourceType_KV_ORACLE: {ResourceType_KV, []ResourceType{}}, + ResourceType_KV_DEX: {ResourceType_KV, []ResourceType{}}, } // This returns a slice of all resource types that are dependent to a specific resource type