mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00
Fix test pop result (#258)
* chore: update elements-rpc to v0.5.2 * fix: logging output in dao keeper * refactor: properly check broadcast tx output * fix: use correct proposer address in test Otherwise we get an error like: ``` [app] reissue: failed. valid result: true proposer: plmnt1gyg6lxcre5f8t4ef0uxcqen9jczwalzjvc25k8 validator identity: fb7ecaf9584dfdc67265f599155571651c149207 ``` Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
parent
4599bc2c78
commit
fa05ec7fff
2
go.mod
2
go.mod
@ -22,7 +22,7 @@ require (
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2
|
||||
github.com/planetmint/planetmint-go/lib v0.3.0
|
||||
github.com/rddl-network/elements-rpc v0.4.0
|
||||
github.com/rddl-network/elements-rpc v0.5.2
|
||||
github.com/spf13/cast v1.5.0
|
||||
github.com/spf13/cobra v1.6.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
|
4
go.sum
4
go.sum
@ -891,8 +891,8 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rddl-network/elements-rpc v0.4.0 h1:A9I8JnbT7hcThGdcHoRZeBg5zMZp2EjDZOIT8EpHFIE=
|
||||
github.com/rddl-network/elements-rpc v0.4.0/go.mod h1:WOSYDMhq+V74lReSInnSejbdEyGI8hiQZSn4cSoFuxo=
|
||||
github.com/rddl-network/elements-rpc v0.5.2 h1:gHCJEJR72/bi98gSfLCL5GHxAJnWZIrhkUwCpvLA5j0=
|
||||
github.com/rddl-network/elements-rpc v0.5.2/go.mod h1:WOSYDMhq+V74lReSInnSejbdEyGI8hiQZSn4cSoFuxo=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
|
@ -3,6 +3,7 @@ package dao
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
@ -274,9 +275,13 @@ func (s *E2ETestSuite) TestPoPResult() {
|
||||
challenges[i].Finished = true
|
||||
|
||||
msg := daotypes.NewMsgReportPopResult(val.Address.String(), &challenges[i])
|
||||
_, err := lib.BroadcastTxWithFileLock(val.Address, msg)
|
||||
out, err := lib.BroadcastTxWithFileLock(val.Address, msg)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
|
||||
txResponse, err := lib.GetTxResponseFromOut(out)
|
||||
s.Require().NoError(err)
|
||||
assert.Equal(s.T(), "[]", txResponse.RawLog)
|
||||
}
|
||||
|
||||
// check balance for stagedcrddl
|
||||
@ -304,22 +309,30 @@ func (s *E2ETestSuite) TestPoPResult() {
|
||||
assert.Contains(s.T(), out.String(), "29965753420") // 5 * 5993150684 = 29965753420
|
||||
|
||||
// send ReissuanceProposal
|
||||
msg1 := daotypes.NewMsgReissueRDDLProposal(val.Address.String(), aliceAddr.String(),
|
||||
msg1 := daotypes.NewMsgReissueRDDLProposal(val.Address.String(), hex.EncodeToString(val.PubKey.Address()),
|
||||
"reissueasset 7add40beb27df701e02ee85089c5bc0021bc813823fedb5f1dcb5debda7f3da9 2996.57534244",
|
||||
challenges[4].Height, challenges[0].Height, challenges[2].Height)
|
||||
_, err = lib.BroadcastTxWithFileLock(val.Address, msg1)
|
||||
output, err := lib.BroadcastTxWithFileLock(val.Address, msg1)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
|
||||
txResponse, err := lib.GetTxResponseFromOut(output)
|
||||
s.Require().NoError(err)
|
||||
assert.Equal(s.T(), "[]", txResponse.RawLog)
|
||||
|
||||
// send ReissuanceResult
|
||||
msg2 := daotypes.NewMsgReissueRDDLResult(val.Address.String(), aliceAddr.String(), "TxID", challenges[4].Height)
|
||||
_, err = lib.BroadcastTxWithFileLock(val.Address, msg2)
|
||||
output, err = lib.BroadcastTxWithFileLock(val.Address, msg2)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
|
||||
txResponse, err = lib.GetTxResponseFromOut(output)
|
||||
s.Require().NoError(err)
|
||||
assert.Equal(s.T(), "[]", txResponse.RawLog)
|
||||
|
||||
// send DistributionRequest
|
||||
distributionOrder := daotypes.DistributionOrder{
|
||||
Proposer: aliceAddr.String(),
|
||||
Proposer: hex.EncodeToString(val.PubKey.Address()),
|
||||
FirstPop: challenges[0].Height,
|
||||
LastPop: challenges[2].Height,
|
||||
DaoTxID: "DaoTxID",
|
||||
@ -327,16 +340,24 @@ func (s *E2ETestSuite) TestPoPResult() {
|
||||
InvestorTxID: "InvestorTxID",
|
||||
}
|
||||
msg3 := daotypes.NewMsgDistributionRequest(val.Address.String(), &distributionOrder)
|
||||
_, err = lib.BroadcastTxWithFileLock(val.Address, msg3)
|
||||
output, err = lib.BroadcastTxWithFileLock(val.Address, msg3)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
|
||||
txResponse, err = lib.GetTxResponseFromOut(output)
|
||||
s.Require().NoError(err)
|
||||
assert.Equal(s.T(), "[]", txResponse.RawLog)
|
||||
|
||||
// send DistributionResult
|
||||
msg4 := daotypes.NewMsgDistributionResult(val.Address.String(), challenges[2].Height, "DaoTxID", "InvestorTxID", "PoPTxID")
|
||||
_, err = lib.BroadcastTxWithFileLock(val.Address, msg4)
|
||||
output, err = lib.BroadcastTxWithFileLock(val.Address, msg4)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
|
||||
txResponse, err = lib.GetTxResponseFromOut(output)
|
||||
s.Require().NoError(err)
|
||||
assert.Equal(s.T(), "[]", txResponse.RawLog)
|
||||
|
||||
// check balance for crddl
|
||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetCmdQueryTotalSupply(), []string{
|
||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, conf.ClaimDenom),
|
||||
|
@ -34,15 +34,15 @@ func (k msgServer) DistributionRequest(goCtx context.Context, msg *types.MsgDist
|
||||
// issue three distributions:
|
||||
investorTx, err := util.DistributeAsset(msg.Distribution.InvestorAddr, msg.Distribution.InvestorAmount)
|
||||
if err != nil {
|
||||
util.GetAppLogger().Error(ctx, distributionRequestTag+"could not distribute asset to Investors: ", err.Error())
|
||||
util.GetAppLogger().Error(ctx, distributionRequestTag+"could not distribute asset to investors: "+err.Error())
|
||||
}
|
||||
popTx, err := util.DistributeAsset(msg.Distribution.PopAddr, msg.Distribution.PopAmount)
|
||||
if err != nil {
|
||||
util.GetAppLogger().Error(ctx, distributionRequestTag+"could not distribute asset to PoP: ", err.Error())
|
||||
util.GetAppLogger().Error(ctx, distributionRequestTag+"could not distribute asset to PoP: "+err.Error())
|
||||
}
|
||||
daoTx, err := util.DistributeAsset(msg.Distribution.DaoAddr, msg.Distribution.DaoAmount)
|
||||
if err != nil {
|
||||
util.GetAppLogger().Error(ctx, distributionRequestTag+"could not distribute asset to DAO: ", err.Error())
|
||||
util.GetAppLogger().Error(ctx, distributionRequestTag+"could not distribute asset to DAO: "+err.Error())
|
||||
}
|
||||
|
||||
msg.Distribution.InvestorTxID = investorTx
|
||||
|
Loading…
x
Reference in New Issue
Block a user