Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import (
upgrades "github.com/LumeraProtocol/lumera/app/upgrades"
appParams "github.com/LumeraProtocol/lumera/app/upgrades/params"
actionmodulekeeper "github.com/LumeraProtocol/lumera/x/action/v1/keeper"
auditmodulekeeper "github.com/LumeraProtocol/lumera/x/audit/v1/keeper"
claimmodulekeeper "github.com/LumeraProtocol/lumera/x/claim/keeper"
lumeraidmodulekeeper "github.com/LumeraProtocol/lumera/x/lumeraid/keeper"
sntypes "github.com/LumeraProtocol/lumera/x/supernode/v1/types"
Expand Down Expand Up @@ -151,6 +152,7 @@ type App struct {
ClaimKeeper claimmodulekeeper.Keeper
SupernodeKeeper sntypes.SupernodeKeeper
ActionKeeper actionmodulekeeper.Keeper
AuditKeeper auditmodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

// simulation manager
Expand Down Expand Up @@ -253,6 +255,7 @@ func New(
&app.ClaimKeeper,
&app.SupernodeKeeper,
&app.ActionKeeper,
&app.AuditKeeper,
// this line is used by starport scaffolding # stargate/app/keeperDefinition
); err != nil {
panic(err)
Expand Down
39 changes: 24 additions & 15 deletions app/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app
import (
"time"

"github.com/cosmos/cosmos-sdk/runtime"
"cosmossdk.io/depinject/appconfig"
"github.com/cosmos/cosmos-sdk/runtime"
"google.golang.org/protobuf/types/known/durationpb"

runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1"
Expand Down Expand Up @@ -34,10 +34,13 @@ import (
evidencetypes "cosmossdk.io/x/evidence/types"
"cosmossdk.io/x/feegrant"
_ "cosmossdk.io/x/feegrant/module" // import for side-effects
_ "cosmossdk.io/x/upgrade" // import for side-effects
_ "cosmossdk.io/x/upgrade" // import for side-effects
upgradetypes "cosmossdk.io/x/upgrade/types"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
actionmodulev1 "github.com/LumeraProtocol/lumera/x/action/v1/module"
actionmoduletypes "github.com/LumeraProtocol/lumera/x/action/v1/types"
auditmodulev1 "github.com/LumeraProtocol/lumera/x/audit/v1/module"
auditmoduletypes "github.com/LumeraProtocol/lumera/x/audit/v1/types"
claimmodulev1 "github.com/LumeraProtocol/lumera/x/claim/module"
claimmoduletypes "github.com/LumeraProtocol/lumera/x/claim/types"
lumeraidmodulev1 "github.com/LumeraProtocol/lumera/x/lumeraid/module"
Expand All @@ -48,8 +51,8 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
_ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects
"github.com/cosmos/cosmos-sdk/x/authz"
_ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects
Expand All @@ -61,8 +64,8 @@ import (
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
_ "github.com/cosmos/cosmos-sdk/x/gov" // import for side-effects
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
_ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects
"github.com/cosmos/cosmos-sdk/x/group"
_ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
_ "github.com/cosmos/cosmos-sdk/x/params" // import for side-effects
Expand All @@ -71,15 +74,14 @@ import (
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
pfmtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v10/packetforward/types"
icatypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/types"
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
pfmtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v10/packetforward/types"
solomachine "github.com/cosmos/ibc-go/v10/modules/light-clients/06-solomachine"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"

lcfg "github.com/LumeraProtocol/lumera/config"
lcfg "github.com/LumeraProtocol/lumera/config"
// this line is used by starport scaffolding # stargate/app/moduleImport
)

Expand Down Expand Up @@ -110,18 +112,19 @@ var (
group.ModuleName,
circuittypes.ModuleName,
// ibc modules
ibcexported.ModuleName, // IBC core module
ibctransfertypes.ModuleName, // IBC transfer module
icatypes.ModuleName, // IBC interchain accounts module (host and controller)
pfmtypes.ModuleName, // IBC packet-forward-middleware
ibctm.ModuleName, // IBC Tendermint light client
solomachine.ModuleName, // IBC Solo Machine light client
ibcexported.ModuleName, // IBC core module
ibctransfertypes.ModuleName, // IBC transfer module
icatypes.ModuleName, // IBC interchain accounts module (host and controller)
pfmtypes.ModuleName, // IBC packet-forward-middleware
ibctm.ModuleName, // IBC Tendermint light client
solomachine.ModuleName, // IBC Solo Machine light client
// chain modules
lumeraidmoduletypes.ModuleName,
wasmtypes.ModuleName,
claimmoduletypes.ModuleName,
supernodemoduletypes.ModuleName,
actionmoduletypes.ModuleName,
auditmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
}

Expand Down Expand Up @@ -150,6 +153,7 @@ var (
claimmoduletypes.ModuleName,
supernodemoduletypes.ModuleName,
actionmoduletypes.ModuleName,
auditmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
}

Expand All @@ -172,6 +176,7 @@ var (
claimmoduletypes.ModuleName,
supernodemoduletypes.ModuleName,
actionmoduletypes.ModuleName,
auditmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
}

Expand Down Expand Up @@ -255,7 +260,7 @@ var (
}),
},
{
Name: stakingtypes.ModuleName,
Name: stakingtypes.ModuleName,
Config: appconfig.WrapAny(&stakingmodulev1.Module{
// NOTE: specifying a prefix is only necessary when using bech32 addresses
// If not specfied, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default
Expand Down Expand Up @@ -342,6 +347,10 @@ var (
Name: actionmoduletypes.ModuleName,
Config: appconfig.WrapAny(&actionmodulev1.Module{}),
},
{
Name: auditmoduletypes.ModuleName,
Config: appconfig.WrapAny(&auditmodulev1.Module{}),
},
// this line is used by starport scaffolding # stargate/app/moduleConfig
},
})
Expand Down
15 changes: 15 additions & 0 deletions proto/lumera/audit/module/v1/module.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";
package lumera.audit.module.v1;

import "cosmos/app/v1alpha1/module.proto";

option go_package = "x/audit/v1/module;audit";

// Module is the config object for the module.
message Module {
option (cosmos.app.v1alpha1.module) = {go_import: "github.com/LumeraProtocol/lumera/x/audit/v1"};

// authority defines the custom module authority.
// If not set, defaults to the governance module.
string authority = 1;
}
38 changes: 38 additions & 0 deletions proto/lumera/audit/v1/evidence.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
syntax = "proto3";

package lumera.audit.v1;

import "cosmos_proto/cosmos.proto";

option go_package = "x/audit/v1/types";

enum EvidenceType {
EVIDENCE_TYPE_UNSPECIFIED = 0;
EVIDENCE_TYPE_ACTION_WRONG_FINALIZATION = 1;
EVIDENCE_TYPE_ACTION_EXPIRED = 2;
}

// Evidence is a stable outer record that stores evidence about an audited subject.
// Type-specific fields are encoded into the `metadata` bytes field.
message Evidence {
// evidence_id is a chain-assigned unique identifier.
uint64 evidence_id = 1;

// subject_address is the audited subject (e.g. supernode-related actor).
string subject_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// reporter_address is the submitter of the evidence.
string reporter_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// action_id optionally links this evidence to a specific action.
string action_id = 4;

// evidence_type is a stable discriminator used to interpret metadata.
EvidenceType evidence_type = 5;

// metadata is protobuf-binary bytes of a type-specific Evidence metadata message.
bytes metadata = 6;

// reported_height is the block height when the evidence was submitted.
uint64 reported_height = 7;
}
29 changes: 29 additions & 0 deletions proto/lumera/audit/v1/evidence_metadata.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";

package lumera.audit.v1;

import "cosmos_proto/cosmos.proto";

option go_package = "x/audit/v1/types";

// ExpirationEvidenceMetadata is metadata for evidence about an action expiring.
message ExpirationEvidenceMetadata {
// expiration_height is the height at which the action expired (if known).
uint64 expiration_height = 1;

// reason is optional human-readable context.
string reason = 2;
}

// FinalizationEvidenceMetadata is metadata for evidence about finalization behavior.
message FinalizationEvidenceMetadata {
// attempted_finalizer_address is the address that attempted finalization.
string attempted_finalizer_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// expected_finalizer_address is optional (if there is a known expected finalizer).
string expected_finalizer_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// reason is optional human-readable context.
string reason = 3;
}

24 changes: 24 additions & 0 deletions proto/lumera/audit/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";
package lumera.audit.v1;

import "amino/amino.proto";
import "gogoproto/gogo.proto";
import "lumera/audit/v1/evidence.proto";
import "lumera/audit/v1/params.proto";

option go_package = "x/audit/v1/types";

// GenesisState defines the audit module's genesis state.
message GenesisState {
// params defines all the parameters of the module.
Params params = 1 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];

// evidence defines the initial evidence records (optional).
repeated Evidence evidence = 2 [(gogoproto.nullable) = false];

// next_evidence_id is the next id to use for chain-assigned ids.
uint64 next_evidence_id = 3;
}
13 changes: 13 additions & 0 deletions proto/lumera/audit/v1/params.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package lumera.audit.v1;

import "amino/amino.proto";
import "gogoproto/gogo.proto";

option go_package = "x/audit/v1/types";

// Params defines the parameters for the module.
message Params {
option (amino.name) = "lumera/x/audit/Params";
option (gogoproto.equal) = true;
}
75 changes: 75 additions & 0 deletions proto/lumera/audit/v1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
syntax = "proto3";
package lumera.audit.v1;

import "amino/amino.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "lumera/audit/v1/evidence.proto";
import "lumera/audit/v1/params.proto";

option go_package = "x/audit/v1/types";

// Query defines the gRPC querier service.
service Query {
// Parameters queries the parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/LumeraProtocol/lumera/audit/v1/params";
}

// EvidenceById queries a single evidence record by id.
rpc EvidenceById(QueryEvidenceByIdRequest) returns (QueryEvidenceByIdResponse) {
option (google.api.http).get = "/LumeraProtocol/lumera/audit/v1/evidence/{evidence_id}";
}

// EvidenceBySubject queries evidence records by subject address.
rpc EvidenceBySubject(QueryEvidenceBySubjectRequest) returns (QueryEvidenceBySubjectResponse) {
option (google.api.http).get = "/LumeraProtocol/lumera/audit/v1/evidence/by_subject/{subject_address}";
}

// EvidenceByAction queries evidence records by action id.
rpc EvidenceByAction(QueryEvidenceByActionRequest) returns (QueryEvidenceByActionResponse) {
option (google.api.http).get = "/LumeraProtocol/lumera/audit/v1/evidence/by_action/{action_id}";
}
}

// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

message QueryEvidenceByIdRequest {
uint64 evidence_id = 1;
}

message QueryEvidenceByIdResponse {
Evidence evidence = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}

message QueryEvidenceBySubjectRequest {
string subject_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

message QueryEvidenceBySubjectResponse {
repeated Evidence evidence = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message QueryEvidenceByActionRequest {
string action_id = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

message QueryEvidenceByActionResponse {
repeated Evidence evidence = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
Loading