From 98fb0a0259327ec41a1a9d7c453d501287c7d852 Mon Sep 17 00:00:00 2001 From: huangweichang Date: Thu, 3 Sep 2020 11:26:50 +0800 Subject: [PATCH 1/3] adjust for requestrand msg --- msg/random/rand.go | 11 ++++++++--- service/task/task_execute_test.go | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/msg/random/rand.go b/msg/random/rand.go index de2849c..7c2ed92 100644 --- a/msg/random/rand.go +++ b/msg/random/rand.go @@ -1,13 +1,16 @@ package random import ( - types "github.com/irisnet/irishub-sync/types" + "github.com/irisnet/irishub-sync/types" "github.com/irisnet/irishub-sync/util/constant" + "github.com/irisnet/irishub-sync/store" ) type DocTxMsgRequestRand struct { - Consumer string `bson:"consumer"` // request address - BlockInterval uint64 `bson:"block_interval"` // block interval after which the requested random number will be generated + Consumer string `bson:"consumer"` // request address + BlockInterval uint64 `bson:"block_interval"` // block interval after which the requested random number will be generated + Oracle bool `bson:"oracle"` + ServiceFeeCap store.Coins `bson:"service_fee_cap"` } func (doctx *DocTxMsgRequestRand) Type() string { @@ -18,4 +21,6 @@ func (doctx *DocTxMsgRequestRand) BuildMsg(txMsg interface{}) { msg := txMsg.(types.MsgRequestRandom) doctx.Consumer = msg.Consumer.String() doctx.BlockInterval = msg.BlockInterval + doctx.Oracle = msg.Oracle + doctx.ServiceFeeCap = types.ParseCoins(msg.ServiceFeeCap.String()) } diff --git a/service/task/task_execute_test.go b/service/task/task_execute_test.go index e21ae8c..c5d3803 100644 --- a/service/task/task_execute_test.go +++ b/service/task/task_execute_test.go @@ -108,7 +108,7 @@ func Test_parseBlock(t *testing.T) { name: "test parse block", args: args{ client: client, - b: 1001, + b: 601, }, }, } From 5a7184934dd70c8767a0bcba2d6759cf7f1b595a Mon Sep 17 00:00:00 2001 From: huangweichang Date: Thu, 3 Sep 2020 15:59:36 +0800 Subject: [PATCH 2/3] add htlc module register --- cdc/cdc.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cdc/cdc.go b/cdc/cdc.go index 5e0300e..dae2333 100644 --- a/cdc/cdc.go +++ b/cdc/cdc.go @@ -21,6 +21,7 @@ import ( "github.com/irismod/token" "github.com/irismod/nft" "github.com/irismod/coinswap" + "github.com/irismod/htlc" "github.com/cosmos/cosmos-sdk/x/auth/tx" "github.com/cosmos/cosmos-sdk/std" ctypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -47,6 +48,7 @@ var ( coinswap.AppModuleBasic{}, guardian.AppModuleBasic{}, oracle.AppModuleBasic{}, + htlc.AppModuleBasic{}, ) ) // 初始化账户地址前缀 From 9a77ed8b53d7c6238c9eedd51a7e15a7c4732699 Mon Sep 17 00:00:00 2001 From: huangweichang Date: Thu, 3 Sep 2020 16:35:53 +0800 Subject: [PATCH 3/3] implement msg assign about submitevidence verifyinvariant --- msg/crisis/verify_invariant.go | 4 ++++ msg/evidence/submit_evidence.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/msg/crisis/verify_invariant.go b/msg/crisis/verify_invariant.go index 2faf4b8..47e9cf9 100644 --- a/msg/crisis/verify_invariant.go +++ b/msg/crisis/verify_invariant.go @@ -24,6 +24,10 @@ func (m *DocMsgVerifyInvariant) BuildMsg(v interface{}) { data, _ := json.Marshal(v) json.Unmarshal(data, &msg) + m.Sender = msg.Sender.String() + m.InvariantModuleName = msg.InvariantModuleName + m.InvariantRoute = msg.InvariantRoute + } func (m *DocMsgVerifyInvariant) HandleTxMsg(msgData sdk.Msg, tx *document.CommonTx) *document.CommonTx { diff --git a/msg/evidence/submit_evidence.go b/msg/evidence/submit_evidence.go index 64ddec1..8328309 100644 --- a/msg/evidence/submit_evidence.go +++ b/msg/evidence/submit_evidence.go @@ -26,6 +26,10 @@ func (m *DocMsgSubmitEvidence) BuildMsg(v interface{}) { data, _ := json.Marshal(v) json.Unmarshal(data, &msg) + m.Submitter = msg.Submitter.String() + m.Evidence.TypeUrl = msg.Evidence.GetTypeUrl() + m.Evidence.Value = string(msg.Evidence.Value) + } func (m *DocMsgSubmitEvidence) HandleTxMsg(msgData sdk.Msg, tx *document.CommonTx) *document.CommonTx {