Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: MBT: Add slashing to model #1640

Merged
merged 40 commits into from
Mar 26, 2024
Merged

test: MBT: Add slashing to model #1640

merged 40 commits into from
Mar 26, 2024

Conversation

p-offtermatt
Copy link
Contributor

@p-offtermatt p-offtermatt commented Feb 12, 2024

Description

Closes: #1531


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • Included the correct type prefix in the PR title
  • Targeted the correct branch (see PR Targeting)
  • Provided a link to the relevant issue or specification
  • Reviewed "Files changed" and left comments if necessary
  • Confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • Confirmed the correct type prefix in the PR title
  • Confirmed all author checklist items have been addressed
  • Confirmed that this PR does not change production code

@github-actions github-actions bot added the C:Testing Assigned automatically by the PR labeler label Feb 12, 2024
Err("not implemented")
}

pure def recvVscMaturedPacketOnProvider(currentState: ProtocolState, sender: Chain, packet: VscMaturedPacket): Result = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved from ccv_utils because the "sibling function" recvSlashPacketOnProvider needs to access a parameter from the module

go run ./... -modelPath=../model/ccv_sync.qnt -init initSync -step stepSync -traceFolder traces/sync_noinv -numTraces 2 -numSteps 30 -numSamples 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decreased numSteps here, since the traces were too large to open/work with. In turn, I increased the numTraces to 2, so it should still give some coverage but be easier to debug

@@ -3,11 +3,11 @@
echo "Generating bounded drift traces with timeouts"
go run ./... -modelPath=../model/ccv_boundeddrift.qnt -step stepBoundedDrift -invariant CanTimeoutConsumer -traceFolder traces/bound_timeout -numTraces 20 -numSteps 200 -numSamples 200
echo "Generating long bounded drift traces without invariants"
go run ./... -modelPath=../model/ccv_boundeddrift.qnt -step stepBoundedDrift -traceFolder traces/bound_noinv -numTraces 20 -numSteps 500 -numSamples 1
go run ./... -modelPath=../model/ccv_boundeddrift.qnt -step stepBoundedDrift -traceFolder traces/bound_noinv -numTraces 20 -numSteps 300 -numSamples 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar reasoning, traces were just too large to work with

@p-offtermatt p-offtermatt marked this pull request as ready for review March 8, 2024 12:57
@p-offtermatt p-offtermatt requested a review from a team as a code owner March 8, 2024 12:57
@@ -17,7 +26,7 @@ func CreateValidators(n int) (
signersByAddress = make(map[string]tmtypes.PrivValidator, n)
)
for i := 0; i < n; i++ {
privVal := mock.NewPV()
privVal := mock.PV{PrivKey: ed25519.GenPrivKeyFromSecret([]byte(chainId + fmt.Sprint(i)))}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to make this deterministic. This caused some other unrelated files to need to change.

pure val provValPower = if (provValSet.keys().contains(providerNode)) provValSet.get(providerNode) else 0
pure val consumersWithAddrAssignmentChangesInThisBlock =
if (provValPower > 0) {
// if the consumer has positive power, the relevant key assignment for the consumer changed
if (provValPower > 0 and providerNode.in(nonJailedNodes(currentState.providerState))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we set the voting power of jailed validators to 0?

Copy link
Contributor Author

@p-offtermatt p-offtermatt Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this makes unjailing operations hard, which we might want to add later, i.e. how would we know which power to restore the unjailed validator to? I filter the jailed validators out when the valset is entered on-chain during EndBlock

tests/mbt/model/ccv.qnt Outdated Show resolved Hide resolved
tests/mbt/model/ccv.qnt Outdated Show resolved Hide resolved
tests/mbt/driver/model_viewer.go Dismissed Show dismissed Hide dismissed
tests/mbt/model/ccv.qnt Outdated Show resolved Hide resolved
tests/mbt/model/ccv.qnt Outdated Show resolved Hide resolved
@sainoe sainoe self-requested a review March 18, 2024 14:21
Copy link
Contributor

@sainoe sainoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Co-authored-by: Simon Noetzlin <[email protected]>
Copy link
Contributor

@mpoke mpoke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Great work @p-offtermatt

tests/mbt/driver/core.go Show resolved Hide resolved
outstandingPacketsToConsumer: Chain -> List[Packet],

// Stores the packets that the provider will send an ack for when it ends the current block.
acksToSendOnEndBlock: Chain -> List[Packet],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these sent on EndBlock? In the code SlashPackets are handled immediatelly.

Copy link
Contributor Author

@p-offtermatt p-offtermatt Mar 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code might send the acks immediately, but recall that they go through IBC, which will not process the acks before they are committed (i.e. the block is ended)

tests/mbt/model/ccv.qnt Outdated Show resolved Hide resolved
@p-offtermatt p-offtermatt enabled auto-merge March 26, 2024 12:01
@p-offtermatt p-offtermatt added this pull request to the merge queue Mar 26, 2024
Merged via the queue into main with commit 920d9d0 Mar 26, 2024
18 checks passed
@p-offtermatt p-offtermatt deleted the ph/mbt-slashing-new branch March 26, 2024 12:21
@p-offtermatt p-offtermatt restored the ph/mbt-slashing-new branch March 28, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Testing Assigned automatically by the PR labeler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MBT: Add slashing
3 participants