From 27c9133b8fe7295112804bb79fb4cd62e669678f Mon Sep 17 00:00:00 2001 From: skyargos Date: Thu, 31 Oct 2024 12:43:46 +0800 Subject: [PATCH 01/37] update proto --- proto/shentu/auth/v1alpha1/tx.proto | 9 +- proto/shentu/bank/v1alpha1/tx.proto | 11 +- proto/shentu/bounty/v1/tx.proto | 38 ++++- proto/shentu/cert/v1alpha1/tx.proto | 16 +++ proto/shentu/oracle/v1alpha1/tx.proto | 195 +++++++++++++++----------- proto/shentu/shield/v1alpha1/tx.proto | 7 + 6 files changed, 190 insertions(+), 86 deletions(-) diff --git a/proto/shentu/auth/v1alpha1/tx.proto b/proto/shentu/auth/v1alpha1/tx.proto index 03f39eb70..497c33122 100644 --- a/proto/shentu/auth/v1alpha1/tx.proto +++ b/proto/shentu/auth/v1alpha1/tx.proto @@ -3,6 +3,8 @@ package shentu.auth.v1alpha1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; option go_package = "github.com/shentufoundation/shentu/x/auth/types"; @@ -16,11 +18,14 @@ service Msg { // MsgUnlock defines a message for unlocking coins from a manual vesting // account. message MsgUnlock { + option (cosmos.msg.v1.signer) = "issuer"; + option (amino.name) = "auth/MsgUnlock"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string issuer = 1 [ (gogoproto.moretags) = "yaml:\"issuer\"" ]; - string account = 2 [ (gogoproto.moretags) = "yaml:\"account_address\"" ]; + string issuer = 1 [(gogoproto.moretags) = "yaml:\"issuer\""]; + string account = 2 [(gogoproto.moretags) = "yaml:\"account_address\""]; repeated cosmos.base.v1beta1.Coin unlock_amount = 3 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" diff --git a/proto/shentu/bank/v1alpha1/tx.proto b/proto/shentu/bank/v1alpha1/tx.proto index 492afff88..9033c1d8e 100644 --- a/proto/shentu/bank/v1alpha1/tx.proto +++ b/proto/shentu/bank/v1alpha1/tx.proto @@ -4,6 +4,8 @@ package shentu.bank.v1alpha1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/bank/v1beta1/bank.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; option go_package = "github.com/shentufoundation/shentu/x/bank/types"; @@ -17,13 +19,16 @@ service Msg { // MsgLockedSend represents a message to send and lock coins from one account to // another. message MsgLockedSend { + option (cosmos.msg.v1.signer) = "from_address"; + option (amino.name) = "bank/MsgLockedSend"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string from_address = 1 [ (gogoproto.moretags) = "yaml:\"from_address\"" ]; - string to_address = 2 [ (gogoproto.moretags) = "yaml:\"to_address\"" ]; + string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; + string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; string unlocker_address = 3 - [ (gogoproto.moretags) = "yaml:\"unlocker_address\"" ]; + [(gogoproto.moretags) = "yaml:\"unlocker_address\""]; repeated cosmos.base.v1beta1.Coin amount = 4 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" diff --git a/proto/shentu/bounty/v1/tx.proto b/proto/shentu/bounty/v1/tx.proto index 7d0ac4ea7..0dff95f8d 100644 --- a/proto/shentu/bounty/v1/tx.proto +++ b/proto/shentu/bounty/v1/tx.proto @@ -3,10 +3,13 @@ package shentu.bounty.v1; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; -import "cosmos_proto/cosmos.proto"; import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "amino/amino.proto"; + import "shentu/bounty/v1/bounty.proto"; option go_package = "github.com/shentufoundation/shentu/x/bounty/types"; @@ -49,6 +52,9 @@ service Msg { // MsgCreateProgram defines a SDK message for creating a new program. message MsgCreateProgram { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/CreateProgram"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -60,6 +66,9 @@ message MsgCreateProgram { // MsgEditProgram defines a SDK message for editing a program. message MsgEditProgram { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/EditProgram"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -77,6 +86,9 @@ message MsgCreateProgramResponse { message MsgEditProgramResponse {} message MsgActivateProgram { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/ActivateProgram"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -87,6 +99,9 @@ message MsgActivateProgram { message MsgActivateProgramResponse {} message MsgCloseProgram { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/CloseProgram"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -98,6 +113,9 @@ message MsgCloseProgramResponse {} // MsgSubmitFinding defines a message to submit a finding. message MsgSubmitFinding { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/SubmitFinding"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -113,6 +131,9 @@ message MsgSubmitFindingResponse {} // MsgEditFinding defines a message to edit a finding. message MsgEditFinding { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/EditFinding"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -128,6 +149,9 @@ message MsgEditFindingResponse {} // MsgConfirmFinding defines a message to confirm a finding to an existing finding. message MsgConfirmFinding { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/ConfirmFinding"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -141,6 +165,9 @@ message MsgConfirmFindingResponse {} // MsgActivateFinding defines a message to activate a finding to an existing finding. message MsgActivateFinding { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/ActivateFinding"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -153,6 +180,9 @@ message MsgActivateFindingResponse {} // MsgConfirmFindingPaid defines a message to close a finding to an existing finding. message MsgConfirmFindingPaid { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/ConfirmFindingPaid"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -165,6 +195,9 @@ message MsgConfirmFindingPaidResponse {} // MsgCloseFinding defines a message to close a finding to an existing finding. message MsgCloseFinding { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/CloseFinding"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -177,6 +210,9 @@ message MsgCloseFindingResponse {} // MsgPublishFinding defines a message to publish a finding. message MsgPublishFinding { + option (cosmos.msg.v1.signer) = "operator_address"; + option (amino.name) = "bounty/PublishFinding"; + option (gogoproto.equal) = false; string finding_id = 1 [(gogoproto.moretags) = "yaml:\"finding_id\""]; diff --git a/proto/shentu/cert/v1alpha1/tx.proto b/proto/shentu/cert/v1alpha1/tx.proto index 9c050f18b..7e86ef69d 100644 --- a/proto/shentu/cert/v1alpha1/tx.proto +++ b/proto/shentu/cert/v1alpha1/tx.proto @@ -3,7 +3,11 @@ package shentu.cert.v1alpha1; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; + import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; + import "shentu/cert/v1alpha1/cert.proto"; option go_package = "github.com/shentufoundation/shentu/x/cert/types"; @@ -18,6 +22,9 @@ service Msg { // MsgProposeCertifier is the message for proposing new certifier. message MsgProposeCertifier { + option (cosmos.msg.v1.signer) = "proposer"; + option (amino.name) = "bounty/ProposeCertifier"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -31,6 +38,9 @@ message MsgProposeCertifierResponse {} // MsgCertifyGeneral is the message for issuing a general certificate. message MsgIssueCertificate { + option (cosmos.msg.v1.signer) = "certifier"; + option (amino.name) = "bounty/IssueCertificate"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -45,6 +55,9 @@ message MsgIssueCertificateResponse {} // MsgRevokeCertificate returns a certificate revoking operation. message MsgRevokeCertificate { + option (cosmos.msg.v1.signer) = "revoker"; + option (amino.name) = "bounty/RevokeCertificate"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -57,6 +70,9 @@ message MsgRevokeCertificateResponse {} // MsgCertifyPlatform is the message for certifying a validator's host platform. message MsgCertifyPlatform { + option (cosmos.msg.v1.signer) = "certifier"; + option (amino.name) = "bounty/CertifyPlatform"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; diff --git a/proto/shentu/oracle/v1alpha1/tx.proto b/proto/shentu/oracle/v1alpha1/tx.proto index 90cb9186d..b77384068 100644 --- a/proto/shentu/oracle/v1alpha1/tx.proto +++ b/proto/shentu/oracle/v1alpha1/tx.proto @@ -1,155 +1,190 @@ syntax = "proto3"; package shentu.oracle.v1alpha1; -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; option go_package = "github.com/shentufoundation/shentu/x/oracle/types"; // Msg defines the shield Msg service. service Msg { - rpc CreateOperator(MsgCreateOperator) returns (MsgCreateOperatorResponse); - rpc RemoveOperator(MsgRemoveOperator) returns (MsgRemoveOperatorResponse); - rpc AddCollateral(MsgAddCollateral) returns (MsgAddCollateralResponse); - rpc ReduceCollateral(MsgReduceCollateral) returns (MsgReduceCollateralResponse); - rpc WithdrawReward(MsgWithdrawReward) returns (MsgWithdrawRewardResponse); - rpc CreateTask(MsgCreateTask) returns (MsgCreateTaskResponse); - rpc TaskResponse(MsgTaskResponse) returns (MsgTaskResponseResponse); - rpc DeleteTask(MsgDeleteTask) returns (MsgDeleteTaskResponse); - rpc CreateTxTask(MsgCreateTxTask) returns (MsgCreateTxTaskResponse); - rpc TxTaskResponse(MsgTxTaskResponse) returns (MsgTxTaskResponseResponse); - rpc DeleteTxTask(MsgDeleteTxTask) returns (MsgDeleteTxTaskResponse); + rpc CreateOperator(MsgCreateOperator) returns (MsgCreateOperatorResponse); + rpc RemoveOperator(MsgRemoveOperator) returns (MsgRemoveOperatorResponse); + rpc AddCollateral(MsgAddCollateral) returns (MsgAddCollateralResponse); + rpc ReduceCollateral(MsgReduceCollateral) returns (MsgReduceCollateralResponse); + rpc WithdrawReward(MsgWithdrawReward) returns (MsgWithdrawRewardResponse); + rpc CreateTask(MsgCreateTask) returns (MsgCreateTaskResponse); + rpc TaskResponse(MsgTaskResponse) returns (MsgTaskResponseResponse); + rpc DeleteTask(MsgDeleteTask) returns (MsgDeleteTaskResponse); + rpc CreateTxTask(MsgCreateTxTask) returns (MsgCreateTxTaskResponse); + rpc TxTaskResponse(MsgTxTaskResponse) returns (MsgTxTaskResponseResponse); + rpc DeleteTxTask(MsgDeleteTxTask) returns (MsgDeleteTxTaskResponse); } message MsgCreateOperator { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "proposer"; + option (amino.name) = "oracle/CreateOperator"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; - repeated cosmos.base.v1beta1.Coin collateral = 2 [ (gogoproto.moretags) = "yaml:\"collateral\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - string proposer = 3 [ (gogoproto.moretags) = "yaml:\"proposer\"" ]; - string name = 4 [ (gogoproto.moretags) = "yaml:\"name\"" ]; + string address = 1 [(gogoproto.moretags) = "yaml:\"address\""]; + repeated cosmos.base.v1beta1.Coin collateral = 2 [(gogoproto.moretags) = "yaml:\"collateral\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + string proposer = 3 [(gogoproto.moretags) = "yaml:\"proposer\""]; + string name = 4 [(gogoproto.moretags) = "yaml:\"name\""]; } message MsgCreateOperatorResponse {} message MsgRemoveOperator { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "proposer"; + option (amino.name) = "oracle/RemoveOperator"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; - string proposer = 2 [ (gogoproto.moretags) = "yaml:\"proposer\"" ]; + string address = 1 [(gogoproto.moretags) = "yaml:\"address\""]; + string proposer = 2 [(gogoproto.moretags) = "yaml:\"proposer\""]; } message MsgRemoveOperatorResponse {} message MsgAddCollateral { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "address"; + option (amino.name) = "oracle/AddCollateral"; - string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; - repeated cosmos.base.v1beta1.Coin collateral_increment = 2 [ (gogoproto.moretags) = "yaml:\"collateral_increment\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string address = 1 [(gogoproto.moretags) = "yaml:\"address\""]; + repeated cosmos.base.v1beta1.Coin collateral_increment = 2 [(gogoproto.moretags) = "yaml:\"collateral_increment\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } message MsgAddCollateralResponse {} message MsgReduceCollateral { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "address"; + option (amino.name) = "oracle/ReduceCollateral"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; - repeated cosmos.base.v1beta1.Coin collateral_decrement = 2 [ (gogoproto.moretags) = "yaml:\"collateral_decrement\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; + string address = 1 [(gogoproto.moretags) = "yaml:\"address\""]; + repeated cosmos.base.v1beta1.Coin collateral_decrement = 2 [(gogoproto.moretags) = "yaml:\"collateral_decrement\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } message MsgReduceCollateralResponse {} message MsgWithdrawReward { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "address"; + option (amino.name) = "oracle/WithdrawReward"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + string address = 1 [(gogoproto.moretags) = "yaml:\"address\""]; } message MsgWithdrawRewardResponse {} message MsgCreateTask { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string contract = 1 [ (gogoproto.moretags) = "yaml:\"contract\"" ]; - string function = 2 [ (gogoproto.moretags) = "yaml:\"function\"" ]; - repeated cosmos.base.v1beta1.Coin bounty = 3 [ (gogoproto.moretags) = "yaml:\"bounty\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - string description = 4 [ (gogoproto.moretags) = "yaml:\"description\"" ]; - string creator = 5 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; - int64 wait = 6 [ (gogoproto.moretags) = "yaml:\"wait\"" ]; - google.protobuf.Duration valid_duration = 7 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "yaml:\"valid_duration\"" ]; + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "oracle/CreateTask"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string contract = 1 [(gogoproto.moretags) = "yaml:\"contract\""]; + string function = 2 [(gogoproto.moretags) = "yaml:\"function\""]; + repeated cosmos.base.v1beta1.Coin bounty = 3 [(gogoproto.moretags) = "yaml:\"bounty\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + string description = 4 [(gogoproto.moretags) = "yaml:\"description\""]; + string creator = 5 [(gogoproto.moretags) = "yaml:\"creator\""]; + int64 wait = 6 [(gogoproto.moretags) = "yaml:\"wait\""]; + google.protobuf.Duration valid_duration = 7 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "yaml:\"valid_duration\""]; } message MsgCreateTaskResponse {} message MsgTaskResponse { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "operator"; + option (amino.name) = "oracle/RespondToTask"; - string contract = 1 [ (gogoproto.moretags) = "yaml:\"contract\"" ]; - string function = 2 [ (gogoproto.moretags) = "yaml:\"function\"" ]; - int64 score = 3 [ (gogoproto.moretags) = "yaml:\"score\"" ]; - string operator = 4 [ (gogoproto.moretags) = "yaml:\"operator\"" ]; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string contract = 1 [(gogoproto.moretags) = "yaml:\"contract\""]; + string function = 2 [(gogoproto.moretags) = "yaml:\"function\""]; + int64 score = 3 [(gogoproto.moretags) = "yaml:\"score\""]; + string operator = 4 [(gogoproto.moretags) = "yaml:\"operator\""]; } message MsgTaskResponseResponse {} message MsgDeleteTask { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "from"; + option (amino.name) = "oracle/DeleteTask"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - string contract = 1 [ (gogoproto.moretags) = "yaml:\"contract\"" ]; - string function = 2 [ (gogoproto.moretags) = "yaml:\"function\"" ]; - bool force = 3 [ (gogoproto.moretags) = "yaml:\"force\"" ]; - string from = 4 [ (gogoproto.moretags) = "yaml:\"from\"" ]; + string contract = 1 [(gogoproto.moretags) = "yaml:\"contract\""]; + string function = 2 [(gogoproto.moretags) = "yaml:\"function\""]; + bool force = 3 [(gogoproto.moretags) = "yaml:\"force\""]; + string from = 4 [(gogoproto.moretags) = "yaml:\"from\""]; } message MsgDeleteTaskResponse {} message MsgCreateTxTask { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; - string chain_id = 2 [ (gogoproto.moretags) = "yaml:\"chain_id\"" ]; - // the bytes of application chain transaction that is going to be evaluated - bytes atx_bytes = 3 [ (gogoproto.moretags) = "yaml:\"atx_bytes\"" ]; - repeated cosmos.base.v1beta1.Coin bounty = 4 [ (gogoproto.moretags) = "yaml:\"bounty\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - google.protobuf.Timestamp valid_time = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"valid_time\""]; + option (cosmos.msg.v1.signer) = "creator"; + option (amino.name) = "oracle/CreateTxTask"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string creator = 1 [(gogoproto.moretags) = "yaml:\"creator\""]; + string chain_id = 2 [(gogoproto.moretags) = "yaml:\"chain_id\""]; + // the bytes of application chain transaction that is going to be evaluated + bytes atx_bytes = 3 [(gogoproto.moretags) = "yaml:\"atx_bytes\""]; + repeated cosmos.base.v1beta1.Coin bounty = 4 [(gogoproto.moretags) = "yaml:\"bounty\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + google.protobuf.Timestamp valid_time = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"valid_time\""]; } message MsgCreateTxTaskResponse { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - // sha256 hash of the application chain transaction - bytes atx_hash = 1; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + // sha256 hash of the application chain transaction + bytes atx_hash = 1; } message MsgTxTaskResponse { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - // sha256 hash of the application chain transaction - bytes atx_hash = 1 [ (gogoproto.moretags) = "yaml:\"atx_hash\"" ]; - int64 score = 2 [ (gogoproto.moretags) = "yaml:\"score\"" ]; - string operator = 3 [ (gogoproto.moretags) = "yaml:\"operator\"" ]; + option (cosmos.msg.v1.signer) = "operator"; + option (amino.name) = "oracle/RespondToTxTask"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + // sha256 hash of the application chain transaction + bytes atx_hash = 1 [(gogoproto.moretags) = "yaml:\"atx_hash\""]; + int64 score = 2 [(gogoproto.moretags) = "yaml:\"score\""]; + string operator = 3 [(gogoproto.moretags) = "yaml:\"operator\""]; } message MsgTxTaskResponseResponse {} message MsgDeleteTxTask { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - // sha256 hash of the application chain transaction - bytes atx_hash = 1 [ (gogoproto.moretags) = "yaml:\"atx_hash\"" ]; - string from = 2 [ (gogoproto.moretags) = "yaml:\"from\"" ]; + option (cosmos.msg.v1.signer) = "from"; + option (amino.name) = "oracle/DeleteTxTask"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + // sha256 hash of the application chain transaction + bytes atx_hash = 1 [(gogoproto.moretags) = "yaml:\"atx_hash\""]; + string from = 2 [(gogoproto.moretags) = "yaml:\"from\""]; } message MsgDeleteTxTaskResponse {} \ No newline at end of file diff --git a/proto/shentu/shield/v1alpha1/tx.proto b/proto/shentu/shield/v1alpha1/tx.proto index 489b30a46..307c8feff 100644 --- a/proto/shentu/shield/v1alpha1/tx.proto +++ b/proto/shentu/shield/v1alpha1/tx.proto @@ -2,7 +2,11 @@ syntax = "proto3"; package shentu.shield.v1alpha1; import "gogoproto/gogo.proto"; + import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; + import "shentu/shield/v1alpha1/shield.proto"; option go_package = "github.com/shentufoundation/shentu/x/shield/types"; @@ -14,6 +18,9 @@ service Msg { // MsgWithdrawForeignRewards defines attribute of withdraw rewards transaction. message MsgWithdrawRewards { + option (cosmos.msg.v1.signer) = "from"; + option (amino.name) = "shield/MsgWithdrawRewards"; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; From a1fc459cd6a6df58993a5573b68486d73869f955 Mon Sep 17 00:00:00 2001 From: skyargos Date: Thu, 31 Oct 2024 12:46:16 +0800 Subject: [PATCH 02/37] update proto pb --- x/auth/types/tx.pb.go | 54 +++++++------ x/bank/types/tx.pb.go | 59 +++++++------- x/bounty/types/tx.pb.go | 133 +++++++++++++++++--------------- x/cert/types/tx.pb.go | 96 ++++++++++++----------- x/oracle/types/tx.pb.go | 165 +++++++++++++++++++++------------------- x/shield/types/tx.pb.go | 34 +++++---- 6 files changed, 290 insertions(+), 251 deletions(-) diff --git a/x/auth/types/tx.pb.go b/x/auth/types/tx.pb.go index 77e8b9244..b8fcf000d 100644 --- a/x/auth/types/tx.pb.go +++ b/x/auth/types/tx.pb.go @@ -8,6 +8,8 @@ import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -116,31 +118,33 @@ func init() { func init() { proto.RegisterFile("shentu/auth/v1alpha1/tx.proto", fileDescriptor_2e193e7ad0fae544) } var fileDescriptor_2e193e7ad0fae544 = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xbf, 0x6e, 0xea, 0x30, - 0x14, 0xc6, 0x93, 0x8b, 0xc4, 0xbd, 0xf8, 0x96, 0x81, 0x14, 0x55, 0x34, 0x52, 0x13, 0x94, 0xa5, - 0x74, 0xa8, 0xdd, 0xd0, 0x4e, 0x6c, 0xa5, 0x53, 0x07, 0x96, 0x48, 0x1d, 0xda, 0x05, 0x39, 0x89, - 0x9b, 0x44, 0x10, 0x3b, 0xc2, 0x0e, 0x82, 0x37, 0xe8, 0xd8, 0x47, 0x60, 0xee, 0x93, 0x30, 0x32, - 0x76, 0xa2, 0x15, 0x2c, 0xcc, 0x3c, 0x41, 0x85, 0x1d, 0x50, 0x87, 0x4a, 0x9d, 0x6c, 0x9d, 0xef, - 0x77, 0xfe, 0x7c, 0xe7, 0x80, 0x33, 0x1e, 0x13, 0x2a, 0x72, 0x84, 0x73, 0x11, 0xa3, 0xb1, 0x8b, - 0x87, 0x59, 0x8c, 0x5d, 0x24, 0x26, 0x30, 0x1b, 0x31, 0xc1, 0x8c, 0xba, 0x92, 0xe1, 0x4e, 0x86, - 0x7b, 0xd9, 0xac, 0x47, 0x2c, 0x62, 0x12, 0x40, 0xbb, 0x9f, 0x62, 0x4d, 0x2b, 0x60, 0x3c, 0x65, - 0x1c, 0xf9, 0x98, 0x13, 0x34, 0x76, 0x7d, 0x22, 0xb0, 0x8b, 0x02, 0x96, 0x50, 0xa5, 0x3b, 0x1b, - 0x1d, 0x54, 0x7a, 0x3c, 0x7a, 0xa0, 0x43, 0x16, 0x0c, 0x8c, 0x0b, 0x50, 0x4e, 0x38, 0xcf, 0xc9, - 0xa8, 0xa1, 0x37, 0xf5, 0x56, 0xa5, 0x5b, 0xdb, 0x2e, 0xed, 0xea, 0x14, 0xa7, 0xc3, 0x8e, 0xa3, - 0xe2, 0x8e, 0x57, 0x00, 0xc6, 0x0d, 0xf8, 0x8b, 0x83, 0x80, 0xe5, 0x54, 0x34, 0xfe, 0x48, 0xd6, - 0xdc, 0x2e, 0xed, 0x13, 0xc5, 0x16, 0x42, 0x1f, 0x87, 0xe1, 0x88, 0x70, 0xee, 0x78, 0x7b, 0xd4, - 0xc8, 0x40, 0x35, 0x97, 0xad, 0xfa, 0x38, 0x95, 0xb9, 0xa5, 0x66, 0xa9, 0xf5, 0xbf, 0x7d, 0x0a, - 0xd5, 0x98, 0x70, 0x37, 0x26, 0x2c, 0xc6, 0x84, 0x77, 0x2c, 0xa1, 0xdd, 0xab, 0xf9, 0xd2, 0xd6, - 0xde, 0x3e, 0xec, 0x56, 0x94, 0x88, 0x38, 0xf7, 0x61, 0xc0, 0x52, 0x54, 0x78, 0x52, 0xcf, 0x25, - 0x0f, 0x07, 0x48, 0x4c, 0x33, 0xc2, 0x65, 0x02, 0xf7, 0x8e, 0x54, 0x87, 0x5b, 0xd9, 0xa0, 0xf3, - 0xef, 0x65, 0x66, 0x6b, 0x9b, 0x99, 0xad, 0x39, 0xc7, 0xa0, 0x76, 0x70, 0xea, 0x11, 0x9e, 0x31, - 0xca, 0x49, 0xfb, 0x11, 0x94, 0x7a, 0x3c, 0x32, 0x3c, 0x50, 0x2e, 0x56, 0x60, 0xc3, 0x9f, 0xb6, - 0x0b, 0x0f, 0x99, 0xe6, 0xf9, 0x2f, 0xc0, 0xbe, 0x74, 0xf7, 0x7e, 0xbe, 0xb2, 0xf4, 0xc5, 0xca, - 0xd2, 0x3f, 0x57, 0x96, 0xfe, 0xba, 0xb6, 0xb4, 0xc5, 0xda, 0xd2, 0xde, 0xd7, 0x96, 0xf6, 0x84, - 0xbe, 0x79, 0x51, 0xc5, 0x9e, 0x59, 0x4e, 0x43, 0x2c, 0x12, 0x46, 0x8b, 0x00, 0x9a, 0xa8, 0xeb, - 0x4b, 0x63, 0x7e, 0x59, 0x1e, 0xeb, 0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x64, 0x3f, 0xa2, 0x81, - 0x19, 0x02, 0x00, 0x00, + // 413 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x3f, 0x8f, 0xd3, 0x30, + 0x18, 0xc6, 0x93, 0xab, 0x54, 0x74, 0x86, 0x43, 0x6a, 0x38, 0xc1, 0x11, 0x89, 0xe4, 0x94, 0x01, + 0xca, 0x49, 0xd8, 0xe4, 0x60, 0xba, 0x8d, 0x32, 0x31, 0x74, 0x89, 0xc4, 0x00, 0x4b, 0xe5, 0x24, + 0x26, 0x89, 0xda, 0xd8, 0x51, 0x5f, 0xa7, 0x6a, 0x57, 0x06, 0x84, 0x98, 0xf8, 0x08, 0x9d, 0x99, + 0xfa, 0x31, 0x3a, 0x76, 0x64, 0x2a, 0xa8, 0x1d, 0xca, 0xdc, 0x4f, 0x80, 0x62, 0xbb, 0x15, 0x03, + 0xd2, 0x2d, 0x71, 0xf2, 0x3e, 0xbf, 0xf7, 0xcf, 0x93, 0xd7, 0xe8, 0x09, 0xe4, 0x8c, 0xcb, 0x9a, + 0xd0, 0x5a, 0xe6, 0x64, 0x12, 0xd2, 0x51, 0x95, 0xd3, 0x90, 0xc8, 0x29, 0xae, 0xc6, 0x42, 0x0a, + 0xe7, 0x5c, 0xcb, 0xb8, 0x91, 0xf1, 0x41, 0x76, 0xcf, 0x33, 0x91, 0x09, 0x05, 0x90, 0xe6, 0x4d, + 0xb3, 0xae, 0x97, 0x08, 0x28, 0x05, 0x90, 0x98, 0x02, 0x23, 0x93, 0x30, 0x66, 0x92, 0x86, 0x24, + 0x11, 0x05, 0x37, 0xfa, 0x23, 0xa3, 0x97, 0x90, 0x91, 0x49, 0xd8, 0x1c, 0x46, 0xe8, 0xd0, 0xb2, + 0xe0, 0x82, 0xa8, 0xa7, 0x0e, 0x05, 0x5f, 0x4e, 0xd0, 0x69, 0x1f, 0xb2, 0xf7, 0x7c, 0x24, 0x92, + 0xa1, 0xf3, 0x1c, 0xb5, 0x0b, 0x80, 0x9a, 0x8d, 0x2f, 0xec, 0x4b, 0xbb, 0x7b, 0xda, 0xeb,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dc, 0x7a, 0xd6, 0x47, 0xf2, 0x8f, 0x53, 0x5d, 0xec, 0x93, 0xa8, 0x79, + 0x4a, 0x65, 0x21, 0xb8, 0x09, 0x90, 0xa9, 0xbe, 0x47, 0xca, 0x76, 0xdc, 0x56, 0xab, 0x7c, 0xf5, + 0x37, 0x00, 0x00, 0xff, 0xff, 0x82, 0x50, 0xf3, 0x79, 0x63, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/bank/types/tx.pb.go b/x/bank/types/tx.pb.go index da7b11762..53b9fd4c0 100644 --- a/x/bank/types/tx.pb.go +++ b/x/bank/types/tx.pb.go @@ -8,6 +8,8 @@ import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/cosmos-sdk/x/bank/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -118,33 +120,36 @@ func init() { func init() { proto.RegisterFile("shentu/bank/v1alpha1/tx.proto", fileDescriptor_9e48e53fa83c4dd7) } var fileDescriptor_9e48e53fa83c4dd7 = []byte{ - // 413 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xb1, 0x8e, 0xd3, 0x30, - 0x18, 0xc7, 0x93, 0x2b, 0x3a, 0x71, 0x3e, 0x10, 0x10, 0xee, 0xd4, 0xa3, 0x88, 0xe4, 0x14, 0x96, - 0x4a, 0x08, 0x9b, 0x14, 0xa6, 0x6e, 0x14, 0x09, 0x09, 0x89, 0x2e, 0x61, 0x63, 0x00, 0x39, 0x89, - 0x9b, 0x46, 0x6d, 0xfc, 0x45, 0xb1, 0x53, 0xb5, 0x6f, 0xc0, 0xc8, 0x23, 0x74, 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0a, 0xd7, 0xbf, 0xd3, 0x6c, 0x35, 0x39, 0x21, 0x3a, 0xa5, 0x29, 0x14, 0x5c, - 0x5e, 0xdd, 0xb8, 0x6e, 0x75, 0xcf, 0x7b, 0x0f, 0xb0, 0x6e, 0x1e, 0x57, 0xc3, 0xc1, 0x75, 0xf3, - 0xf8, 0x15, 0x24, 0x7c, 0xf0, 0x6c, 0x55, 0x3a, 0xc6, 0x97, 0xef, 0x4e, 0x37, 0x4e, 0xe4, 0xb8, - 0x08, 0x70, 0x08, 0x29, 0xa9, 0x27, 0xa5, 0x1f, 0x4f, 0x45, 0x34, 0x21, 0x72, 0x91, 0x31, 0xa1, - 0x04, 0xe1, 0xd7, 0xd1, 0xfd, 0x9b, 0x9f, 0x96, 0x8e, 0xf1, 0x73, 0xe9, 0x18, 0x6e, 0x1b, 0x5d, - 0x1e, 0x4d, 0xce, 0x67, 0x22, 0x03, 0x2e, 0x58, 0x8f, 0xa1, 0xd6, 0x50, 0xc4, 0xd6, 0x07, 0x84, - 0x0e, 0xc6, 0xfa, 0x18, 0xff, 0xeb, 0xaf, 0xe2, 0xa3, 0x84, 0xce, 0x93, 0xff, 0x28, 0x6a, 0x8e, - 0x19, 0xbc, 0x59, 0x6d, 0x6c, 0x73, 0xbd, 0xb1, 0xcd, 0x1f, 0x1b, 0xdb, 0xfc, 0xbc, 0xb5, 0x8d, - 0xf5, 0xd6, 0x36, 0xbe, 0x6d, 0x6d, 0xe3, 0x3d, 0x39, 0xe8, 0x4a, 0x07, 0x8e, 0xa0, 0xe0, 0x11, - 0x95, 0x09, 0xf0, 0x7a, 0x83, 0xcc, 0xf5, 0x95, 0x50, 0x2d, 0x06, 0xa7, 0xea, 0x32, 0x3c, 0xff, - 0x15, 0x00, 0x00, 0xff, 0xff, 0x36, 0x10, 0x81, 0xfa, 0x99, 0x02, 0x00, 0x00, + // 449 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x31, 0x6f, 0xd4, 0x30, + 0x14, 0xc7, 0x93, 0x1e, 0xaa, 0x54, 0x17, 0x04, 0x0d, 0xad, 0x52, 0x0e, 0x91, 0x54, 0x61, 0x39, + 0x15, 0x61, 0x37, 0x85, 0xe9, 0x36, 0x0e, 0x09, 0x09, 0x89, 0x2e, 0x61, 0x63, 0x00, 0x39, 0x89, + 0x9b, 0x8b, 0xee, 0xe2, 0x17, 0xc5, 0xce, 0xa9, 0x5d, 0x99, 0x10, 0x13, 0x1f, 0xa1, 0x33, 0x53, + 0x3f, 0x46, 0xc7, 0x8e, 0x4c, 0xa1, 0xba, 0x1b, 0xca, 0x7c, 0x9f, 0x00, 0xc5, 0x4e, 0xca, 0x05, + 0x18, 0xba, 0xc4, 0xf1, 0xfb, 0xbd, 0xff, 0xdf, 0xc9, 0xdf, 0x0f, 0x3d, 0x11, 0x63, 0xc6, 0x65, + 0x49, 0x42, 0xca, 0x27, 0x64, 0xe6, 0xd3, 0x69, 0x3e, 0xa6, 0x3e, 0x91, 0x27, 0x38, 0x2f, 0x40, + 0x82, 0xb5, 0xad, 0x31, 0xae, 0x31, 0x6e, 0x71, 0x7f, 0x3b, 0x81, 0x04, 0x54, 0x03, 0xa9, 0xdf, + 0x74, 0x6f, 0xdf, 0x89, 0x40, 0x64, 0x20, 0x48, 0x48, 0x05, 0x23, 0x33, 0x3f, 0x64, 0x92, 0xfa, + 0x24, 0x82, 0x94, 0xff, 0xc3, 0xd5, 0x51, 0x9a, 0x2b, 0x63, 0xcd, 0xed, 0x86, 0x67, 0x22, 0x21, + 0x33, 0xbf, 0x5e, 0x1a, 0xb0, 0x45, 0xb3, 0x94, 0x03, 0x51, 0x4f, 0x5d, 0xf2, 0xae, 0xd6, 0xd0, + 0xbd, 0x23, 0x91, 0xbc, 0x83, 0x68, 0xc2, 0xe2, 0xf7, 0x8c, 0xc7, 0xd6, 0x10, 0xdd, 0x3d, 0x2e, + 0x20, 0xfb, 0x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c5, 0xff, 0x9b, 0x14, 0xdc, 0x71, 0xe8, 0x3f, 0xbb, + 0x45, 0x53, 0x7b, 0xcc, 0xe8, 0xed, 0xc5, 0xdc, 0x31, 0x2f, 0xe7, 0x8e, 0x79, 0x35, 0x77, 0xcc, + 0x6f, 0x0b, 0xc7, 0xb8, 0x5c, 0x38, 0xc6, 0x8f, 0x85, 0x63, 0x7c, 0x20, 0x2b, 0x7f, 0xaf, 0x0d, + 0x8f, 0xa1, 0xe4, 0x31, 0x95, 0x29, 0xf0, 0xa6, 0x40, 0x4e, 0xf4, 0x98, 0xa9, 0x28, 0xc2, 0x75, + 0x35, 0x34, 0x2f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x99, 0x73, 0x02, 0xdb, 0xed, 0x02, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/bounty/types/tx.pb.go b/x/bounty/types/tx.pb.go index 3fbe0650c..01038acb8 100644 --- a/x/bounty/types/tx.pb.go +++ b/x/bounty/types/tx.pb.go @@ -9,6 +9,8 @@ import ( _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -949,68 +951,75 @@ func init() { func init() { proto.RegisterFile("shentu/bounty/v1/tx.proto", fileDescriptor_1e4b4296bac3db30) } var fileDescriptor_1e4b4296bac3db30 = []byte{ - // 963 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x16, 0xe5, 0x1f, 0xc4, 0xe3, 0x58, 0x76, 0xd8, 0xd8, 0x96, 0x98, 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4a, 0x7e, 0xb5, 0xf9, 0xc8, 0xc7, 0xcc, - 0xdc, 0x8c, 0xfe, 0xb3, 0xbf, 0xf8, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xe2, 0x93, 0xaf, 0xe3, 0x42, - 0x10, 0x00, 0x00, + // 1077 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcf, 0x6f, 0xe3, 0xc4, + 0x17, 0x8f, 0x93, 0xb6, 0xfa, 0x76, 0xba, 0x4d, 0x5b, 0x6f, 0x7f, 0x24, 0xde, 0xef, 0xc6, 0xc5, + 0x20, 0xd1, 0x2d, 0xab, 0x58, 0xd9, 0x2d, 0xb0, 0x2a, 0xa7, 0xed, 0x6a, 0x57, 0xac, 0xa0, 0xa2, + 0xf2, 0x9e, 0x40, 0x48, 0xd1, 0x24, 0x9e, 0x38, 0x23, 0xc5, 0x1e, 0xcb, 0x33, 0x89, 0x36, 0x57, + 0x4e, 0x88, 0x13, 0xff, 0x00, 0x62, 0xff, 0x84, 0xfd, 0x0f, 0xb8, 0x21, 0x0e, 0x1c, 0x56, 0x9c, + 0x38, 0x45, 0xa8, 0x3d, 0x2c, 0x07, 0x0e, 0x28, 0x82, 0x3b, 0xb2, 0x3d, 0xe3, 0xda, 0x8e, 0xb3, + 0x4e, 0xd3, 0x4a, 0x94, 0x4b, 0xe5, 0x79, 0xef, 0x33, 0xef, 0xf9, 0xf3, 0x3e, 0x9e, 0xf7, 0xa6, + 0x01, 0x55, 0xda, 0x45, 0x0e, 0xeb, 0xeb, 0x2d, 0xd2, 0x77, 0xd8, 0x50, 0x1f, 0x34, 0x74, 0xf6, + 0xbc, 0xee, 0x7a, 0x84, 0x11, 0x79, 0x3d, 0x74, 0xd5, 0x43, 0x57, 0x7d, 0xd0, 0x50, 0x36, 0x2d, + 0x62, 0x91, 0xc0, 0xa9, 0xfb, 0x4f, 0x21, 0x4e, 0x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, 0xff, 0xff, 0xe5, 0x4a, 0x93, + 0x5a, 0x6d, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/cert/types/tx.pb.go b/x/cert/types/tx.pb.go index 353fd7582..3b5bcfd15 100644 --- a/x/cert/types/tx.pb.go +++ b/x/cert/types/tx.pb.go @@ -8,6 +8,8 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -351,51 +353,55 @@ func init() { func init() { proto.RegisterFile("shentu/cert/v1alpha1/tx.proto", fileDescriptor_c52586cc907ff884) } var fileDescriptor_c52586cc907ff884 = []byte{ - // 698 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x95, 0xcf, 0x4e, 0xdb, 0x4a, - 0x14, 0xc6, 0xe3, 0x04, 0x2e, 0x30, 0xc0, 0x25, 0x77, 0x88, 0xee, 0xcd, 0x4d, 0xc1, 0xae, 0xbc, - 0xa8, 0x68, 0x55, 0xec, 0x92, 0x6e, 0x2a, 0xda, 0x4d, 0xc3, 0xa6, 0xa8, 0x8a, 0x14, 0x79, 0xd7, - 0x6e, 0xd0, 0xc4, 0x9e, 0x38, 0x16, 0x8e, 0xc7, 0xf2, 0x8c, 0x11, 0x7e, 0x83, 0x2e, 0xfb, 0x08, - 0xec, 0xfa, 0x02, 0x6c, 0xfa, 0x06, 0x15, 0x52, 0x25, 0x96, 0x5d, 0x59, 0x15, 0x48, 0x55, 0xd7, - 0x7e, 0x82, 0xca, 0x33, 0x1e, 0x37, 0xe4, 0x4f, 0x15, 0xb1, 0xcb, 0xcc, 0xf7, 0x9b, 0x73,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xab, 0x56, 0xae, 0x6f, 0xd5, 0xca, 0xb7, 0x5b, 0xb5, 0xf2, 0xde, 0x74, 0x3d, 0x36, 0x8c, - 0xfb, 0x86, 0x4d, 0x46, 0xa6, 0x88, 0x3a, 0x20, 0x71, 0xe0, 0xa0, 0x7c, 0x5e, 0x8a, 0x0d, 0xf3, - 0x5c, 0xfc, 0xa9, 0xb0, 0x24, 0xc4, 0xb4, 0xff, 0x17, 0x6f, 0xd6, 0xe7, 0xbf, 0x02, 0x00, 0x00, - 0xff, 0xff, 0x98, 0xd9, 0xba, 0x7a, 0xf1, 0x06, 0x00, 0x00, + // 764 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x3d, 0x4f, 0xdb, 0x40, + 0x18, 0xce, 0x07, 0x94, 0x72, 0x40, 0x09, 0x26, 0x82, 0x34, 0x85, 0xb8, 0xf2, 0x50, 0x51, 0x54, + 0xec, 0x26, 0x5d, 0x2a, 0xda, 0xa5, 0x61, 0x29, 0xaa, 0x22, 0x45, 0xde, 0xda, 0x05, 0x39, 0xce, + 0xc5, 0xb1, 0x88, 0x7d, 0x96, 0xef, 0x1c, 0xe1, 0xb5, 0x4b, 0xab, 0x2e, 0xed, 0x4f, 0xe0, 0x27, + 0x30, 0xf0, 0x23, 0x2a, 0xa4, 0x4a, 0x8c, 0x9d, 0xa2, 0x8a, 0x0c, 0x74, 0xf6, 0x2f, 0xa8, 0x7c, + 0x1f, 0x26, 0x71, 0x92, 0x2a, 0x62, 0x01, 0xdf, 0xfb, 0x3c, 0x77, 0xef, 0xfb, 0x3e, 0xef, 0x47, + 0xc0, 0x2e, 0xee, 0x42, 0x97, 0x04, 0x9a, 0x09, 0x7d, 0xa2, 0xf5, 0xab, 0x46, 0xcf, 0xeb, 0x1a, + 0x55, 0x8d, 0x9c, 0xa9, 0x9e, 0x8f, 0x08, 0x92, 0x8a, 0x0c, 0x56, 0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, + 0xda, 0xfc, 0xdc, 0xc4, 0xa9, 0x03, 0xd6, 0xd3, 0x4d, 0xb8, 0x37, 0xf3, 0x99, 0x14, 0xb3, 0xfc, + 0x72, 0x5e, 0xa6, 0x70, 0x57, 0x3f, 0xfe, 0x79, 0x53, 0xc9, 0x5e, 0xdf, 0x54, 0xb2, 0x7f, 0x6e, + 0x2a, 0xd9, 0x1f, 0xc3, 0x4a, 0xe6, 0x7a, 0x58, 0xc9, 0xfc, 0x1e, 0x56, 0x32, 0x9f, 0x34, 0xcb, + 0x26, 0xdd, 0xa0, 0xa5, 0x9a, 0xc8, 0xd1, 0xd8, 0xab, 0x1d, 0x14, 0xb8, 0x6d, 0x23, 0x9e, 0x40, + 0x6e, 0xd0, 0xce, 0xd8, 0x2f, 0x1f, 0x09, 0x3d, 0x88, 0x5b, 0x0f, 0x68, 0x57, 0xbf, 0xfa, 0x17, + 0x00, 0x00, 0xff, 0xff, 0x6a, 0xef, 0xe8, 0x8f, 0xc2, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index 22a5d1b7f..2c1ae8e24 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -8,6 +8,8 @@ import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -895,83 +897,92 @@ func init() { func init() { proto.RegisterFile("shentu/oracle/v1alpha1/tx.proto", fileDescriptor_997621a7e064be40) } var fileDescriptor_997621a7e064be40 = []byte{ - // 1205 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xbf, 0x6f, 0xdb, 0xc6, - 0x17, 0x17, 0xa5, 0xf8, 0xd7, 0xf9, 0x67, 0x68, 0x27, 0x91, 0x65, 0x44, 0xf4, 0xf7, 0xbe, 0x68, - 0xec, 0xa2, 0x0d, 0x59, 0x39, 0x4b, 0x91, 0xa1, 0x40, 0x64, 0x17, 0x68, 0x10, 0x18, 0x01, 0x88, - 0x00, 0x2d, 0xba, 0x18, 0x27, 0xf2, 0x2c, 0x11, 0x96, 0x78, 0x02, 0xef, 0x64, 0xcb, 0x40, 0x87, - 0x8e, 0x1d, 0x33, 0x76, 0x29, 0x90, 0xa1, 0xe8, 0xd0, 0xa1, 0x7f, 0x87, 0xc7, 0x4c, 0x45, 0x27, - 0xa5, 0xb0, 0x97, 0xa2, 0x40, 0x17, 0xcd, 0x1d, 0x8a, 0xbb, 0x23, 0xa9, 0x23, 0x29, 0x50, 0x52, - 0x10, 0x78, 0x32, 0x75, 0xef, 0x73, 0xef, 0xde, 0xfb, 0xbc, 0x9f, 0x30, 0x30, 0x68, 0x0b, 0xfb, - 0xac, 0x67, 0x91, 0x00, 0x39, 0x6d, 0x6c, 0x9d, 0xd7, 0x50, 0xbb, 0xdb, 0x42, 0x35, 0x8b, 0xf5, - 0xcd, 0x6e, 0x40, 0x18, 0xd1, 0xef, 0x4b, 0x80, 0x29, 0x01, 0x66, 0x04, 0xa8, 0x6c, 0x35, 0x49, - 0x93, 0x08, 0x88, 0xc5, 0xbf, 0x24, 0xba, 0x52, 0x75, 0x08, 0xed, 0x10, 0x6a, 0x35, 0x10, 0xe5, - 0xca, 0x1a, 0x98, 0xa1, 0x9a, 0xe5, 0x10, 0xcf, 0x8f, 0xe4, 0x4d, 0x42, 0x9a, 0x6d, 0x6c, 0x89, - 0x5f, 0x8d, 0xde, 0xa9, 0xe5, 0xf6, 0x02, 0xc4, 0x3c, 0x12, 0xc9, 0x8d, 0xb4, 0x9c, 0x79, 0x1d, - 0x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d, 0x81, 0xf9, 0x06, 0xe9, - 0xf9, 0xec, 0xb2, 0x5c, 0x9a, 0x14, 0x97, 0x67, 0x61, 0x5c, 0x56, 0xa5, 0x36, 0x79, 0x6d, 0xb6, - 0x48, 0x84, 0x6f, 0xe9, 0x9f, 0x83, 0x65, 0x17, 0x53, 0x27, 0xf0, 0xba, 0xc2, 0x52, 0xd9, 0x59, - 0xee, 0x0f, 0x07, 0x86, 0x2e, 0x75, 0x2b, 0x42, 0x68, 0xab, 0x50, 0x4e, 0xbc, 0xc3, 0xf9, 0x21, - 0x41, 0x79, 0x2e, 0x4d, 0x7c, 0x28, 0x80, 0x76, 0x04, 0xe1, 0xad, 0xeb, 0x02, 0x79, 0xac, 0x3c, - 0xbf, 0xab, 0xed, 0x97, 0xd4, 0xd6, 0xc5, 0x4f, 0xa1, 0x2d, 0x84, 0xba, 0x03, 0xd6, 0xce, 0x51, - 0xdb, 0x73, 0x4f, 0xa2, 0x81, 0x50, 0x5e, 0xd8, 0xd5, 0x04, 0x15, 0x72, 0x22, 0x98, 0xd1, 0x44, - 0x30, 0x8f, 0x42, 0x40, 0xfd, 0x7f, 0x21, 0x15, 0xf7, 0xa4, 0xb6, 0xe4, 0x75, 0xf8, 0xe3, 0x3b, - 0x43, 0xb3, 0x57, 0xc5, 0x61, 0x74, 0x43, 0x49, 0x81, 0x07, 0xe0, 0x5e, 0x22, 0xc8, 0x71, 0xf8, - 0x7f, 0xd7, 0xc0, 0xfa, 0x31, 0x6d, 0xaa, 0x67, 0xb7, 0x90, 0x00, 0x8f, 0xc0, 0x1c, 0x75, 0x48, - 0x80, 0xc5, 0x2c, 0x28, 0xd5, 0x37, 0x86, 0x03, 0x63, 0x45, 0xa2, 0xc5, 0x31, 0xb4, 0xa5, 0x98, - 0x2b, 0x26, 0x61, 0xcb, 0x0c, 0xe3, 0xa5, 0x28, 0x8e, 0x24, 0xd0, 0x8e, 0x41, 0x8a, 0xc7, 0xdb, - 0xe0, 0x41, 0xca, 0xaf,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, - 0x26, 0x93, 0x21, 0x80, 0xb9, 0xde, 0x8c, 0x6d, 0xa7, 0x3e, 0x58, 0x4b, 0x9d, 0xe4, 0xe5, 0x42, - 0x12, 0x9a, 0x9b, 0x0b, 0xe3, 0x7b, 0x1a, 0xf7, 0x2c, 0xd1, 0xd0, 0xf6, 0x26, 0x13, 0x33, 0xd9, - 0xb3, 0x71, 0x0d, 0xab, 0xfe, 0xe2, 0xea, 0xba, 0xaa, 0xbd, 0xbd, 0xae, 0x6a, 0x7f, 0x5e, 0x57, - 0xb5, 0xd7, 0x37, 0xd5, 0xc2, 0xdb, 0x9b, 0x6a, 0xe1, 0x8f, 0x9b, 0x6a, 0xe1, 0xdb, 0x9a, 0x32, - 0xf3, 0xa4, 0xd2, 0x53, 0xd2, 0xf3, 0x5d, 0xb1, 0xf4, 0x85, 0x07, 0x56, 0x3f, 0xfa, 0x17, 0x87, - 0x18, 0x81, 0x8d, 0x79, 0x31, 0xd8, 0x9e, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x6d, 0x00, - 0xc3, 0x00, 0x11, 0x00, 0x00, + // 1348 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcf, 0x6b, 0x1b, 0xc7, + 0x17, 0xd7, 0x4a, 0x4e, 0x62, 0x8f, 0x7f, 0xc4, 0x5e, 0x3b, 0xb1, 0xac, 0x10, 0xad, 0xbf, 0xf3, + 0xa5, 0xb1, 0x93, 0x26, 0xbb, 0x51, 0x72, 0x29, 0x3a, 0x14, 0xa2, 0xa4, 0xd0, 0x50, 0x4c, 0x60, + 0x09, 0xb4, 0xf4, 0x62, 0x46, 0xbb, 0x63, 0x69, 0x89, 0xb4, 0xa3, 0xee, 0x8e, 0x1c, 0xf9, 0x56, + 0x0a, 0x85, 0xd2, 0x4b, 0xd3, 0x43, 0xa1, 0x97, 0x42, 0xa0, 0xb7, 0x1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e6, 0xac, 0xc8, 0xf4, + 0x32, 0x0a, 0xd6, 0xc7, 0xb6, 0xda, 0x0f, 0x33, 0x7d, 0xd6, 0xc1, 0xa5, 0xdb, 0x73, 0x80, 0x55, + 0x4a, 0x47, 0xb6, 0xc2, 0x2c, 0x4a, 0x75, 0x68, 0x26, 0xa5, 0x93, 0x17, 0x3f, 0xb3, 0x0e, 0x80, + 0xb2, 0xf4, 0x7d, 0x30, 0xb5, 0x06, 0x18, 0xac, 0x74, 0x63, 0x26, 0x58, 0x7a, 0x47, 0x13, 0xac, + 0x68, 0xff, 0xdf, 0xcb, 0x38, 0xae, 0x02, 0x4b, 0xce, 0x8c, 0x40, 0x35, 0x1a, 0xe5, 0x1d, 0xce, + 0x8a, 0x66, 0x08, 0xcb, 0x8c, 0x66, 0xfc, 0xb1, 0x63, 0xd1, 0x68, 0x0f, 0xdd, 0xde, 0x74, 0x32, + 0x38, 0x30, 0x33, 0x9a, 0x89, 0x83, 0x39, 0x04, 0x6b, 0x23, 0x92, 0xac, 0x5a, 0xd0, 0xa1, 0x99, + 0xb5, 0x30, 0x79, 0xea, 0xb1, 0xc8, 0xb4, 0x89, 0xb7, 0x37, 0x9d, 0x98, 0xe9, 0x91, 0x4d, 0x1a, + 0x58, 0xb5, 0xcf, 0x9e, 0xbf, 0x2a, 0x1b, 0x2f, 0x5e, 0x95, 0x8d, 0xbf, 0x5f, 0x95, 0x8d, 0x27, + 0xaf, 0xcb, 0xb9, 0x17, 0xaf, 0xcb, 0xb9, 0xbf, 0x5e, 0x97, 0x73, 0x5f, 0x56, 0x94, 0x17, 0x56, + 0x18, 0x3d, 0x22, 0xdd, 0xd0, 0xe7, 0x9b, 0xac, 0x14, 0x38, 0xbd, 0xe4, 0xaf, 0x54, 0xfc, 0xc1, + 0xad, 0x9f, 0xe5, 0xcf, 0xe8, 0xed, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x33, 0x14, 0x73, 0x25, + 0xc3, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/shield/types/tx.pb.go b/x/shield/types/tx.pb.go index 89f094091..c940c7be0 100644 --- a/x/shield/types/tx.pb.go +++ b/x/shield/types/tx.pb.go @@ -7,6 +7,8 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -111,26 +113,28 @@ func init() { func init() { proto.RegisterFile("shentu/shield/v1alpha1/tx.proto", fileDescriptor_e048a9056d0d0343) } var fileDescriptor_e048a9056d0d0343 = []byte{ - // 291 bytes of a gzipped FileDescriptorProto + // 329 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0xce, 0x48, 0xcd, 0x2b, 0x29, 0xd5, 0x2f, 0xce, 0xc8, 0x4c, 0xcd, 0x49, 0xd1, 0x2f, 0x33, 0x4c, 0xcc, 0x29, 0xc8, 0x48, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, 0x28, 0xd0, 0x83, 0x28, 0xd0, 0x83, 0x29, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0xa5, 0xe4, 0x92, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x93, 0x12, 0x8b, 0x53, 0xf5, - 0xcb, 0x0c, 0x93, 0x52, 0x4b, 0x12, 0x0d, 0xf5, 0x93, 0xf3, 0x33, 0xf3, 0xa0, 0xf2, 0xca, 0x38, - 0xac, 0x83, 0x9a, 0x0e, 0x56, 0xa4, 0xe4, 0xcc, 0x25, 0x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, - 0x01, 0x00, 0x00, + 0xcb, 0x0c, 0x93, 0x52, 0x4b, 0x12, 0x0d, 0xf5, 0x93, 0xf3, 0x33, 0xf3, 0xa0, 0xf2, 0xe2, 0x50, + 0xf9, 0xdc, 0xe2, 0x74, 0xfd, 0x32, 0x43, 0x10, 0x05, 0x95, 0x10, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, + 0xd7, 0x07, 0x93, 0x50, 0x21, 0x65, 0x1c, 0x4e, 0x83, 0xba, 0x04, 0xac, 0x48, 0x29, 0x8b, 0x4b, + 0xc8, 0xb7, 0x38, 0x3d, 0x3c, 0xb3, 0x24, 0x23, 0xa5, 0x28, 0xb1, 0x3c, 0x28, 0xb5, 0x3c, 0xb1, + 0x28, 0xa5, 0x58, 0x48, 0x99, 0x8b, 0x25, 0xad, 0x28, 0x3f, 0x57, 0x82, 0x51, 0x81, 0x51, 0x83, + 0xd3, 0x89, 0xff, 0xd3, 0x3d, 0x79, 0xee, 0xca, 0xc4, 0xdc, 0x1c, 0x2b, 0x25, 0x90, 0xa8, 0x52, + 0x10, 0x58, 0xd2, 0x4a, 0xbf, 0x63, 0x81, 0x3c, 0xc3, 0x8b, 0x05, 0xf2, 0x0c, 0x4d, 0xcf, 0x37, + 0x68, 0x81, 0x85, 0xba, 0x9e, 0x6f, 0xd0, 0x92, 0x84, 0x5a, 0x87, 0x69, 0xaa, 0x92, 0x0c, 0x97, + 0x14, 0xa6, 0x68, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x51, 0x05, 0x17, 0xb3, 0x6f, + 0x71, 0xba, 0x50, 0x21, 0x17, 0x3f, 0xba, 0x6b, 0xb4, 0xf4, 0xb0, 0x87, 0xa1, 0x1e, 0xa6, 0x69, + 0x52, 0x46, 0xc4, 0xab, 0x85, 0xd9, 0xec, 0xe4, 0x7d, 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, 0x86, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x10, + 0x73, 0xd3, 0xf2, 0x4b, 0xf3, 0x52, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0xa0, 0x02, 0xfa, 0x15, 0xb0, + 0x00, 0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x87, 0xab, 0x31, 0x20, 0x00, 0x00, 0xff, + 0xff, 0x0d, 0x96, 0xa6, 0x74, 0x19, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From c3aceb8f04d9b4aacac7c74e03386c3e9c9742ae Mon Sep 17 00:00:00 2001 From: skyargos Date: Tue, 5 Nov 2024 11:04:43 +0800 Subject: [PATCH 03/37] fix: 07-tendermint add in moudle manager --- app/app.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/app.go b/app/app.go index f60126990..bde148424 100644 --- a/app/app.go +++ b/app/app.go @@ -96,6 +96,8 @@ import ( ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" @@ -509,6 +511,7 @@ func NewShentuApp( oracle.NewAppModule(app.OracleKeeper, app.BankKeeper), shield.NewAppModule(app.ShieldKeeper, app.AccountKeeper, app.BankKeeper), ibc.NewAppModule(app.IBCKeeper), + ibctm.AppModule{}, params.NewAppModule(app.ParamsKeeper), transferModule, icaModule, From f0baea0ab64b317c55b9c3ed73045d8adcc70e42 Mon Sep 17 00:00:00 2001 From: skyargos Date: Tue, 5 Nov 2024 15:00:10 +0800 Subject: [PATCH 04/37] update app.go --- app/app.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index bde148424..559a76416 100644 --- a/app/app.go +++ b/app/app.go @@ -82,6 +82,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/ibc-go/modules/capability" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" @@ -96,13 +97,12 @@ import ( ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v8/modules/core" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" appparams "github.com/shentufoundation/shentu/v2/app/params" "github.com/shentufoundation/shentu/v2/x/auth" From 0c2aa0e11f01ea56ba4ee388c735464c78dd05ff Mon Sep 17 00:00:00 2001 From: skyargos Date: Wed, 6 Nov 2024 15:56:57 +0800 Subject: [PATCH 05/37] refactor!: rm GetSignBytes 1. https://github.com/cosmos/cosmos-sdk/pull/16062 --- x/auth/types/codec.go | 19 -------- x/auth/types/msgs.go | 5 -- x/bank/types/codec.go | 19 -------- x/bank/types/msgs.go | 5 -- x/bounty/types/codec.go | 19 -------- x/bounty/types/msgs.go | 96 -------------------------------------- x/cert/types/codec.go | 19 -------- x/cert/types/msgs.go | 24 ---------- x/oracle/types/codec.go | 19 -------- x/oracle/types/msgs.go | 101 ---------------------------------------- x/shield/types/codec.go | 12 ----- x/shield/types/msg.go | 6 --- 12 files changed, 344 deletions(-) diff --git a/x/auth/types/codec.go b/x/auth/types/codec.go index a0c503984..784c5f6a8 100644 --- a/x/auth/types/codec.go +++ b/x/auth/types/codec.go @@ -3,7 +3,6 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -48,21 +47,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/auth module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/auth and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} diff --git a/x/auth/types/msgs.go b/x/auth/types/msgs.go index 5f5643be1..186bab70f 100644 --- a/x/auth/types/msgs.go +++ b/x/auth/types/msgs.go @@ -45,11 +45,6 @@ func (m MsgUnlock) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgUnlock) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners defines whose signature is required. func (m MsgUnlock) GetSigners() []sdk.AccAddress { issuer, err := sdk.AccAddressFromBech32(m.Issuer) diff --git a/x/bank/types/codec.go b/x/bank/types/codec.go index 5731e3b0b..0ca14b979 100644 --- a/x/bank/types/codec.go +++ b/x/bank/types/codec.go @@ -3,7 +3,6 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -24,21 +23,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/bank module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/staking and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} diff --git a/x/bank/types/msgs.go b/x/bank/types/msgs.go index c3ae4508c..7a83570b1 100644 --- a/x/bank/types/msgs.go +++ b/x/bank/types/msgs.go @@ -46,11 +46,6 @@ func (m MsgLockedSend) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgLockedSend) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners defines whose signature is required. func (m MsgLockedSend) GetSigners() []sdk.AccAddress { from, err := sdk.AccAddressFromBech32(m.FromAddress) diff --git a/x/bounty/types/codec.go b/x/bounty/types/codec.go index 095baf15f..6d4196762 100644 --- a/x/bounty/types/codec.go +++ b/x/bounty/types/codec.go @@ -3,7 +3,6 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" ) @@ -41,21 +40,3 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/bounty module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/bounty and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} diff --git a/x/bounty/types/msgs.go b/x/bounty/types/msgs.go index 2a9e73f69..e5ad91b16 100644 --- a/x/bounty/types/msgs.go +++ b/x/bounty/types/msgs.go @@ -43,10 +43,6 @@ func (msg MsgCreateProgram) Route() string { return RouterKey } // Type implements the sdk.Msg interface. func (msg MsgCreateProgram) Type() string { return TypeMsgCreateProgram } -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). -// If the validator address is not same as delegator's, then the validator must -// sign the msg as well. func (msg MsgCreateProgram) GetSigners() []sdk.AccAddress { // creator should sign the message cAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -57,12 +53,6 @@ func (msg MsgCreateProgram) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{cAddr} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgCreateProgram) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // ValidateBasic implements the sdk.Msg interface. func (msg MsgCreateProgram) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -97,10 +87,6 @@ func (msg MsgEditProgram) Route() string { return RouterKey } // Type implements the sdk.Msg interface. func (msg MsgEditProgram) Type() string { return TypeMsgEditProgram } -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). -// If the validator address is not same as delegator's, then the validator must -// sign the msg as well. func (msg MsgEditProgram) GetSigners() []sdk.AccAddress { // creator should sign the message cAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -111,12 +97,6 @@ func (msg MsgEditProgram) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{cAddr} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgEditProgram) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // ValidateBasic implements the sdk.Msg interface. func (msg MsgEditProgram) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -146,10 +126,6 @@ func (msg MsgSubmitFinding) Route() string { return RouterKey } // Type implements the sdk.Msg interface. func (msg MsgSubmitFinding) Type() string { return TypeMsgSubmitFinding } -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). -// If the validator address is not same as delegator's, then the validator must -// sign the msg as well. func (msg MsgSubmitFinding) GetSigners() []sdk.AccAddress { // creator should sign the message cAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -160,12 +136,6 @@ func (msg MsgSubmitFinding) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{cAddr} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgSubmitFinding) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // ValidateBasic implements the sdk.Msg interface. func (msg MsgSubmitFinding) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -204,10 +174,6 @@ func (msg MsgEditFinding) Route() string { return RouterKey } // Type implements the sdk.Msg interface. func (msg MsgEditFinding) Type() string { return TypeMsgEditFinding } -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). -// If the validator address is not same as delegator's, then the validator must -// sign the msg as well. func (msg MsgEditFinding) GetSigners() []sdk.AccAddress { // creator should sign the message cAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -218,12 +184,6 @@ func (msg MsgEditFinding) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{cAddr} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgEditFinding) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // ValidateBasic implements the sdk.Msg interface. func (msg MsgEditFinding) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -252,19 +212,11 @@ func (msg MsgActivateProgram) Route() string { return RouterKey } // Type implements sdk.Msg interface. func (msg MsgActivateProgram) Type() string { return TypeMsgActivateProgram } -// GetSigners implements sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). func (msg MsgActivateProgram) GetSigners() []sdk.AccAddress { cAddr, _ := sdk.AccAddressFromBech32(msg.OperatorAddress) return []sdk.AccAddress{cAddr} } -// GetSignBytes implements the sdk.Msg interface, returns the message bytes to sign over. -func (msg MsgActivateProgram) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // ValidateBasic implements the sdk.Msg interface. func (msg MsgActivateProgram) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -290,19 +242,11 @@ func (msg MsgCloseProgram) Route() string { return RouterKey } // Type implements sdk.Msg interface. func (msg MsgCloseProgram) Type() string { return TypeMsgCloseProgram } -// GetSigners implements sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). func (msg MsgCloseProgram) GetSigners() []sdk.AccAddress { cAddr, _ := sdk.AccAddressFromBech32(msg.OperatorAddress) return []sdk.AccAddress{cAddr} } -// GetSignBytes implements the sdk.Msg interface, returns the message bytes to sign over. -func (msg MsgCloseProgram) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // ValidateBasic implements the sdk.Msg interface. func (msg MsgCloseProgram) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -328,14 +272,6 @@ func (msg MsgActivateFinding) Route() string { return RouterKey } // Type implements the sdk.Msg interface. func (msg MsgActivateFinding) Type() string { return TypeMsgActivateFinding } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgActivateFinding) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). func (msg MsgActivateFinding) GetSigners() []sdk.AccAddress { // host should sign the message hostAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -372,14 +308,6 @@ func (msg MsgConfirmFinding) Route() string { return RouterKey } // Type implements the sdk.Msg interface. func (msg MsgConfirmFinding) Type() string { return TypeMsgConfirmFinding } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgConfirmFinding) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). func (msg MsgConfirmFinding) GetSigners() []sdk.AccAddress { // host should sign the message hostAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -418,14 +346,6 @@ func (msg MsgConfirmFindingPaid) Route() string { return RouterKey } // Type implements the sdk.Msg interface. func (msg MsgConfirmFindingPaid) Type() string { return TypeMsgConfirmFindingPaid } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgConfirmFindingPaid) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). func (msg MsgConfirmFindingPaid) GetSigners() []sdk.AccAddress { // host should sign the message hostAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -462,14 +382,6 @@ func (msg MsgCloseFinding) Route() string { return RouterKey } // Type implements the sdk.Msg interface. func (msg MsgCloseFinding) Type() string { return TypeMsgCloseFinding } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgCloseFinding) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). func (msg MsgCloseFinding) GetSigners() []sdk.AccAddress { // host should sign the message hostAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -509,8 +421,6 @@ func (msg MsgPublishFinding) Route() string { return RouterKey } // Type implements the sdk.Msg interface. func (msg MsgPublishFinding) Type() string { return TypeMsgPublishFinding } -// GetSigners implements the sdk.Msg interface. It returns the address(es) that -// must sign over msg.GetSignBytes(). func (msg MsgPublishFinding) GetSigners() []sdk.AccAddress { // releaser should sign the message cAddr, err := sdk.AccAddressFromBech32(msg.OperatorAddress) @@ -520,12 +430,6 @@ func (msg MsgPublishFinding) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{cAddr} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgPublishFinding) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // ValidateBasic implements the sdk.Msg interface. func (msg MsgPublishFinding) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.OperatorAddress) diff --git a/x/cert/types/codec.go b/x/cert/types/codec.go index 8305174e6..14de277d0 100644 --- a/x/cert/types/codec.go +++ b/x/cert/types/codec.go @@ -3,7 +3,6 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -56,21 +55,3 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/cert module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/cert and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} diff --git a/x/cert/types/msgs.go b/x/cert/types/msgs.go index 58d9943ff..f6d5ff26f 100644 --- a/x/cert/types/msgs.go +++ b/x/cert/types/msgs.go @@ -51,12 +51,6 @@ func (m MsgProposeCertifier) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgProposeCertifier) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&m) - return sdk.MustSortJSON(bz) -} - // GetSigners defines whose signature is required. func (m MsgProposeCertifier) GetSigners() []sdk.AccAddress { proposerAddr, err := sdk.AccAddressFromBech32(m.Proposer) @@ -98,12 +92,6 @@ func (m MsgIssueCertificate) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgIssueCertificate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&m) - return sdk.MustSortJSON(bz) -} - // GetSigners defines whose signature is required. func (m MsgIssueCertificate) GetSigners() []sdk.AccAddress { certifierAddr, err := sdk.AccAddressFromBech32(m.Certifier) @@ -146,12 +134,6 @@ func (m MsgRevokeCertificate) Route() string { return ModuleName } // Type returns the action name. func (m MsgRevokeCertificate) Type() string { return "revoke_certificate" } -// GetSignBytes encodes the message for signing. -func (m MsgRevokeCertificate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&m) - return sdk.MustSortJSON(bz) -} - // GetSigners defines whose signature is required. func (m MsgRevokeCertificate) GetSigners() []sdk.AccAddress { revokerAddr, err := sdk.AccAddressFromBech32(m.Revoker) @@ -197,12 +179,6 @@ func (m MsgCertifyPlatform) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgCertifyPlatform) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&m) - return sdk.MustSortJSON(bz) -} - // GetSigners defines whose signature is required. func (m MsgCertifyPlatform) GetSigners() []sdk.AccAddress { certifierAddr, err := sdk.AccAddressFromBech32(m.Certifier) diff --git a/x/oracle/types/codec.go b/x/oracle/types/codec.go index 884e07c7f..7a339cf26 100644 --- a/x/oracle/types/codec.go +++ b/x/oracle/types/codec.go @@ -3,7 +3,6 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" ) @@ -46,21 +45,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/oracle module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/oracle and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} diff --git a/x/oracle/types/msgs.go b/x/oracle/types/msgs.go index 84c486eea..92bf68713 100644 --- a/x/oracle/types/msgs.go +++ b/x/oracle/types/msgs.go @@ -1,7 +1,6 @@ package types import ( - "encoding/json" "fmt" "time" @@ -64,15 +63,6 @@ func (m MsgCreateOperator) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgCreateOperator) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // GetSigners defines whose signature is required. func (m MsgCreateOperator) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Proposer) @@ -108,15 +98,6 @@ func (m MsgRemoveOperator) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgRemoveOperator) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // GetSigners defines whose signature is required. func (m MsgRemoveOperator) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Proposer) @@ -155,15 +136,6 @@ func (m MsgAddCollateral) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgAddCollateral) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // GetSigners defines whose signature is required. func (m MsgAddCollateral) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Address) @@ -202,15 +174,6 @@ func (m MsgReduceCollateral) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgReduceCollateral) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // GetSigners defines whose signature is required. func (m MsgReduceCollateral) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Address) @@ -240,15 +203,6 @@ func (m MsgWithdrawReward) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgWithdrawReward) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // GetSigners defines whose signature is required. func (m MsgWithdrawReward) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Address) @@ -280,15 +234,6 @@ func (m MsgCreateTask) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgCreateTask) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // GetSigners defines whose signature is required. func (m MsgCreateTask) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Creator) @@ -316,15 +261,6 @@ func (m MsgTaskResponse) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgTaskResponse) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // GetSigners defines whose signature is required. func (m MsgTaskResponse) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Operator) @@ -352,15 +288,6 @@ func (m MsgDeleteTask) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -func (m MsgDeleteTask) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // GetSigners defines whose signature is required. func (m MsgDeleteTask) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.From) @@ -404,16 +331,6 @@ func (m MsgCreateTxTask) ValidateBasic() error { return nil } -// GetSignBytes encodes the message for signing. -// LegacyMsg interface for Amino -func (m MsgCreateTxTask) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // GetSigners defines whose signature is required. func (m MsgCreateTxTask) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Creator) @@ -447,15 +364,6 @@ func (m MsgTxTaskResponse) ValidateBasic() error { return nil } -// LegacyMsg interface for Amino -func (m MsgTxTaskResponse) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // Msg interface, return the account that should sign the tx func (m MsgTxTaskResponse) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(m.Operator) @@ -487,15 +395,6 @@ func (m MsgDeleteTxTask) ValidateBasic() error { return nil } -// LegacyMsg interface for Amino -func (m MsgDeleteTxTask) GetSignBytes() []byte { - b, err := json.Marshal(m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - // Msg interface, return the account that should sign the tx func (m MsgDeleteTxTask) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(m.From) diff --git a/x/shield/types/codec.go b/x/shield/types/codec.go index 6417d2ca7..2af32287e 100644 --- a/x/shield/types/codec.go +++ b/x/shield/types/codec.go @@ -3,7 +3,6 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" ) @@ -20,14 +19,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - //amino.Seal() -} diff --git a/x/shield/types/msg.go b/x/shield/types/msg.go index 659e7e921..4a6187f07 100644 --- a/x/shield/types/msg.go +++ b/x/shield/types/msg.go @@ -30,12 +30,6 @@ func (msg MsgWithdrawRewards) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{from} } -// GetSignBytes implements the sdk.Msg interface. -func (msg MsgWithdrawRewards) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // ValidateBasic implements the sdk.Msg interface. func (msg MsgWithdrawRewards) ValidateBasic() error { from, err := sdk.AccAddressFromBech32(msg.From) From 4e911abdea6aad16eeb2d091712c0c7d2f8d3c88 Mon Sep 17 00:00:00 2001 From: skyargos Date: Wed, 6 Nov 2024 16:43:25 +0800 Subject: [PATCH 06/37] fix: make lint error --- app/upgrade_handler.go | 2 +- go.mod | 2 +- x/bank/module.go | 5 - x/cert/module.go | 1 - x/gov/keeper/certifier.go | 3 + x/gov/keeper/deposit.go | 4 +- x/gov/keeper/tally.go | 15 ++- x/gov/keeper/vote.go | 4 +- x/gov/types/v1/genesis.go | 1 + x/gov/types/v1alpha1/params.go | 14 +-- x/mint/module.go | 5 - x/oracle/abci.go | 4 +- x/oracle/keeper/task.go | 4 +- x/oracle/module.go | 15 +-- x/oracle/simulation/decoder.go | 55 ----------- x/oracle/simulation/decoder_test.go | 138 ---------------------------- x/oracle/simulation/genesis.go | 63 ------------- x/oracle/simulation/params.go | 67 -------------- x/shield/module.go | 1 - 19 files changed, 31 insertions(+), 372 deletions(-) delete mode 100644 x/oracle/simulation/decoder.go delete mode 100644 x/oracle/simulation/decoder_test.go delete mode 100644 x/oracle/simulation/genesis.go delete mode 100644 x/oracle/simulation/params.go diff --git a/app/upgrade_handler.go b/app/upgrade_handler.go index 56f3806ae..5a73292c3 100644 --- a/app/upgrade_handler.go +++ b/app/upgrade_handler.go @@ -16,7 +16,7 @@ const ( upgradeName = "v2.12.0" ) -func (app ShentuApp) setUpgradeHandler(cdc codec.BinaryCodec, clientKeeper clientkeeper.Keeper) { +func (app ShentuApp) setUpgradeHandler(_ codec.BinaryCodec, clientKeeper clientkeeper.Keeper) { app.UpgradeKeeper.SetUpgradeHandler( upgradeName, func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { diff --git a/go.mod b/go.mod index 468f4e062..0626bff58 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,6 @@ require ( github.com/cosmos/tools/cmd/runsim v1.0.0 github.com/golangci/golangci-lint v1.52.0 github.com/google/uuid v1.6.0 - github.com/gorilla/mux v1.8.1 github.com/magiconair/properties v1.8.7 github.com/ory/dockertest/v3 v3.10.0 github.com/rakyll/statik v0.1.7 @@ -192,6 +191,7 @@ require ( github.com/googleapis/gax-go/v2 v2.12.3 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect diff --git a/x/bank/module.go b/x/bank/module.go index c548cc35c..1d9858113 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -150,11 +150,6 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { banksim.RandomizedGenState(simState) } -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - // RegisterStoreDecoder performs a no-op. func (AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { //sdr[types.StoreKey] = simtypes.NewStoreDecoderFuncFromCollectionsSchema(am.keeper.(keeper.BaseKeeper).Schema) diff --git a/x/cert/module.go b/x/cert/module.go index 7d8011bcf..1e4a6522a 100644 --- a/x/cert/module.go +++ b/x/cert/module.go @@ -29,7 +29,6 @@ var ( // AppModuleBasic specifies the app module basics object. type AppModuleBasic struct { - cdc codec.Codec } // NewAppModuleBasic create a new AppModuleBasic object in cert module diff --git a/x/gov/keeper/certifier.go b/x/gov/keeper/certifier.go index 1d69a79b1..da2b36dde 100644 --- a/x/gov/keeper/certifier.go +++ b/x/gov/keeper/certifier.go @@ -79,6 +79,9 @@ func (k Keeper) IsCertifier(ctx context.Context, addr sdk.AccAddress) (bool, err func (k Keeper) CertifierVoteIsRequired(ctx context.Context, proposalID uint64) (bool, error) { proposal, err := k.Proposals.Get(ctx, proposalID) + if err != nil { + return false, err + } proposalMsgs, err := proposal.GetMsgs() if err != nil { return false, err diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 229529bac..fed1de032 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -16,7 +16,7 @@ import ( // validateInitialDeposit validates if initial deposit is greater than or equal to the minimum // required at the time of proposal submission. This threshold amount is determined by // the deposit parameters. Returns nil on success, error otherwise. -func (keeper Keeper) validateInitialDeposit(ctx context.Context, params v1.Params, initialDeposit sdk.Coins, expedited bool) error { +func (keeper Keeper) validateInitialDeposit(_ context.Context, params v1.Params, initialDeposit sdk.Coins, expedited bool) error { if !initialDeposit.IsValid() || initialDeposit.IsAnyNegative() { return errors.Wrap(sdkerrors.ErrInvalidCoins, initialDeposit.String()) } @@ -46,7 +46,7 @@ func (keeper Keeper) validateInitialDeposit(ctx context.Context, params v1.Param } // validateDepositDenom validates if the deposit denom is accepted by the governance module. -func (keeper Keeper) validateDepositDenom(ctx context.Context, params v1.Params, depositAmount sdk.Coins) error { +func (keeper Keeper) validateDepositDenom(_ context.Context, params v1.Params, depositAmount sdk.Coins) error { denoms := []string{} acceptedDenoms := make(map[string]bool, len(params.MinDeposit)) for _, coin := range params.MinDeposit { diff --git a/x/gov/keeper/tally.go b/x/gov/keeper/tally.go index 669358d8e..d2a81bb0b 100644 --- a/x/gov/keeper/tally.go +++ b/x/gov/keeper/tally.go @@ -128,7 +128,7 @@ func (k Keeper) Tally(ctx context.Context, proposal govtypesv1.Proposal) (passes } } - pass, veto := passAndVetoStakeResult(k, ctx, th) + pass, veto := passAndVetoStakeResult(ctx, k, th) return pass, veto, tallyResults, nil } @@ -203,7 +203,7 @@ func delegatorVoting(ctx context.Context, k Keeper, vote govtypesv1.Vote, valida }) } -func passAndVetoStakeResult(k Keeper, ctx context.Context, th TallyHelper) (pass bool, veto bool) { +func passAndVetoStakeResult(ctx context.Context, k Keeper, th TallyHelper) (pass bool, veto bool) { // If there is no staked coins, the proposal fails. totalBonded, err := k.stakingKeeper.TotalBondedTokens(ctx) if err != nil { @@ -244,7 +244,7 @@ func passAndVetoStakeResult(k Keeper, ctx context.Context, th TallyHelper) (pass // passAndVetoSecurityResult has two storeKey differences from passAndVetoStakeResult: // 1. Every certifier has equal voting power (1 head = 1 vote) -func passAndVetoSecurityResult(k Keeper, ctx context.Context, th TallyHelper) (pass bool) { +func passAndVetoSecurityResult(ctx context.Context, k Keeper, th TallyHelper) (pass bool) { // If no one votes (everyone abstains), proposal fails. if th.totalVotingPower.IsZero() { return false @@ -287,6 +287,9 @@ func SecurityTally(ctx context.Context, k Keeper, proposal govtypesv1.Proposal) currVotes = append(currVotes, vote) return true, nil }) + if err != nil { + return false, false, govtypesv1.TallyResult{} + } for _, vote := range currVotes { if len(vote.Options) != 1 { @@ -296,6 +299,10 @@ func SecurityTally(ctx context.Context, k Keeper, proposal govtypesv1.Proposal) totalHeadCounts = totalHeadCounts.Add(math.LegacyNewDec(1)) } customParams, err := k.GetCustomParams(ctx) + if err != nil { + return false, false, govtypesv1.TallyResult{} + } + tallyResults := govtypesv1.NewTallyResultFromMap(results) ctally := customParams.CertifierUpdateSecurityVoteTally @@ -309,7 +316,7 @@ func SecurityTally(ctx context.Context, k Keeper, proposal govtypesv1.Proposal) }, results, } - pass := passAndVetoSecurityResult(k, ctx, th) + pass := passAndVetoSecurityResult(ctx, k, th) var endVoting, isCertifierUpdateProposal bool // For CertifierUpdateProposal: If security round didn't pass, continue to diff --git a/x/gov/keeper/vote.go b/x/gov/keeper/vote.go index 54e9a3416..9ec5f1df5 100644 --- a/x/gov/keeper/vote.go +++ b/x/gov/keeper/vote.go @@ -69,9 +69,9 @@ func (k Keeper) AddVote(ctx context.Context, proposalID uint64, voterAddr sdk.Ac } // DeleteVotes deletes all the votes from a given proposalID. -func (keeper Keeper) DeleteVotes(ctx context.Context, proposalID uint64) error { +func (k Keeper) DeleteVotes(ctx context.Context, proposalID uint64) error { rng := collections.NewPrefixedPairRange[uint64, sdk.AccAddress](proposalID) - err := keeper.Votes.Clear(ctx, rng) + err := k.Votes.Clear(ctx, rng) if err != nil { return err } diff --git a/x/gov/types/v1/genesis.go b/x/gov/types/v1/genesis.go index bd9725919..4cf4ba23f 100644 --- a/x/gov/types/v1/genesis.go +++ b/x/gov/types/v1/genesis.go @@ -88,6 +88,7 @@ func ValidateGenesis(data *GenesisState) error { // weed out duplicate votes errGroup.Go(func() error { type voteKey struct { + //nolint:revive ProposalId uint64 //nolint:revive // staying consistent with main and v0.47 Voter string } diff --git a/x/gov/types/v1alpha1/params.go b/x/gov/types/v1alpha1/params.go index df1bbc8c7..9b16928e3 100644 --- a/x/gov/types/v1alpha1/params.go +++ b/x/gov/types/v1alpha1/params.go @@ -3,10 +3,9 @@ package v1alpha1 import ( "fmt" + "cosmossdk.io/math" yaml "gopkg.in/yaml.v2" - sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -105,19 +104,19 @@ func validateTallyParams(tallyParams govtypesv1beta1.TallyParams) error { if tallyParams.Quorum.IsNegative() { return fmt.Errorf("quorom cannot be negative: %s", tallyParams.Quorum) } - if tallyParams.Quorum.GT(sdk.OneDec()) { + if tallyParams.Quorum.GT(math.LegacyOneDec()) { return fmt.Errorf("quorom too large: %s", tallyParams) } if !tallyParams.Threshold.IsPositive() { return fmt.Errorf("vote threshold must be positive: %s", tallyParams.Threshold) } - if tallyParams.Threshold.GT(sdk.OneDec()) { + if tallyParams.Threshold.GT(math.LegacyOneDec()) { return fmt.Errorf("vote threshold too large: %s", tallyParams) } if !tallyParams.VetoThreshold.IsPositive() { return fmt.Errorf("veto threshold must be positive: %s", tallyParams.Threshold) } - if tallyParams.VetoThreshold.GT(sdk.OneDec()) { + if tallyParams.VetoThreshold.GT(math.LegacyOneDec()) { return fmt.Errorf("veto threshold too large: %s", tallyParams) } @@ -136,8 +135,3 @@ func validateVotingParams(i interface{}) error { return nil } - -// CertVotesKey gets the first part of the cert votes key based on the proposalID -func CertVotesKey(proposalID uint64) []byte { - return append(CertVotesKeyPrefix, govtypes.GetProposalIDBytes(proposalID)...) -} diff --git a/x/mint/module.go b/x/mint/module.go index cd8a326f9..572be7c20 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -164,11 +164,6 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { //simulation.RandomizedGenState(simState) } -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - // RegisterStoreDecoder registers a decoder for mint module's types. func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { //sdr[minttypes.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/oracle/abci.go b/x/oracle/abci.go index 4a18ebdc8..ec9ebb873 100644 --- a/x/oracle/abci.go +++ b/x/oracle/abci.go @@ -22,8 +22,8 @@ func EndBlocker(ctx context.Context, k keeper.Keeper) error { if err != nil { return err } - toAggTaskIDs := append(tasks, closingTaskIDs...) - for _, taskID := range toAggTaskIDs { + tasks = append(tasks, closingTaskIDs...) + for _, taskID := range tasks { err := k.Aggregate(ctx, taskID.Tid) if err != nil { continue diff --git a/x/oracle/keeper/task.go b/x/oracle/keeper/task.go index c95f9f1b1..f41eb3855 100644 --- a/x/oracle/keeper/task.go +++ b/x/oracle/keeper/task.go @@ -396,8 +396,8 @@ func (k Keeper) SetShortcutTasks(ctx context.Context, tid []byte) error { if err != nil { return err } - taskIDs := append(tasks, types.TaskID{Tid: tid}) - bz := k.cdc.MustMarshalLengthPrefixed(&types.TaskIDs{TaskIds: taskIDs}) + tasks = append(tasks, types.TaskID{Tid: tid}) + bz := k.cdc.MustMarshalLengthPrefixed(&types.TaskIDs{TaskIds: tasks}) return store.Set(types.ShortcutTasksKeyPrefix, bz) } diff --git a/x/oracle/module.go b/x/oracle/module.go index 971e5cd8e..f77fe1515 100644 --- a/x/oracle/module.go +++ b/x/oracle/module.go @@ -33,7 +33,6 @@ var ( // AppModuleBasic specifies the app module basics object. type AppModuleBasic struct { - cdc codec.Codec } // NewAppModuleBasic creates a new AppModuleBasic object in oracle module. @@ -165,12 +164,12 @@ func (am AppModule) EndBlock(ctx context.Context) error { // AppModuleSimulation functions // GenerateGenesisState creates a randomized GenState of this module. -func (AppModuleBasic) GenerateGenesisState(simState *module.SimulationState) { +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { //simulation.RandomizedGenState(simState) } // RegisterStoreDecoder registers a decoder for oracle module. -func (am AppModuleBasic) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { //sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) } @@ -179,13 +178,3 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp return nil //return simulation.WeightedOperations(simState.AppParams, simState.Cdc, am.keeper, am.keeper.GetAccountKeeper(), am.bankKeeper) } - -// ProposalContents returns functions that generate gov proposals for the module. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -//// RandomizedParams returns functions that generate params for the module. -//func (AppModuleBasic) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { -// return simulation.ParamChanges(r) -//} diff --git a/x/oracle/simulation/decoder.go b/x/oracle/simulation/decoder.go deleted file mode 100644 index 73928b6b5..000000000 --- a/x/oracle/simulation/decoder.go +++ /dev/null @@ -1,55 +0,0 @@ -package simulation - -// -//import ( -// "bytes" -// "fmt" -// -// "github.com/cosmos/cosmos-sdk/types/kv" -// -// "github.com/cosmos/cosmos-sdk/codec" -// -// "github.com/shentufoundation/shentu/v2/x/oracle/types" -//) -// -//// NewDecodeStore unmarshals the KVPair's Value to the corresponding type of oracle module. -//func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { -// return func(kvA, kvB kv.Pair) string { -// switch { -// case bytes.Equal(kvA.Key[:1], types.OperatorStoreKeyPrefix): -// var operatorA, operatorB types.Operator -// cdc.MustUnmarshalLengthPrefixed(kvA.Value, &operatorA) -// cdc.MustUnmarshalLengthPrefixed(kvB.Value, &operatorB) -// return fmt.Sprintf("%v\n%v", operatorA, operatorB) -// -// case bytes.Equal(kvA.Key[:1], types.WithdrawStoreKeyPrefix): -// var withdrawA, withdrawB types.Withdraw -// cdc.MustUnmarshalLengthPrefixed(kvA.Value, &withdrawA) -// cdc.MustUnmarshalLengthPrefixed(kvB.Value, &withdrawB) -// return fmt.Sprintf("%v\n%v", withdrawA, withdrawB) -// -// case bytes.Equal(kvA.Key[:1], types.TotalCollateralKeyPrefix): -// var totalA, totalB types.CoinsProto -// cdc.MustUnmarshalLengthPrefixed(kvA.Value, &totalA) -// cdc.MustUnmarshalLengthPrefixed(kvB.Value, &totalB) -// return fmt.Sprintf("%v\n%v", totalA.Coins, totalB.Coins) -// -// case bytes.Equal(kvA.Key[:1], types.TaskStoreKeyPrefix): -// var taskA, taskB types.Task -// cdc.MustUnmarshalLengthPrefixed(kvA.Value, &taskA) -// cdc.MustUnmarshalLengthPrefixed(kvB.Value, &taskB) -// return fmt.Sprintf("%v\n%v", taskA, taskB) -// -// case bytes.Equal(kvA.Key[:1], types.ClosingTaskStoreKeyPrefix), -// bytes.Equal(kvA.Key[:1], types.ClosingTaskStoreKeyTimedPrefix), -// bytes.Equal(kvA.Key[:1], types.ExpireTaskStoreKeyPrefix): -// var taskIDsA, taskIDsB types.TaskIDs -// cdc.MustUnmarshalLengthPrefixed(kvA.Value, &taskIDsA) -// cdc.MustUnmarshalLengthPrefixed(kvB.Value, &taskIDsB) -// return fmt.Sprintf("%v\n%v", taskIDsA.TaskIds, taskIDsB.TaskIds) -// -// default: -// panic(fmt.Sprintf("invalid %s key prefix %X", types.ModuleName, kvA.Key[:1])) -// } -// } -//} diff --git a/x/oracle/simulation/decoder_test.go b/x/oracle/simulation/decoder_test.go deleted file mode 100644 index 82b450acd..000000000 --- a/x/oracle/simulation/decoder_test.go +++ /dev/null @@ -1,138 +0,0 @@ -package simulation_test - -// -//import ( -// "fmt" -// "math/rand" -// "strconv" -// "testing" -// "time" -// -// "github.com/stretchr/testify/require" -// -// "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" -// -// sdk "github.com/cosmos/cosmos-sdk/types" -// "github.com/cosmos/cosmos-sdk/types/kv" -// simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -// -// shentuapp "github.com/shentufoundation/shentu/v2/app" -// "github.com/shentufoundation/shentu/v2/x/oracle/simulation" -// "github.com/shentufoundation/shentu/v2/x/oracle/types" -//) -// -//func TestDecodeStore(t *testing.T) { -// cdc, _ := shentuapp.MakeCodecs() -// -// dec := simulation.NewDecodeStore(cdc) -// rand.Seed(time.Now().UnixNano()) -// -// operator := types.Operator{ -// Address: RandomAccount().Address.String(), -// Proposer: RandomAccount().Address.String(), -// Collateral: RandomCoins(100000), -// AccumulatedRewards: RandomCoins(100000), -// Name: RandomString(10), -// } -// -// withdraw := types.Withdraw{ -// Address: RandomAccount().Address.String(), -// Amount: RandomCoins(100000), -// DueBlock: rand.Int63n(1000) + 1, -// } -// -// totalCollateral := RandomCoins(1000000) -// -// task := types.Task{ -// Contract: RandomString(30), -// Function: RandomString(15), -// Bounty: RandomCoins(100000), -// Description: RandomString(10), -// Expiration: time.Time{}, -// Creator: RandomAccount().Address.String(), -// Responses: []types.Response{RandomResponse()}, -// Result: sdk.NewInt(rand.Int63n(256)), -// ExpireHeight: rand.Int63n(10000), -// WaitingBlocks: rand.Int63n(1000), -// Status: types.TaskStatus(rand.Intn(4)), -// } -// -// taskIDs := []types.TaskID{ -// { -// Tid: types.NewTaskID(task.Contract, task.Function), -// }, -// } -// -// operatorAddr, err := sdk.AccAddressFromBech32(operator.Address) -// require.NoError(t, err) -// withdrawAddr, err := sdk.AccAddressFromBech32(withdraw.Address) -// require.NoError(t, err) -// KVPairs := kv.Pairs{ -// Pairs: []kv.Pair{ -// {Key: types.OperatorStoreKey(operatorAddr), Value: cdc.MustMarshalLengthPrefixed(&operator)}, -// {Key: types.WithdrawStoreKey(withdrawAddr, withdraw.DueBlock), Value: cdc.MustMarshalLengthPrefixed(&withdraw)}, -// {Key: types.TotalCollateralKey(), Value: cdc.MustMarshalLengthPrefixed(&types.CoinsProto{Coins: totalCollateral})}, -// {Key: types.TaskStoreKey(types.NewTaskID(task.Contract, task.Function)), Value: cdc.MustMarshalLengthPrefixed(&task)}, -// {Key: types.ClosingTaskIDsStoreKey(task.ExpireHeight), Value: cdc.MustMarshalLengthPrefixed(&types.TaskIDs{TaskIds: taskIDs})}, -// }, -// } -// -// tests := []struct { -// name string -// expectedLog string -// }{ -// {"Operator", fmt.Sprintf("%v\n%v", operator, operator)}, -// {"Withdraw", fmt.Sprintf("%v\n%v", withdraw, withdraw)}, -// {"TotalCollateral", fmt.Sprintf("%s\n%s", totalCollateral, totalCollateral)}, -// {"Task", fmt.Sprintf("%v\n%v", task, task)}, -// {"TaskIDs", fmt.Sprintf("%v\n%v", taskIDs, taskIDs)}, -// {"other", ""}, -// } -// -// for i, tt := range tests { -// t.Run(tt.name, func(t *testing.T) { -// if i == len(tests)-1 { // nolint -// require.Panics(t, func() { dec(KVPairs.Pairs[i], KVPairs.Pairs[i]) }, tt.name) // nolint -// } else { -// require.Equal(t, tt.expectedLog, dec(KVPairs.Pairs[i], KVPairs.Pairs[i]), tt.name) // nolint -// } -// }) -// } -//} -// -//func RandomAccount() simtypes.Account { -// privKey := secp256k1.GenPrivKey() -// pubKey := privKey.PubKey() -// address := sdk.AccAddress(pubKey.Address()) -// -// return simtypes.Account{ -// PrivKey: privKey, -// PubKey: pubKey, -// Address: address, -// } -//} -// -//func RandomCoins(n int) sdk.Coins { -// amount := rand.Intn(n) -// denom := sdk.DefaultBondDenom -// coins, err := sdk.ParseCoinsNormalized(strconv.Itoa(amount) + denom) -// if err != nil { -// panic(err) -// } -// return coins -//} -// -//func RandomString(n int) string { -// bytes := make([]byte, n) -// rand.Read(bytes) -// return string(bytes) -//} -// -//func RandomResponse() types.Response { -// return types.Response{ -// Score: sdk.NewInt(rand.Int63n(256)), -// Operator: RandomAccount().Address.String(), -// Weight: sdk.NewInt(rand.Int63n(256)), -// Reward: RandomCoins(100000), -// } -//} diff --git a/x/oracle/simulation/genesis.go b/x/oracle/simulation/genesis.go deleted file mode 100644 index 86cf5472a..000000000 --- a/x/oracle/simulation/genesis.go +++ /dev/null @@ -1,63 +0,0 @@ -package simulation - -// -//import ( -// "math/rand" -// "time" -// -// "cosmossdk.io/math" -// -// "github.com/cosmos/cosmos-sdk/types/module" -// -// "github.com/shentufoundation/shentu/v2/x/oracle/types" -//) -// -//// RandomizedGenState creates a random genesis state for module simulation. -//func RandomizedGenState(simState *module.SimulationState) { -// var poolParams types.LockedPoolParams -// simState.AppParams.GetOrGenerate( -// simState.Cdc, string(types.ParamsStoreKeyPoolParams), &poolParams, simState.Rand, -// func(r *rand.Rand) { -// poolParams = GenPoolParams(r) -// }) -// -// var taskParams types.TaskParams -// simState.AppParams.GetOrGenerate( -// simState.Cdc, string(types.ParamsStoreKeyTaskParams), &taskParams, simState.Rand, -// func(r *rand.Rand) { -// taskParams = GenTaskParams(r) -// }) -// -// gs := types.NewGenesisState( -// nil, -// nil, -// poolParams, -// taskParams, -// nil, -// nil, -// nil, -// ) -// -// simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&gs) -//} -// -//// GenPoolParams returns a randomized LockedPoolParams object. -//func GenPoolParams(r *rand.Rand) types.LockedPoolParams { -// return types.LockedPoolParams{ -// LockedInBlocks: r.Int63n(10), -// MinimumCollateral: r.Int63n(10000), -// } -//} -// -//// GenTaskParams returns a randomized TaskParams object. -//func GenTaskParams(r *rand.Rand) types.TaskParams { -// return types.TaskParams{ -// ExpirationDuration: time.Duration(48) * time.Hour, -// AggregationWindow: r.Int63n(40), -// AggregationResult: math.NewInt(r.Int63n(100)), -// ThresholdScore: math.NewInt(r.Int63n(100)), -// Epsilon1: math.NewInt(r.Int63n(10) + 1), -// Epsilon2: math.NewInt(r.Int63n(10) + 90), -// ShortcutQuorum: math.LegacyNewDecWithPrec(int64((r.Float64()+r.Float64())/2*10000)+1, 4), -// } -//} diff --git a/x/oracle/simulation/params.go b/x/oracle/simulation/params.go deleted file mode 100644 index 7f7772dce..000000000 --- a/x/oracle/simulation/params.go +++ /dev/null @@ -1,67 +0,0 @@ -package simulation - -const ( - subkeyLockedInBlocks = "locked_in_blocks" - subkeyMinimumCollateral = "minimum_collateral" - subkeyExpirationDuration = "expiration_duration" - subkeyAggregationWindow = "aggregation_window" - subkeyAggregationResult = "aggregation_result" - subkeyThresholdScore = "threshold_score" - subkeyEpsilon1 = "epsilon1" - subkeyEpsilon2 = "epsilon2" - subkeyShortcutQuorum = "shortcut_quorum" -) - -//// ParamChanges defines the parameters that can be modified by param change proposals on the simulation. -//func ParamChanges(_ *rand.Rand) []simtypes.ParamChange { -// return []simtypes.ParamChange{ -// simulation.NewSimParamChange(types.ModuleName, string(types.ParamsStoreKeyPoolParams), -// func(r *rand.Rand) string { -// pp := GenPoolParams(r) -// changes := []struct { -// key string -// value int64 -// }{ -// {subkeyLockedInBlocks, pp.LockedInBlocks}, -// {subkeyMinimumCollateral, pp.MinimumCollateral}, -// } -// -// pc := make(map[string]string) -// numChanges := len(changes) -// for i := 0; i < numChanges; i++ { -// c := changes[i] -// pc[c.key] = strconv.FormatInt(c.value, 10) -// } -// bz, _ := json.Marshal(pc) -// return string(bz) -// }, -// ), -// -// simulation.NewSimParamChange(types.ModuleName, string(types.ParamsStoreKeyTaskParams), -// func(r *rand.Rand) string { -// tp := GenTaskParams(r) -// changes := []struct { -// key string -// value int64 -// }{ -// {subkeyAggregationWindow, tp.AggregationWindow}, -// {subkeyAggregationResult, tp.AggregationResult.Int64()}, -// {subkeyThresholdScore, tp.ThresholdScore.Int64()}, -// {subkeyEpsilon1, tp.Epsilon1.Int64()}, -// {subkeyEpsilon2, tp.Epsilon2.Int64()}, -// } -// -// pc := make(map[string]string) -// numChanges := len(changes) -// for i := 0; i < numChanges; i++ { -// c := changes[i] -// pc[c.key] = strconv.FormatInt(c.value, 10) -// } -// pc[subkeyExpirationDuration] = fmt.Sprintf("%d", tp.ExpirationDuration) -// pc[subkeyShortcutQuorum] = tp.ShortcutQuorum.String() -// bz, _ := json.Marshal(pc) -// return string(bz) -// }, -// ), -// } -//} diff --git a/x/shield/module.go b/x/shield/module.go index 517eec0e0..0cd971eca 100644 --- a/x/shield/module.go +++ b/x/shield/module.go @@ -29,7 +29,6 @@ var ( // AppModuleBasic specifies the app module basics object. type AppModuleBasic struct { - cdc codec.Codec } // NewAppModuleBasic creates a new AppModuleBasic object in shield module. From e400d0665f209b49d8b1b0c11cf0c0aa559f864a Mon Sep 17 00:00:00 2001 From: 0311xuyang Date: Wed, 6 Nov 2024 20:40:57 +0800 Subject: [PATCH 07/37] rebuild e2e test --- Makefile | 2 +- e2e.Dockerfile | 2 +- tests/e2e/address.go | 33 ++ tests/e2e/chain.go | 102 +++- tests/e2e/docker/hermes.Dockerfile | 5 +- tests/e2e/e2e_bank_test.go | 80 +++ tests/e2e/e2e_bounty_test.go | 410 +++++++-------- tests/e2e/e2e_cert_test.go | 53 -- tests/e2e/e2e_distribution_test.go | 82 +++ tests/e2e/e2e_exec_test.go | 703 ++++++++++++++++++++++++++ tests/e2e/e2e_feegrant_test.go | 64 +++ tests/e2e/e2e_gov_test.go | 163 +++--- tests/e2e/e2e_ibc_test.go | 162 ++++++ tests/e2e/e2e_oracle_test.go | 259 ---------- tests/e2e/e2e_setup_test.go | 164 +++--- tests/e2e/e2e_shield_test.go | 232 --------- tests/e2e/e2e_staking_test.go | 114 ++--- tests/e2e/e2e_test.go | 548 +------------------- tests/e2e/e2e_util_test.go | 266 ---------- tests/e2e/genesis.go | 117 ++--- tests/e2e/http_util.go | 40 ++ tests/e2e/io.go | 14 +- tests/e2e/keys.go | 37 -- tests/e2e/query.go | 198 ++++++++ tests/e2e/scripts/hermes_bootstrap.sh | 102 +++- tests/e2e/util.go | 7 + tests/e2e/validator.go | 129 +++-- 27 files changed, 2024 insertions(+), 2064 deletions(-) create mode 100644 tests/e2e/address.go create mode 100644 tests/e2e/e2e_bank_test.go create mode 100644 tests/e2e/e2e_distribution_test.go create mode 100644 tests/e2e/e2e_exec_test.go create mode 100644 tests/e2e/e2e_feegrant_test.go create mode 100644 tests/e2e/e2e_ibc_test.go delete mode 100644 tests/e2e/e2e_oracle_test.go delete mode 100644 tests/e2e/e2e_shield_test.go delete mode 100644 tests/e2e/e2e_util_test.go create mode 100644 tests/e2e/http_util.go create mode 100644 tests/e2e/query.go diff --git a/Makefile b/Makefile index 40ea91650..fff354cb4 100644 --- a/Makefile +++ b/Makefile @@ -162,7 +162,7 @@ docker-build-debug: # in CI. docker-build-hermes: - @cd tests/e2e/docker; docker build -t cosmos/hermes-e2e:latest -f hermes.Dockerfile . + @cd tests/e2e/docker; docker build -t cosmos/hermes-e2e:1.0.0 -f hermes.Dockerfile . image: Dockerfile Dockerfile.update diff --git a/e2e.Dockerfile b/e2e.Dockerfile index bfc76713c..7075e9eb1 100644 --- a/e2e.Dockerfile +++ b/e2e.Dockerfile @@ -1,7 +1,7 @@ ARG IMG_TAG=latest # Compile the shentud binary -FROM golang:1.19-alpine AS shentud-builder +FROM golang:1.22-alpine AS shentud-builder WORKDIR /src/app/ COPY go.mod go.sum* ./ RUN go mod download diff --git a/tests/e2e/address.go b/tests/e2e/address.go new file mode 100644 index 000000000..33079aa8c --- /dev/null +++ b/tests/e2e/address.go @@ -0,0 +1,33 @@ +package e2e + +import ( + "fmt" + "math/rand" + "strconv" + + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + crypto "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// HDPath generates an HD path based on the wallet index +func HDPath(index int) string { + return fmt.Sprintf("m/44'/118'/0'/0/%d", index) +} + +// PubKey returns a sample account PubKey +func PubKey() crypto.PubKey { + seed := []byte(strconv.Itoa(rand.Int())) + return ed25519.GenPrivKeyFromSecret(seed).PubKey() +} + +// AccAddress returns a sample account address +func AccAddress() sdk.AccAddress { + addr := PubKey().Address() + return sdk.AccAddress(addr) +} + +// Address returns a sample string account address +func Address() string { + return AccAddress().String() +} diff --git a/tests/e2e/chain.go b/tests/e2e/chain.go index 3be824346..b9cab8637 100644 --- a/tests/e2e/chain.go +++ b/tests/e2e/chain.go @@ -2,19 +2,33 @@ package e2e import ( "fmt" - "io/ioutil" + "os" + "cosmossdk.io/log" + evidencetypes "cosmossdk.io/x/evidence/types" + feegrant "cosmossdk.io/x/feegrant" + upgradetypes "cosmossdk.io/x/upgrade/types" tmrand "github.com/cometbft/cometbft/libs/rand" + dbm "github.com/cosmos/cosmos-db" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + txtypes "github.com/cosmos/cosmos-sdk/types/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + distribtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govv1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + paramsproptypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" shentu "github.com/shentufoundation/shentu/v2/app" "github.com/shentufoundation/shentu/v2/app/params" + bountytypes "github.com/shentufoundation/shentu/v2/x/bounty/types" + certtypes "github.com/shentufoundation/shentu/v2/x/cert/types" + oracletypes "github.com/shentufoundation/shentu/v2/x/oracle/types" ) const ( @@ -28,30 +42,40 @@ var ( ) func init() { - encodingConfig = shentu.MakeEncodingConfig() - - encodingConfig.InterfaceRegistry.RegisterImplementations( - (*sdk.Msg)(nil), - &stakingtypes.MsgCreateValidator{}, - ) - encodingConfig.InterfaceRegistry.RegisterImplementations( - (*cryptotypes.PubKey)(nil), - &secp256k1.PubKey{}, - &ed25519.PubKey{}, - ) + encodingConfig = params.MakeEncodingConfig() + + stakingtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + banktypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + authtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + authvesting.RegisterInterfaces(encodingConfig.InterfaceRegistry) + stakingtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + evidencetypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + cryptocodec.RegisterInterfaces(encodingConfig.InterfaceRegistry) + govv1types.RegisterInterfaces(encodingConfig.InterfaceRegistry) + govv1beta1types.RegisterInterfaces(encodingConfig.InterfaceRegistry) + paramsproptypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + upgradetypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + distribtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + txtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + feegrant.RegisterInterfaces(encodingConfig.InterfaceRegistry) + bountytypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + certtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + oracletypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) cdc = encodingConfig.Codec } type chain struct { - dataDir string - id string - validators []*validator - accounts []*account + dataDir string + id string + validators []*validator + accounts []*account + genesisAccounts []*account + certifier *account } func newChain() (*chain, error) { - tmpDir, err := ioutil.TempDir("", "shentu-e2e-testnet-") + tmpDir, err := os.MkdirTemp("", "shentu-e2e-testnet-") if err != nil { return nil, err } @@ -67,11 +91,27 @@ func (c *chain) configDir() string { } func (c *chain) createAndInitValidators(count int) error { + app := shentu.NewShentuApp( + log.NewNopLogger(), + dbm.NewMemDB(), + nil, + true, + simtestutil.NewAppOptionsWithFlagHome(shentu.DefaultNodeHome), + ) + + defer func() { + if err := app.Close(); err != nil { + panic(err) + } + }() + + genesisState := app.BasicModuleManager.DefaultGenesis(encodingConfig.Codec) + for i := 0; i < count; i++ { node := c.createValidator(i) // generate genesis files - if err := node.init(); err != nil { + if err := node.init(genesisState); err != nil { return err } @@ -93,12 +133,28 @@ func (c *chain) createAndInitValidators(count int) error { } func (c *chain) createAndInitValidatorsWithMnemonics(count int, mnemonics []string) error { + app := shentu.NewShentuApp( + log.NewNopLogger(), + dbm.NewMemDB(), + nil, + true, + simtestutil.NewAppOptionsWithFlagHome(shentu.DefaultNodeHome), + ) + + defer func() { + if err := app.Close(); err != nil { + panic(err) + } + }() + + genesisState := app.BasicModuleManager.DefaultGenesis(encodingConfig.Codec) + for i := 0; i < count; i++ { // create node node := c.createValidator(i) // generate genesis files - if err := node.init(); err != nil { + if err := node.init(genesisState); err != nil { return err } diff --git a/tests/e2e/docker/hermes.Dockerfile b/tests/e2e/docker/hermes.Dockerfile index 432e444e1..b97ff0ae9 100644 --- a/tests/e2e/docker/hermes.Dockerfile +++ b/tests/e2e/docker/hermes.Dockerfile @@ -1,12 +1,9 @@ -FROM informalsystems/hermes:0.12.0 AS hermes-builder +FROM informalsystems/hermes:1.10.0 AS hermes-builder FROM debian:buster-slim USER root -COPY --chown=0:0 --from=hermes-builder /usr/lib/x86_64-linux-gnu/libssl.so.1.1 /usr/lib/x86_64-linux-gnu/libssl.so.1.1 -COPY --chown=0:0 --from=hermes-builder /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 COPY --from=hermes-builder /usr/bin/hermes /usr/local/bin/ RUN chmod +x /usr/local/bin/hermes EXPOSE 3031 -ENTRYPOINT ["hermes", "start"] diff --git a/tests/e2e/e2e_bank_test.go b/tests/e2e/e2e_bank_test.go new file mode 100644 index 000000000..e32657091 --- /dev/null +++ b/tests/e2e/e2e_bank_test.go @@ -0,0 +1,80 @@ +package e2e + +import ( + "fmt" + "time" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (s *IntegrationTestSuite) testBankTokenTransfer() { + s.Run("send_uctk_between_accounts", func() { + var ( + err error + valIdx = 0 + c = s.chainA + endpoint = fmt.Sprintf("http://%s", s.valResources[c.id][valIdx].GetHostPort("1317/tcp")) + ) + + alice, _ := c.genesisAccounts[1].keyInfo.GetAddress() + bob, _ := c.genesisAccounts[2].keyInfo.GetAddress() + charlie, _ := c.genesisAccounts[3].keyInfo.GetAddress() + + var beforeAliceUctk, beforeBobUctk, beforeCharlieUctk sdk.Coin + var afterAliceUctk, afterBobUctk, afterCharlieUctk sdk.Coin + + s.Require().Eventually( + func() bool { + beforeAliceUctk, err = queryShentuBalance(endpoint, alice.String(), uctkDenom) + s.Require().NoError(err) + beforeBobUctk, err = queryShentuBalance(endpoint, bob.String(), uctkDenom) + s.Require().NoError(err) + beforeCharlieUctk, err = queryShentuBalance(endpoint, charlie.String(), uctkDenom) + s.Require().NoError(err) + return beforeAliceUctk.IsValid() && beforeBobUctk.IsValid() && beforeCharlieUctk.IsValid() + }, + 20*time.Second, + 5*time.Second, + ) + + // Alice sends 10ctk to Bob + amountCoin := sdk.NewCoin(uctkDenom, math.NewInt(10000000)) + + s.execBankSend(c, valIdx, alice.String(), bob.String(), amountCoin, feesAmountCoin, false) + s.Require().Eventually( + func() bool { + afterAliceUctk, err = queryShentuBalance(endpoint, alice.String(), uctkDenom) + s.Require().NoError(err) + afterBobUctk, err = queryShentuBalance(endpoint, bob.String(), uctkDenom) + s.Require().NoError(err) + outgoing := beforeAliceUctk.Sub(amountCoin).Sub(feesAmountCoin).IsEqual(afterAliceUctk) + incoming := beforeBobUctk.Add(amountCoin).IsEqual(afterBobUctk) + return outgoing && incoming + }, + 20*time.Second, + 5*time.Second, + ) + + beforeAliceUctk, beforeBobUctk = afterAliceUctk, afterBobUctk + + // alice sends 10ctk to bob and charlie + s.execBankMultiSend(c, valIdx, alice.String(), []string{bob.String(), charlie.String()}, amountCoin, feesAmountCoin, false) + s.Require().Eventually( + func() bool { + afterAliceUctk, err = queryShentuBalance(endpoint, alice.String(), uctkDenom) + s.Require().NoError(err) + afterBobUctk, err = queryShentuBalance(endpoint, bob.String(), uctkDenom) + s.Require().NoError(err) + afterCharlieUctk, err = queryShentuBalance(endpoint, charlie.String(), uctkDenom) + s.Require().NoError(err) + outgoing := beforeAliceUctk.Sub(amountCoin).Sub(amountCoin).Sub(feesAmountCoin).IsEqual(afterAliceUctk) + incoming := beforeBobUctk.Add(amountCoin).IsEqual(afterBobUctk) && beforeCharlieUctk.Add(amountCoin).IsEqual(afterCharlieUctk) + return outgoing && incoming + }, + 20*time.Second, + 5*time.Second, + ) + }) +} diff --git a/tests/e2e/e2e_bounty_test.go b/tests/e2e/e2e_bounty_test.go index 033eef72a..6b1b345c1 100644 --- a/tests/e2e/e2e_bounty_test.go +++ b/tests/e2e/e2e_bounty_test.go @@ -1,242 +1,186 @@ package e2e import ( - "context" - "fmt" - "strings" "time" - sdkflags "github.com/cosmos/cosmos-sdk/client/flags" - - bountycli "github.com/shentufoundation/shentu/v2/x/bounty/client/cli" bountytypes "github.com/shentufoundation/shentu/v2/x/bounty/types" ) -func (s *IntegrationTestSuite) executeCreateProgram(c *chain, valIdx int, pid, name, detail, creatorAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu bounty create program %s on %s", pid, c.id) - - command := []string{ - shentuBinary, - txCommand, - bountytypes.ModuleName, - "create-program", - fmt.Sprintf("--%s=%s", bountycli.FlagProgramID, pid), - fmt.Sprintf("--%s=%s", bountycli.FlagName, name), - fmt.Sprintf("--%s=%s", bountycli.FlagDetail, detail), - fmt.Sprintf("--%s=%s", sdkflags.FlagFrom, creatorAddr), - fmt.Sprintf("--%s=%s", sdkflags.FlagChainID, c.id), - fmt.Sprintf("--%s=%s", sdkflags.FlagGas, "auto"), - fmt.Sprintf("--%s=%s", sdkflags.FlagFees, fees), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully create program", creatorAddr) -} - -func (s *IntegrationTestSuite) executeActivateProgram(c *chain, valIdx int, pid, operatorAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu bounty create program %s on %s", pid, c.id) - - command := []string{ - shentuBinary, - txCommand, - bountytypes.ModuleName, - "activate-program", - fmt.Sprintf("%s", pid), - fmt.Sprintf("--%s=%s", sdkflags.FlagFrom, operatorAddr), - fmt.Sprintf("--%s=%s", sdkflags.FlagChainID, c.id), - fmt.Sprintf("--%s=%s", sdkflags.FlagGas, "auto"), - fmt.Sprintf("--%s=%s", sdkflags.FlagFees, fees), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully create program", operatorAddr) -} - -func (s *IntegrationTestSuite) executeSubmitFinding(c *chain, valIdx int, pid, fid, submitAddr, title, desc, poc, detail, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu bounty submit finding on %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - bountytypes.ModuleName, - "submit-finding", - fmt.Sprintf("--%s=%s", bountycli.FlagProgramID, pid), - fmt.Sprintf("--%s=%s", bountycli.FlagFindingID, fid), - fmt.Sprintf("--%s=%s", bountycli.FlagFindingTitle, title), - fmt.Sprintf("--%s=%s", bountycli.FlagFindingDescription, desc), - fmt.Sprintf("--%s=%s", bountycli.FlagFindingProofOfContent, poc), - fmt.Sprintf("--%s=%s", bountycli.FlagDetail, detail), - fmt.Sprintf("--%s=%s", bountycli.FlagFindingSeverityLevel, bountytypes.Low.String()), - fmt.Sprintf("--%s=%s", sdkflags.FlagFrom, submitAddr), - fmt.Sprintf("--%s=%s", sdkflags.FlagChainID, c.id), - fmt.Sprintf("--%s=%s", sdkflags.FlagGas, "auto"), - fmt.Sprintf("--%s=%s", sdkflags.FlagFees, fees), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully submit finding", submitAddr) -} - -func (s *IntegrationTestSuite) executeConfirmFinding(c *chain, valIdx int, findingId, hostAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu bounty acctpe finding on %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - bountytypes.ModuleName, - "confirm-finding", - fmt.Sprintf("%s", findingId), - fmt.Sprintf("--%s=%s", sdkflags.FlagFrom, hostAddr), - fmt.Sprintf("--%s=%s", sdkflags.FlagChainID, c.id), - fmt.Sprintf("--%s=%s", sdkflags.FlagGas, "auto"), - fmt.Sprintf("--%s=%s", sdkflags.FlagFees, fees), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully accept finding", hostAddr) -} - -func (s *IntegrationTestSuite) executeCloseFinding(c *chain, valIdx int, findingId, hostAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu bounty reject finding on %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - bountytypes.ModuleName, - "close-finding", - fmt.Sprintf("%s", findingId), - fmt.Sprintf("--%s=%s", sdkflags.FlagFrom, hostAddr), - fmt.Sprintf("--%s=%s", sdkflags.FlagChainID, c.id), - fmt.Sprintf("--%s=%s", sdkflags.FlagGas, "auto"), - fmt.Sprintf("--%s=%s", sdkflags.FlagFees, fees), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully reject finding", hostAddr) -} - -//func (s *IntegrationTestSuite) executeReleaseFinding(c *chain, valIdx, findingId int, hostAddr, keyFile, fees string) { -// ctx, cancel := context.WithTimeout(context.Background(), time.Minute) -// defer cancel() -// -// s.T().Logf("Executing shentu bounty release finding on %s", c.id) -// -// command := []string{ -// shentuBinary, -// txCommand, -// bountytypes.ModuleName, -// "release-finding", -// fmt.Sprintf("%d", findingId), -// fmt.Sprintf("--%s=%s", bountycli.FlagEncKeyFile, keyFile), -// fmt.Sprintf("--%s=%s", sdkflags.FlagFrom, hostAddr), -// fmt.Sprintf("--%s=%s", sdkflags.FlagChainID, c.id), -// fmt.Sprintf("--%s=%s", sdkflags.FlagGas, "auto"), -// fmt.Sprintf("--%s=%s", sdkflags.FlagFees, fees), -// "--keyring-backend=test", -// "--output=json", -// "-y", -// } -// -// s.T().Logf("cmd: %s", strings.Join(command, " ")) -// -// s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) -// s.T().Logf("%s successfully release finding", hostAddr) -//} - -func (s *IntegrationTestSuite) executeEndProgram(c *chain, valIdx int, programId, hostAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu bounty close program on %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - bountytypes.ModuleName, - "close-program", - fmt.Sprintf("%s", programId), - fmt.Sprintf("--%s=%s", sdkflags.FlagFrom, hostAddr), - fmt.Sprintf("--%s=%s", sdkflags.FlagChainID, c.id), - fmt.Sprintf("--%s=%s", sdkflags.FlagGas, "auto"), - fmt.Sprintf("--%s=%s", sdkflags.FlagFees, fees), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully end program", hostAddr) -} - -func queryBountyProgram(endpoint, programID string) (*bountytypes.QueryProgramResponse, error) { - grpcReq := &bountytypes.QueryProgramRequest{ - ProgramId: programID, - } - conn, err := connectGrpc(endpoint) - defer conn.Close() - client := bountytypes.NewQueryClient(conn) - - grpcRsp, err := client.Program(context.Background(), grpcReq) - if err != nil { - return nil, fmt.Errorf("failed to execute request: %w", err) - } - - return grpcRsp, nil -} - -func queryBountyFinding(endpoint, findingID string) (*bountytypes.QueryFindingResponse, error) { - grpcReq := &bountytypes.QueryFindingRequest{ - FindingId: findingID, - } - conn, err := connectGrpc(endpoint) - defer conn.Close() - client := bountytypes.NewQueryClient(conn) - - grpcRsp, err := client.Finding(context.Background(), grpcReq) - if err != nil { - return nil, fmt.Errorf("failed to execute request: %w", err) - } - - return grpcRsp, nil +func (s *IntegrationTestSuite) testBounty() { + s.Run("test_bounty", func() { + var ( + // err error + valIdx = 0 + c = s.chainA + grpcEndpoint = s.valResources[s.chainA.id][0].GetHostPort("9090/tcp") + ) + + alice, _ := c.genesisAccounts[1].keyInfo.GetAddress() + bob, _ := c.genesisAccounts[2].keyInfo.GetAddress() + charlie, _ := c.genesisAccounts[3].keyInfo.GetAddress() + + programID := "fc28a970-f977-4bcb-bbfb-560baaaf7dd2" + programName := "e2e-program-name" + programDetail := `{"desc":"Refer to https://bounty.desc/cosmos for more details.","targets":["https://github.com/bounty/repo"],"total_bounty":500000,"bounty_denom":"USDT","bounty_levels":[{"severity":"critical","bounty":{"min_amount":"1","max_amount":"25000"}},{"severity":"high","bounty":{"min_amount":"1","max_amount":"3000"}},{"severity":"medium","bounty":{"min_amount":"1","max_amount":"1000"}},{"severity":"low","bounty":{"min_amount":"1","max_amount":"500"}},{"severity":"informational","bounty":{"min_amount":"1","max_amount":"1"}}]}` + + findingID := "4b34ff64-ad6a-4dda-98f5-6da02db7106c" + findingDesc := "e2e-finding-desc" + findingPoc := "e2e-finding-poc" + // Create a program + s.execCreateProgram(c, valIdx, programID, programName, programDetail, alice.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + program, err := queryProgram(grpcEndpoint, programID) + return err == nil && program.ProgramId == programID && program.Status == bountytypes.ProgramStatusInactive + }, + 20*time.Second, + 5*time.Second, + ) + + // Create a duplicate program + s.execCreateProgram(c, valIdx, programID, "dupe-name", programDetail, alice.String(), feesAmountCoin, true) + + // Active a program by non-admin + s.execActivateProgram(c, valIdx, programID, alice.String(), feesAmountCoin, true) + + // Issue admin certificate + certifierAcct, _ := c.certifier.keyInfo.GetAddress() + s.execIssueCertificate(c, valIdx, charlie.String(), "bountyadmin", "set bounty admin", certifierAcct.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + ok, _ := queryCertificate(grpcEndpoint, charlie.String(), "bountyadmin") + return ok + }, + 20*time.Second, + 5*time.Second, + ) + + // Submit finding to inactive program + s.execSubmitFinding(c, valIdx, programID, findingID, "MEDIUM", findingDesc, findingPoc, bob.String(), feesAmountCoin, true) + + // Active a program by admin + s.execActivateProgram(c, valIdx, programID, charlie.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + program, err := queryProgram(grpcEndpoint, programID) + return err == nil && program.ProgramId == programID && program.Status == bountytypes.ProgramStatusActive + }, + 20*time.Second, + 5*time.Second, + ) + + // Submit a finding + s.execSubmitFinding(c, valIdx, programID, findingID, "MEDIUM", findingDesc, findingPoc, bob.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + finding, err := queryFinding(grpcEndpoint, findingID) + return err == nil && finding.FindingId == findingID && finding.Status == bountytypes.FindingStatusSubmitted + }, + 20*time.Second, + 5*time.Second, + ) + + // Edit a finding + s.execEditFinding(c, valIdx, findingID, "LOW", findingDesc, findingPoc, bob.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + finding, err := queryFinding(grpcEndpoint, findingID) + return err == nil && finding.FindingId == findingID && finding.SeverityLevel == bountytypes.Low + }, + 20*time.Second, + 5*time.Second, + ) + + // Edit a finding by non-creator + s.execEditFinding(c, valIdx, findingID, "CRITICAL", findingDesc, findingPoc, alice.String(), feesAmountCoin, true) + + // Active a finding by non-admin + s.execActivateFinding(c, valIdx, findingID, bob.String(), feesAmountCoin, true) + + // Active a finding by admin + s.execActivateFinding(c, valIdx, findingID, charlie.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + finding, err := queryFinding(grpcEndpoint, findingID) + return err == nil && finding.FindingId == findingID && finding.Status == bountytypes.FindingStatusActive + }, + 20*time.Second, + 5*time.Second, + ) + + // Close program by admin + s.execCloseProgram(c, valIdx, programID, charlie.String(), feesAmountCoin, true) + + findingFingerprint, err := queryFindingFingerprint(grpcEndpoint, findingID) + s.Require().NoError(err) + // Confirm a finding by non-client + s.execConfirmFinding(c, valIdx, findingID, findingFingerprint, bob.String(), feesAmountCoin, true) + + // Confirm a finding by client + s.execConfirmFinding(c, valIdx, findingID, findingFingerprint, alice.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + finding, err := queryFinding(grpcEndpoint, findingID) + return err == nil && finding.FindingId == findingID && finding.Status == bountytypes.FindingStatusConfirmed + }, + 20*time.Second, + 5*time.Second, + ) + + // Edit payment by creator + s.execEditPayment(c, valIdx, findingID, "payment-hash", bob.String(), feesAmountCoin, true) + + // Edit payment by client + s.execEditPayment(c, valIdx, findingID, "payment-hash", alice.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + finding, err := queryFinding(grpcEndpoint, findingID) + return err == nil && finding.FindingId == findingID && finding.PaymentHash == "payment-hash" + }, + 20*time.Second, + 5*time.Second, + ) + + // Confirm paid by non-creator + s.execConfirmPayment(c, valIdx, findingID, alice.String(), feesAmountCoin, true) + + // Confirm paid by creator + s.execConfirmPayment(c, valIdx, findingID, bob.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + finding, err := queryFinding(grpcEndpoint, findingID) + return err == nil && finding.FindingId == findingID && finding.Status == bountytypes.FindingStatusPaid + }, + 20*time.Second, + 5*time.Second, + ) + + // Publish a finding by creator + s.execPublishFinding(c, valIdx, findingID, findingDesc, findingPoc, bob.String(), feesAmountCoin, true) + + // Publish a finding by client + s.execPublishFinding(c, valIdx, findingID, findingDesc, findingPoc, alice.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + finding, err := queryFinding(grpcEndpoint, findingID) + return err == nil && finding.FindingId == findingID && finding.ProofOfConcept == findingPoc + }, + 20*time.Second, + 5*time.Second, + ) + + // Close a program by non-client + s.execCloseProgram(c, valIdx, programID, bob.String(), feesAmountCoin, true) + + // Close a program by client + s.execCloseProgram(c, valIdx, programID, alice.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + program, err := queryProgram(grpcEndpoint, programID) + return err == nil && program.ProgramId == programID && program.Status == bountytypes.ProgramStatusClosed + }, + 20*time.Second, + 5*time.Second, + ) + }) } diff --git a/tests/e2e/e2e_cert_test.go b/tests/e2e/e2e_cert_test.go index 9b049c832..df8caf702 100644 --- a/tests/e2e/e2e_cert_test.go +++ b/tests/e2e/e2e_cert_test.go @@ -1,54 +1 @@ package e2e - -import ( - "context" - "fmt" - "strings" - "time" - - "github.com/cosmos/cosmos-sdk/client/flags" - certtypes "github.com/shentufoundation/shentu/v2/x/cert/types" -) - -func (s *IntegrationTestSuite) executeIssueCertificate(c *chain, valIdx int, certificateType, content, certifierAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu tx issue certificate %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - certtypes.ModuleName, - "issue-certificate", - certificateType, - content, - fmt.Sprintf("--%s=%s", flags.FlagFrom, certifierAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully issue %s certificate to %s", certifierAddr, certificateType, content) -} - -func queryCertificate(endpoint string, certificateId int) (*certtypes.QueryCertificateResponse, error) { - grpcReq := &certtypes.QueryCertificateRequest{ - CertificateId: uint64(certificateId), - } - conn, err := connectGrpc(endpoint) - defer conn.Close() - client := certtypes.NewQueryClient(conn) - - grpcRsp, err := client.Certificate(context.Background(), grpcReq) - if err != nil { - return nil, fmt.Errorf("failed to execute request: %w", err) - } - - return grpcRsp, nil -} diff --git a/tests/e2e/e2e_distribution_test.go b/tests/e2e/e2e_distribution_test.go new file mode 100644 index 000000000..0214f2b0c --- /dev/null +++ b/tests/e2e/e2e_distribution_test.go @@ -0,0 +1,82 @@ +package e2e + +import ( + "fmt" + "time" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (s *IntegrationTestSuite) testDistribution() { + s.Run("test_distribution", func() { + var ( + err error + valIdx = 0 + c = s.chainA + endpoint = fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp")) + ) + + delegator, _ := c.genesisAccounts[2].keyInfo.GetAddress() + withdrawer, _ := c.genesisAccounts[3].keyInfo.GetAddress() + s.execSetWithdrawAddress(c, valIdx, delegator.String(), withdrawer.String(), feesAmountCoin, false) + s.Require().Eventually( + func() bool { + res, err := queryDelegatorWithdrawalAddress(endpoint, delegator.String()) + s.Require().NoError(err) + return res.WithdrawAddress == withdrawer.String() + }, + 20*time.Second, + 5*time.Second, + ) + + // var beforeBalance, afterBalance sdk.Coin + + // s.Require().Eventually( + // func() bool { + // beforeBalance, err = queryShentuBalance(endpoint, delegator.String(), uctkDenom) + // s.Require().NoError(err) + // return beforeBalance.IsValid() + // }, + // 20*time.Second, + // 5*time.Second, + // ) + + // valaddr, _ := c.validators[0].keyInfo.GetAddress() + // validator := sdk.ValAddress(valaddr) + // s.execWithdrawReward(c, valIdx, delegator.String(), validator.String(), feesAmountCoin, false) + // s.Require().Eventually( + // func() bool { + // afterBalance, err = queryShentuBalance(endpoint, delegator.String(), uctkDenom) + // s.Require().NoError(err) + // return afterBalance.IsGTE(beforeBalance.Sub(feesAmountCoin)) + // }, + // 20*time.Second, + // 5*time.Second, + // ) + + var beforeDistribBalance, afterDistribBalance sdk.Coin + + s.Require().Eventually( + func() bool { + beforeDistribBalance, err = queryShentuBalance(endpoint, distribModuleAcct.String(), uctkDenom) + s.Require().NoError(err) + return beforeDistribBalance.IsValid() + }, + 20*time.Second, + 5*time.Second, + ) + amount := sdk.NewCoin(uctkDenom, math.NewInt(10000000)) + s.execFundCommunityPool(c, valIdx, delegator.String(), amount, feesAmountCoin, false) + s.Require().Eventually( + func() bool { + afterDistribBalance, err = queryShentuBalance(endpoint, distribModuleAcct.String(), uctkDenom) + s.Require().NoError(err) + return afterDistribBalance.IsGTE(beforeDistribBalance.Add(amount)) + }, + 20*time.Second, + 5*time.Second, + ) + }) +} diff --git a/tests/e2e/e2e_exec_test.go b/tests/e2e/e2e_exec_test.go new file mode 100644 index 000000000..295c04c60 --- /dev/null +++ b/tests/e2e/e2e_exec_test.go @@ -0,0 +1,703 @@ +package e2e + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "strings" + "time" + + "github.com/ory/dockertest/v3/docker" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type flagOption func(map[string]string) + +func withExtraFlag(key, value string) flagOption { + return func(flags map[string]string) { + flags[key] = value + } +} + +func applyOptions(options []flagOption) map[string]string { + flags := make(map[string]string) + for _, opt := range options { + opt(flags) + } + return flags +} + +func (s *IntegrationTestSuite) execShentuTxCmd(ctx context.Context, c *chain, cmd []string, valIdx int, validation func([]byte, []byte) bool) ([]byte, []byte) { + if validation == nil { + validation = s.execValidationDefault(s.chainA, 0) + } + var ( + outBuf bytes.Buffer + errBuf bytes.Buffer + ) + exec, err := s.dkrPool.Client.CreateExec(docker.CreateExecOptions{ + Context: ctx, + AttachStdout: true, + AttachStderr: true, + Container: s.valResources[c.id][valIdx].Container.ID, + User: "root", + Cmd: cmd, + }) + s.Require().NoError(err) + + err = s.dkrPool.Client.StartExec(exec.ID, docker.StartExecOptions{ + Context: ctx, + Detach: false, + OutputStream: &outBuf, + ErrorStream: &errBuf, + }) + s.Require().NoError(err) + + stdOut := outBuf.Bytes() + stdErr := errBuf.Bytes() + + if !validation(stdOut, stdErr) { + s.Require().FailNowf("Exec validation failed", "stdout: %s, stderr: %s", string(stdOut), string(stdErr)) + } + return stdOut, stdErr +} + +func (s *IntegrationTestSuite) executeHermesCommand(ctx context.Context, hermesCmd []string, validation func([]byte, []byte) bool) ([]byte, []byte) { + if validation == nil { + validation = s.execValidationHermes() + } + var ( + outBuf bytes.Buffer + errBuf bytes.Buffer + ) + exec, err := s.dkrPool.Client.CreateExec(docker.CreateExecOptions{ + Context: ctx, + AttachStdout: true, + AttachStderr: true, + Container: s.hermesResource.Container.ID, + User: "root", + Cmd: hermesCmd, + }) + s.Require().NoError(err) + + err = s.dkrPool.Client.StartExec(exec.ID, docker.StartExecOptions{ + Context: ctx, + Detach: false, + OutputStream: &outBuf, + ErrorStream: &errBuf, + }) + s.Require().NoError(err) + + stdOut := outBuf.Bytes() + stdErr := errBuf.Bytes() + + if !validation(stdOut, stdErr) { + s.Require().FailNowf("Exec validation failed", "stdout: %s, stderr: %s", string(stdOut), string(stdErr)) + } + return stdOut, stdErr +} + +func (s *IntegrationTestSuite) execValidationDefault(chain *chain, valIdx int) func([]byte, []byte) bool { + return func(stdout, stderr []byte) bool { + var txResp sdk.TxResponse + if err := cdc.UnmarshalJSON(stdout, &txResp); err != nil { + return false + } + if strings.Contains(txResp.String(), "code: 0") || txResp.Code == 0 { + endpoint := fmt.Sprintf("http://%s", s.valResources[chain.id][valIdx].GetHostPort("1317/tcp")) + s.Require().Eventually( + func() bool { + err := queryShentuTx(endpoint, txResp.TxHash) + return err == nil + }, + time.Minute, + 5*time.Second, + "stdout: %s, stderr: %s", + string(stdout), string(stderr), + ) + return true + } + return false + } +} + +func (s *IntegrationTestSuite) execValidationError(chain *chain, valIdx int) func([]byte, []byte) bool { + return func(stdout, stderr []byte) bool { + var txResp sdk.TxResponse + if err := cdc.UnmarshalJSON(stdout, &txResp); err != nil { + return true + } + if txResp.Code != 0 { + return true + } + endpoint := fmt.Sprintf("http://%s", s.valResources[chain.id][valIdx].GetHostPort("1317/tcp")) + s.Require().Eventually( + func() bool { + err := queryShentuTx(endpoint, txResp.TxHash) + return err != nil + }, + time.Minute, + 5*time.Second, + "stdout: %s, stderr: %s", + string(stdout), string(stderr), + ) + return true + } +} + +func (s *IntegrationTestSuite) execValidationHermes() func([]byte, []byte) bool { + return func(stdout, stderr []byte) bool { + var out map[string]interface{} + err := json.Unmarshal(stdout, &out) + if err != nil { + return false + } + if lvl := out["level"]; lvl != nil && strings.ToLower(lvl.(string)) == "error" { + errMsg := out["fields"].(map[string]interface{})["message"] + s.Require().FailNowf("hermes relayer command failed", "stderr: %s", errMsg) + } + if s := out["status"]; s != nil && s != "success" { + return false + } + return true + } +} + +func (s *IntegrationTestSuite) execBankSend(c *chain, valIdx int, from, to string, amount, fees sdk.Coin, expectError bool, opt ...flagOption) { + cmd := []string{ + shentuBinary, + txCommand, + "bank", + "send", + from, + to, + amount.String(), + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + flags := applyOptions(opt) + for k, v := range flags { + cmd = append(cmd, fmt.Sprintf("--%s", k), fmt.Sprintf("%s", v)) + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed bank send from %s to %s %s", from, to, amount.String()) +} + +func (s *IntegrationTestSuite) execBankMultiSend(c *chain, valIdx int, from string, to []string, amount, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bank", + "multi-send", + from, + } + cmd2 := []string{ + amount.String(), + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + cmd = append(cmd, to...) + cmd = append(cmd, cmd2...) + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed bank multi-send from %s to %s %s", from, strings.Join(to, ","), amount.String()) +} + +func (s *IntegrationTestSuite) execSetWithdrawAddress(c *chain, valIdx int, delegator, withdrawer string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "distribution", + "set-withdraw-addr", + withdrawer, + "--from", delegator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed set withdraw address of %s to %s", delegator, withdrawer) +} + +func (s *IntegrationTestSuite) execWithdrawReward(c *chain, valIdx int, delegator, validator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "distribution", + "withdraw-rewards", + validator, + "--from", delegator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed withdraw rewards of %s from %s", delegator, validator) +} + +func (s *IntegrationTestSuite) execFundCommunityPool(c *chain, valIdx int, account string, amount, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "distribution", + "fund-community-pool", + amount.String(), + "--from", account, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed fund community pool from %s %s", account, amount.String()) +} + +func (s *IntegrationTestSuite) execFeeGrant(c *chain, valIdx int, granter, grantee string, limit, fees sdk.Coin, expectError bool, opt ...flagOption) { + cmd := []string{ + shentuBinary, + txCommand, + "feegrant", + "grant", + granter, + grantee, + "--from", granter, + "--spend-limit", limit.String(), + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + + flags := applyOptions(opt) + for k, v := range flags { + cmd = append(cmd, fmt.Sprintf("--%s", k), fmt.Sprintf("%s", v)) + } + + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed fee grant from %s to %s %s", granter, grantee, limit.String()) +} + +func (s *IntegrationTestSuite) execDelegate(c *chain, valIdx int, delegator, validator string, amount, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "staking", + "delegate", + validator, + amount.String(), + "--from", delegator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed delegate from %s to %s %s", delegator, validator, amount.String()) +} + +func (s *IntegrationTestSuite) execCreateProgram(c *chain, valIdx int, programID, name, desc, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "create-program", + "--program-id", programID, + "--name", name, + "--detail", desc, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed create program %s by %s", programID, creator) +} + +func (s *IntegrationTestSuite) execEditProgram(c *chain, valIdx int, name, desc, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "edit-program", + "--name", name, + "--detail", desc, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed edit program %s by %s", name, creator) +} + +func (s *IntegrationTestSuite) execActivateProgram(c *chain, valIdx int, programID, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "activate-program", + programID, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed activate program %s by %s", programID, creator) +} + +func (s *IntegrationTestSuite) execCloseProgram(c *chain, valIdx int, programID, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "close-program", + programID, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed close program %s by %s", programID, creator) +} + +func (s *IntegrationTestSuite) execSubmitFinding(c *chain, valIdx int, programID, findingID, severity, desc, poc, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "submit-finding", + "--program-id", programID, + "--finding-id", findingID, + "--severity-level", severity, + "--desc", desc, + "--poc", poc, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed submit finding %s by %s", findingID, creator) +} + +func (s *IntegrationTestSuite) execEditFinding(c *chain, valIdx int, findingID, severity, desc, poc, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "edit-finding", + "--finding-id", findingID, + "--severity-level", severity, + "--desc", desc, + "--poc", poc, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed edit finding %s by %s", findingID, creator) +} + +func (s *IntegrationTestSuite) execActivateFinding(c *chain, valIdx int, findingID, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "activate-finding", + findingID, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed activate finding %s by %s", findingID, creator) +} + +func (s *IntegrationTestSuite) execConfirmFinding(c *chain, valIdx int, findingID, fingerprint, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "confirm-finding", + findingID, + "--fingerprint", fingerprint, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed confirm finding %s by %s", findingID, creator) +} + +func (s *IntegrationTestSuite) execEditPayment(c *chain, valIdx int, findingID, payment, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "edit-finding", + "--finding-id", findingID, + "--payment-hash", payment, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed edit payment of finding %s by %s", findingID, creator) +} + +func (s *IntegrationTestSuite) execConfirmPayment(c *chain, valIdx int, findingID, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "confirm-finding-paid", + findingID, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed confirm payment of finding %s by %s", findingID, creator) +} + +func (s *IntegrationTestSuite) execPublishFinding(c *chain, valIdx int, findingID, desc, poc, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "publish-finding", + findingID, + "--desc", desc, + "--poc", poc, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed publish finding %s by %s", findingID, creator) +} + +func (s *IntegrationTestSuite) execCloseFinding(c *chain, valIdx int, findingID, creator string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "bounty", + "close-finding", + findingID, + "--from", creator, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully executed close finding %s by %s", findingID, creator) +} + +func (s *IntegrationTestSuite) execIssueCertificate(c *chain, valIdx int, content, certificate, desc, certifier string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "cert", + "issue-certificate", + certificate, + content, + "--description", desc, + "--from", certifier, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully issued %s certificate to %s by %s", certificate, content, certifier) + if !expectError { + certificateCounter++ + } +} + +func (s *IntegrationTestSuite) execRevokeCertificate(c *chain, valIdx int, certificateID, certifier string, fees sdk.Coin, expectError bool) { + cmd := []string{ + shentuBinary, + txCommand, + "cert", + "revoke-certificate", + certificateID, + "--from", certifier, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + validation := s.execValidationDefault(c, valIdx) + if expectError { + validation = s.execValidationError(c, valIdx) + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, validation) + s.T().Logf("Successfully revoked certificate %s by %s", certificateID, certifier) +} + +func (s *IntegrationTestSuite) execSubmitProposal(c *chain, valIdx int, proposalFileName, proposer string, fees sdk.Coin) { + cmd := []string{ + shentuBinary, + txCommand, + "gov", + "submit-proposal", + configFile(proposalFileName), + "--from", proposer, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + proposalCounter++ + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, s.execValidationDefault(c, valIdx)) + s.T().Logf("Successfully submitted proposal %d", proposalCounter) +} + +func (s *IntegrationTestSuite) execVoteProposal(c *chain, valIdx int, proposalID uint64, voter, option string, fees sdk.Coin) { + cmd := []string{ + shentuBinary, + txCommand, + "gov", + "vote", + fmt.Sprintf("%d", proposalID), + option, + "--from", voter, + "--fees", fees.String(), + "--chain-id", c.id, + "--keyring-backend", "test", + "--output", "json", + "--yes", + } + s.execShentuTxCmd(context.Background(), c, cmd, valIdx, s.execValidationDefault(c, valIdx)) + s.T().Logf("Successfully voted proposal %d %s by %s", proposalID, option, voter) +} diff --git a/tests/e2e/e2e_feegrant_test.go b/tests/e2e/e2e_feegrant_test.go new file mode 100644 index 000000000..641695739 --- /dev/null +++ b/tests/e2e/e2e_feegrant_test.go @@ -0,0 +1,64 @@ +package e2e + +import ( + "fmt" + "time" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +func (s *IntegrationTestSuite) testFeeGrant() { + s.Run("test_fee_grant", func() { + var ( + err error + valIdx = 0 + c = s.chainA + endpoint = fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp")) + ) + + alice, _ := c.genesisAccounts[1].keyInfo.GetAddress() + bob, _ := c.genesisAccounts[2].keyInfo.GetAddress() + charlie, _ := c.genesisAccounts[3].keyInfo.GetAddress() + + amount := sdk.NewCoin(uctkDenom, math.NewInt(10000000)) + s.execFeeGrant(c, valIdx, alice.String(), bob.String(), amount, feesAmountCoin, false, withExtraFlag("allowed-messages", sdk.MsgTypeURL(&banktypes.MsgSend{}))) + + var beforeAliceUctk, beforeBobUctk, beforeCharlieUctk sdk.Coin + var afterAliceUctk, afterBobUctk, afterCharlieUctk sdk.Coin + + s.Require().Eventually( + func() bool { + beforeAliceUctk, err = queryShentuBalance(endpoint, alice.String(), uctkDenom) + s.Require().NoError(err) + beforeBobUctk, err = queryShentuBalance(endpoint, bob.String(), uctkDenom) + s.Require().NoError(err) + beforeCharlieUctk, err = queryShentuBalance(endpoint, charlie.String(), uctkDenom) + s.Require().NoError(err) + return beforeAliceUctk.IsValid() && beforeBobUctk.IsValid() && beforeCharlieUctk.IsValid() + }, + 20*time.Second, + 5*time.Second, + ) + + // Bob sends 10ctk to Charlie, Alice pays the fees + s.execBankSend(c, valIdx, bob.String(), charlie.String(), amount, feesAmountCoin, false, withExtraFlag("fee-granter", alice.String())) + s.Require().Eventually( + func() bool { + afterAliceUctk, err = queryShentuBalance(endpoint, alice.String(), uctkDenom) + s.Require().NoError(err) + afterBobUctk, err = queryShentuBalance(endpoint, bob.String(), uctkDenom) + s.Require().NoError(err) + afterCharlieUctk, err = queryShentuBalance(endpoint, charlie.String(), uctkDenom) + s.Require().NoError(err) + outgoing := beforeBobUctk.Sub(amount).IsEqual(afterBobUctk) + incoming := beforeCharlieUctk.Add(amount).IsEqual(afterCharlieUctk) + feepayment := beforeAliceUctk.Sub(feesAmountCoin).IsEqual(afterAliceUctk) + return outgoing && incoming && feepayment + }, + 20*time.Second, + 5*time.Second, + ) + }) +} diff --git a/tests/e2e/e2e_gov_test.go b/tests/e2e/e2e_gov_test.go index 6f698c9b8..d0ccc1607 100644 --- a/tests/e2e/e2e_gov_test.go +++ b/tests/e2e/e2e_gov_test.go @@ -1,112 +1,73 @@ package e2e import ( - "context" "fmt" - govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "strings" + "path/filepath" "time" - "github.com/cosmos/cosmos-sdk/client/flags" - sdkgovtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkgovtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) -func (s *IntegrationTestSuite) executeSubmitUpgradeProposal(c *chain, valIdx, upgradeHeight int, submitterAddr, proposalName, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu tx submit proposal %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - sdkgovtypes.ModuleName, - "submit-proposal", - "software-upgrade", - proposalName, - fmt.Sprintf("--upgrade-height=%d", upgradeHeight), - fmt.Sprintf("--title=\"title of %s\"", proposalName), - fmt.Sprintf("--description=\"description of %s\"", proposalName), - fmt.Sprintf("--%s=%s", flags.FlagFrom, submitterAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully submit %s proposal", submitterAddr, proposalName) -} - -func (s *IntegrationTestSuite) executeDepositProposal(c *chain, valIdx int, submitterAddr string, proposalId int, amount, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu tx deposit proposal %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - sdkgovtypes.ModuleName, - "deposit", - fmt.Sprintf("%d", proposalId), - amount, - fmt.Sprintf("--%s=%s", flags.FlagFrom, submitterAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully deposit proposal %d %s", submitterAddr, proposalId, amount) +func (s *IntegrationTestSuite) testCommonProposal() { + s.Run("test_common_proposal", func() { + var ( + valIdx = 0 + c = s.chainA + grpcEndpoint = s.valResources[s.chainA.id][0].GetHostPort("9090/tcp") + ) + + valA, _ := c.validators[0].keyInfo.GetAddress() + valB, _ := c.validators[1].keyInfo.GetAddress() + + alice, _ := c.genesisAccounts[1].keyInfo.GetAddress() + bob, _ := c.genesisAccounts[2].keyInfo.GetAddress() + + // Create a proposal to send 10ctk from alice to bob + amount := sdk.NewCoin(uctkDenom, math.NewInt(10000000)) + s.writePoolSpendProposal(c, alice.String(), "pool_proposal.json", amount) + + s.execSubmitProposal(c, valIdx, "pool_proposal.json", bob.String(), feesAmountCoin) + s.Require().Eventually( + func() bool { + proposal, err := queryProposal(grpcEndpoint, proposalCounter) + return err == nil && proposal.Id == proposalCounter && proposal.Status == sdkgovtypes.StatusVotingPeriod + }, + 20*time.Second, + 5*time.Second, + ) + + s.execVoteProposal(c, 0, proposalCounter, valA.String(), "yes", feesAmountCoin) + s.execVoteProposal(c, 1, proposalCounter, valB.String(), "yes", feesAmountCoin) + s.Require().Eventually( + func() bool { + proposal, err := queryProposal(grpcEndpoint, proposalCounter) + return err == nil && proposal.Id == proposalCounter && proposal.Status == sdkgovtypes.StatusPassed + }, + 20*time.Second, + 5*time.Second, + ) + }) } -func (s *IntegrationTestSuite) executeVoteProposal(c *chain, valIdx int, submitterAddr string, proposalId int, vote, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu tx vote proposal %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - sdkgovtypes.ModuleName, - "vote", - fmt.Sprintf("%d", proposalId), - vote, - fmt.Sprintf("--%s=%s", flags.FlagFrom, submitterAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully vote proposal %d %s", submitterAddr, proposalId, vote) -} - -func queryProposal(endpoint string, proposalID int) (*govtypesv1.QueryProposalResponse, error) { - grpcReq := &govtypesv1.QueryProposalRequest{ - ProposalId: uint64(proposalID), - } - conn, err := connectGrpc(endpoint) - defer conn.Close() - client := govtypesv1.NewQueryClient(conn) - - grpcRsp, err := client.Proposal(context.Background(), grpcReq) - if err != nil { - return nil, fmt.Errorf("failed to execute request: %w", err) - } - - return grpcRsp, nil +func (s *IntegrationTestSuite) writePoolSpendProposal(c *chain, recipient, fileName string, amount sdk.Coin) { + template := `{ + "messages": [{ + "@type": "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + "authority": "%s", + "recipient": "%s", + "amount": [{ + "denom": "%s", + "amount": "%s" + }] + }], + "metadata": "community pool spend", + "deposit": "512000000uctk", + "title": "community pool proposal", + "summary": "community pool summary" + }` + body := fmt.Sprintf(template, govModuleAcct.String(), recipient, amount.Denom, amount.Amount.String()) + err := writeFile(filepath.Join(c.validators[0].configDir(), "config", fileName), []byte(body)) + s.Require().NoError(err) } diff --git a/tests/e2e/e2e_ibc_test.go b/tests/e2e/e2e_ibc_test.go new file mode 100644 index 000000000..7970a47fb --- /dev/null +++ b/tests/e2e/e2e_ibc_test.go @@ -0,0 +1,162 @@ +package e2e + +import ( + "context" + "fmt" + "strings" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (s *IntegrationTestSuite) testIBCTokanTransfer() { + s.Run("send_uctk_to_chainB", func() { + var ( + balances sdk.Coins + err error + beforeBalance int64 + ibcStakeDenom string + ) + + address, err := s.chainA.validators[0].keyInfo.GetAddress() + s.Require().NoError(err) + sender := address.String() + + address, err = s.chainB.validators[0].keyInfo.GetAddress() + s.Require().NoError(err) + recipient := address.String() + + chainBAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainB.id][0].GetHostPort("1317/tcp")) + + s.Require().Eventually( + func() bool { + balances, err = queryShentuAllBalances(chainBAPIEndpoint, recipient) + s.Require().NoError(err) + return balances.Len() != 0 + }, + time.Minute, + 5*time.Second, + ) + for _, c := range balances { + if strings.Contains(c.Denom, "ibc/") { + beforeBalance = c.Amount.Int64() + break + } + } + + token := sdk.NewInt64Coin(uctkDenom, 3300000000) // 3,300ctk + s.sendIBC(s.chainA, 0, sender, recipient, "", token, feesAmountCoin) + s.hermesClearPacket(hermesConfigWithGasPrices, s.chainA.id, transferPort, transferChannel) + + // require the recipient account receives the IBC tokens (IBC packets ACKd) + s.Require().Eventually( + func() bool { + balances, err = queryShentuAllBalances(chainBAPIEndpoint, recipient) + s.Require().NoError(err) + return balances.Len() == 3 + }, + time.Minute, + 5*time.Second, + ) + + for _, c := range balances { + if strings.Contains(c.Denom, "ibc/") { + ibcStakeDenom = c.Denom + s.Require().Equal(token.Amount.Int64()+beforeBalance, c.Amount.Int64()) + break + } + } + + s.Require().NotEmpty(ibcStakeDenom) + }) +} + +func (s *IntegrationTestSuite) sendIBC(c *chain, valIdx int, sender, recipient, note string, token, fees sdk.Coin) { + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + + ibcCmd := []string{ + shentuBinary, + txCommand, + "ibc-transfer", + "transfer", + transferPort, + transferChannel, + recipient, + token.String(), + fmt.Sprintf("--from=%s", sender), + fmt.Sprintf("--fees=%s", fees.String()), + fmt.Sprintf("--chain-id=%s", c.id), + fmt.Sprintf("--memo=%s", note), + "--keyring-backend=test", + "--broadcast-mode=sync", + "--output=json", + "-y", + } + s.T().Logf("sending %s from %s (%s) to %s (%s) with memo %s", token.String(), s.chainA.id, sender, s.chainB.id, recipient, note) + s.execShentuTxCmd(ctx, c, ibcCmd, valIdx, s.execValidationDefault(c, valIdx)) + s.T().Log("successfully sent IBC tokens") +} + +func (s *IntegrationTestSuite) hermesClearPacket(configPath, chainID, portID, channelID string) { + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + + hermesCmd := []string{ + hermesBinary, + "--json", + fmt.Sprintf("--config=%s", configPath), + "clear", + "packets", + fmt.Sprintf("--chain=%s", chainID), + fmt.Sprintf("--channel=%s", channelID), + fmt.Sprintf("--port=%s", portID), + } + + s.executeHermesCommand(ctx, hermesCmd, nil) + s.T().Log("successfully cleared IBC packets") +} + +func (s *IntegrationTestSuite) createConnection() { + s.T().Logf("creating connection between %s and %s", s.chainA.id, s.chainB.id) + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + hermesCmd := []string{ + hermesBinary, + "--json", + "create", + "connection", + "--a-chain", + s.chainA.id, + "--b-chain", + s.chainB.id, + } + s.executeHermesCommand(ctx, hermesCmd, nil) + s.T().Logf("successfully created connection between %s and %s", s.chainA.id, s.chainB.id) +} + +func (s *IntegrationTestSuite) createChannel() { + s.T().Logf("creating channel between %s and %s", s.chainA.id, s.chainB.id) + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + hermesCmd := []string{ + hermesBinary, + "--json", + "create", + "channel", + "--a-chain", + s.chainA.id, + "--a-connection", + "connection-0", + "--a-port", + transferPort, + "--b-port", + transferPort, + "--channel-version", + "ics20-1", + "--order", + "unordered", + } + s.executeHermesCommand(ctx, hermesCmd, nil) + s.T().Logf("successfully created channel between %s and %s", s.chainA.id, s.chainB.id) +} diff --git a/tests/e2e/e2e_oracle_test.go b/tests/e2e/e2e_oracle_test.go deleted file mode 100644 index 2895a08c8..000000000 --- a/tests/e2e/e2e_oracle_test.go +++ /dev/null @@ -1,259 +0,0 @@ -package e2e - -import ( - "context" - "fmt" - "strings" - "time" - - "github.com/cosmos/cosmos-sdk/client/flags" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/shentufoundation/shentu/v2/x/oracle/types" -) - -func (s *IntegrationTestSuite) executeOracleCreateOperator(c *chain, valIdx int, operatorAddr, collateral, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - s.T().Logf("Executing shentu tx create operator %s", c.id) - defer cancel() - - command := []string{ - shentuBinary, - txCommand, - types.ModuleName, - "create-operator", - operatorAddr, - collateral, - fmt.Sprintf("--%s=%s", flags.FlagFrom, operatorAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("successfully add operator on %s", operatorAddr) -} - -func (s *IntegrationTestSuite) executeOracleCreateTxTask(c *chain, valIdx int, txBytes, chainId, bounty, valTime, creatorAddr, fees string) (string, error) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - s.T().Logf("Executing shentu tx create tx-task %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - types.ModuleName, - "create-txtask", - txBytes, - chainId, - bounty, - valTime, - fmt.Sprintf("--%s=%s", flags.FlagFrom, creatorAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - stdOut, _ := s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - txResp := sdk.TxResponse{} - if err := cdc.UnmarshalJSON(stdOut, &txResp); err != nil { - return "", err - } - - s.T().Logf("%s successfully submit tx-task on %s", creatorAddr, txResp.TxHash) - return txResp.TxHash, nil -} - -func (s *IntegrationTestSuite) executeOracleRespondTxTask(c *chain, valIdx, score int, taskHash, operatorAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - s.T().Logf("Executing shentu tx respond tx-task %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - types.ModuleName, - "respond-to-txtask", - taskHash, - fmt.Sprintf("%d", score), - fmt.Sprintf("--%s=%s", flags.FlagFrom, operatorAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("successfully respond by operator %s", operatorAddr) -} - -func (s *IntegrationTestSuite) executeOracleCreateTask(c *chain, valIdx int, contract, function, bounty, creatorAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - s.T().Logf("Executing shentu tx create task %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - types.ModuleName, - "create-task", - contract, - function, - bounty, - fmt.Sprintf("--%s=%s", flags.FlagFrom, creatorAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("successfully create task by %s", creatorAddr) -} - -func (s *IntegrationTestSuite) executeOracleRespondTask(c *chain, valIdx, score int, contract, function, operatorAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - s.T().Logf("Executing shentu tx respond task %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - types.ModuleName, - "respond-to-task", - contract, - function, - fmt.Sprintf("%d", score), - fmt.Sprintf("--%s=%s", flags.FlagFrom, operatorAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("successfully respond by operator %s", operatorAddr) -} - -func (s *IntegrationTestSuite) executeOracleClaimReward(c *chain, valIdx int, operatorAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - s.T().Logf("Executing shentu tx claim reward %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - types.ModuleName, - "claim-reward", - operatorAddr, - fmt.Sprintf("--%s=%s", flags.FlagFrom, operatorAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("successfully claim reward by operator %s", operatorAddr) -} - -func (s *IntegrationTestSuite) executeOracleRemoveOperator(c *chain, valIdx int, operatorAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - s.T().Logf("Executing shentu tx create operator %s", c.id) - defer cancel() - - command := []string{ - shentuBinary, - txCommand, - types.ModuleName, - "remove-operator", - operatorAddr, - fmt.Sprintf("--%s=%s", flags.FlagFrom, operatorAddr), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("successfully remove operator on %s", operatorAddr) -} - -func queryOracleTaskHash(endpoint, txHash string) (string, error) { - txRsp, err := getShentuTx(endpoint, txHash) - if err != nil { - return "", err - } - for _, log := range txRsp.Logs { - for _, event := range log.Events { - if event.Type == "create_tx_task" { - for _, attribute := range event.Attributes { - if attribute.Key == "atx_hash" { - return attribute.Value, nil - } - } - } - } - } - return "", fmt.Errorf("field not find") -} - -func queryOracleOperator(endpoint, operatorAddr string) (*types.QueryOperatorResponse, error) { - grpcReq := &types.QueryOperatorRequest{ - Address: operatorAddr, - } - conn, _ := connectGrpc(endpoint) - defer conn.Close() - client := types.NewQueryClient(conn) - grpcRsp, err := client.Operator(context.Background(), grpcReq) - if err != nil { - return nil, fmt.Errorf("failed to execute request: %w", err) - } - return grpcRsp, nil -} - -func queryOracleTxTask(endpoint, ataskHash string) (*types.QueryTxTaskResponse, error) { - grpcReq := &types.QueryTxTaskRequest{ - AtxHash: ataskHash, - } - conn, _ := connectGrpc(endpoint) - defer conn.Close() - client := types.NewQueryClient(conn) - grpcRsp, err := client.TxTask(context.Background(), grpcReq) - if err != nil { - return nil, fmt.Errorf("failed to execute request: %w", err) - } - return grpcRsp, nil -} - -func queryOracleTask(endpoint, contract, function string) (*types.QueryTaskResponse, error) { - grpcReq := &types.QueryTaskRequest{ - Contract: contract, - Function: function, - } - conn, _ := connectGrpc(endpoint) - defer conn.Close() - client := types.NewQueryClient(conn) - grpcRsp, err := client.Task(context.Background(), grpcReq) - if err != nil { - return nil, fmt.Errorf("failed to execute request: %w", err) - } - return grpcRsp, nil -} - -func queryOracleOperators(endpoint string) (*types.QueryOperatorsResponse, error) { - grpcReq := &types.QueryOperatorsRequest{} - conn, _ := connectGrpc(endpoint) - defer conn.Close() - client := types.NewQueryClient(conn) - grpcRsp, err := client.Operators(context.Background(), grpcReq) - if err != nil { - return nil, fmt.Errorf("failed to execute request: %w", err) - } - return grpcRsp, nil -} diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index a2cb27a12..60f6ef8a5 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "os" "path" @@ -17,8 +16,6 @@ import ( "cosmossdk.io/math" - govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - tmconfig "github.com/cometbft/cometbft/config" tmjson "github.com/cometbft/cometbft/libs/json" rpchttp "github.com/cometbft/cometbft/rpc/client/http" @@ -26,9 +23,11 @@ import ( "github.com/cosmos/cosmos-sdk/server" srvconfig "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + distribtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - sdkgovtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/ory/dockertest/v3" "github.com/ory/dockertest/v3/docker" @@ -36,7 +35,6 @@ import ( "github.com/stretchr/testify/suite" "github.com/shentufoundation/shentu/v2/common" - shieldtypes "github.com/shentufoundation/shentu/v2/x/shield/types" ) const ( @@ -46,31 +44,32 @@ const ( queryCommand = "query" keysCommand = "keys" uctkDenom = "uctk" - photonDenom = "photon" - initBalanceStr = "110000000000uctk,100000000000photon" - minGasPrice = "0.00001" + ctkDenom = "ctk" + initBalanceStr = "100000000000000000uctk" + minGasPrice = "0.005" proposalBlockBuffer = 1000 - shieldPoolName = "testpool" - shieldPoolLimit = "1000000000" + + hermesBinary = "hermes" + hermesConfigWithGasPrices = "/root/.hermes/config.toml" + hermesConfigNoGasPrices = "/root/.hermes/config-zero.toml" + transferPort = "transfer" + transferChannel = "channel-0" + + govAuthority = "shentu10d07y265gmmuvt4z0w9aw880jnsr700jjkhuyw" ) var ( - uctkAmount, _ = math.NewIntFromString("100000000000") - collateralAmount, _ = math.NewIntFromString("1000000000") - shieldAmount, _ = math.NewIntFromString("100000000") - depositAmount, _ = math.NewIntFromString("10000000") - feesAmount, _ = math.NewIntFromString("1000") - uctkAmountCoin = sdk.NewCoin(uctkDenom, uctkAmount) - collateralAmountCoin = sdk.NewCoin(uctkDenom, collateralAmount) - shieldAmountCoin = sdk.NewCoin(uctkDenom, shieldAmount) - depositAmountCoin = sdk.NewCoin(uctkDenom, depositAmount) - feesAmountCoin = sdk.NewCoin(photonDenom, feesAmount) - proposalCounter = 0 - certificateCounter = 0 - shieldPoolCounter = 0 - shieldPurchaseCounter = 0 - bountyProgramCounter = 0 - bountyFindingCounter = 0 + shentuConfigPath = filepath.Join(shentuHome, "config") + depositAmount = math.NewInt(512000000) + stakingAmount = math.NewInt(100000000000) + feesAmount = math.NewInt(5000) + depositAmountCoin = sdk.NewCoin(uctkDenom, depositAmount) + stakingAmountCoin = sdk.NewCoin(uctkDenom, stakingAmount) + feesAmountCoin = sdk.NewCoin(uctkDenom, feesAmount) + distribModuleAcct = authtypes.NewModuleAddress(distribtypes.ModuleName) + govModuleAcct = authtypes.NewModuleAddress(govtypes.ModuleName) + proposalCounter uint64 = 0 + certificateCounter = 0 ) type IntegrationTestSuite struct { @@ -141,6 +140,7 @@ func (s *IntegrationTestSuite) TearDownSuite() { s.Require().NoError(err) if skipCleanup { + s.T().Log("skipping e2e integration test suite cleanup...") return } } @@ -166,36 +166,31 @@ func (s *IntegrationTestSuite) TearDownSuite() { } func (s *IntegrationTestSuite) initNodes(c *chain) { + var err error s.Require().NoError(c.createAndInitValidators(2)) - // create 4 accounts for test - accts, err := c.validators[0].createAccounts(4) + // create 6 accounts for test + s.Require().NoError(c.addAccountFromMnemonic(6)) + certifierAddr, err := c.genesisAccounts[0].keyInfo.GetAddress() + c.certifier = c.genesisAccounts[0] s.Require().NoError(err) - c.accounts = append(c.accounts, accts...) // initialize a genesis file for the first validator val0ConfigDir := c.validators[0].configDir() + var addrAll []sdk.AccAddress for _, val := range c.validators { - key, err := val.keyInfo.GetAddress() + addr, err := val.keyInfo.GetAddress() s.Require().NoError(err) - - s.Require().NoError( - addGenesisAccount(val0ConfigDir, "", initBalanceStr, key), - ) - s.Require().NoError( - addCertifierAccount(val0ConfigDir, "", key), - ) + addrAll = append(addrAll, addr) } - for _, val := range c.accounts { - key, err := val.keyInfo.GetAddress() + for _, val := range c.genesisAccounts { + addr, err := val.keyInfo.GetAddress() s.Require().NoError(err) - - s.T().Logf("Account %s : %s", val.moniker, key) - s.Require().NoError( - addGenesisAccount(val0ConfigDir, "", initBalanceStr, key), - ) + addrAll = append(addrAll, addr) } - + s.Require().NoError( + modifyGenesis(val0ConfigDir, "", initBalanceStr, addrAll, certifierAddr, uctkDenom), + ) // copy the genesis file to the remaining validators for _, val := range c.validators[1:] { _, err := copyFile( @@ -209,9 +204,10 @@ func (s *IntegrationTestSuite) initNodes(c *chain) { func (s *IntegrationTestSuite) initGenesis(c *chain) { serverCtx := server.NewDefaultContext() config := serverCtx.Config + validator := c.validators[0] - config.SetRoot(c.validators[0].configDir()) - config.Moniker = c.validators[0].moniker + config.SetRoot(validator.configDir()) + config.Moniker = validator.moniker genFilePath := config.GenesisFile() appGenState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFilePath) @@ -221,16 +217,18 @@ func (s *IntegrationTestSuite) initGenesis(c *chain) { s.Require().NoError(cdc.UnmarshalJSON(appGenState[banktypes.ModuleName], &bankGenState)) bankGenState.DenomMetadata = append(bankGenState.DenomMetadata, banktypes.Metadata{ - Description: "An example stable token", - Display: photonDenom, - Base: photonDenom, - Symbol: photonDenom, - Name: photonDenom, + Description: "The native staking token of the Shentu Chain.", + Display: ctkDenom, + Base: uctkDenom, DenomUnits: []*banktypes.DenomUnit{ { - Denom: photonDenom, + Denom: uctkDenom, Exponent: 0, }, + { + Denom: ctkDenom, + Exponent: 6, + }, }, }) @@ -238,32 +236,13 @@ func (s *IntegrationTestSuite) initGenesis(c *chain) { s.Require().NoError(err) appGenState[banktypes.ModuleName] = bz - shieldGenState := shieldtypes.GetGenesisStateFromAppState(cdc, appGenState) - //sa, err := c.validators[0].keyInfo.GetAddress() - //s.Require().NoError(err) - //shieldGenState.ShieldAdmin = sa.String() - bz, err = cdc.MarshalJSON(&shieldGenState) - s.Require().NoError(err) - appGenState[shieldtypes.ModuleName] = bz - - var govGenState govtypesv1.GenesisState - s.Require().NoError(cdc.UnmarshalJSON(appGenState[sdkgovtypes.ModuleName], &govGenState)) - - votingPeriod := time.Second * 20 - govGenState.VotingParams.VotingPeriod = &votingPeriod - minDepositTokens := sdk.TokensFromConsensusPower(0, math.NewIntFromUint64(10)) - govGenState.DepositParams.MinDeposit = sdk.Coins{sdk.NewCoin(common.MicroCTKDenom, minDepositTokens)} - bz, err = cdc.MarshalJSON(&govGenState) - s.Require().NoError(err) - appGenState[sdkgovtypes.ModuleName] = bz - var genUtilGenState genutiltypes.GenesisState s.Require().NoError(cdc.UnmarshalJSON(appGenState[genutiltypes.ModuleName], &genUtilGenState)) // generate genesis txs genTxs := make([]json.RawMessage, len(c.validators)) for i, val := range c.validators { - createValmsg, err := val.buildCreateValidatorMsg(uctkAmountCoin) + createValmsg, err := val.buildCreateValidatorMsg(stakingAmountCoin) s.Require().NoError(err) signedTx, err := val.signMsg(createValmsg) @@ -277,15 +256,12 @@ func (s *IntegrationTestSuite) initGenesis(c *chain) { genUtilGenState.GenTxs = genTxs - bz, err = cdc.MarshalJSON(&genUtilGenState) + appGenState[genutiltypes.ModuleName], err = cdc.MarshalJSON(&genUtilGenState) s.Require().NoError(err) - appGenState[genutiltypes.ModuleName] = bz - bz, err = json.MarshalIndent(appGenState, "", " ") + genDoc.AppState, err = json.MarshalIndent(appGenState, "", " ") s.Require().NoError(err) - genDoc.AppState = bz - bz, err = tmjson.MarshalIndent(genDoc, "", " ") s.Require().NoError(err) @@ -334,8 +310,11 @@ func (s *IntegrationTestSuite) initValidatorConfigs(c *chain) { appConfig := srvconfig.DefaultConfig() appConfig.API.Enable = true - appConfig.MinGasPrices = fmt.Sprintf("%s%s", minGasPrice, photonDenom) + appConfig.MinGasPrices = fmt.Sprintf("%s%s", minGasPrice, uctkDenom) + appConfig.GRPC.Address = "0.0.0.0:9090" + appConfig.API.Address = "tcp://0.0.0.0:1317" + srvconfig.SetConfigTemplate(srvconfig.DefaultConfigTemplate) srvconfig.WriteConfigFile(appCfgPath, appConfig) } } @@ -349,7 +328,7 @@ func (s *IntegrationTestSuite) runValidators(c *chain, portOffset int) { Name: val.instanceName(), NetworkID: s.dkrNet.Network.ID, Mounts: []string{ - fmt.Sprintf("%s/:/root/.shentud", val.configDir()), + fmt.Sprintf("%s/:%s", val.configDir(), shentuHome), }, Repository: "shentuchain/shentud-e2e", } @@ -406,12 +385,14 @@ func (s *IntegrationTestSuite) runValidators(c *chain, portOffset int) { func (s *IntegrationTestSuite) runIBCRelayer() { s.T().Log("starting Hermes relayer container...") - tmpDir, err := ioutil.TempDir("", "shentu-e2e-testnet-hermes-") + tmpDir, err := os.MkdirTemp("", "shentu-e2e-testnet-hermes-") s.Require().NoError(err) s.tmpDirs = append(s.tmpDirs, tmpDir) shentuAVal := s.chainA.validators[0] shentuBVal := s.chainB.validators[0] + shentuARly := s.chainA.genesisAccounts[0] + shentuBRly := s.chainB.genesisAccounts[0] hermesCfgPath := path.Join(tmpDir, "hermes") s.Require().NoError(os.MkdirAll(hermesCfgPath, 0755)) @@ -424,8 +405,8 @@ func (s *IntegrationTestSuite) runIBCRelayer() { s.hermesResource, err = s.dkrPool.RunWithOptions( &dockertest.RunOptions{ Name: fmt.Sprintf("%s-%s-relayer", s.chainA.id, s.chainB.id), - Repository: "ghcr.io/cosmos/hermes-e2e", - Tag: "0.13.0", + Repository: "cosmos/hermes-e2e", + Tag: "1.0.0", NetworkID: s.dkrNet.Network.ID, Mounts: []string{ fmt.Sprintf("%s/:/root/hermes", hermesCfgPath), @@ -438,13 +419,15 @@ func (s *IntegrationTestSuite) runIBCRelayer() { fmt.Sprintf("SHENTU_B_E2E_CHAIN_ID=%s", s.chainB.id), fmt.Sprintf("SHENTU_A_E2E_VAL_MNEMONIC=%s", shentuAVal.mnemonic), fmt.Sprintf("SHENTU_B_E2E_VAL_MNEMONIC=%s", shentuBVal.mnemonic), + fmt.Sprintf("SHENTU_A_E2E_RLY_MNEMONIC=%s", shentuARly.mnemonic), + fmt.Sprintf("SHENTU_B_E2E_RLY_MNEMONIC=%s", shentuBRly.mnemonic), fmt.Sprintf("SHENTU_A_E2E_VAL_HOST=%s", s.valResources[s.chainA.id][0].Container.Name[1:]), fmt.Sprintf("SHENTU_B_E2E_VAL_HOST=%s", s.valResources[s.chainB.id][0].Container.Name[1:]), }, Entrypoint: []string{ "sh", "-c", - "chmod +x /root/hermes/hermes_bootstrap.sh && /root/hermes/hermes_bootstrap.sh", + "chmod +x /root/hermes/hermes_bootstrap.sh && /root/hermes/hermes_bootstrap.sh && tail -f /dev/null", }, }, noRestart, @@ -483,12 +466,12 @@ func (s *IntegrationTestSuite) runIBCRelayer() { s.T().Logf("started Hermes relayer container: %s", s.hermesResource.Container.ID) - // XXX: Give time to both networks to start, otherwise we might see gRPC - // transport errors. - time.Sleep(10 * time.Second) + // Give time to both networks to start, otherwise we might see gRPC transport errors. + // time.Sleep(10 * time.Second) // create the client, connection and channel between the two Shentu chains - s.connectIBCChains() + // s.createConnection() + // s.createChannel() } func noRestart(config *docker.HostConfig) { @@ -497,3 +480,8 @@ func noRestart(config *docker.HostConfig) { Name: "no", } } + +func configFile(filename string) string { + filepath := filepath.Join(shentuConfigPath, filename) + return filepath +} diff --git a/tests/e2e/e2e_shield_test.go b/tests/e2e/e2e_shield_test.go deleted file mode 100644 index 9b53f65aa..000000000 --- a/tests/e2e/e2e_shield_test.go +++ /dev/null @@ -1,232 +0,0 @@ -package e2e - -import ( - "context" - "encoding/json" - "fmt" - "os" - "path/filepath" - "strings" - "time" - - "github.com/cosmos/cosmos-sdk/client/flags" - sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - shieldtypes "github.com/shentufoundation/shentu/v2/x/shield/types" -) - -func (s *IntegrationTestSuite) executeDepositCollateral(c *chain, valIdx int, submitterAddr, amount, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu tx shield deposit collateral %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - shieldtypes.ModuleName, - "deposit-collateral", - amount, - fmt.Sprintf("--%s=%s", flags.FlagFrom, submitterAddr), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - fmt.Sprintf("--%s=%s", flags.FlagGas, "auto"), - fmt.Sprintf("--%s=%s", flags.FlagFees, fees), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully deposit %s", submitterAddr, amount) -} - -func (s *IntegrationTestSuite) executeCreatePool(c *chain, valIdx int, poolAmount, poolName, sponsorAddr, shieldLimit, submitterAddr, nativeAmount, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu tx shield create pool %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - shieldtypes.ModuleName, - "create-pool", - poolAmount, - poolName, - sponsorAddr, - fmt.Sprintf("--%s=%s", "shield-limit", shieldLimit), - fmt.Sprintf("--%s=%s", "native-deposit", nativeAmount), - fmt.Sprintf("--%s=%s", flags.FlagFrom, submitterAddr), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - fmt.Sprintf("--%s=%s", flags.FlagGas, "auto"), - fmt.Sprintf("--%s=%s", flags.FlagFees, fees), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully create pool %s", submitterAddr, poolName) -} - -func (s *IntegrationTestSuite) executePurchaseShield(c *chain, valIdx, poolId int, shieldAmount, description, submitterAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu tx shield purchase %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - shieldtypes.ModuleName, - "purchase", - fmt.Sprintf("%d", poolId), - shieldAmount, - description, - fmt.Sprintf("--%s=%s", flags.FlagFrom, submitterAddr), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - fmt.Sprintf("--%s=%s", flags.FlagGas, "auto"), - fmt.Sprintf("--%s=%s", flags.FlagFees, fees), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully purchase shield at pool %d", submitterAddr, poolId) -} - -func (s *IntegrationTestSuite) executeSubmitClaimProposal(c *chain, valIdx int, proposalFile, submitterAddr, fees string) { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.T().Logf("Executing shentu tx submit proposal %s", c.id) - - command := []string{ - shentuBinary, - txCommand, - govtypes.ModuleName, - "submit-proposal", - "shield-claim", - proposalFile, - fmt.Sprintf("--%s=%s", flags.FlagFrom, submitterAddr), - fmt.Sprintf("--%s=%s", flags.FlagGas, "auto"), - fmt.Sprintf("--%s=%s", flags.FlagFees, fees), - fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id), - "--keyring-backend=test", - "--output=json", - "-y", - } - - s.T().Logf("cmd: %s", strings.Join(command, " ")) - - s.execShentuTxCmd(ctx, c, command, valIdx, s.defaultExecValidation(c, valIdx)) - s.T().Logf("%s successfully submit claim proposal %s", submitterAddr, proposalFile) -} - -func (s *IntegrationTestSuite) writeClaimProposal(c *chain, valIdx, poolId, purchaseId int, fileName string) string { - type ClaimLoss struct { - Denom string `json:"denom"` - Amount string `json:"amount"` - } - type ClaimProposal struct { - PoolId int `json:"pool_id"` - PurchaseId int `json:"purchase_id"` - Evidence string `json:"evidence"` - Description string `json:"description"` - Loss sdk.Coins `json:"loss"` - Deposit sdk.Coins `json:"deposit"` - } - - loss := sdk.NewCoin(uctkDenom, sdk.NewInt(1000000)) - deposit := sdk.NewCoin(uctkDenom, sdk.NewInt(110000000)) - - var proposal = &ClaimProposal{ - PoolId: poolId, - PurchaseId: purchaseId, - Evidence: "Attack happened on