Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
update cosmos-sdk to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
kaifei committed Oct 26, 2019
1 parent 308bb07 commit dc28d36
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 63 deletions.
2 changes: 1 addition & 1 deletion service/cosmos/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ require (
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 // indirect
)

replace github.com/cosmos/cosmos-sdk => github.com/irisnet/cosmos-sdk v0.23.2-0.20191022102555-c1d4d1c8fb5c
replace github.com/cosmos/cosmos-sdk => github.com/irisnet/cosmos-sdk v0.23.2-0.20191024053222-fb9fd55110ea
4 changes: 2 additions & 2 deletions service/cosmos/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/irisnet/cosmos-sdk v0.23.2-0.20191022102555-c1d4d1c8fb5c h1:StKkWseQpS1yPecH3yLSU9yBrH8qevX9tTPCJ9g4p/Y=
github.com/irisnet/cosmos-sdk v0.23.2-0.20191022102555-c1d4d1c8fb5c/go.mod h1:DATGOvgReTZJ+NJRi+Z4Pi6DxuabkOU51MZhyP4qtY0=
github.com/irisnet/cosmos-sdk v0.23.2-0.20191024053222-fb9fd55110ea h1:P5tJ1QbtaVRGXPQ+icBGHKIUGHbbdEyiXkTR+rABR6k=
github.com/irisnet/cosmos-sdk v0.23.2-0.20191024053222-fb9fd55110ea/go.mod h1:DATGOvgReTZJ+NJRi+Z4Pi6DxuabkOU51MZhyP4qtY0=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
Expand Down
105 changes: 53 additions & 52 deletions service/iris/block/parse_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ func (iris *Iris_Block) ParseIrisTxModel(txBytes types.Tx, block *types.Block) i
logger.Error("can't get msgs", logger.String("method", methodName))
return docTx
}
msg := msgs[0]

