Skip to content

Commit

Permalink
feat!: PSS enable per-consumer chain commission (#1657)
Browse files Browse the repository at this point in the history
* add draft commission

* implement consumer commission draft

* formatting

* add msg handling

* improve UT

* nits

* Update x/ccv/provider/keeper/keeper.go

Co-authored-by: insumity <karolos@informal.systems>

* Update proto/interchain_security/ccv/provider/v1/tx.proto

Co-authored-by: Marius Poke <marius.poke@posteo.de>

* optimize keys

* Update x/ccv/provider/keeper/keeper.go

Co-authored-by: insumity <karolos@informal.systems>

* address comments

* address comments

* remove unnecessary check

* Revert "remove unnecessary check"

This reverts commit 2951e9b.

* fix minor bug in StopConsumerChain

---------

Co-authored-by: insumity <karolos@informal.systems>
Co-authored-by: Marius Poke <marius.poke@posteo.de>
  • Loading branch information
3 people committed Mar 12, 2024
1 parent 7497fc0 commit c689111
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 181 deletions.
2 changes: 1 addition & 1 deletion proto/interchain_security/ccv/provider/v1/provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,4 @@ message OptedInValidator {
int64 power = 3;
// public key used by the validator on the consumer
bytes public_key = 4;
}
}
2 changes: 0 additions & 2 deletions tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1533,11 +1533,9 @@ func (tr TestConfig) delegateTokens(
}

cmd := target.ExecCommand(tr.chainConfigs[action.Chain].BinaryName,

"tx", "staking", "delegate",
validatorAddress,
fmt.Sprint(action.Amount)+`stake`,

`--from`, `validator`+fmt.Sprint(action.From),
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, action.From),
Expand Down
4 changes: 0 additions & 4 deletions tests/mbt/model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,4 @@ The available sanity checks are:
- CanOptIn (only with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`)
- CanOptOut (only with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`)
- CanFailOptOut (only with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`)
<<<<<<< HEAD
- CanHaveOptIn (only with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`)
=======
- CanHaveOptIn (only with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`)
>>>>>>> 6e075652 (test: MBT: Add partial set security to model (feature branch version) (#1627))
5 changes: 5 additions & 0 deletions tests/mbt/model/ccv_boundeddrift.qnt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ module ccv_boundeddrift {
StepOptOut,
}

action stepBoundedDriftKeyAssignment = any {
stepBoundedDrift,
nondetKeyAssignment,
}

// INVARIANT
// The maxDrift between chains is never exceeded.
// This *should* be ensured by the step function.
Expand Down
42 changes: 0 additions & 42 deletions tests/mbt/model/run_invariants.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,6 @@
#!/bin/bash

<<<<<<< HEAD
# to stop on any errors
set -e

quint test ccv_model.qnt
quint test ccv_test.qnt
quint run --invariant "all{ValidatorUpdatesArePropagatedInv,ValidatorSetHasExistedInv,SameVscPacketsInv,MatureOnTimeInv,EventuallyMatureOnProviderInv}" ccv_model.qnt --max-steps 200 --max-samples 200
quint run --invariant "all{ValidatorUpdatesArePropagatedKeyAssignmentInv,ValidatorSetHasExistedKeyAssignmentInv,SameVscPacketsKeyAssignmentInv,MatureOnTimeInv,EventuallyMatureOnProviderInv,KeyAssignmentRulesInv}" ccv_model.qnt --step stepKeyAssignment --max-steps 200 --max-samples 200


# do not stop on errors anymore, so we can give better output if we error
set +e

run_invariant() {
local invariant=$1
local step=$2
local match=$3

if [[ -z "$step" ]]; then
quint run --invariant $invariant ccv_model.qnt | grep -q $match
else
quint run --invariant $invariant --step $step ccv_model.qnt | grep -q $match
fi

if [[ $? -eq 0 ]]; then
echo "sanity check $invariant ok"
else
echo "sanity check $invariant not ok"
exit 1
fi
}

run_invariant "CanRunConsumer" "" '[violation]'
run_invariant "CanStopConsumer" "" '[violation]'
run_invariant "CanTimeoutConsumer" "" '[violation]'
run_invariant "CanSendVscPackets" "" '[violation]'
run_invariant "CanSendVscMaturedPackets" "" '[violation]'
run_invariant "CanAssignConsumerKey" "stepKeyAssignment" '[violation]'
run_invariant "CanHaveConsumerAddresses" "stepKeyAssignment" '[violation]'
run_invariant "CanReceiveMaturations" "stepKeyAssignment" '[violation]'
=======
quint test ccv_model.qnt
quint test ccv_test.qnt
quint run --invariant "all{ValidatorUpdatesArePropagatedInv,ValidatorSetHasExistedInv,SameVscPacketsInv,MatureOnTimeInv,EventuallyMatureOnProviderInv}" ccv_model.qnt --max-steps 200 --max-samples 200
quint run --invariant "all{ValidatorUpdatesArePropagatedKeyAssignmentInv,ValidatorSetHasExistedKeyAssignmentInv,SameVscPacketsKeyAssignmentInv,MatureOnTimeInv,EventuallyMatureOnProviderInv,KeyAssignmentRulesInv}" ccv_model.qnt --step stepKeyAssignment --max-steps 200 --max-samples 200
>>>>>>> 6e075652 (test: MBT: Add partial set security to model (feature branch version) (#1627))
128 changes: 0 additions & 128 deletions testutil/keeper/mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions x/ccv/provider/keeper/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,6 @@ func TestStopConsumerChain(t *testing.T) {
require.Error(t, err)
} else {
require.NoError(t, err)

// in case the chain was successfully stopped, it should not contain a Top N associated to it
_, found := providerKeeper.GetTopN(ctx, "chainID")
require.False(t, found)
}

testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, "chainID", "channelID")
Expand Down

0 comments on commit c689111

Please sign in to comment.