mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 14:35:47 +00:00
fix: merge conflicts
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
commit
b107758731
@ -213,6 +213,14 @@ func (s *SelectionE2ETestSuite) VerifyTokens(token string) {
|
|||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
assert.Contains(s.T(), out.String(), token)
|
assert.Contains(s.T(), out.String(), token)
|
||||||
assert.Equal(s.T(), "amount: \"11986301368\"\ndenom: "+token+"\n", out.String()) // 2 * 5993150684 = 11986301368
|
assert.Equal(s.T(), "amount: \"11986301368\"\ndenom: "+token+"\n", out.String()) // 2 * 5993150684 = 11986301368
|
||||||
|
|
||||||
|
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
||||||
|
val.Address.String(),
|
||||||
|
fmt.Sprintf(s.errormsg, bank.FlagDenom, token),
|
||||||
|
})
|
||||||
|
s.Require().NoError(err)
|
||||||
|
assert.Contains(s.T(), out.String(), token)
|
||||||
|
assert.Equal(s.T(), "amount: \"300000000\"\ndenom: "+token+"\n", out.String()) // 3 * 300000000
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SelectionE2ETestSuite) TestTokenDistribution1() {
|
func (s *SelectionE2ETestSuite) TestTokenDistribution1() {
|
||||||
|
|||||||
@ -87,9 +87,9 @@ func SendLiquidAssetRegistration(goCtx context.Context, notarizedAsset machinety
|
|||||||
buildSignBroadcastTx(goCtx, loggingContext, sendingValidatorAddress, msg)
|
buildSignBroadcastTx(goCtx, loggingContext, sendingValidatorAddress, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendInitPoP(goCtx context.Context, proposer string, challenger string, challengee string, blockHeight int64) {
|
func SendInitPoP(goCtx context.Context, challenger string, challengee string, blockHeight int64) {
|
||||||
sendingValidatorAddress := config.GetConfig().GetValidatorAddress()
|
sendingValidatorAddress := config.GetConfig().GetValidatorAddress()
|
||||||
msg := daotypes.NewMsgInitPop(sendingValidatorAddress, proposer, challenger, challengee, blockHeight)
|
msg := daotypes.NewMsgInitPop(sendingValidatorAddress, sendingValidatorAddress, challenger, challengee, blockHeight)
|
||||||
loggingContext := "PoP"
|
loggingContext := "PoP"
|
||||||
buildSignBroadcastTx(goCtx, loggingContext, sendingValidatorAddress, msg)
|
buildSignBroadcastTx(goCtx, loggingContext, sendingValidatorAddress, msg)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper)
|
|||||||
|
|
||||||
// Init PoP - independent from challenger and challengee
|
// Init PoP - independent from challenger and challengee
|
||||||
// The keeper will send the MQTT initializing message to challenger && challengee
|
// The keeper will send the MQTT initializing message to challenger && challengee
|
||||||
util.SendInitPoP(ctx, hexProposerAddress, challenger, challengee, currentBlockHeight)
|
util.SendInitPoP(ctx, challenger, challengee, currentBlockHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
if isReissuanceHeight(ctx, k, currentBlockHeight) {
|
if isReissuanceHeight(ctx, k, currentBlockHeight) {
|
||||||
|
|||||||
@ -56,7 +56,7 @@ func (k msgServer) resolveStagedClaims(ctx sdk.Context, start int64, end int64)
|
|||||||
if challenge.GetSuccess() {
|
if challenge.GetSuccess() {
|
||||||
popParticipants[challenge.Challengee] += challengeeAmt
|
popParticipants[challenge.Challengee] += challengeeAmt
|
||||||
}
|
}
|
||||||
initiatorAddr, err := sdk.AccAddressFromHexUnsafe(challenge.Initiator)
|
initiatorAddr, err := sdk.AccAddressFromBech32(challenge.Initiator)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.GetAppLogger().Error(ctx, "error converting initiator address")
|
util.GetAppLogger().Error(ctx, "error converting initiator address")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ func (k msgServer) ReportPopResult(goCtx context.Context, msg *types.MsgReportPo
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = sdk.AccAddressFromHexUnsafe(msg.Challenge.GetInitiator())
|
_, err = sdk.AccAddressFromBech32(msg.Challenge.GetInitiator())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.GetAppLogger().Error(ctx, "error converting initiator address")
|
util.GetAppLogger().Error(ctx, "error converting initiator address")
|
||||||
return nil, errorsmod.Wrap(types.ErrInvalidPoPInitiator, "PoP initiator not hex encoded")
|
return nil, errorsmod.Wrap(types.ErrInvalidPoPInitiator, "PoP initiator not hex encoded")
|
||||||
@ -102,7 +102,7 @@ func (k msgServer) handlePoP(ctx sdk.Context, challenge types.Challenge) (err er
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
initiatorAddr, _ := sdk.AccAddressFromHexUnsafe(challenge.Initiator)
|
initiatorAddr, _ := sdk.AccAddressFromBech32(challenge.Initiator)
|
||||||
err = k.sendRewards(ctx, initiatorAddr.String(), k.GetValidatorPoPReward(ctx))
|
err = k.sendRewards(ctx, initiatorAddr.String(), k.GetValidatorPoPReward(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package keeper_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -29,8 +28,7 @@ func TestMsgServer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMsgServerReportPoPResult(t *testing.T) {
|
func TestMsgServerReportPoPResult(t *testing.T) {
|
||||||
initiator := sample.Secp256k1AccAddress()
|
initiator := sample.Secp256k1AccAddress().String()
|
||||||
initiatorHex := hex.EncodeToString(initiator.Bytes())
|
|
||||||
challenger := sample.Secp256k1AccAddress()
|
challenger := sample.Secp256k1AccAddress()
|
||||||
challengee := sample.Secp256k1AccAddress()
|
challengee := sample.Secp256k1AccAddress()
|
||||||
errInvalidPopData := "Invalid pop data"
|
errInvalidPopData := "Invalid pop data"
|
||||||
@ -45,7 +43,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
types.MsgReportPopResult{
|
types.MsgReportPopResult{
|
||||||
Creator: challenger.String(),
|
Creator: challenger.String(),
|
||||||
Challenge: &types.Challenge{
|
Challenge: &types.Challenge{
|
||||||
Initiator: initiatorHex,
|
Initiator: initiator,
|
||||||
Challenger: challenger.String(),
|
Challenger: challenger.String(),
|
||||||
Challengee: challengee.String(),
|
Challengee: challengee.String(),
|
||||||
Height: 1,
|
Height: 1,
|
||||||
@ -60,7 +58,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
types.MsgReportPopResult{
|
types.MsgReportPopResult{
|
||||||
Creator: challenger.String(),
|
Creator: challenger.String(),
|
||||||
Challenge: &types.Challenge{
|
Challenge: &types.Challenge{
|
||||||
Initiator: initiatorHex,
|
Initiator: initiator,
|
||||||
Challenger: challenger.String(),
|
Challenger: challenger.String(),
|
||||||
Challengee: challengee.String(),
|
Challengee: challengee.String(),
|
||||||
Height: 2,
|
Height: 2,
|
||||||
@ -88,7 +86,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
types.MsgReportPopResult{
|
types.MsgReportPopResult{
|
||||||
Creator: challenger.String(),
|
Creator: challenger.String(),
|
||||||
Challenge: &types.Challenge{
|
Challenge: &types.Challenge{
|
||||||
Initiator: initiatorHex,
|
Initiator: initiator,
|
||||||
Challenger: challenger.String(),
|
Challenger: challenger.String(),
|
||||||
Challengee: challengee.String(),
|
Challengee: challengee.String(),
|
||||||
Height: 4,
|
Height: 4,
|
||||||
@ -103,7 +101,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
types.MsgReportPopResult{
|
types.MsgReportPopResult{
|
||||||
Creator: challenger.String(),
|
Creator: challenger.String(),
|
||||||
Challenge: &types.Challenge{
|
Challenge: &types.Challenge{
|
||||||
Initiator: initiatorHex,
|
Initiator: initiator,
|
||||||
Challenger: challenger.String(),
|
Challenger: challenger.String(),
|
||||||
Challengee: challengee.String(),
|
Challengee: challengee.String(),
|
||||||
Height: 5,
|
Height: 5,
|
||||||
@ -118,7 +116,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
types.MsgReportPopResult{
|
types.MsgReportPopResult{
|
||||||
Creator: challenger.String(),
|
Creator: challenger.String(),
|
||||||
Challenge: &types.Challenge{
|
Challenge: &types.Challenge{
|
||||||
Initiator: initiatorHex,
|
Initiator: initiator,
|
||||||
Challenger: challenger.String(),
|
Challenger: challenger.String(),
|
||||||
Challengee: challengee.String(),
|
Challengee: challengee.String(),
|
||||||
Height: 6,
|
Height: 6,
|
||||||
@ -128,30 +126,15 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"PoP report data does not match challenge: invalid challenge",
|
"PoP report data does not match challenge: invalid challenge",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Initiator not hex encoded",
|
|
||||||
types.MsgReportPopResult{
|
|
||||||
Creator: challenger.String(),
|
|
||||||
Challenge: &types.Challenge{
|
|
||||||
Initiator: initiator.String(),
|
|
||||||
Challenger: challenger.String(),
|
|
||||||
Challengee: challengee.String(),
|
|
||||||
Height: 7,
|
|
||||||
Success: true,
|
|
||||||
Finished: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"PoP initiator not hex encoded: invalid PoP initiator",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Non-Existing PoP",
|
"Non-Existing PoP",
|
||||||
types.MsgReportPopResult{
|
types.MsgReportPopResult{
|
||||||
Creator: challenger.String(),
|
Creator: challenger.String(),
|
||||||
Challenge: &types.Challenge{
|
Challenge: &types.Challenge{
|
||||||
Initiator: initiatorHex,
|
Initiator: initiator,
|
||||||
Challenger: challenger.String(),
|
Challenger: challenger.String(),
|
||||||
Challengee: challengee.String(),
|
Challengee: challengee.String(),
|
||||||
Height: 8,
|
Height: 7,
|
||||||
Success: true,
|
Success: true,
|
||||||
Finished: true,
|
Finished: true,
|
||||||
},
|
},
|
||||||
@ -171,7 +154,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
// adjust challenge 4 to satisfy the test case
|
// adjust challenge 4 to satisfy the test case
|
||||||
testCases[3].msg.Challenge.Challengee = testCases[3].msg.Challenge.Challenger
|
testCases[3].msg.Challenge.Challengee = testCases[3].msg.Challenge.Challenger
|
||||||
testCases[4].msg.Challenge.Challenger = testCases[4].msg.Challenge.Challengee
|
testCases[4].msg.Challenge.Challenger = testCases[4].msg.Challenge.Challengee
|
||||||
testCases[5].msg.Challenge.Initiator = hex.EncodeToString(challenger.Bytes())
|
testCases[5].msg.Challenge.Initiator = challenger.String()
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
tc := tc
|
tc := tc
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user