Skip to content

Commit

Permalink
tests: rm EquivocationProposal from e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed Oct 13, 2023
1 parent c71521c commit e20b2c1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 255 deletions.
72 changes: 0 additions & 72 deletions tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
"github.com/tidwall/gjson"

evidencetypes "cosmossdk.io/x/evidence/types"

"github.com/cosmos/interchain-security/v3/x/ccv/provider/client"
"github.com/cosmos/interchain-security/v3/x/ccv/provider/types"
ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types"
Expand Down Expand Up @@ -428,76 +426,6 @@ func (tr TestRun) submitParamChangeProposal(
tr.waitBlocks(action.chain, 2, 60*time.Second)
}

type submitEquivocationProposalAction struct {
chain chainID
height int64
time time.Time
power int64
validator validatorID
deposit uint
from validatorID
}

func (tr TestRun) submitEquivocationProposal(action submitEquivocationProposalAction, verbose bool) {
val := tr.validatorConfigs[action.validator]
providerChain := tr.chainConfigs[chainID("provi")]

prop := client.EquivocationProposalJSON{
Summary: "Validator equivocation!",
EquivocationProposal: types.EquivocationProposal{
Title: "Validator equivocation!",
Description: fmt.Sprintf("Validator: %s has committed an equivocation infraction on chainID: %s", action.validator, action.chain),
Equivocations: []*evidencetypes.Equivocation{
{
Height: action.height,
Time: action.time,
Power: action.power,
ConsensusAddress: val.valconsAddress,
},
},
},
Deposit: fmt.Sprint(action.deposit) + `stake`,
}

bz, err := json.Marshal(prop)
if err != nil {
log.Fatal(err)
}

jsonStr := string(bz)
if strings.Contains(jsonStr, "'") {
log.Fatal("prop json contains single quote")
}

//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments.
bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName,
"/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/equivocation-proposal.json")).CombinedOutput()

if err != nil {
log.Fatal(err, "\n", string(bz))
}

//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments.
// EQUIVOCATION PROPOSAL
bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, providerChain.binaryName,
"tx", "gov", "submit-legacy-proposal", "equivocation", "/equivocation-proposal.json",
`--from`, `validator`+fmt.Sprint(action.from),
`--chain-id`, string(providerChain.chainId),
`--home`, tr.getValidatorHome(providerChain.chainId, action.from),
`--node`, tr.getValidatorNode(providerChain.chainId, action.from),
`--gas`, "9000000",
`--keyring-backend`, `test`,
`-y`,
).CombinedOutput()

if err != nil {
log.Fatal(err, "\n", string(bz))
}

// wait for inclusion in a block -> '--broadcast-mode block' is deprecated
tr.waitBlocks(chainID("provi"), 2, 30*time.Second)
}

type voteGovProposalAction struct {
chain chainID
from []validatorID
Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ func (tr *TestRun) runStep(step Step, verbose bool) {
tr.submitConsumerAdditionProposal(action, verbose)
case submitConsumerRemovalProposalAction:
tr.submitConsumerRemovalProposal(action, verbose)
case submitEquivocationProposalAction:
tr.submitEquivocationProposal(action, verbose)
case submitParamChangeLegacyProposalAction:
tr.submitParamChangeProposal(action, verbose)
case voteGovProposalAction:
Expand Down
19 changes: 0 additions & 19 deletions tests/e2e/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,6 @@ type ConsumerRemovalProposal struct {

func (p ConsumerRemovalProposal) isProposal() {}

type EquivocationProposal struct {
Height uint
Power uint
ConsensusAddress string
Deposit uint
Status string
}

func (p EquivocationProposal) isProposal() {}

type Rewards struct {
IsRewarded map[validatorID]bool
// if true it will calculate if the validator/delegator is rewarded between 2 successive blocks,
Expand Down Expand Up @@ -460,15 +450,6 @@ func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal {
StopTime: int(stopTime.Milliseconds()),
}

case "/interchain_security.ccv.provider.v1.EquivocationProposal":
return EquivocationProposal{
Deposit: uint(deposit),
Status: status,
Height: uint(gjson.Get(string(bz), `messages.0.content.equivocations.0.height`).Uint()),
Power: uint(gjson.Get(string(bz), `messages.0.content.equivocations.0.power`).Uint()),
ConsensusAddress: gjson.Get(string(bz), `messages.0.content.equivocations.0.consensus_address`).String(),
}

case "/cosmos.params.v1beta1.ParameterChangeProposal":
return ParamsProposal{
Deposit: uint(deposit),
Expand Down
18 changes: 6 additions & 12 deletions tests/e2e/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ var happyPathSteps = concatSteps(
stepsDowntimeWithOptOut("consu"),
stepsRedelegate("consu"),
stepsDowntime("consu"),
stepsRejectEquivocationProposal("consu", 2), // prop to tombstone bob is rejected
stepsDoubleSignOnProviderAndConsumer("consu"), // carol double signs on provider, bob double signs on consumer
stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted
stepsStartRelayer(),
stepsConsumerRemovalPropNotPassing("consu", 3), // submit removal prop but vote no on it - chain should stay
stepsStopChain("consu", 4), // stop chain
stepsConsumerRemovalPropNotPassing("consu", 2), // submit removal prop but vote no on it - chain should stay
stepsStopChain("consu", 3), // stop chain
)

var shortHappyPathSteps = concatSteps(
Expand All @@ -37,12 +35,10 @@ var shortHappyPathSteps = concatSteps(
stepsUnbond("consu"),
stepsRedelegateShort("consu"),
stepsDowntime("consu"),
stepsRejectEquivocationProposal("consu", 2), // prop to tombstone bob is rejected
stepsDoubleSignOnProviderAndConsumer("consu"), // carol double signs on provider, bob double signs on consumer
stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted
stepsStartRelayer(),
stepsConsumerRemovalPropNotPassing("consu", 3), // submit removal prop but vote no on it - chain should stay
stepsStopChain("consu", 4), // stop chain
stepsConsumerRemovalPropNotPassing("consu", 2), // submit removal prop but vote no on it - chain should stay
stepsStopChain("consu", 3), // stop chain
)

var lightClientAttackSteps = concatSteps(
Expand All @@ -51,12 +47,10 @@ var lightClientAttackSteps = concatSteps(
stepsUnbond("consu"),
stepsRedelegateShort("consu"),
stepsDowntime("consu"),
stepsRejectEquivocationProposal("consu", 2), // prop to tombstone bob is rejected
stepsLightClientAttackOnProviderAndConsumer("consu"), // carol double signs on provider, bob double signs on consumer
stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted
stepsStartRelayer(),
stepsConsumerRemovalPropNotPassing("consu", 3), // submit removal prop but vote no on it - chain should stay
stepsStopChain("consu", 4), // stop chain
stepsConsumerRemovalPropNotPassing("consu", 2), // submit removal prop but vote no on it - chain should stay
stepsStopChain("consu", 3), // stop chain
)

var slashThrottleSteps = concatSteps(
Expand Down
150 changes: 0 additions & 150 deletions tests/e2e/steps_submit_equivocation_proposal.go

This file was deleted.

0 comments on commit e20b2c1

Please sign in to comment.