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

disable consumer initiated slashing + fix slash acks bug #692

Merged
merged 29 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c1bf2a3
disable consumer initiating slashing; also jailing for double-signing…
mpoke Jan 31, 2023
ca336b6
Merge remote-tracking branch 'upstream/main' into 689-disable-slashing
sainoe Feb 1, 2023
5a94d33
fix diff testing
sainoe Feb 1, 2023
3362d26
fix TestHandleSlashPacket
shaspitz Feb 1, 2023
c96b752
fix relay tests
shaspitz Feb 1, 2023
51289c4
Merge branch 'main' into 689-disable-slashing
shaspitz Feb 2, 2023
69086f8
set jailUntil again
shaspitz Feb 2, 2023
7e38dbe
rm TestSlashUndelegation
shaspitz Feb 2, 2023
7b93387
rm unused func
shaspitz Feb 2, 2023
cc08a1b
change e2e test to check downtime
shaspitz Feb 2, 2023
550e05d
comments
shaspitz Feb 2, 2023
73cfd6f
split out TestRelayAndApplySlashPacket
shaspitz Feb 2, 2023
23a93ab
final fix in slashing.go
shaspitz Feb 2, 2023
186774d
fix TestHandleSlashPacket
shaspitz Feb 2, 2023
16d17a4
expectJailing bool
shaspitz Feb 2, 2023
3ce6cba
fix throttle e2e tests
shaspitz Feb 2, 2023
0e280f0
Merge branch 'main' into 689-disable-slashing
shaspitz Feb 2, 2023
ec89a19
doc diff test
sainoe Feb 3, 2023
b78c4a1
fix diff-test slashing
sainoe Feb 3, 2023
7bb66d6
upstream new traces
sainoe Feb 3, 2023
be8da31
update integration tests with new consumer initiated slash behaviour …
MSalopek Feb 3, 2023
045015a
Update tests/difference/core/model/src/model.ts
sainoe Feb 3, 2023
3ed0fa3
Update tests/difference/core/model/src/model.ts
sainoe Feb 3, 2023
a9f9770
merge
shaspitz Feb 3, 2023
238a69f
rm comment
shaspitz Feb 3, 2023
3429939
fix bug in diff-test model
sainoe Feb 6, 2023
73fc228
Fix slash acks bug (#708)
shaspitz Feb 6, 2023
4261dcd
fix comment strings in integration tests
MSalopek Feb 6, 2023
975cf36
Merge branch 'main' into 689-disable-slashing
jtremback Feb 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/difference/core/driver/traces.json

Large diffs are not rendered by default.

32 changes: 14 additions & 18 deletions tests/difference/core/model/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,13 @@ class CCVProvider {
};

onReceive = (data: PacketData) => {

// Drop slash packets for double-sign infraction
if ('isDowntime' in data && ! data.isDowntime) {
shaspitz marked this conversation as resolved.
Show resolved Hide resolved
this.m.events.push(Event.RECEIVE_DOWNTIME_SLASH_REQUEST);
return;
}

/*
TODO: tidy up before merging to main
This is some quick prototyping to get the tests passing
Expand Down Expand Up @@ -458,36 +465,25 @@ class CCVProvider {
};

onReceiveSlash = (data: Slash) => {
let infractionHeight = undefined;

if (data.vscID === 0) {
infractionHeight = this.initialHeight;
} else {
infractionHeight = this.vscIDtoH[data.vscID];
}

// Check validator status
if (this.m.staking.status[data.val] === Status.UNBONDED) {
this.m.events.push(Event.RECEIVE_SLASH_REQUEST_UNBONDED);
return;
}

if (data.isDowntime) {
this.m.events.push(Event.RECEIVE_DOWNTIME_SLASH_REQUEST);
} else {
this.m.events.push(Event.RECEIVE_DOUBLE_SIGN_SLASH_REQUEST);
}
this.m.events.push(Event.RECEIVE_DOWNTIME_SLASH_REQUEST);
shaspitz marked this conversation as resolved.
Show resolved Hide resolved


if (this.tombstoned[data.val]) {
return;
}

this.m.staking.slash(data.val, infractionHeight);
// jail validator
this.m.staking.jailUntil(data.val, this.m.t[P] + JAIL_SECONDS);
if (data.isDowntime) {
this.downtimeSlashAcks.push(data.val);
} else {
this.tombstoned[data.val] = true;
}
// update slash acks
this.downtimeSlashAcks.push(data.val);

};

afterUnbondingInitiated = (opID: number) => {
Expand Down
35 changes: 0 additions & 35 deletions tests/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,38 +611,3 @@ func (s *CCVTestSuite) setupValidatorPowers() {
}
s.Require().Equal(int64(4000), stakingKeeper.GetLastTotalPower(s.providerCtx()).Int64())
}

// getHeightOfVSCPacketRecv returns the height of when the consumer received a VSCPacket.
// If expectedMaturityTimesLen > 0, then it's expected to find expectedMaturityTimesLen
// maturity times (i.e., VSCPakcets not yet matured). The vscID of the VSCPacket is retrieved
// from the maturity time with maturityTimesIndex.
func (s *CCVTestSuite) getHeightOfVSCPacketRecv(
bundle icstestingutils.ConsumerBundle,
expectedMaturityTimesLen int,
maturityTimesIndex int,
msgAndArgs ...interface{},
) (height uint64) {
maturityTimes := bundle.GetKeeper().GetAllPacketMaturityTimes(bundle.GetCtx())
if expectedMaturityTimesLen > 0 {
s.Require().Len(
maturityTimes,
expectedMaturityTimesLen,
fmt.Sprintf("unexpected number of maturity times; %s", msgAndArgs...),
)
}
vscID := maturityTimes[maturityTimesIndex].VscId
hToVSCids := bundle.GetKeeper().GetAllHeightToValsetUpdateIDs(bundle.GetCtx())
found := false
for _, hToVSCid := range hToVSCids {
if hToVSCid.ValsetUpdateId == vscID {
height = hToVSCid.Height
found = true
break
}
}
s.Require().True(
found,
fmt.Sprintf("cannot find height mapped to vscID; %s", msgAndArgs...),
)
return
}
Loading