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

Throttle bug fixes + req refactors #565

Merged
merged 10 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
56 changes: 56 additions & 0 deletions tests/e2e/throttle.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import (

sdktypes "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"
icstestingutils "github.com/cosmos/interchain-security/testutil/ibc_testing"
providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types"
ccvtypes "github.com/cosmos/interchain-security/x/ccv/types"
tmtypes "github.com/tendermint/tendermint/types"
)

Expand Down Expand Up @@ -339,6 +341,60 @@ func (s *CCVTestSuite) TestSlashMeterAllowanceChanges() {

}

// TestSlashSameValidator tests the edge case that that the total slashed validator power
// queued up for a single block exceeds the slash meter allowance,
// but some of the slash packets are for the same validator, and therefore some packets
// will be applied to a validator that is already jailed but still not unbonded (ie. still slashable).
func (s *CCVTestSuite) TestSlashSameValidator() {

s.SetupAllCCVChannels()

// Setup 4 validators with 25% of the total power each.
s.setupValidatorPowers()

providerKeeper := s.providerApp.GetProviderKeeper()

// Set replenish fraction to 1.0 so that all sent packets should handled immediately (no throttling)
params := providerKeeper.GetParams(s.providerCtx())
params.SlashMeterReplenishFraction = "1.0"
providerKeeper.SetParams(s.providerCtx(), params)
providerKeeper.InitializeSlashMeter(s.providerCtx())

// Send a downtime and double-sign slash packet for 3/4 validators
// This will have a total slashing power of 150% total power.
tmval1 := s.providerChain.Vals.Validators[1]
tmval2 := s.providerChain.Vals.Validators[2]
tmval3 := s.providerChain.Vals.Validators[3]
s.setDefaultValSigningInfo(*tmval1)
s.setDefaultValSigningInfo(*tmval2)
s.setDefaultValSigningInfo(*tmval3)

packets := []channeltypes.Packet{
s.constructSlashPacketFromConsumer(s.getFirstBundle(), *tmval1, stakingtypes.Downtime, 1),
s.constructSlashPacketFromConsumer(s.getFirstBundle(), *tmval2, stakingtypes.Downtime, 2),
s.constructSlashPacketFromConsumer(s.getFirstBundle(), *tmval3, stakingtypes.Downtime, 3),
s.constructSlashPacketFromConsumer(s.getFirstBundle(), *tmval1, stakingtypes.DoubleSign, 4),
s.constructSlashPacketFromConsumer(s.getFirstBundle(), *tmval2, stakingtypes.DoubleSign, 5),
s.constructSlashPacketFromConsumer(s.getFirstBundle(), *tmval3, stakingtypes.DoubleSign, 6),
}

// Recv and queue all slash packets.
for _, packet := range packets {
slashPacketData := ccvtypes.SlashPacketData{}
ccvtypes.ModuleCdc.MustUnmarshalJSON(packet.GetData(), &slashPacketData)
providerKeeper.OnRecvSlashPacket(s.providerCtx(), packet, slashPacketData)
}

// We should have 6 pending slash packet entries queued.
s.Require().Len(providerKeeper.GetAllPendingSlashPacketEntries(s.providerCtx()), 6)

// Call next block to process all pending slash packets in end blocker.
s.providerChain.NextBlock()

// All slash packets should have been handled immediately, even though they totaled to 150% of total power.
s.Require().Len(providerKeeper.GetAllPendingSlashPacketEntries(s.providerCtx()), 0)
}

