diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index d4ccac089..6c3e7d59a 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -803,6 +803,7 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode runTxMode) (*s ) if handler := app.msgServiceRouter.Handler(msg); handler != nil { + ctx = ctx.WithMessageIndex(i) // ADR 031 request type routing msgResult, err = handler(ctx, msg) eventMsgName = sdk.MsgTypeURL(msg) diff --git a/proto/cosmos/accesscontrol/accesscontrol.proto b/proto/cosmos/accesscontrol/accesscontrol.proto index a54d910d3..fc2f6b19d 100644 --- a/proto/cosmos/accesscontrol/accesscontrol.proto +++ b/proto/cosmos/accesscontrol/accesscontrol.proto @@ -4,8 +4,7 @@ package cosmos.accesscontrol.v1beta1; import "gogoproto/gogo.proto"; import "cosmos/accesscontrol/constants.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/accesscontrol/types"; - +option go_package = "github.com/cosmos/cosmos-sdk/types/accesscontrol"; message AccessOperation { AccessType access_type = 1; diff --git a/proto/cosmos/accesscontrol/constants.proto b/proto/cosmos/accesscontrol/constants.proto index 8209546c0..8c7a2e07d 100644 --- a/proto/cosmos/accesscontrol/constants.proto +++ b/proto/cosmos/accesscontrol/constants.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos.accesscontrol.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/accesscontrol/types"; +option go_package = "github.com/cosmos/cosmos-sdk/types/accesscontrol"; enum AccessType { UNKNOWN = 0; diff --git a/proto/cosmos/accesscontrol/genesis.proto b/proto/cosmos/accesscontrol_genesis/genesis.proto similarity index 77% rename from proto/cosmos/accesscontrol/genesis.proto rename to proto/cosmos/accesscontrol_genesis/genesis.proto index 8ebf7a06b..52341abdb 100644 --- a/proto/cosmos/accesscontrol/genesis.proto +++ b/proto/cosmos/accesscontrol_genesis/genesis.proto @@ -1,8 +1,7 @@ syntax = "proto3"; -package cosmos.accesscontrol.v1beta1; +package cosmos.accesscontrol_genesis.v1beta1; import "gogoproto/gogo.proto"; -import "cosmos/accesscontrol/constants.proto"; import "cosmos/accesscontrol/accesscontrol.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/accesscontrol/types"; @@ -11,7 +10,7 @@ message GenesisState { Params params = 1 [(gogoproto.nullable) = false]; // mapping between every message type and its predetermined resource read/write sequence - repeated MessageDependencyMapping message_dependency_mapping = 2 [ + repeated cosmos.accesscontrol.v1beta1.MessageDependencyMapping message_dependency_mapping = 2 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"message_dependency_mapping\"" ]; diff --git a/x/accesscontrol/types/access_operation.go b/types/accesscontrol/access_operation.go similarity index 87% rename from x/accesscontrol/types/access_operation.go rename to types/accesscontrol/access_operation.go index da43f9a2a..452faec10 100644 --- a/x/accesscontrol/types/access_operation.go +++ b/types/accesscontrol/access_operation.go @@ -1,4 +1,4 @@ -package types +package accesscontrol import ( fmt "fmt" diff --git a/x/accesscontrol/types/accesscontrol.pb.go b/types/accesscontrol/accesscontrol.pb.go similarity index 95% rename from x/accesscontrol/types/accesscontrol.pb.go rename to types/accesscontrol/accesscontrol.pb.go index 71c00858e..48d4a5362 100644 --- a/x/accesscontrol/types/accesscontrol.pb.go +++ b/types/accesscontrol/accesscontrol.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: cosmos/accesscontrol/accesscontrol.proto -package types +package accesscontrol import ( fmt "fmt" @@ -145,29 +145,29 @@ func init() { } var fileDescriptor_d636a082612ba091 = []byte{ - // 348 bytes of a gzipped FileDescriptorProto + // 347 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xc1, 0x6a, 0xf2, 0x40, 0x10, 0xc7, 0xb3, 0xfa, 0xf1, 0x81, 0xeb, 0xf7, 0xb5, 0xb0, 0xed, 0x21, 0x48, 0x89, 0x22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bf, 0xd9, 0xc4, 0x6e, 0x9b, 0xfd, 0x3f, 0x8b, 0x55, 0xd3, 0x89, 0x6a, 0xb4, 0x2c, 0xeb, 0xfe, 0xdd, 0x62, 0xed, 0xa1, 0xe5, 0xda, 0x43, 0xef, 0x6b, 0x0f, 0xbd, 0x6e, 0x3c, 0x67, 0xb9, 0xf1, 0x9c, 0xb7, 0x8d, - 0xe7, 0xdc, 0xf7, 0x92, 0xd4, 0x3c, 0xce, 0xc7, 0x01, 0x13, 0x59, 0x58, 0x5e, 0xcf, 0x3e, 0x1d, - 0x3d, 0x99, 0x86, 0xcf, 0xdf, 0x4e, 0xb9, 0xdd, 0xa7, 0x1e, 0xff, 0x2d, 0xee, 0x78, 0xf9, 0x11, - 0x00, 0x00, 0xff, 0xff, 0x6d, 0x7a, 0x65, 0x41, 0x4d, 0x02, 0x00, 0x00, + 0xe7, 0x3c, 0x5c, 0x26, 0xa9, 0x79, 0x9a, 0x8f, 0x03, 0x26, 0xb2, 0xb0, 0xbc, 0x9e, 0x7d, 0x3a, + 0x7a, 0x32, 0x0d, 0xb7, 0xfb, 0xfb, 0x76, 0xce, 0xf1, 0xdf, 0xe2, 0x8a, 0x57, 0x1f, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x08, 0x42, 0x61, 0x26, 0x4b, 0x02, 0x00, 0x00, } func (m *AccessOperation) Marshal() (dAtA []byte, err error) { diff --git a/x/accesscontrol/types/constants.pb.go b/types/accesscontrol/constants.pb.go similarity index 89% rename from x/accesscontrol/types/constants.pb.go rename to types/accesscontrol/constants.pb.go index 4be83860f..1c0073a25 100644 --- a/x/accesscontrol/types/constants.pb.go +++ b/types/accesscontrol/constants.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: cosmos/accesscontrol/constants.proto -package types +package accesscontrol import ( fmt "fmt" @@ -92,7 +92,7 @@ func init() { } var fileDescriptor_36568f7561081112 = []byte{ - // 240 bytes of a gzipped FileDescriptorProto + // 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, @@ -103,9 +103,9 @@ var fileDescriptor_36568f7561081112 = []byte{ 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, 0x3e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, + 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, - 0x94, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xf5, 0x1a, 0x84, 0xd2, - 0x2d, 0x4e, 0xc9, 0xd6, 0xaf, 0x40, 0xf3, 0x67, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, - 0x93, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x1e, 0xf7, 0xf6, 0x0c, 0x01, 0x00, 0x00, + 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, } diff --git a/types/context.go b/types/context.go index 60d3ca267..fa3184b81 100644 --- a/types/context.go +++ b/types/context.go @@ -12,6 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/gaskv" stypes "github.com/cosmos/cosmos-sdk/store/types" + acltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" ) /* @@ -39,8 +40,18 @@ type Context struct { consParams *tmproto.ConsensusParams eventManager *EventManager priority int64 // The tx priority, only relevant in CheckTx + + txBlockingChannels MessageAccessOpsChannelMapping + txCompletionChannels MessageAccessOpsChannelMapping + messageIndex int // Used to track current message being processed } +// Alias for Map of MessageIndex -> AccessOperation -> Channel +type MessageAccessOpsChannelMapping = map[int]AccessOpsChannelMapping + +// Alias for Map of AccessOperation -> Channel +type AccessOpsChannelMapping = map[*acltypes.AccessOperation][]chan interface{} + // Proposed rename, not done to avoid API breakage type Request = Context @@ -60,6 +71,9 @@ func (c Context) IsReCheckTx() bool { return c.recheckTx } func (c Context) MinGasPrices() DecCoins { return c.minGasPrice } func (c Context) EventManager() *EventManager { return c.eventManager } func (c Context) Priority() int64 { return c.priority } +func (c Context) TxCompletionChannels() MessageAccessOpsChannelMapping { return c.txCompletionChannels } +func (c Context) TxBlockingChannels() MessageAccessOpsChannelMapping { return c.txBlockingChannels } +func (c Context) MessageIndex() int { return c.messageIndex } // clone the header before returning func (c Context) BlockHeader() tmproto.Header { @@ -222,6 +236,24 @@ func (c Context) WithEventManager(em *EventManager) Context { return c } +// WithTxCompletionChannels returns a Context with an updated list of completion channel +func (c Context) WithTxCompletionChannels(completionChannels MessageAccessOpsChannelMapping) Context { + c.txCompletionChannels = completionChannels + return c +} + +// WithTxBlockingChannels returns a Context with an updated list of blocking channels for completion signals +func (c Context) WithTxBlockingChannels(blockingChannels MessageAccessOpsChannelMapping) Context { + c.txBlockingChannels = blockingChannels + return c +} + +// WithMessageIndex returns a Context with the current message index that's being processed +func (c Context) WithMessageIndex(messageIndex int) Context { + c.messageIndex = messageIndex + return c +} + // TODO: remove??? func (c Context) IsZero() bool { return c.ms == nil diff --git a/types/tx_msg.go b/types/tx_msg.go index 42d01fdc5..b88d4e735 100644 --- a/types/tx_msg.go +++ b/types/tx_msg.go @@ -78,4 +78,4 @@ type TxEncoder func(tx Tx) ([]byte, error) // MsgTypeURL returns the TypeURL of a `sdk.Msg`. func MsgTypeURL(msg Msg) string { return "/" + proto.MessageName(msg) -} +} \ No newline at end of file diff --git a/x/accesscontrol/keeper/genesis.go b/x/accesscontrol/keeper/genesis.go index 0ca282093..85f01ecf2 100644 --- a/x/accesscontrol/keeper/genesis.go +++ b/x/accesscontrol/keeper/genesis.go @@ -2,7 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - + acltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" "github.com/cosmos/cosmos-sdk/x/accesscontrol/types" ) @@ -14,8 +14,8 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { } func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - resourceDepedencyMappings := []types.MessageDependencyMapping{} - k.IterateResourceKeys(ctx, func(dependencyMapping types.MessageDependencyMapping) (stop bool) { + resourceDepedencyMappings := []acltypes.MessageDependencyMapping{} + k.IterateResourceKeys(ctx, func(dependencyMapping acltypes.MessageDependencyMapping) (stop bool) { resourceDepedencyMappings = append(resourceDepedencyMappings, dependencyMapping) return false }) diff --git a/x/accesscontrol/keeper/keeper.go b/x/accesscontrol/keeper/keeper.go index 97b651c3d..3f9de3931 100644 --- a/x/accesscontrol/keeper/keeper.go +++ b/x/accesscontrol/keeper/keeper.go @@ -8,8 +8,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + acltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" "github.com/cosmos/cosmos-sdk/x/accesscontrol/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) @@ -41,17 +41,17 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -func (k Keeper) GetResourceDependencyMapping(ctx sdk.Context, messageKey string) types.MessageDependencyMapping { +func (k Keeper) GetResourceDependencyMapping(ctx sdk.Context, messageKey string) acltypes.MessageDependencyMapping { store := ctx.KVStore(k.storeKey) b := store.Get(types.GetResourceDependencyKey(messageKey)) - dependencyMapping := types.MessageDependencyMapping{} + dependencyMapping := acltypes.MessageDependencyMapping{} k.cdc.MustUnmarshal(b, &dependencyMapping) return dependencyMapping } func (k Keeper) SetResourceDependencyMapping( ctx sdk.Context, - dependencyMapping types.MessageDependencyMapping, + dependencyMapping acltypes.MessageDependencyMapping, ) error { err := types.ValidateMessageDependencyMapping(dependencyMapping) if err != nil { @@ -64,12 +64,12 @@ func (k Keeper) SetResourceDependencyMapping( return nil } -func (k Keeper) IterateResourceKeys(ctx sdk.Context, handler func(dependencyMapping types.MessageDependencyMapping) (stop bool)) { +func (k Keeper) IterateResourceKeys(ctx sdk.Context, handler func(dependencyMapping acltypes.MessageDependencyMapping) (stop bool)) { store := ctx.KVStore(k.storeKey) iter := sdk.KVStorePrefixIterator(store, types.GetResourceDependencyMappingKey()) defer iter.Close() for ; iter.Valid(); iter.Next() { - dependencyMapping := types.MessageDependencyMapping{} + dependencyMapping := acltypes.MessageDependencyMapping{} k.cdc.MustUnmarshal(iter.Value(), &dependencyMapping) if handler(dependencyMapping) { break diff --git a/x/accesscontrol/types/genesis.go b/x/accesscontrol/types/genesis.go index e45d81886..6282f5f1e 100644 --- a/x/accesscontrol/types/genesis.go +++ b/x/accesscontrol/types/genesis.go @@ -4,22 +4,23 @@ import ( "encoding/json" "github.com/cosmos/cosmos-sdk/codec" + acltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" ) -func DefaultMessageDependencyMapping() []MessageDependencyMapping { - return []MessageDependencyMapping{ +func DefaultMessageDependencyMapping() []acltypes.MessageDependencyMapping { + return []acltypes.MessageDependencyMapping{ { MessageKey: "", - AccessOps: []AccessOperation{ - {AccessType: AccessType_UNKNOWN, ResourceType: ResourceType_ANY, IdentifierTemplate: "*"}, - {AccessType: AccessType_COMMIT, ResourceType: ResourceType_ANY, IdentifierTemplate: "*"}, + AccessOps: []acltypes.AccessOperation{ + {AccessType: acltypes.AccessType_UNKNOWN, ResourceType: acltypes.ResourceType_ANY, IdentifierTemplate: "*"}, + {AccessType: acltypes.AccessType_COMMIT, ResourceType: acltypes.ResourceType_ANY, IdentifierTemplate: "*"}, }, }, } } // NewGenesisState creates a new GenesisState object -func NewGenesisState(params Params, messageDependencyMapping []MessageDependencyMapping) *GenesisState { +func NewGenesisState(params Params, messageDependencyMapping []acltypes.MessageDependencyMapping) *GenesisState { return &GenesisState{ Params: params, MessageDependencyMapping: messageDependencyMapping, diff --git a/x/accesscontrol/types/genesis.pb.go b/x/accesscontrol/types/genesis.pb.go index 36ab7cd0a..7b9d9a594 100644 --- a/x/accesscontrol/types/genesis.pb.go +++ b/x/accesscontrol/types/genesis.pb.go @@ -1,10 +1,11 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/accesscontrol/genesis.proto +// source: cosmos/accesscontrol_genesis/genesis.proto package types import ( fmt "fmt" + accesscontrol "github.com/cosmos/cosmos-sdk/types/accesscontrol" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -26,14 +27,14 @@ 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 []MessageDependencyMapping `protobuf:"bytes,2,rep,name=message_dependency_mapping,json=messageDependencyMapping,proto3" json:"message_dependency_mapping" yaml:"message_dependency_mapping"` + MessageDependencyMapping []accesscontrol.MessageDependencyMapping `protobuf:"bytes,2,rep,name=message_dependency_mapping,json=messageDependencyMapping,proto3" json:"message_dependency_mapping" yaml:"message_dependency_mapping"` } func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_70bf81890cee44c6, []int{0} + return fileDescriptor_e8a7226192860e6d, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -69,7 +70,7 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetMessageDependencyMapping() []MessageDependencyMapping { +func (m *GenesisState) GetMessageDependencyMapping() []accesscontrol.MessageDependencyMapping { if m != nil { return m.MessageDependencyMapping } @@ -82,7 +83,7 @@ type Params struct { func (m *Params) Reset() { *m = Params{} } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_70bf81890cee44c6, []int{1} + return fileDescriptor_e8a7226192860e6d, []int{1} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -112,36 +113,35 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo func init() { - proto.RegisterType((*GenesisState)(nil), "cosmos.accesscontrol.v1beta1.GenesisState") - proto.RegisterType((*Params)(nil), "cosmos.accesscontrol.v1beta1.Params") + proto.RegisterType((*GenesisState)(nil), "cosmos.accesscontrol_genesis.v1beta1.GenesisState") + proto.RegisterType((*Params)(nil), "cosmos.accesscontrol_genesis.v1beta1.Params") } func init() { - proto.RegisterFile("cosmos/accesscontrol/genesis.proto", fileDescriptor_70bf81890cee44c6) + proto.RegisterFile("cosmos/accesscontrol_genesis/genesis.proto", fileDescriptor_e8a7226192860e6d) } -var fileDescriptor_70bf81890cee44c6 = []byte{ - // 309 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0xce, 0x2f, 0xce, +var fileDescriptor_e8a7226192860e6d = []byte{ + // 299 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4a, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0x4e, 0x4e, 0x2d, 0x2e, 0x4e, 0xce, 0xcf, 0x2b, 0x29, 0xca, 0xcf, - 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, - 0x81, 0xa8, 0xd1, 0x43, 0x51, 0xa3, 0x57, 0x66, 0x98, 0x94, 0x5a, 0x92, 0x68, 0x28, 0x25, 0x92, - 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa8, 0x0f, 0x62, 0x41, 0xf4, 0x48, 0xa9, 0x60, 0x35, 0x37, 0x39, - 0x3f, 0xaf, 0xb8, 0x24, 0x31, 0xaf, 0x04, 0x6a, 0xb2, 0x94, 0x06, 0x56, 0x55, 0xa8, 0xf6, 0x80, - 0x55, 0x2a, 0x7d, 0x61, 0xe4, 0xe2, 0x71, 0x87, 0xb8, 0x2a, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, - 0x89, 0x8b, 0xad, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, - 0x45, 0x0f, 0x9f, 0x2b, 0xf5, 0x02, 0xc0, 0x6a, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, - 0xea, 0x14, 0x9a, 0xcf, 0xc8, 0x25, 0x95, 0x9b, 0x5a, 0x5c, 0x9c, 0x98, 0x9e, 0x1a, 0x9f, 0x92, - 0x5a, 0x90, 0x9a, 0x97, 0x92, 0x9a, 0x97, 0x5c, 0x19, 0x9f, 0x9b, 0x58, 0x50, 0x90, 0x99, 0x97, - 0x2e, 0xc1, 0xa4, 0xc0, 0xac, 0xc1, 0x6d, 0x64, 0x86, 0xdf, 0x60, 0x5f, 0x88, 0x7e, 0x17, 0xb8, - 0x76, 0x5f, 0x88, 0x6e, 0x27, 0x4d, 0x90, 0x55, 0x9f, 0xee, 0xc9, 0x2b, 0x56, 0x26, 0xe6, 0xe6, - 0x58, 0x29, 0xe1, 0xb6, 0x47, 0x29, 0x48, 0x22, 0x17, 0x87, 0x21, 0x4a, 0x7c, 0x5c, 0x6c, 0x10, - 0x97, 0x5b, 0xb1, 0xcc, 0x58, 0x20, 0xcf, 0xe0, 0xe4, 0x73, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, - 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, - 0xc7, 0x72, 0x0c, 0x51, 0x46, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, - 0xd0, 0x50, 0x85, 0x50, 0xba, 0xc5, 0x29, 0xd9, 0xfa, 0x15, 0x68, 0x41, 0x5c, 0x52, 0x59, 0x90, - 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x5b, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x7e, 0x82, - 0xdb, 0x05, 0x02, 0x00, 0x00, + 0x89, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x87, 0xd2, 0x7a, 0x05, 0x45, 0xf9, 0x25, + 0xf9, 0x42, 0x2a, 0x10, 0xb5, 0x7a, 0x58, 0xd5, 0xea, 0x95, 0x19, 0x26, 0xa5, 0x96, 0x24, 0x1a, + 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x35, 0xe8, 0x83, 0x58, 0x10, 0xbd, 0x52, 0x1a, 0xd8, + 0xec, 0x41, 0xe5, 0x41, 0x54, 0x2a, 0xfd, 0x61, 0xe4, 0xe2, 0x71, 0x87, 0x98, 0x19, 0x5c, 0x92, + 0x58, 0x92, 0x2a, 0xe4, 0xc5, 0xc5, 0x56, 0x90, 0x58, 0x94, 0x98, 0x5b, 0x2c, 0xc1, 0xa8, 0xc0, + 0xa8, 0xc1, 0x6d, 0xa4, 0xa3, 0x47, 0x8c, 0x3b, 0xf4, 0x02, 0xc0, 0x7a, 0x9c, 0x58, 0x4e, 0xdc, + 0x93, 0x67, 0x08, 0x82, 0x9a, 0x20, 0x34, 0x9f, 0x91, 0x4b, 0x2a, 0x37, 0xb5, 0xb8, 0x38, 0x31, + 0x3d, 0x35, 0x3e, 0x25, 0xb5, 0x20, 0x35, 0x2f, 0x25, 0x35, 0x2f, 0xb9, 0x32, 0x3e, 0x37, 0xb1, + 0xa0, 0x20, 0x33, 0x2f, 0x5d, 0x82, 0x49, 0x81, 0x59, 0x83, 0xdb, 0xc8, 0x0c, 0xab, 0x05, 0x70, + 0x83, 0x7d, 0x21, 0xfa, 0x5d, 0xe0, 0xda, 0x7d, 0x21, 0xba, 0x9d, 0x34, 0x41, 0x56, 0x7d, 0xba, + 0x27, 0xaf, 0x58, 0x99, 0x98, 0x9b, 0x63, 0xa5, 0x84, 0xdb, 0x1e, 0xa5, 0x20, 0x89, 0x5c, 0x1c, + 0x86, 0x28, 0xf1, 0x71, 0xb1, 0x41, 0x5c, 0x6e, 0xc5, 0x32, 0x63, 0x81, 0x3c, 0x83, 0x93, 0xcf, + 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, + 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, 0xa5, 0x67, 0x96, 0x64, 0x94, + 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x43, 0x17, 0x42, 0xe9, 0x16, 0xa7, 0x64, 0xeb, 0x57, + 0xa0, 0x05, 0x75, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x8c, 0x8d, 0x01, 0x01, 0x00, + 0x00, 0xff, 0xff, 0xe9, 0xaa, 0xc5, 0x46, 0xf7, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -348,7 +348,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MessageDependencyMapping = append(m.MessageDependencyMapping, MessageDependencyMapping{}) + m.MessageDependencyMapping = append(m.MessageDependencyMapping, accesscontrol.MessageDependencyMapping{}) if err := m.MessageDependencyMapping[len(m.MessageDependencyMapping)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/accesscontrol/types/message_dependency_mapping.go b/x/accesscontrol/types/message_dependency_mapping.go index 82a1247d6..32feafd4c 100644 --- a/x/accesscontrol/types/message_dependency_mapping.go +++ b/x/accesscontrol/types/message_dependency_mapping.go @@ -4,6 +4,7 @@ import ( fmt "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + acltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" "github.com/gogo/protobuf/proto" ) @@ -13,9 +14,9 @@ func GenerateMessageKey(msg sdk.Msg) string { return proto.MessageName(msg) } -func ValidateMessageDependencyMapping(mapping MessageDependencyMapping) error { +func ValidateMessageDependencyMapping(mapping acltypes.MessageDependencyMapping) error { lastAccessOp := mapping.AccessOps[len(mapping.AccessOps)-1] - if lastAccessOp.AccessType != AccessType_COMMIT { + if lastAccessOp.AccessType != acltypes.AccessType_COMMIT { return ErrNoCommitAccessOp } return nil