Skip to content

Commit

Permalink
Merge branch 'main' into feat/whitelist-escrow-address-ibc-query
Browse files Browse the repository at this point in the history
  • Loading branch information
joldie777 committed Sep 18, 2024
2 parents cdf4aab + 55d8cb7 commit 439e1ca
Show file tree
Hide file tree
Showing 49 changed files with 2,713 additions and 1,766 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ test: test-unit
test-all: check test-race test-cover

test-unit:
@VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./...
@VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' `go list ./... | grep -v dex`

test-race:
@VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock' ./...
Expand Down
21 changes: 0 additions & 21 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,6 @@ import (
dexkeeper "github.com/neutron-org/neutron/v4/x/dex/keeper"
dextypes "github.com/neutron-org/neutron/v4/x/dex/types"

"github.com/neutron-org/neutron/v4/x/ibcswap"
ibcswapkeeper "github.com/neutron-org/neutron/v4/x/ibcswap/keeper"
ibcswaptypes "github.com/neutron-org/neutron/v4/x/ibcswap/types"

globalfeekeeper "github.com/neutron-org/neutron/v4/x/globalfee/keeper"
gmpmiddleware "github.com/neutron-org/neutron/v4/x/gmp"

Expand Down Expand Up @@ -276,7 +272,6 @@ var (
globalfee.AppModule{},
feemarket.AppModuleBasic{},
dex.AppModuleBasic{},
ibcswap.AppModuleBasic{},
oracle.AppModuleBasic{},
marketmap.AppModuleBasic{},
dynamicfees.AppModuleBasic{},
Expand All @@ -298,7 +293,6 @@ var (
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
crontypes.ModuleName: nil,
dextypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcswaptypes.ModuleName: {authtypes.Burner},
oracletypes.ModuleName: nil,
marketmaptypes.ModuleName: nil,
feemarkettypes.FeeCollectorName: nil,
Expand Down Expand Up @@ -370,7 +364,6 @@ type App struct {
CronKeeper cronkeeper.Keeper
PFMKeeper *pfmkeeper.Keeper
DexKeeper dexkeeper.Keeper
SwapKeeper ibcswapkeeper.Keeper
GlobalFeeKeeper globalfeekeeper.Keeper

PFMModule packetforward.AppModule
Expand Down Expand Up @@ -748,15 +741,6 @@ func New(

dexModule := dex.NewAppModule(appCodec, app.DexKeeper, app.BankKeeper)

app.SwapKeeper = ibcswapkeeper.NewKeeper(
appCodec,
app.MsgServiceRouter(),
app.IBCKeeper.ChannelKeeper,
app.BankKeeper,
)

swapModule := ibcswap.NewAppModule(app.SwapKeeper)

wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
Expand Down Expand Up @@ -921,7 +905,6 @@ func New(
pfmkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)

ibcStack = ibcswap.NewIBCMiddleware(ibcStack, app.SwapKeeper)
ibcStack = gmpmiddleware.NewIBCMiddleware(ibcStack)

ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
Expand Down Expand Up @@ -972,7 +955,6 @@ func New(
globalfee.NewAppModule(app.GlobalFeeKeeper, app.GetSubspace(globalfee.ModuleName), app.AppCodec(), app.keys[globalfee.ModuleName]),
feemarket.NewAppModule(appCodec, *app.FeeMarkerKeeper),
dynamicfees.NewAppModule(appCodec, *app.DynamicFeesKeeper),
swapModule,
dexModule,
marketmapModule,
oracleModule,
Expand Down Expand Up @@ -1022,7 +1004,6 @@ func New(
oracletypes.ModuleName,
globalfee.ModuleName,
feemarkettypes.ModuleName,
ibcswaptypes.ModuleName,
dextypes.ModuleName,
consensusparamtypes.ModuleName,
)
Expand Down Expand Up @@ -1059,7 +1040,6 @@ func New(
oracletypes.ModuleName,
globalfee.ModuleName,
feemarkettypes.ModuleName,
ibcswaptypes.ModuleName,
dextypes.ModuleName,
consensusparamtypes.ModuleName,
)
Expand Down Expand Up @@ -1101,7 +1081,6 @@ func New(
feemarkettypes.ModuleName,
oracletypes.ModuleName,
marketmaptypes.ModuleName,
ibcswaptypes.ModuleName,
dextypes.ModuleName,
dynamicfeestypes.ModuleName,
consensusparamtypes.ModuleName,
Expand Down
2 changes: 2 additions & 0 deletions app/proposals_allowlisting.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ func isSdkMessageWhitelisted(msg sdk.Msg) bool {
*feeburnertypes.MsgUpdateParams,
*feerefundertypes.MsgUpdateParams,
*crontypes.MsgUpdateParams,
*crontypes.MsgAddSchedule,
*crontypes.MsgRemoveSchedule,
*contractmanagertypes.MsgUpdateParams,
*dextypes.MsgUpdateParams,
*banktypes.MsgUpdateParams,
Expand Down
Binary file modified contracts/neutron_chain_manager.wasm
Binary file not shown.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2
github.com/cosmos/ibc-go/modules/capability v1.0.1
github.com/cosmos/ibc-go/v8 v8.5.0
github.com/cosmos/ibc-go/v8 v8.5.1
github.com/cosmos/ics23/go v0.11.0
github.com/cosmos/interchain-security/v5 v5.1.1
github.com/gogo/protobuf v1.3.3
Expand All @@ -33,9 +33,8 @@ require (
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0
github.com/hashicorp/go-metrics v0.5.3
github.com/iancoleman/orderedmap v0.3.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.20.3
github.com/prometheus/client_golang v1.20.4
github.com/rs/zerolog v1.33.0
github.com/skip-mev/block-sdk/v2 v2.1.5
github.com/skip-mev/feemarket v1.1.1
Expand Down Expand Up @@ -142,6 +141,7 @@ require (
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/iancoleman/orderedmap v0.3.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ github.com/cosmos/ibc-go/modules/apps/callbacks v0.2.1-0.20231113120333-342c00b0
github.com/cosmos/ibc-go/modules/apps/callbacks v0.2.1-0.20231113120333-342c00b0f8bd/go.mod h1:JWfpWVKJKiKtd53/KbRoKfxWl8FsT2GPcNezTOk0o5Q=
github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI=
github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E=
github.com/cosmos/ibc-go/v8 v8.5.0 h1:OjaSXz480JT8ZuMrASxGgS7XzloZ2NuuJPwZB/fKDgE=
github.com/cosmos/ibc-go/v8 v8.5.0/go.mod h1:P5hkAvq0Qbg0h18uLxDVA9q1kOJ0l36htMsskiNwXbo=
github.com/cosmos/ibc-go/v8 v8.5.1 h1:3JleEMKBjRKa3FeTKt4fjg22za/qygLBo7mDkoYTNBs=
github.com/cosmos/ibc-go/v8 v8.5.1/go.mod h1:P5hkAvq0Qbg0h18uLxDVA9q1kOJ0l36htMsskiNwXbo=
github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU=
github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0=
github.com/cosmos/interchain-security/v5 v5.0.0-20240802125602-fa1e09444aae h1:/EWV9qryltapge0v4ctvl2jV3Nne5nsbd+GYblj/jWA=
Expand Down Expand Up @@ -924,8 +924,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4=
github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand Down
2 changes: 1 addition & 1 deletion proto/neutron/cron/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "neutron/cron/schedule.proto";

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types";

// GenesisState defines the cron module's genesis state.
// Defines the cron module's genesis state.
message GenesisState {
repeated Schedule scheduleList = 2 [(gogoproto.nullable) = false];
Params params = 1 [(gogoproto.nullable) = false];
Expand Down
2 changes: 1 addition & 1 deletion proto/neutron/cron/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "gogoproto/gogo.proto";

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types";

// Params defines the parameters for the module.
// Defines the parameters for the module.
message Params {
option (gogoproto.goproto_stringer) = false;
// Security address that can remove schedules
Expand Down
8 changes: 7 additions & 1 deletion proto/neutron/cron/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "neutron/cron/schedule.proto";

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types";

// Query defines the gRPC querier service.
// Defines the gRPC querier service.
service Query {
// Queries the parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
Expand All @@ -30,25 +30,31 @@ service Query {
// this line is used by starport scaffolding # 2
}

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

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

// The request type for the Query/Schedule RPC method.
message QueryGetScheduleRequest {
string name = 1;
}

// The response type for the Query/Params RPC method.
message QueryGetScheduleResponse {
Schedule schedule = 1 [(gogoproto.nullable) = false];
}

// The request type for the Query/Schedules RPC method.
message QuerySchedulesRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// The response type for the Query/Params RPC method.
message QuerySchedulesResponse {
repeated Schedule schedules = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
Expand Down
21 changes: 17 additions & 4 deletions proto/neutron/cron/schedule.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,38 @@ import "gogoproto/gogo.proto";

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types";

// Defines when messages will be executed in the block
enum ExecutionStage {
// Execution at the end of the block
EXECUTION_STAGE_END_BLOCKER = 0;
// Execution at the beginning of the block
EXECUTION_STAGE_BEGIN_BLOCKER = 1;
}

// Defines the schedule for execution
message Schedule {
// Name of schedule
string name = 1;
// Period in blocks
uint64 period = 2;
// Msgs that will be executed every period amount of time
// Msgs that will be executed every certain number of blocks, specified in the `period` field
repeated MsgExecuteContract msgs = 3 [(gogoproto.nullable) = false];
// Last execution's block height
uint64 last_execute_height = 4;
// Stage when messages will be executed
ExecutionStage execution_stage = 5;
}

// Defines the contract and the message to pass
message MsgExecuteContract {
// Contract is the address of the smart contract
// The address of the smart contract
string contract = 1;
// Msg is json encoded message to be passed to the contract
// JSON encoded message to be passed to the contract
string msg = 2;
}

// Defines the number of current schedules
message ScheduleCount {
// Count is the number of current schedules
// The number of current schedules
int32 count = 1;
}
51 changes: 45 additions & 6 deletions proto/neutron/cron/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,72 @@ import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "neutron/cron/params.proto";
import "neutron/cron/schedule.proto";

// this line is used by starport scaffolding # proto/tx/import

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types";

// Msg defines the Msg service.
// Defines the Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;

// Adds new schedule.
rpc AddSchedule(MsgAddSchedule) returns (MsgAddScheduleResponse);
// Removes schedule.
rpc RemoveSchedule(MsgRemoveSchedule) returns (MsgRemoveScheduleResponse);
// Updates the module parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// this line is used by starport scaffolding # proto/tx/rpc
}

// The MsgAddSchedule request type.
message MsgAddSchedule {
option (amino.name) = "cron/MsgAddSchedule";
option (cosmos.msg.v1.signer) = "authority";

// The address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Name of the schedule
string name = 2;
// Period in blocks
uint64 period = 3;
// Msgs that will be executed every certain number of blocks, specified in the `period` field
repeated MsgExecuteContract msgs = 4 [(gogoproto.nullable) = false];
// Stage when messages will be executed
ExecutionStage execution_stage = 5;
}

// Defines the response structure for executing a MsgAddSchedule message.
message MsgAddScheduleResponse {}

// The MsgRemoveSchedule request type.
message MsgRemoveSchedule {
option (amino.name) = "cron/MsgRemoveSchedule";
option (cosmos.msg.v1.signer) = "authority";

// The address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Name of the schedule
string name = 2;
}

// Defines the response structure for executing a MsgRemoveSchedule message.
message MsgRemoveScheduleResponse {}

// this line is used by starport scaffolding # proto/tx/message

// MsgUpdateParams is the MsgUpdateParams request type.
// The MsgUpdateParams request type.
//
// Since: 0.47
message MsgUpdateParams {
option (amino.name) = "cron/MsgUpdateParams";
option (cosmos.msg.v1.signer) = "authority";

// Authority is the address of the governance account.
// The address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// params defines the x/cron parameters to update.
// Defines the x/cron parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [
Expand All @@ -40,8 +80,7 @@ message MsgUpdateParams {
];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
// Defines the response structure for executing a MsgUpdateParams message.
//
// Since: 0.47
message MsgUpdateParamsResponse {}
32 changes: 32 additions & 0 deletions proto/neutron/cron/v1/schedule.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
syntax = "proto3";
package neutron.cron.v1;

import "gogoproto/gogo.proto";

option go_package = "github.com/neutron-org/neutron/v4/x/cron/types/v1";

// Defines the schedule for execution
message Schedule {
// Name of schedule
string name = 1;
// Period in blocks
uint64 period = 2;
// Msgs that will be executed every certain number of blocks, specified in the `period` field
repeated MsgExecuteContract msgs = 3 [(gogoproto.nullable) = false];
// Last execution's block height
uint64 last_execute_height = 4;
}

// Defines the contract and the message to pass
message MsgExecuteContract {
// The address of the smart contract
string contract = 1;
// JSON encoded message to be passed to the contract
string msg = 2;
}

// Defines the number of current schedules
message ScheduleCount {
// The number of current schedules
int32 count = 1;
}
1 change: 1 addition & 0 deletions tests/feemarket/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610 h1:4JlsiRVt
github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610/go.mod h1:kB8gFZX07CyJnw8q9iEZijI3qJTIe1K/Y++P5VGkrcg=
github.com/skip-mev/feemarket v1.1.0 h1:3z/3Mplmk4t1C/IjghC+OE361L9n8dR3Xr7bXIcS7ec=
github.com/skip-mev/feemarket v1.1.0/go.mod h1:CVsCaHxJDK4y271c1Dan6Z8G2QaOyWJLoSBnDEPon40=
github.com/skip-mev/feemarket v1.1.1/go.mod h1:DUa6djUsTeMOrbrcIZqWSVxU9IZNCXp96ruaojyBNpc=
github.com/skip-mev/feemarket/tests/e2e v1.10.0 h1:oKAZSo+rynd2b7+T8/U+4C+h//rrTdjLICG2Awjk8YA=
github.com/skip-mev/feemarket/tests/e2e v1.10.0/go.mod h1:57BURopGhr+L0zDkhj1E9jzP9W8rMzRb3b+MT+trlB4=
github.com/skip-mev/interchaintest/v8 v8.0.1-0.20240611183342-72ec508eb966 h1:X5BD7m4QieHlORqGho1Af8r0O1GSWBRYO330xyu2kzQ=
Expand Down
Loading

0 comments on commit 439e1ca

Please sign in to comment.