-
Notifications
You must be signed in to change notification settings - Fork 138
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
Slashing related e2e test improvements #461
Conversation
oldBlockTime := s.consumerCtx().BlockTime() | ||
packetData := types.NewSlashPacketData(validator, valsetUpdateId, stakingtypes.DoubleSign) | ||
// Relay the VSC packet to the consumer | ||
relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new way that we relay the VSC packet from provider to consumer. Note that this method is commonly used elsewhere, and is a more effective test compared to manual packet construction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why relayAllCommittedPackets
is needed for VSC packets and not the Slash packets here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great question, after looking through the slashing file a bit, this method is specific to the relaying and provider handling for slash packets.
There are methods further in the file that test the actual logic around sending downtime and double signing slash packets from a consumer. If we implemented that logic into this test, we'd be able to use relayAllCommittedPackets
. Instead this test just manually sends/relays slash packets.
We could consolidate all those tests into a single tests, but prob out of the scope for this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also updated the comment for TestRelayAndApplySlashPacket
to make this more clear
err = s.path.EndpointA.UpdateClient() | ||
s.Require().NoError(err) | ||
|
||
// reconstruct VSC packet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the old way we sent the VSC packet from provider to consumer
} | ||
|
||
oldBlockTime := s.consumerCtx().BlockTime() | ||
slashFraction := int64(100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was removed in favor of the slashing keeper's value used below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work, the new test is very clear 👍
@@ -830,6 +830,24 @@ func (k Keeper) SetVscSendTimestamp( | |||
store.Set(types.VscSendingTimestampKey(chainID, vscID), timeBz) | |||
} | |||
|
|||
// GetVscSendTimestamp returns a VSC send timestamp by chainID and vscID | |||
// | |||
// Note: This method is used only for testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just a small comment.
oldBlockTime := s.consumerCtx().BlockTime() | ||
packetData := types.NewSlashPacketData(validator, valsetUpdateId, stakingtypes.DoubleSign) | ||
// Relay the VSC packet to the consumer | ||
relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why relayAllCommittedPackets
is needed for VSC packets and not the Slash packets here ?
commit fb83bb7 Author: MSalopek <[email protected]> Date: Tue Nov 15 22:54:06 2022 +0100 add multiple consumer chains in integration tests (#407) commit 33137b3 Author: Shawn Marshall-Spitzbart <[email protected]> Date: Tue Nov 15 12:05:45 2022 -0800 testutils refactors and cleanup (#472) * changes * mas * Update README.md * Update README.md * sorry for the friday night emails * Update instance_test.go * util naming commit 0096317 Author: Daniel T <[email protected]> Date: Tue Nov 15 19:24:40 2022 +0000 Adds Cryptographic Identity utility for working with various keys ect (#470) * Adds crypto.go Cryptographic Identity util * Changes mock to ibcmock Co-authored-by: Daniel <[email protected]> commit b10e132 Author: Shawn Marshall-Spitzbart <[email protected]> Date: Mon Nov 14 16:32:31 2022 -0800 circuit breaker params (#444) * changes * Update params.go commit df53566 Author: Shawn Marshall-Spitzbart <[email protected]> Date: Mon Nov 14 16:11:22 2022 -0800 Slashing related e2e test improvements (#461)
Squashed commit of the following: commit fb83bb7 Author: MSalopek <[email protected]> Date: Tue Nov 15 22:54:06 2022 +0100 add multiple consumer chains in integration tests (#407) commit 33137b3 Author: Shawn Marshall-Spitzbart <[email protected]> Date: Tue Nov 15 12:05:45 2022 -0800 testutils refactors and cleanup (#472) * changes * mas * Update README.md * Update README.md * sorry for the friday night emails * Update instance_test.go * util naming commit 0096317 Author: Daniel T <[email protected]> Date: Tue Nov 15 19:24:40 2022 +0000 Adds Cryptographic Identity utility for working with various keys ect (#470) * Adds crypto.go Cryptographic Identity util * Changes mock to ibcmock Co-authored-by: Daniel <[email protected]> commit b10e132 Author: Shawn Marshall-Spitzbart <[email protected]> Date: Mon Nov 14 16:32:31 2022 -0800 circuit breaker params (#444) * changes * Update params.go commit df53566 Author: Shawn Marshall-Spitzbart <[email protected]> Date: Mon Nov 14 16:11:22 2022 -0800 Slashing related e2e test improvements (#461) Co-authored-by: Daniel <[email protected]>
Improves a couple slashing related e2e tests by:
providerSlashingKeeper.SlashFractionDowntime
instead of hardcoding an expected slash fractionThe second point here is needed to properly tie #462 into existing e2e tests, the hack was faultily making e2e tests fail.