|
|
|
@@ -0,0 +1,552 @@
|
|
|
|
|
package types
|
|
|
|
|
|
|
|
|
|
// msg_services.go holds the x/services Msg* types implementing sdk.Msg
|
|
|
|
|
// (P5-01-01, REQ-037; G-006 controlled exception: types/ gains the
|
|
|
|
|
// cosmos-sdk import for sdk.Msg — D-055; the invariant/lexicon tests in
|
|
|
|
|
// *_test.go stay stdlib-only per G-024, isolated from this msg_*.go
|
|
|
|
|
// file). Each Msg carries a ValidateBasic (stateless) and GetSigners.
|
|
|
|
|
//
|
|
|
|
|
// The eight Services Msg types drive the Care/SIM/Vault/Mail runtime
|
|
|
|
|
// (REQ-037, A-551 per-kind typed dispatch — one Msg* per ServiceKind,
|
|
|
|
|
// NOT a generic MsgInvokeService):
|
|
|
|
|
//
|
|
|
|
|
// Lifecycle (kind-agnostic):
|
|
|
|
|
// - MsgRegisterService: register a service (operator-reach-id valid;
|
|
|
|
|
// window-id must reference an Active Window — checked via the
|
|
|
|
|
// WindowKeeper shim at the handler; status=Pending).
|
|
|
|
|
// - MsgActivateService: Pending → Active (window-id must still be
|
|
|
|
|
// Active — A-552 window-grant-on-every-op).
|
|
|
|
|
// - MsgSuspendService: Active → Suspended.
|
|
|
|
|
// - MsgRevokeService: any → Revoked (terminal; revocation requires
|
|
|
|
|
// the Window grantor or a Watcher quorum — simtest wiring uses a
|
|
|
|
|
// nil WindowKeeper for the grantor check).
|
|
|
|
|
//
|
|
|
|
|
// Per-kind (typed dispatch — A-551):
|
|
|
|
|
// - MsgIssueCareGrant (Care) — issue a community-care grant.
|
|
|
|
|
// - MsgActivateSIM (SIM) — activate a connectivity SIM.
|
|
|
|
|
// - MsgProvisionVault (Vault) — provision storage-quota-grain via
|
|
|
|
|
// the VaultKeeper shim (A-553: references x/vault by ID-string;
|
|
|
|
|
// G-003 — no struct import of x/vault/types).
|
|
|
|
|
// - MsgBindMailbox (Mail) — bind a messaging mailbox.
|
|
|
|
|
//
|
|
|
|
|
// All cross-module refs are by-ID-string (G-003): service-id is this
|
|
|
|
|
// service's ID; operator-reach-id references an x/identity Reach by
|
|
|
|
|
// ID-string; window-id references an x/window Window by ID-string
|
|
|
|
|
// (A-307). GetSigners returns the signer reach-ids encoded as
|
|
|
|
|
// sdk.AccAddress bytes. The reach-id is the lexicon-clean holder
|
|
|
|
|
// identifier (G-003 — NOT a banned financial-holder term; use
|
|
|
|
|
// Holder/Reach).
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// --- MsgRegisterService ------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// MsgRegisterService registers a service (status=Pending). The handler
|
|
|
|
|
// enforces the window-id must reference an Active Window via the
|
|
|
|
|
// WindowKeeper shim (A-552). ValidateBasic is stateless: non-empty
|
|
|
|
|
// service-id, non-empty operator-reach-id, non-empty window-id, a known
|
|
|
|
|
// ServiceKind, non-empty name, non-empty signer.
|
|
|
|
|
type MsgRegisterService struct {
|
|
|
|
|
ServiceID string `json:"service_id" yaml:"service_id"`
|
|
|
|
|
Kind ServiceKind `json:"kind" yaml:"kind"`
|
|
|
|
|
OperatorReachID string `json:"operator_reach_id" yaml:"operator_reach_id"`
|
|
|
|
|
Name string `json:"name" yaml:"name"`
|
|
|
|
|
WindowID string `json:"window_id" yaml:"window_id"`
|
|
|
|
|
Signer string `json:"signer" yaml:"signer"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message (sdk.Msg = proto.Message).
|
|
|
|
|
func (m *MsgRegisterService) Reset() { *m = MsgRegisterService{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgRegisterService) String() string {
|
|
|
|
|
return fmt.Sprintf("MsgRegisterService{ServiceID:%s Kind:%s OperatorReachID:%s Name:%s WindowID:%s Signer:%s}",
|
|
|
|
|
m.ServiceID, m.Kind, m.OperatorReachID, m.Name, m.WindowID, m.Signer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgRegisterService) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// ValidateBasic is the stateless validation: non-empty service-id, a
|
|
|
|
|
// known ServiceKind, non-empty operator-reach-id, non-empty name,
|
|
|
|
|
// non-empty window-id, non-empty signer. The handler enforces the
|
|
|
|
|
// stateful Window-Active check via the WindowKeeper shim (A-552) +
|
|
|
|
|
// idempotency (service-id must not already exist).
|
|
|
|
|
func (m *MsgRegisterService) ValidateBasic() error {
|
|
|
|
|
if m.ServiceID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty service-id")
|
|
|
|
|
}
|
|
|
|
|
if !knownServiceKind(m.Kind) {
|
|
|
|
|
return fmt.Errorf("services: unknown service kind %q", m.Kind)
|
|
|
|
|
}
|
|
|
|
|
if m.OperatorReachID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty operator-reach-id")
|
|
|
|
|
}
|
|
|
|
|
if m.Name == "" {
|
|
|
|
|
return fmt.Errorf("services: empty name")
|
|
|
|
|
}
|
|
|
|
|
if m.WindowID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty window-id")
|
|
|
|
|
}
|
|
|
|
|
if m.Signer == "" {
|
|
|
|
|
return fmt.Errorf("services: empty signer")
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetSigners returns the signer's reach-id as sdk.AccAddress bytes.
|
|
|
|
|
func (m *MsgRegisterService) GetSigners() []sdk.AccAddress {
|
|
|
|
|
return []sdk.AccAddress{[]byte(m.Signer)}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- MsgActivateService ------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// MsgActivateService transitions a service Pending → Active. The
|
|
|
|
|
// handler enforces the window-id on the existing service must still be
|
|
|
|
|
// Active (A-552 window-grant-on-every-op). ValidateBasic is stateless:
|
|
|
|
|
// non-empty service-id, non-empty signer.
|
|
|
|
|
type MsgActivateService struct {
|
|
|
|
|
ServiceID string `json:"service_id" yaml:"service_id"`
|
|
|
|
|
Signer string `json:"signer" yaml:"signer"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgActivateService) Reset() { *m = MsgActivateService{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgActivateService) String() string {
|
|
|
|
|
return fmt.Sprintf("MsgActivateService{ServiceID:%s Signer:%s}", m.ServiceID, m.Signer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgActivateService) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// ValidateBasic is the stateless validation: non-empty service-id,
|
|
|
|
|
// non-empty signer. The handler enforces the stateful source-status
|
|
|
|
|
// check (must be Pending) and the window-grant Active check (A-552).
|
|
|
|
|
func (m *MsgActivateService) ValidateBasic() error {
|
|
|
|
|
if m.ServiceID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty service-id")
|
|
|
|
|
}
|
|
|
|
|
if m.Signer == "" {
|
|
|
|
|
return fmt.Errorf("services: empty signer")
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetSigners returns the signer's reach-id as sdk.AccAddress bytes.
|
|
|
|
|
func (m *MsgActivateService) GetSigners() []sdk.AccAddress {
|
|
|
|
|
return []sdk.AccAddress{[]byte(m.Signer)}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- MsgSuspendService -------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// MsgSuspendService transitions a service Active → Suspended. The
|
|
|
|
|
// handler enforces the window-id on the existing service must still be
|
|
|
|
|
// Active (A-552 window-grant-on-every-op — a revoked Window
|
|
|
|
|
// invalidates the transition). ValidateBasic is stateless: non-empty
|
|
|
|
|
// service-id, non-empty signer.
|
|
|
|
|
type MsgSuspendService struct {
|
|
|
|
|
ServiceID string `json:"service_id" yaml:"service_id"`
|
|
|
|
|
Signer string `json:"signer" yaml:"signer"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgSuspendService) Reset() { *m = MsgSuspendService{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgSuspendService) String() string {
|
|
|
|
|
return fmt.Sprintf("MsgSuspendService{ServiceID:%s Signer:%s}", m.ServiceID, m.Signer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgSuspendService) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// ValidateBasic is the stateless validation: non-empty service-id,
|
|
|
|
|
// non-empty signer. The handler enforces the stateful source-status
|
|
|
|
|
// check (must be Active) and the window-grant Active check (A-552).
|
|
|
|
|
func (m *MsgSuspendService) ValidateBasic() error {
|
|
|
|
|
if m.ServiceID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty service-id")
|
|
|
|
|
}
|
|
|
|
|
if m.Signer == "" {
|
|
|
|
|
return fmt.Errorf("services: empty signer")
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetSigners returns the signer's reach-id as sdk.AccAddress bytes.
|
|
|
|
|
func (m *MsgSuspendService) GetSigners() []sdk.AccAddress {
|
|
|
|
|
return []sdk.AccAddress{[]byte(m.Signer)}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- MsgRevokeService --------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// MsgRevokeService transitions a service to Revoked (terminal). The
|
|
|
|
|
// handler enforces the window-id on the existing service must still be
|
|
|
|
|
// Active (A-552 window-grant-on-every-op — a revoked Window invalidates
|
|
|
|
|
// the revocation too, mirroring the grantor-authorized revoke path).
|
|
|
|
|
// Revocation in the simtest is grantor-authorized via the signer reach-
|
|
|
|
|
// id; a Watcher quorum path is documented for the live chain (v0.6+).
|
|
|
|
|
// ValidateBasic is stateless: non-empty service-id, non-empty signer.
|
|
|
|
|
type MsgRevokeService struct {
|
|
|
|
|
ServiceID string `json:"service_id" yaml:"service_id"`
|
|
|
|
|
Signer string `json:"signer" yaml:"signer"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgRevokeService) Reset() { *m = MsgRevokeService{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgRevokeService) String() string {
|
|
|
|
|
return fmt.Sprintf("MsgRevokeService{ServiceID:%s Signer:%s}", m.ServiceID, m.Signer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgRevokeService) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// ValidateBasic is the stateless validation: non-empty service-id,
|
|
|
|
|
// non-empty signer. The handler enforces the stateful source-status
|
|
|
|
|
// check (must not already be Revoked — idempotent reject) and the
|
|
|
|
|
// window-grant Active check (A-552).
|
|
|
|
|
func (m *MsgRevokeService) ValidateBasic() error {
|
|
|
|
|
if m.ServiceID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty service-id")
|
|
|
|
|
}
|
|
|
|
|
if m.Signer == "" {
|
|
|
|
|
return fmt.Errorf("services: empty signer")
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetSigners returns the signer's reach-id as sdk.AccAddress bytes.
|
|
|
|
|
func (m *MsgRevokeService) GetSigners() []sdk.AccAddress {
|
|
|
|
|
return []sdk.AccAddress{[]byte(m.Signer)}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- MsgIssueCareGrant (Care — A-551 typed dispatch) ------------------------
|
|
|
|
|
|
|
|
|
|
// MsgIssueCareGrant issues a community-care grant against a Care service
|
|
|
|
|
// (ServiceKind=Care — A-551 per-kind typed dispatch, NOT a generic
|
|
|
|
|
// MsgInvokeService). The handler enforces the window-id on the existing
|
|
|
|
|
// Care service must still be Active (A-552 window-grant-on-every-op).
|
|
|
|
|
// ValidateBasic is stateless: non-empty service-id, non-empty
|
|
|
|
|
// care-kind, non-empty grant-recipient-reach-id, non-empty signer.
|
|
|
|
|
type MsgIssueCareGrant struct {
|
|
|
|
|
ServiceID string `json:"service_id" yaml:"service_id"`
|
|
|
|
|
CareKind string `json:"care_kind" yaml:"care_kind"`
|
|
|
|
|
GrantRecipientReachID string `json:"grant_recipient_reach_id" yaml:"grant_recipient_reach_id"`
|
|
|
|
|
Signer string `json:"signer" yaml:"signer"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgIssueCareGrant) Reset() { *m = MsgIssueCareGrant{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgIssueCareGrant) String() string {
|
|
|
|
|
return fmt.Sprintf("MsgIssueCareGrant{ServiceID:%s CareKind:%s GrantRecipientReachID:%s Signer:%s}",
|
|
|
|
|
m.ServiceID, m.CareKind, m.GrantRecipientReachID, m.Signer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgIssueCareGrant) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// ValidateBasic is the stateless validation: non-empty service-id,
|
|
|
|
|
// non-empty care-kind, non-empty grant-recipient-reach-id, non-empty
|
|
|
|
|
// signer. The handler enforces the stateful service-exists + kind=Care
|
|
|
|
|
// + window-grant Active checks (A-552).
|
|
|
|
|
func (m *MsgIssueCareGrant) ValidateBasic() error {
|
|
|
|
|
if m.ServiceID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty service-id")
|
|
|
|
|
}
|
|
|
|
|
if m.CareKind == "" {
|
|
|
|
|
return fmt.Errorf("services: empty care-kind")
|
|
|
|
|
}
|
|
|
|
|
if m.GrantRecipientReachID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty grant-recipient-reach-id")
|
|
|
|
|
}
|
|
|
|
|
if m.Signer == "" {
|
|
|
|
|
return fmt.Errorf("services: empty signer")
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetSigners returns the signer's reach-id as sdk.AccAddress bytes.
|
|
|
|
|
func (m *MsgIssueCareGrant) GetSigners() []sdk.AccAddress {
|
|
|
|
|
return []sdk.AccAddress{[]byte(m.Signer)}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- MsgActivateSIM (SIM — A-551 typed dispatch) ----------------------------
|
|
|
|
|
|
|
|
|
|
// MsgActivateSIM activates a connectivity SIM against a SIM service
|
|
|
|
|
// (ServiceKind=SIM — A-551 per-kind typed dispatch). The handler
|
|
|
|
|
// enforces the window-id on the existing SIM service must still be
|
|
|
|
|
// Active (A-552 window-grant-on-every-op). ValidateBasic is stateless:
|
|
|
|
|
// non-empty service-id, non-empty carrier, non-empty
|
|
|
|
|
// recipient-reach-id, non-empty signer.
|
|
|
|
|
type MsgActivateSIM struct {
|
|
|
|
|
ServiceID string `json:"service_id" yaml:"service_id"`
|
|
|
|
|
Carrier string `json:"carrier" yaml:"carrier"`
|
|
|
|
|
RecipientReachID string `json:"recipient_reach_id" yaml:"recipient_reach_id"`
|
|
|
|
|
Signer string `json:"signer" yaml:"signer"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgActivateSIM) Reset() { *m = MsgActivateSIM{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgActivateSIM) String() string {
|
|
|
|
|
return fmt.Sprintf("MsgActivateSIM{ServiceID:%s Carrier:%s RecipientReachID:%s Signer:%s}",
|
|
|
|
|
m.ServiceID, m.Carrier, m.RecipientReachID, m.Signer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgActivateSIM) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// ValidateBasic is the stateless validation: non-empty service-id,
|
|
|
|
|
// non-empty carrier, non-empty recipient-reach-id, non-empty signer.
|
|
|
|
|
// The handler enforces the stateful service-exists + kind=SIM +
|
|
|
|
|
// window-grant Active checks (A-552).
|
|
|
|
|
func (m *MsgActivateSIM) ValidateBasic() error {
|
|
|
|
|
if m.ServiceID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty service-id")
|
|
|
|
|
}
|
|
|
|
|
if m.Carrier == "" {
|
|
|
|
|
return fmt.Errorf("services: empty carrier")
|
|
|
|
|
}
|
|
|
|
|
if m.RecipientReachID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty recipient-reach-id")
|
|
|
|
|
}
|
|
|
|
|
if m.Signer == "" {
|
|
|
|
|
return fmt.Errorf("services: empty signer")
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetSigners returns the signer's reach-id as sdk.AccAddress bytes.
|
|
|
|
|
func (m *MsgActivateSIM) GetSigners() []sdk.AccAddress {
|
|
|
|
|
return []sdk.AccAddress{[]byte(m.Signer)}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- MsgProvisionVault (Vault — A-551 typed dispatch, A-553 x/vault shim) ---
|
|
|
|
|
|
|
|
|
|
// MsgProvisionVault provisions storage-quota-grain against a Vault
|
|
|
|
|
// service (ServiceKind=Vault — A-551 per-kind typed dispatch; A-553:
|
|
|
|
|
// references x/vault by ID via the VaultKeeper shim — G-003). The
|
|
|
|
|
// handler enforces the window-id on the existing Vault service must
|
|
|
|
|
// still be Active (A-552) and delegates the storage-quota-grain
|
|
|
|
|
// provisioning to the VaultKeeper shim. ValidateBasic is stateless:
|
|
|
|
|
// non-empty service-id, storage-quota-grain > 0, non-empty signer.
|
|
|
|
|
type MsgProvisionVault struct {
|
|
|
|
|
ServiceID string `json:"service_id" yaml:"service_id"`
|
|
|
|
|
StorageQuotaGrain int64 `json:"storage_quota_grain" yaml:"storage_quota_grain"`
|
|
|
|
|
Signer string `json:"signer" yaml:"signer"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgProvisionVault) Reset() { *m = MsgProvisionVault{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgProvisionVault) String() string {
|
|
|
|
|
return fmt.Sprintf("MsgProvisionVault{ServiceID:%s StorageQuotaGrain:%d Signer:%s}",
|
|
|
|
|
m.ServiceID, m.StorageQuotaGrain, m.Signer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgProvisionVault) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// ValidateBasic is the stateless validation: non-empty service-id,
|
|
|
|
|
// storage-quota-grain > 0, non-empty signer. The handler enforces the
|
|
|
|
|
// stateful service-exists + kind=Vault + window-grant Active checks
|
|
|
|
|
// (A-552) and delegates to the VaultKeeper shim (A-553).
|
|
|
|
|
func (m *MsgProvisionVault) ValidateBasic() error {
|
|
|
|
|
if m.ServiceID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty service-id")
|
|
|
|
|
}
|
|
|
|
|
if m.StorageQuotaGrain <= 0 {
|
|
|
|
|
return fmt.Errorf("services: storage-quota-grain must be > 0")
|
|
|
|
|
}
|
|
|
|
|
if m.Signer == "" {
|
|
|
|
|
return fmt.Errorf("services: empty signer")
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetSigners returns the signer's reach-id as sdk.AccAddress bytes.
|
|
|
|
|
func (m *MsgProvisionVault) GetSigners() []sdk.AccAddress {
|
|
|
|
|
return []sdk.AccAddress{[]byte(m.Signer)}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- MsgBindMailbox (Mail — A-551 typed dispatch) ---------------------------
|
|
|
|
|
|
|
|
|
|
// MsgBindMailbox binds a messaging mailbox against a Mail service
|
|
|
|
|
// (ServiceKind=Mail — A-551 per-kind typed dispatch). The handler
|
|
|
|
|
// enforces the window-id on the existing Mail service must still be
|
|
|
|
|
// Active (A-552 window-grant-on-every-op). ValidateBasic is stateless:
|
|
|
|
|
// non-empty service-id, non-empty mailbox-id, non-empty
|
|
|
|
|
// holder-reach-id, non-empty signer.
|
|
|
|
|
type MsgBindMailbox struct {
|
|
|
|
|
ServiceID string `json:"service_id" yaml:"service_id"`
|
|
|
|
|
MailboxID string `json:"mailbox_id" yaml:"mailbox_id"`
|
|
|
|
|
HolderReachID string `json:"holder_reach_id" yaml:"holder_reach_id"`
|
|
|
|
|
Signer string `json:"signer" yaml:"signer"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgBindMailbox) Reset() { *m = MsgBindMailbox{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgBindMailbox) String() string {
|
|
|
|
|
return fmt.Sprintf("MsgBindMailbox{ServiceID:%s MailboxID:%s HolderReachID:%s Signer:%s}",
|
|
|
|
|
m.ServiceID, m.MailboxID, m.HolderReachID, m.Signer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgBindMailbox) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// ValidateBasic is the stateless validation: non-empty service-id,
|
|
|
|
|
// non-empty mailbox-id, non-empty holder-reach-id, non-empty signer.
|
|
|
|
|
// The handler enforces the stateful service-exists + kind=Mail +
|
|
|
|
|
// window-grant Active checks (A-552).
|
|
|
|
|
func (m *MsgBindMailbox) ValidateBasic() error {
|
|
|
|
|
if m.ServiceID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty service-id")
|
|
|
|
|
}
|
|
|
|
|
if m.MailboxID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty mailbox-id")
|
|
|
|
|
}
|
|
|
|
|
if m.HolderReachID == "" {
|
|
|
|
|
return fmt.Errorf("services: empty holder-reach-id")
|
|
|
|
|
}
|
|
|
|
|
if m.Signer == "" {
|
|
|
|
|
return fmt.Errorf("services: empty signer")
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetSigners returns the signer's reach-id as sdk.AccAddress bytes.
|
|
|
|
|
func (m *MsgBindMailbox) GetSigners() []sdk.AccAddress {
|
|
|
|
|
return []sdk.AccAddress{[]byte(m.Signer)}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- MsgServer interface + Response types -----------------------------------
|
|
|
|
|
|
|
|
|
|
// MsgServer is the services module's message server interface (one method
|
|
|
|
|
// per Msg*). The keeper's msg_server.go implements this; module.go's
|
|
|
|
|
// RegisterServices wires the implementation. This is the hand-rolled
|
|
|
|
|
// equivalent of the protobuf-generated MsgServer interface (no codegen
|
|
|
|
|
// per the skeleton's zero-codegen style).
|
|
|
|
|
type MsgServer interface {
|
|
|
|
|
RegisterService(ctx interface{}, msg *MsgRegisterService) (*MsgRegisterServiceResponse, error)
|
|
|
|
|
ActivateService(ctx interface{}, msg *MsgActivateService) (*MsgActivateServiceResponse, error)
|
|
|
|
|
SuspendService(ctx interface{}, msg *MsgSuspendService) (*MsgSuspendServiceResponse, error)
|
|
|
|
|
RevokeService(ctx interface{}, msg *MsgRevokeService) (*MsgRevokeServiceResponse, error)
|
|
|
|
|
IssueCareGrant(ctx interface{}, msg *MsgIssueCareGrant) (*MsgIssueCareGrantResponse, error)
|
|
|
|
|
ActivateSIM(ctx interface{}, msg *MsgActivateSIM) (*MsgActivateSIMResponse, error)
|
|
|
|
|
ProvisionVault(ctx interface{}, msg *MsgProvisionVault) (*MsgProvisionVaultResponse, error)
|
|
|
|
|
BindMailbox(ctx interface{}, msg *MsgBindMailbox) (*MsgBindMailboxResponse, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Response types (hand-rolled equivalents of the protobuf-generated
|
|
|
|
|
// response wrappers; empty bodies — the response is the state mutation +
|
|
|
|
|
// event).
|
|
|
|
|
|
|
|
|
|
// MsgRegisterServiceResponse is the response to MsgRegisterService.
|
|
|
|
|
type MsgRegisterServiceResponse struct{}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgRegisterServiceResponse) Reset() { *m = MsgRegisterServiceResponse{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgRegisterServiceResponse) String() string { return "MsgRegisterServiceResponse{}" }
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgRegisterServiceResponse) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// MsgActivateServiceResponse is the response to MsgActivateService.
|
|
|
|
|
type MsgActivateServiceResponse struct{}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgActivateServiceResponse) Reset() { *m = MsgActivateServiceResponse{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgActivateServiceResponse) String() string { return "MsgActivateServiceResponse{}" }
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgActivateServiceResponse) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// MsgSuspendServiceResponse is the response to MsgSuspendService.
|
|
|
|
|
type MsgSuspendServiceResponse struct{}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgSuspendServiceResponse) Reset() { *m = MsgSuspendServiceResponse{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgSuspendServiceResponse) String() string { return "MsgSuspendServiceResponse{}" }
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgSuspendServiceResponse) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// MsgRevokeServiceResponse is the response to MsgRevokeService.
|
|
|
|
|
type MsgRevokeServiceResponse struct{}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgRevokeServiceResponse) Reset() { *m = MsgRevokeServiceResponse{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgRevokeServiceResponse) String() string { return "MsgRevokeServiceResponse{}" }
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgRevokeServiceResponse) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// MsgIssueCareGrantResponse is the response to MsgIssueCareGrant.
|
|
|
|
|
type MsgIssueCareGrantResponse struct{}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgIssueCareGrantResponse) Reset() { *m = MsgIssueCareGrantResponse{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgIssueCareGrantResponse) String() string { return "MsgIssueCareGrantResponse{}" }
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgIssueCareGrantResponse) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// MsgActivateSIMResponse is the response to MsgActivateSIM.
|
|
|
|
|
type MsgActivateSIMResponse struct{}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgActivateSIMResponse) Reset() { *m = MsgActivateSIMResponse{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgActivateSIMResponse) String() string { return "MsgActivateSIMResponse{}" }
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgActivateSIMResponse) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// MsgProvisionVaultResponse is the response to MsgProvisionVault.
|
|
|
|
|
type MsgProvisionVaultResponse struct{}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgProvisionVaultResponse) Reset() { *m = MsgProvisionVaultResponse{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgProvisionVaultResponse) String() string { return "MsgProvisionVaultResponse{}" }
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgProvisionVaultResponse) ProtoMessage() {}
|
|
|
|
|
|
|
|
|
|
// MsgBindMailboxResponse is the response to MsgBindMailbox.
|
|
|
|
|
type MsgBindMailboxResponse struct{}
|
|
|
|
|
|
|
|
|
|
// Reset implements proto.Message.
|
|
|
|
|
func (m *MsgBindMailboxResponse) Reset() { *m = MsgBindMailboxResponse{} }
|
|
|
|
|
|
|
|
|
|
// String implements proto.Message.
|
|
|
|
|
func (m *MsgBindMailboxResponse) String() string { return "MsgBindMailboxResponse{}" }
|
|
|
|
|
|
|
|
|
|
// ProtoMessage implements proto.Message.
|
|
|
|
|
func (*MsgBindMailboxResponse) ProtoMessage() {}
|