docTx = imodel.IrisTx{
Height: height,
Expand All @@ -183,59 +182,61 @@ func (iris *Iris_Block) ParseIrisTxModel(txBytes types.Tx, block *types.Block) i
Code: result.Code,
Events: parseEvents(&result),
}
switch msg.(type) {
case imodel.MsgTransfer:
msg := msg.(imodel.MsgTransfer)
docTx.Initiator = msg.FromAddress.String()
docTx.From = msg.FromAddress.String()
docTx.To = msg.ToAddress.String()
docTx.Amount = utils.ParseCoins(msg.Amount)
docTx.Type = constant.TxTypeTransfer
break
case imodel.IBCBankMsgTransfer:
msg := msg.(imodel.IBCBankMsgTransfer)
docTx.Initiator = msg.Sender
docTx.From = docTx.Initiator
docTx.To = msg.Receiver
docTx.Amount = buildCoins(msg.Denomination, msg.Amount.String())
docTx.Type = constant.TxTypeIBCBankTransfer
docTx.IBCPacketHash = buildIBCPacketHashByEvents(docTx.Events)
txMsg := docTxMsg.DocTxMsgIBCBankTransfer{}
txMsg.BuildMsg(msg)
docTx.Msgs = append(docMsgs, imodel.DocTxMsg{
Type: txMsg.Type(),
Msg: &txMsg,
})
break
case imodel.IBCBankMsgReceivePacket:
msg := msg.(imodel.IBCBankMsgReceivePacket)
docTx.Initiator = msg.Signer.String()
docTx.Type = constant.TxTypeIBCBankRecvTransferPacket

if transPacketData, err := buildIBCPacketData(msg.Packet.Data()); err != nil {
logger.Error("build ibc packet data fail", logger.String("packetData", string(msg.Packet.Data())),
logger.String("err", err.Error()))
} else {
docTx.From = transPacketData.Sender
docTx.To = transPacketData.Receiver
docTx.Amount = buildCoins(transPacketData.Denomination, transPacketData.Amount)
}
for _, msg := range msgs {
switch msg.(type) {
case imodel.MsgTransfer:
msg := msg.(imodel.MsgTransfer)
docTx.Initiator = msg.FromAddress.String()
docTx.From = msg.FromAddress.String()
docTx.To = msg.ToAddress.String()
docTx.Amount = utils.ParseCoins(msg.Amount)
docTx.Type = constant.TxTypeTransfer
break
case imodel.IBCBankMsgTransfer:
msg := msg.(imodel.IBCBankMsgTransfer)
docTx.Initiator = msg.Sender
docTx.From = docTx.Initiator
docTx.To = msg.Receiver
docTx.Amount = buildCoins(msg.Denomination, msg.Amount.String())
docTx.Type = constant.TxTypeIBCBankTransfer
docTx.IBCPacketHash = buildIBCPacketHashByEvents(docTx.Events)
txMsg := docTxMsg.DocTxMsgIBCBankTransfer{}
txMsg.BuildMsg(msg)
docTx.Msgs = append(docMsgs, imodel.DocTxMsg{
Type: txMsg.Type(),
Msg: &txMsg,
})
break
case imodel.IBCBankMsgReceivePacket:
msg := msg.(imodel.IBCBankMsgReceivePacket)
docTx.Initiator = msg.Signer.String()
docTx.Type = constant.TxTypeIBCBankRecvTransferPacket

if transPacketData, err := buildIBCPacketData(msg.Packet.Data()); err != nil {
logger.Error("build ibc packet data fail", logger.String("packetData", string(msg.Packet.Data())),
logger.String("err", err.Error()))
} else {
docTx.From = transPacketData.Sender
docTx.To = transPacketData.Receiver
docTx.Amount = buildCoins(transPacketData.Denomination, transPacketData.Amount)
}

if hash, err := buildIBCPacketHashByPacket(msg.Packet.(imodel.IBCPacket)); err != nil {
logger.Error("build ibc packet hash fail", logger.String("err", err.Error()))
} else {
docTx.IBCPacketHash = hash
}
if hash, err := buildIBCPacketHashByPacket(msg.Packet.(imodel.IBCPacket)); err != nil {
logger.Error("build ibc packet hash fail", logger.String("err", err.Error()))
} else {
docTx.IBCPacketHash = hash
}

txMsg := docTxMsg.DocTxMsgIBCBankReceivePacket{}
txMsg.BuildMsg(msg)
docTx.Msgs = append(docMsgs, imodel.DocTxMsg{
Type: txMsg.Type(),
Msg: &txMsg,
})
break
default:
logger.Warn("unknown msg type")
txMsg := docTxMsg.DocTxMsgIBCBankReceivePacket{}
txMsg.BuildMsg(msg)
docTx.Msgs = append(docMsgs, imodel.DocTxMsg{
Type: txMsg.Type(),
Msg: &txMsg,
})
break
default:
logger.Warn("unknown msg type")
}
}

return docTx
Expand Down
2 changes: 1 addition & 1 deletion service/iris/block/parse_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestIris_Block_ParseIrisTx(t *testing.T) {
{
name: "test parse iris tx",
args: args{
b: 17359,
b: 20713,
client: client,
},
},
Expand Down
2 changes: 1 addition & 1 deletion service/iris/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ require (
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 // indirect
)

replace github.com/cosmos/cosmos-sdk => github.com/irisnet/cosmos-sdk v0.23.2-0.20191022102555-c1d4d1c8fb5c
replace github.com/cosmos/cosmos-sdk => github.com/irisnet/cosmos-sdk v0.23.2-0.20191024053222-fb9fd55110ea
8 changes: 2 additions & 6 deletions service/iris/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/irisnet/cosmos-sdk v0.23.2-0.20191022102555-c1d4d1c8fb5c h1:StKkWseQpS1yPecH3yLSU9yBrH8qevX9tTPCJ9g4p/Y=
github.com/irisnet/cosmos-sdk v0.23.2-0.20191022102555-c1d4d1c8fb5c/go.mod h1:DATGOvgReTZJ+NJRi+Z4Pi6DxuabkOU51MZhyP4qtY0=
github.com/irisnet/cosmos-sdk v0.23.2-0.20191024053222-fb9fd55110ea h1:P5tJ1QbtaVRGXPQ+icBGHKIUGHbbdEyiXkTR+rABR6k=
github.com/irisnet/cosmos-sdk v0.23.2-0.20191024053222-fb9fd55110ea/go.mod h1:DATGOvgReTZJ+NJRi+Z4Pi6DxuabkOU51MZhyP4qtY0=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
Expand All @@ -137,10 +137,8 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs=
github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM=
Expand Down Expand Up @@ -339,7 +337,6 @@ google.golang.org/grpc v1.23.1 h1:q4XQuHFC6I28BKZpo6IYyb3mNO+l7lSOxRuYTCiDfXk=
google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
Expand All @@ -348,7 +345,6 @@ gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXL
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 h1:yiW+nvdHb9LVqSHQBXfZCieqV4fzYhNBql77zY0ykqs=
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down

0 comments on commit dc28d36

Please sign in to comment.