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

feat: update the slashing and evidence modules to work with ICS #15908

Merged
merged 12 commits into from
Apr 25, 2023
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 2023/04/21 13:41:27 TestKeyCodec [rapid] draw key: testutil.TestKeyCodec{KeySpecs:[]testutil.TestFieldSpec{testutil.TestFieldSpec{FieldName:"dur", Gen:(*rapid.Generator[interface {}])(0x140002218c0)}}, Codec:(*ormkv.KeyCodec)(0x14001322480)}
# 2023/04/21 13:41:27 TestKeyCodec [rapid] draw values[0]: &impl.messageState{NoUnkeyedLiterals:pragma.NoUnkeyedLiterals{}, DoNotCompare:pragma.DoNotCompare{}, DoNotCopy:pragma.DoNotCopy{}, atomicMessageInfo:(*impl.MessageInfo)(0x14000154840)}
# 2023/04/21 13:41:27 TestKeyCodec [rapid] draw values2[0]: &impl.messageState{NoUnkeyedLiterals:pragma.NoUnkeyedLiterals{}, DoNotCompare:pragma.DoNotCompare{}, DoNotCopy:pragma.DoNotCopy{}, atomicMessageInfo:(*impl.MessageInfo)(0x14000154840)}
# 2023/04/21 13:41:27 TestKeyCodec assertion failed: 1 (int) != -1 (int)
#
v0.4.8#6224298232862242562
0x9249249249249
0x0
0x9867f1f40f739
0xe
0x0
0x0
0x0
0x10000000000000
0x0
0x0
0x0
0x0
0x0
0x10000000000000
0x0
0x1
0x0
0x0
0x0
0x10000000000000
0x0
0x0
0x0
0x0
0x0
0x0
0x10000000000000
0x0
0x1
0x0
0x0
0x1
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 2023/04/21 13:41:29 TestUniqueKeyCodec [rapid] draw keyCodec: testutil.TestKeyCodec{KeySpecs:[]testutil.TestFieldSpec{testutil.TestFieldSpec{FieldName:"u32", Gen:(*rapid.Generator[interface {}])(0x14000221320)}}, Codec:(*ormkv.KeyCodec)(0x14000531a70)}
# 2023/04/21 13:41:29 TestUniqueKeyCodec [rapid] draw primaryKeyCodec: testutil.TestKeyCodec{KeySpecs:[]testutil.TestFieldSpec{testutil.TestFieldSpec{FieldName:"i32", Gen:(*rapid.Generator[interface {}])(0x14000221500)}}, Codec:(*ormkv.KeyCodec)(0x14000531b00)}
# 2023/04/21 13:41:29 TestUniqueKeyCodec [rapid] draw a0: &testpb.ExampleTable{state:impl.MessageState{NoUnkeyedLiterals:pragma.NoUnkeyedLiterals{}, DoNotCompare:pragma.DoNotCompare{}, DoNotCopy:pragma.DoNotCopy{}, atomicMessageInfo:(*impl.MessageInfo)(0x14000222000)}, sizeCache:0, unknownFields:[]uint8(nil), U32:0x0, U64:0x0, Str:"", Bz:[]uint8(nil), Ts:(*timestamppb.Timestamp)(nil), Dur:(*durationpb.Duration)(nil), I32:1, S32:0, Sf32:0, I64:0, S64:0, Sf64:0, F32:0x0, F64:0x0, B:false, E:0, Repeated:[]uint32(nil), Map:map[string]uint32(nil), Msg:(*testpb.ExampleTable_ExampleMessage)(nil), Sum:testpb.isExampleTable_Sum(nil)}
#
v0.4.8#4211888547178155051
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x6b74f03291620
0x4
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x1
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 2023/04/21 13:41:29 TestRandomTableData [rapid] draw i: 0
# 2023/04/21 13:41:29 TestRandomTableData [rapid] draw j: 2
# 2023/04/21 13:41:29 TestRandomTableData assertion failed: error is not nil: start must be before end for field testpb.ExampleTable.str: invalid range iteration keys
#
v0.4.8#16769933745078028119
0x0
0x0
0x0
0x0
0x0
0x1
1 change: 1 addition & 0 deletions x/evidence/keeper/infraction.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (k Keeper) handleEquivocationEvidence(ctx sdk.Context, evidence *types.Equi
// allowable but none of the disallowed evidence types. Instead of
// getting this coordination right, it is easier to relax the
// constraints and ignore evidence that cannot be handled.
logger.Info(fmt.Sprintf("expected pubkey for validator %s but not found", consAddr))
return
}
}
Expand Down
3 changes: 3 additions & 0 deletions x/slashing/keeper/infractions.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Addre

// fetch the validator public key
consAddr := sdk.ConsAddress(addr)
if _, err := k.GetPubkey(ctx, addr); err != nil {
sainoe marked this conversation as resolved.
Show resolved Hide resolved
panic(fmt.Sprintf("Validator consensus-address %s not found", consAddr))
}

// don't update missed blocks when validator's jailed
if k.sk.IsValidatorJailed(ctx, consAddr) {
Expand Down