func (s *CCVTestSuite) confirmValidatorJailed(tmVal tmtypes.Validator) {
sdkVal, found := s.providerApp.GetE2eStakingKeeper().GetValidator(
s.providerCtx(), sdktypes.ValAddress(tmVal.Address))
Expand Down
12 changes: 8 additions & 4 deletions tests/integration/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ func KeyAssignmentTestRun() TestRun {
".app_state.slashing.params.signed_blocks_window = \"2\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"2s\" | " +
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"",
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " +
".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling
},
chainID("consu"): {
chainId: chainID("consu"),
Expand Down Expand Up @@ -221,7 +222,8 @@ func DefaultTestRun() TestRun {
".app_state.slashing.params.signed_blocks_window = \"2\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"2s\" | " +
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"",
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " +
".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling
},
chainID("consu"): {
chainId: chainID("consu"),
Expand Down Expand Up @@ -260,7 +262,8 @@ func DemocracyTestRun() TestRun {
".app_state.slashing.params.signed_blocks_window = \"2\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"2s\" | " +
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"",
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " +
".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling
},
chainID("democ"): {
chainId: chainID("democ"),
Expand Down Expand Up @@ -300,7 +303,8 @@ func MultiConsumerTestRun() TestRun {
".app_state.slashing.params.signed_blocks_window = \"2\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"2s\" | " +
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"",
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " +
".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling
},
chainID("consu"): {
chainId: chainID("consu"),
Expand Down
9 changes: 7 additions & 2 deletions tests/integration/steps_double_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ package main
// simulates double signing on provider and vsc propagation to consumer chains
// steps continue from downtime tests state.
//
// Note: These steps are not affected by slash packet throttling since
// only one consumer initiated slash is implemented.
// Note: These steps ARE affected by slash packet throttling, since the
// consumer-initiated slash steps are executed after consumer-initiated downtime
// slashes have already occurred. However slash packet throttling is
// psuedo-disabled in this test by setting the slash meter replenish
// fraction to 1.0 in the config file.
//
// TODO: test throttling logic directly, https://github.com/cosmos/interchain-security/issues/509
func stepsDoubleSign(consumer1, consumer2 string) []Step {
return []Step{
{
Expand Down
4 changes: 4 additions & 0 deletions testutil/e2e/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ func TestSlashMeterAllowanceChanges(t *testing.T) {
runCCVTestByName(t, "TestSlashMeterAllowanceChanges")
}

func TestSlashSameValidator(t *testing.T) {
runCCVTestByName(t, "TestSlashSameValidator")
}

//
// Unbonding tests
//
Expand Down
13 changes: 9 additions & 4 deletions x/ccv/provider/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,17 @@ func (k Keeper) OnRecvSlashPacket(ctx sdk.Context, packet channeltypes.Packet, d
panic(fmt.Errorf("SlashPacket received on unknown channel %s", packet.DestinationChannel))
}

// The slash packet validator address may be known only on the consumer chain,
// in this case, it must be mapped back to the consensus address on the provider chain
consumerConsAddr := sdk.ConsAddress(data.Validator.Address)
providerConsAddr := k.GetProviderAddrFromConsumerAddr(ctx, chainID, consumerConsAddr)

// Queue a pending slash packet entry to the parent queue, which will be seen by the throttling logic
k.QueuePendingSlashPacketEntry(ctx, providertypes.NewSlashPacketEntry(
ctx.BlockTime(), // recv time
chainID, // consumer chain id that sent the packet
packet.Sequence, // IBC sequence number of the packet
data.Validator.Address))
ctx.BlockTime(), // recv time
chainID, // consumer chain id that sent the packet
packet.Sequence, // IBC sequence number of the packet
providerConsAddr)) // Provider consensus address of val to be slashed
mpoke marked this conversation as resolved.
Show resolved Hide resolved

// Queue slash packet data in the same (consumer chain specific) queue as vsc matured packet data,
// to enforce order of handling between the two packet types.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not update the packet data to include the providerConsAddr and avoid calling GetProviderAddrFromConsumerAddr later on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not update the packet data

By this, I believe you're referring to the SlashPacketData type. This is the protobuf generated type that is sent over the wire from consumer to provider. Adding a new field to this type (that's only used on the provider) seems unnecessary to me. However, if you feel this is important, I can refactor the base branch once the merge conflicts are solved. I'm hesitant to do much more refactoring in this PR due to how disconnected from main it is at this time :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking more like updating SlashPacketData.Validator.Address to the provider address obtained from GetProviderAddrFromConsumerAddr. But it's not that important.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah gotcha, that's a reasonable change, done in 1f920b4

Expand Down
15 changes: 13 additions & 2 deletions x/ccv/provider/keeper/throttle.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,20 @@ func (k Keeper) HandlePendingSlashPackets(ctx sdktypes.Context) {
// Iterate through ordered (by received time) slash packet entries from any consumer chain
k.IteratePendingSlashPacketEntries(ctx, func(entry providertypes.SlashPacketEntry) (stop bool) {

// Obtain validator from the provider's consensus address.
// Note: if validator is not found or unbonded, this will be handled appropriately in HandleSlashPacket
val, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, entry.ProviderValConsAddr)

// Obtain the validator power relevant to the slash packet that's about to be handled
// (this power will be removed via jailing or tombstoning)
valPower := k.stakingKeeper.GetLastValidatorPower(ctx, entry.ValAddr)
var valPower int64
if !found || val.IsJailed() {
// If validator is not found, or found but jailed, it's power is 0. This path is explicitly defined since the
// staking keeper's LastValidatorPower values are not updated till the staking keeper's endblocker.
valPower = 0
} else {
valPower = k.stakingKeeper.GetLastValidatorPower(ctx, val.GetOperator())
}
Comment on lines +38 to +45
Copy link
Contributor

Choose a reason for hiding this comment

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

I might be missing something but doesn't this change allow validator to be slashed all the way to 0 in a single block?

If a consumer sends many slash packets for the same validator?


Besides that, I don't think this addressing the problem in this comment

#462 (comment)

To state the problem more clearly:

We want it to be possible to set the slashFraction or other params so that the throttle is 'invisible'. Ie. the behavior of the system is exactly as in the current spec,
This means, we do not want any slash packets to be held up/delayed (still talking about when fraction=1, replenishPeriod = 1 second ect).

Consider the following

Imagine there are n validators total on the provider, with k<n active. Imagine the actives are v1,v2..vk and the inactives are vk+1,..vn

A consumer sends slash packets for every single provider validator v1..,vn and they are all delivered to the provider in the same block.

It is possible, that all of the slashes for the active validators v1..vk are handled first. This will set the meter to 0 so the slashes for vk+1,.. vn will be blocked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this design we can slash up to but not including 100% of the "initial val set" instantaneously when the replenish fraction is 1. If we want to include 100%, its a one line inequality change. I like 100% not being allowed, but I'm not super attached to that idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change we discussed today is included in 777a3f6, thank you for the efforts and feedback. Even with disagreements at times, the dialogue ended up useful and productive! It will be cool to get this feature properly specced and thoroughly tested before prod

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and before I forget,

I might be missing something but doesn't this change allow validator to be slashed all the way to 0 in a single block?

Yes this is possible with or without slash packet throttling. Does #544 address your concern? If not, might be useful to add onto that issue or create a new one


// Subtract this power from the slash meter
meter = meter.Sub(sdktypes.NewInt(valPower))
Expand Down Expand Up @@ -184,7 +195,7 @@ func (k Keeper) QueuePendingSlashPacketEntry(ctx sdktypes.Context,
entry providertypes.SlashPacketEntry) {
store := ctx.KVStore(k.storeKey)
key := providertypes.PendingSlashPacketEntryKey(entry)
store.Set(key, entry.ValAddr)
store.Set(key, entry.ProviderValConsAddr)
}

// GetAllPendingSlashPacketEntries returns all pending slash packet entries in the queue
Expand Down
28 changes: 14 additions & 14 deletions x/ccv/provider/keeper/throttle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"github.com/golang/mock/gomock"

sdktypes "github.com/cosmos/cosmos-sdk/types"
cryptoutil "github.com/cosmos/interchain-security/testutil/crypto"
testkeeper "github.com/cosmos/interchain-security/testutil/keeper"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/ed25519"
tmtypes "github.com/tendermint/tendermint/types"
"golang.org/x/exp/slices"
)
Expand Down Expand Up @@ -626,7 +626,7 @@ func TestPendingSlashPacketEntries(t *testing.T) {
entry := providertypes.NewSlashPacketEntry(now.Local(),
fmt.Sprintf("chain-%d", i),
8, // all with seq = 8
ed25519.GenPrivKey().PubKey().Address())
cryptoutil.NewCryptoIdentityFromIntSeed(i).SDKConsAddress())
providerKeeper.QueuePendingSlashPacketEntry(ctx, entry)
}
entries = providerKeeper.GetAllPendingSlashPacketEntries(ctx)
Expand All @@ -637,7 +637,7 @@ func TestPendingSlashPacketEntries(t *testing.T) {
entry := providertypes.NewSlashPacketEntry(now.Add(time.Hour).Local(),
fmt.Sprintf("chain-%d", i),
9, // all with seq = 9
ed25519.GenPrivKey().PubKey().Address())
cryptoutil.NewCryptoIdentityFromIntSeed(i).SDKConsAddress())
providerKeeper.QueuePendingSlashPacketEntry(ctx, entry)
}

Expand All @@ -660,7 +660,7 @@ func TestPendingSlashPacketEntries(t *testing.T) {
entry := providertypes.NewSlashPacketEntry(now.Add(2*time.Hour).Local(),
fmt.Sprintf("chain-%d", i+5),
7697, // all with seq = 7697
ed25519.GenPrivKey().PubKey().Address())
cryptoutil.NewCryptoIdentityFromIntSeed(i).SDKConsAddress())
providerKeeper.QueuePendingSlashPacketEntry(ctx, entry)
}

Expand Down Expand Up @@ -689,17 +689,17 @@ func TestPendingSlashPacketEntries(t *testing.T) {
require.Equal(t, now, entry.RecvTime)
require.Equal(t, fmt.Sprintf("chain-%d", idx), entry.ConsumerChainID)
require.Equal(t, uint64(8), entry.IbcSeqNum)
require.NotEmpty(t, entry.ValAddr)
require.NotEmpty(t, entry.ProviderValConsAddr)
case 3, 4, 5:
require.Equal(t, now.Add(time.Hour), entry.RecvTime)
require.Equal(t, fmt.Sprintf("chain-%d", idx-3), entry.ConsumerChainID)
require.Equal(t, uint64(9), entry.IbcSeqNum)
require.NotEmpty(t, entry.ValAddr)
require.NotEmpty(t, entry.ProviderValConsAddr)
case 6, 7, 8:
require.Equal(t, now.Add(2*time.Hour), entry.RecvTime)
require.Equal(t, fmt.Sprintf("chain-%d", idx-6+5), entry.ConsumerChainID)
require.Equal(t, uint64(7697), entry.IbcSeqNum)
require.NotEmpty(t, entry.ValAddr)
require.NotEmpty(t, entry.ProviderValConsAddr)
default:
t.Fatalf("unexpected entry index %d", idx)
}
Expand Down Expand Up @@ -730,13 +730,13 @@ func TestPendingSlashPacketEntryDeletion(t *testing.T) {

// Instantiate entries in the expected order we wish to get them back as (ordered by recv time)
entries = []providertypes.SlashPacketEntry{}
entries = append(entries, providertypes.NewSlashPacketEntry(now, "chain-0", 1, ed25519.GenPrivKey().PubKey().Address()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(time.Hour).UTC(), "chain-1", 178, ed25519.GenPrivKey().PubKey().Address()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(2*time.Hour).Local(), "chain-2", 89, ed25519.GenPrivKey().PubKey().Address()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(3*time.Hour).In(time.FixedZone("UTC-8", -8*60*60)), "chain-3", 23423, ed25519.GenPrivKey().PubKey().Address()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(4*time.Hour).Local(), "chain-4", 323, ed25519.GenPrivKey().PubKey().Address()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(5*time.Hour).UTC(), "chain-5", 18, ed25519.GenPrivKey().PubKey().Address()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(6*time.Hour).Local(), "chain-6", 2, ed25519.GenPrivKey().PubKey().Address()))
entries = append(entries, providertypes.NewSlashPacketEntry(now, "chain-0", 1, cryptoutil.NewCryptoIdentityFromIntSeed(0).SDKConsAddress()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(time.Hour).UTC(), "chain-1", 178, cryptoutil.NewCryptoIdentityFromIntSeed(1).SDKConsAddress()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(2*time.Hour).Local(), "chain-2", 89, cryptoutil.NewCryptoIdentityFromIntSeed(2).SDKConsAddress()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(3*time.Hour).In(time.FixedZone("UTC-8", -8*60*60)), "chain-3", 23423, cryptoutil.NewCryptoIdentityFromIntSeed(3).SDKConsAddress()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(4*time.Hour).Local(), "chain-4", 323, cryptoutil.NewCryptoIdentityFromIntSeed(4).SDKConsAddress()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(5*time.Hour).UTC(), "chain-5", 18, cryptoutil.NewCryptoIdentityFromIntSeed(5).SDKConsAddress()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(6*time.Hour).Local(), "chain-6", 2, cryptoutil.NewCryptoIdentityFromIntSeed(6).SDKConsAddress()))

// Instantiate shuffled copy of above slice
shuffledEntries := append([]providertypes.SlashPacketEntry{}, entries...)
Expand Down
8 changes: 4 additions & 4 deletions x/ccv/provider/types/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
cryptoutil "github.com/cosmos/interchain-security/testutil/crypto"
testkeeper "github.com/cosmos/interchain-security/testutil/keeper"
"github.com/cosmos/interchain-security/x/ccv/provider/types"
providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/ed25519"
)

// Tests that all singular keys, or prefixes to fully resolves keys are a single byte long,
Expand Down Expand Up @@ -179,9 +179,9 @@ func TestPendingPacketDataKeyAndParse(t *testing.T) {
func TestPendingSlashPacketEntryKeyAndParse(t *testing.T) {
now := time.Now()
entries := []providertypes.SlashPacketEntry{}
entries = append(entries, providertypes.NewSlashPacketEntry(now, "chain-0", 2, ed25519.GenPrivKey().PubKey().Address()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(2*time.Hour), "chain-7896978", 3, ed25519.GenPrivKey().PubKey().Address()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(3*time.Hour), "chain-1", 4723894, ed25519.GenPrivKey().PubKey().Address()))
entries = append(entries, providertypes.NewSlashPacketEntry(now, "chain-0", 2, cryptoutil.NewCryptoIdentityFromIntSeed(0).SDKConsAddress()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(2*time.Hour), "chain-7896978", 3, cryptoutil.NewCryptoIdentityFromIntSeed(1).SDKConsAddress()))
entries = append(entries, providertypes.NewSlashPacketEntry(now.Add(3*time.Hour), "chain-1", 4723894, cryptoutil.NewCryptoIdentityFromIntSeed(2).SDKConsAddress()))

for _, entry := range entries {
key := providertypes.PendingSlashPacketEntryKey(entry)
Expand Down
16 changes: 9 additions & 7 deletions x/ccv/provider/types/throttle.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package types

import (
"time"

sdktypes "github.com/cosmos/cosmos-sdk/types"
)

// A persisted queue entry indicating that a slash packet data instance needs to be handled
Expand All @@ -14,20 +16,20 @@ type SlashPacketEntry struct {
// The IBC sequence number of the recv packet.
// This field is used in the store key to ensure uniqueness.
IbcSeqNum uint64
// The byte address of the validator being slashed.
// The provider's consensus address of the validator being slashed.
// This field is used to obtain validator power in HandlePendingSlashPackets.
// It is not used in the store key, but is persisted in value bytes,
// see QueuePendingSlashPacketEntry.
ValAddr []byte
ProviderValConsAddr sdktypes.ConsAddress
}

// NewSlashPacketEntry creates a new SlashPacketEntry.
func NewSlashPacketEntry(recvTime time.Time, consumerChainID string,
ibcSeqNum uint64, valAddr []byte) SlashPacketEntry {
ibcSeqNum uint64, providerValConsAddr sdktypes.ConsAddress) SlashPacketEntry {
return SlashPacketEntry{
RecvTime: recvTime.UTC(), // UTC prevents serialization inconsistencies
ConsumerChainID: consumerChainID,
IbcSeqNum: ibcSeqNum,
ValAddr: valAddr,
RecvTime: recvTime.UTC(), // UTC prevents serialization inconsistencies
ConsumerChainID: consumerChainID,
IbcSeqNum: ibcSeqNum,
ProviderValConsAddr: providerValConsAddr,
}
}