From 2847807b3d79e7ccf0a7add71fcf32a6e7092982 Mon Sep 17 00:00:00 2001 From: oren-lava Date: Sun, 22 Jan 2023 12:04:09 +0200 Subject: [PATCH 1/3] CNS-239: moved block time calc to different file --- x/pairing/keeper/pairing.go | 136 ---------------- .../keeper/pairing_avg_block_time_calc.go | 145 ++++++++++++++++++ 2 files changed, 145 insertions(+), 136 deletions(-) create mode 100644 x/pairing/keeper/pairing_avg_block_time_calc.go diff --git a/x/pairing/keeper/pairing.go b/x/pairing/keeper/pairing.go index 6dd8f34da0..e543d8d1e6 100644 --- a/x/pairing/keeper/pairing.go +++ b/x/pairing/keeper/pairing.go @@ -2,15 +2,12 @@ package keeper import ( "fmt" - "math" "math/big" "strconv" - "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/lavanet/lava/utils" epochstoragetypes "github.com/lavanet/lava/x/epochstorage/types" - pairingtypes "github.com/lavanet/lava/x/pairing/types" tendermintcrypto "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/rpc/core" ) @@ -221,136 +218,3 @@ func (k Keeper) returnSubsetOfProvidersByStake(ctx sdk.Context, clientAddress sd } return returnedProviders } - -const ( - EPOCH_BLOCK_DIVIDER uint64 = 5 // determines how many blocks from the previous epoch will be included in the average block time calculation - MIN_SAMPLE_STEP uint64 = 1 // the minimal sample step when calculating the average block time -) - -// Function to calculate how much time (in seconds) is left until the next epoch -func (k Keeper) calculateNextEpochTime(ctx sdk.Context) (uint64, error) { - // Get current epoch - currentEpoch := k.epochStorageKeeper.GetEpochStart(ctx) - - // Calculate the average block time (i.e., how much time it takes to create a new block, in average) - averageBlockTime, err := k.calculateAverageBlockTime(ctx, currentEpoch) - if err != nil { - return 0, fmt.Errorf("could not calculate average block time, err: %s", err) - } - - // Get the next epoch - nextEpochStart, err := k.epochStorageKeeper.GetNextEpoch(ctx, currentEpoch) - if err != nil { - return 0, fmt.Errorf("could not get next epoch start, err: %s", err) - } - - // Get epochBlocksOverlap - overlapBlocks := k.EpochBlocksOverlap(ctx) - - // Get number of blocks from the current block to the next epoch - blocksUntilNewEpoch := nextEpochStart + overlapBlocks - uint64(ctx.BlockHeight()) - - // Calculate the time left for the next pairing in seconds (blocks left * avg block time) - timeLeftToNextEpoch := blocksUntilNewEpoch * averageBlockTime - - return timeLeftToNextEpoch, nil -} - -// Function to calculate the average block time (i.e., how much time it takes to create a new block, in average) -func (k Keeper) calculateAverageBlockTime(ctx sdk.Context, epoch uint64) (uint64, error) { - // Get epochBlocks (the number of blocks in an epoch) - epochBlocks, err := k.epochStorageKeeper.EpochBlocks(ctx, epoch) - if err != nil { - return 0, fmt.Errorf("could not get epochBlocks, err: %s", err) - } - - // Define sample step. Determines which timestamps will be taken in the average block time calculation. - // if epochBlock < EPOCH_BLOCK_DIVIDER -> sampleStep = MIN_SAMPLE_STEP. - // else sampleStep will be epochBlocks/EPOCH_BLOCK_DIVIDER - if MIN_SAMPLE_STEP > epochBlocks { - return 0, fmt.Errorf("invalid MIN_SAMPLE_STEP value since it's larger than epochBlocks. MIN_SAMPLE_STEP: %v, epochBlocks: %v", MIN_SAMPLE_STEP, epochBlocks) - } - sampleStep := MIN_SAMPLE_STEP - if epochBlocks > EPOCH_BLOCK_DIVIDER { - sampleStep = epochBlocks / EPOCH_BLOCK_DIVIDER - } - - // Get a list of the previous epoch's blocks timestamp and height - prevEpochTimestampAndHeightList, err := k.getPreviousEpochTimestampsByHeight(ctx, epoch, sampleStep) - if pairingtypes.NoPreviousEpochForAverageBlockTimeCalculationError.Is(err) || pairingtypes.PreviousEpochStartIsBlockZeroError.Is(err) { - // if the errors indicate that we're on the first epoch / after a fork or previous epoch start is 0, we return averageBlockTime=0 without an error - return 0, nil - } - if err != nil { - return 0, fmt.Errorf("couldn't get prevEpochTimestampAndHeightList. err: %v", err) - } - - // Calculate the average block time from prevEpochTimestampAndHeightList - averageBlockTime, err := calculateAverageBlockTimeFromList(ctx, prevEpochTimestampAndHeightList, sampleStep) - if pairingtypes.NotEnoughBlocksToCalculateAverageBlockTimeError.Is(err) || pairingtypes.AverageBlockTimeIsLessOrEqualToZeroError.Is(err) { - // we shouldn't fail the get-pairing query because the average block time calculation failed (to indicate the fail, we return 0) - return 0, nil - } - if err != nil { - return 0, fmt.Errorf("couldn't calculate average block time. err: %v", err) - } - - return averageBlockTime, nil -} - -type blockHeightAndTime struct { - blockHeight uint64 - blockTime time.Time -} - -// Function to get a list of the timestamps of the blocks in the previous epoch of the input (so it'll be deterministic) -func (k Keeper) getPreviousEpochTimestampsByHeight(ctx sdk.Context, epoch uint64, sampleStep uint64) ([]blockHeightAndTime, error) { - // Check for special cases: - // 1. no previous epoch - we're on the first epoch / after a fork. Since there is no previous epoch to calculate average time on, return an empty slice and no error - // 2. start of previous epoch is block 0 - we're on the second epoch. To get the block's header using the "core" module, the block height can't be zero (causes panic). In this case, we also return an empty slice and no error - prevEpoch, err := k.epochStorageKeeper.GetPreviousEpochStartForBlock(ctx, epoch) - if err != nil { - return nil, pairingtypes.NoPreviousEpochForAverageBlockTimeCalculationError - } else if prevEpoch == 0 { - return nil, pairingtypes.PreviousEpochStartIsBlockZeroError - } - - // Get previous epoch timestamps, in sampleStep steps - prevEpochTimestampAndHeightList := []blockHeightAndTime{} - for block := prevEpoch; block <= epoch; block += sampleStep { - // Get current block's height and timestamp - blockInt64 := int64(block) - blockCore, err := core.Block(nil, &blockInt64) - if err != nil { - return nil, fmt.Errorf("could not get current block header, block: %v, err: %s", blockInt64, err) - } - currentBlockTimestamp := blockCore.Block.Header.Time.UTC() - blockHeightAndTimeStruct := blockHeightAndTime{blockHeight: block, blockTime: currentBlockTimestamp} - - // Append the timestamp to the timestamp list - prevEpochTimestampAndHeightList = append(prevEpochTimestampAndHeightList, blockHeightAndTimeStruct) - } - - return prevEpochTimestampAndHeightList, nil -} - -func calculateAverageBlockTimeFromList(ctx sdk.Context, blockHeightAndTimeList []blockHeightAndTime, sampleStep uint64) (uint64, error) { - if len(blockHeightAndTimeList) <= 1 { - return 0, utils.LavaFormatError("There isn't enough blockHeight structs in the previous epoch to calculate average block time", pairingtypes.NotEnoughBlocksToCalculateAverageBlockTimeError, nil) - } - - averageBlockTime := time.Duration(math.MaxInt64) - for i := 1; i < len(blockHeightAndTimeList); i++ { - // Calculate the average block time creation over sampleStep blocks - currentAverageBlockTime := blockHeightAndTimeList[i].blockTime.Sub(blockHeightAndTimeList[i-1].blockTime) / time.Duration(sampleStep) - if currentAverageBlockTime <= 0 { - return 0, utils.LavaFormatError("calculated average block time is less than or equal to zero", pairingtypes.AverageBlockTimeIsLessOrEqualToZeroError, &map[string]string{"block": fmt.Sprintf("%v", blockHeightAndTimeList[i].blockHeight), "block timestamp": blockHeightAndTimeList[i].blockTime.String(), "prevBlock": fmt.Sprintf("%v", blockHeightAndTimeList[i-1].blockHeight), "prevBlock timestamp": blockHeightAndTimeList[i-1].blockTime.String()}) - } - // save the minimal average block time - if averageBlockTime > currentAverageBlockTime { - averageBlockTime = currentAverageBlockTime - } - } - - return uint64(averageBlockTime.Seconds()), nil -} diff --git a/x/pairing/keeper/pairing_avg_block_time_calc.go b/x/pairing/keeper/pairing_avg_block_time_calc.go new file mode 100644 index 0000000000..50bd3635ff --- /dev/null +++ b/x/pairing/keeper/pairing_avg_block_time_calc.go @@ -0,0 +1,145 @@ +package keeper + +import ( + "fmt" + "math" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/lavanet/lava/utils" + pairingtypes "github.com/lavanet/lava/x/pairing/types" + "github.com/tendermint/tendermint/rpc/core" +) + +const ( + EPOCH_BLOCK_DIVIDER uint64 = 5 // determines how many blocks from the previous epoch will be included in the average block time calculation + MIN_SAMPLE_STEP uint64 = 1 // the minimal sample step when calculating the average block time +) + +// Function to calculate how much time (in seconds) is left until the next epoch +func (k Keeper) calculateNextEpochTime(ctx sdk.Context) (uint64, error) { + // Get current epoch + currentEpoch := k.epochStorageKeeper.GetEpochStart(ctx) + + // Calculate the average block time (i.e., how much time it takes to create a new block, in average) + averageBlockTime, err := k.calculateAverageBlockTime(ctx, currentEpoch) + if err != nil { + return 0, fmt.Errorf("could not calculate average block time, err: %s", err) + } + + // Get the next epoch + nextEpochStart, err := k.epochStorageKeeper.GetNextEpoch(ctx, currentEpoch) + if err != nil { + return 0, fmt.Errorf("could not get next epoch start, err: %s", err) + } + + // Get epochBlocksOverlap + overlapBlocks := k.EpochBlocksOverlap(ctx) + + // Get number of blocks from the current block to the next epoch + blocksUntilNewEpoch := nextEpochStart + overlapBlocks - uint64(ctx.BlockHeight()) + + // Calculate the time left for the next pairing in seconds (blocks left * avg block time) + timeLeftToNextEpoch := blocksUntilNewEpoch * averageBlockTime + + return timeLeftToNextEpoch, nil +} + +// Function to calculate the average block time (i.e., how much time it takes to create a new block, in average) +func (k Keeper) calculateAverageBlockTime(ctx sdk.Context, epoch uint64) (uint64, error) { + // Get epochBlocks (the number of blocks in an epoch) + epochBlocks, err := k.epochStorageKeeper.EpochBlocks(ctx, epoch) + if err != nil { + return 0, fmt.Errorf("could not get epochBlocks, err: %s", err) + } + + // Define sample step. Determines which timestamps will be taken in the average block time calculation. + // if epochBlock < EPOCH_BLOCK_DIVIDER -> sampleStep = MIN_SAMPLE_STEP. + // else sampleStep will be epochBlocks/EPOCH_BLOCK_DIVIDER + if MIN_SAMPLE_STEP > epochBlocks { + return 0, fmt.Errorf("invalid MIN_SAMPLE_STEP value since it's larger than epochBlocks. MIN_SAMPLE_STEP: %v, epochBlocks: %v", MIN_SAMPLE_STEP, epochBlocks) + } + sampleStep := MIN_SAMPLE_STEP + if epochBlocks > EPOCH_BLOCK_DIVIDER { + sampleStep = epochBlocks / EPOCH_BLOCK_DIVIDER + } + + // Get a list of the previous epoch's blocks timestamp and height + prevEpochTimestampAndHeightList, err := k.getPreviousEpochTimestampsByHeight(ctx, epoch, sampleStep) + if pairingtypes.NoPreviousEpochForAverageBlockTimeCalculationError.Is(err) || pairingtypes.PreviousEpochStartIsBlockZeroError.Is(err) { + // if the errors indicate that we're on the first epoch / after a fork or previous epoch start is 0, we return averageBlockTime=0 without an error + return 0, nil + } + if err != nil { + return 0, fmt.Errorf("couldn't get prevEpochTimestampAndHeightList. err: %v", err) + } + + // Calculate the average block time from prevEpochTimestampAndHeightList + averageBlockTime, err := calculateAverageBlockTimeFromList(ctx, prevEpochTimestampAndHeightList, sampleStep) + if pairingtypes.NotEnoughBlocksToCalculateAverageBlockTimeError.Is(err) || pairingtypes.AverageBlockTimeIsLessOrEqualToZeroError.Is(err) { + // we shouldn't fail the get-pairing query because the average block time calculation failed (to indicate the fail, we return 0) + return 0, nil + } + if err != nil { + return 0, fmt.Errorf("couldn't calculate average block time. err: %v", err) + } + + return averageBlockTime, nil +} + +type blockHeightAndTime struct { + blockHeight uint64 + blockTime time.Time +} + +// Function to get a list of the timestamps of the blocks in the previous epoch of the input (so it'll be deterministic) +func (k Keeper) getPreviousEpochTimestampsByHeight(ctx sdk.Context, epoch uint64, sampleStep uint64) ([]blockHeightAndTime, error) { + // Check for special cases: + // 1. no previous epoch - we're on the first epoch / after a fork. Since there is no previous epoch to calculate average time on, return an empty slice and no error + // 2. start of previous epoch is block 0 - we're on the second epoch. To get the block's header using the "core" module, the block height can't be zero (causes panic). In this case, we also return an empty slice and no error + prevEpoch, err := k.epochStorageKeeper.GetPreviousEpochStartForBlock(ctx, epoch) + if err != nil { + return nil, pairingtypes.NoPreviousEpochForAverageBlockTimeCalculationError + } else if prevEpoch == 0 { + return nil, pairingtypes.PreviousEpochStartIsBlockZeroError + } + + // Get previous epoch timestamps, in sampleStep steps + prevEpochTimestampAndHeightList := []blockHeightAndTime{} + for block := prevEpoch; block <= epoch; block += sampleStep { + // Get current block's height and timestamp + blockInt64 := int64(block) + blockCore, err := core.Block(nil, &blockInt64) + if err != nil { + return nil, fmt.Errorf("could not get current block header, block: %v, err: %s", blockInt64, err) + } + currentBlockTimestamp := blockCore.Block.Header.Time.UTC() + blockHeightAndTimeStruct := blockHeightAndTime{blockHeight: block, blockTime: currentBlockTimestamp} + + // Append the timestamp to the timestamp list + prevEpochTimestampAndHeightList = append(prevEpochTimestampAndHeightList, blockHeightAndTimeStruct) + } + + return prevEpochTimestampAndHeightList, nil +} + +func calculateAverageBlockTimeFromList(ctx sdk.Context, blockHeightAndTimeList []blockHeightAndTime, sampleStep uint64) (uint64, error) { + if len(blockHeightAndTimeList) <= 1 { + return 0, utils.LavaFormatError("There isn't enough blockHeight structs in the previous epoch to calculate average block time", pairingtypes.NotEnoughBlocksToCalculateAverageBlockTimeError, nil) + } + + averageBlockTime := time.Duration(math.MaxInt64) + for i := 1; i < len(blockHeightAndTimeList); i++ { + // Calculate the average block time creation over sampleStep blocks + currentAverageBlockTime := blockHeightAndTimeList[i].blockTime.Sub(blockHeightAndTimeList[i-1].blockTime) / time.Duration(sampleStep) + if currentAverageBlockTime <= 0 { + return 0, utils.LavaFormatError("calculated average block time is less than or equal to zero", pairingtypes.AverageBlockTimeIsLessOrEqualToZeroError, &map[string]string{"block": fmt.Sprintf("%v", blockHeightAndTimeList[i].blockHeight), "block timestamp": blockHeightAndTimeList[i].blockTime.String(), "prevBlock": fmt.Sprintf("%v", blockHeightAndTimeList[i-1].blockHeight), "prevBlock timestamp": blockHeightAndTimeList[i-1].blockTime.String()}) + } + // save the minimal average block time + if averageBlockTime > currentAverageBlockTime { + averageBlockTime = currentAverageBlockTime + } + } + + return uint64(averageBlockTime.Seconds()), nil +} From ddb11439450154293caafd9dcee31ee9bf4a1bdc Mon Sep 17 00:00:00 2001 From: oren-lava Date: Sun, 22 Jan 2023 12:18:52 +0200 Subject: [PATCH 2/3] CNS-239: added nextPairingBlock field to get pairing response --- proto/pairing/query.proto | 1 + x/pairing/keeper/grpc_query_get_pairing.go | 4 +- ...lc.go => pairing_next_epoch_time_block.go} | 13 +- x/pairing/types/query.pb.go | 204 ++++++++++-------- 4 files changed, 131 insertions(+), 91 deletions(-) rename x/pairing/keeper/{pairing_avg_block_time_calc.go => pairing_next_epoch_time_block.go} (93%) diff --git a/proto/pairing/query.proto b/proto/pairing/query.proto index 891a229ca0..50afb212a9 100644 --- a/proto/pairing/query.proto +++ b/proto/pairing/query.proto @@ -114,6 +114,7 @@ message QueryGetPairingResponse { uint64 currentEpoch = 2; uint64 timeLeftToNextPairing = 3; uint64 specLastUpdatedBlock = 4; + uint64 blockOfNextPairing = 5; } message QueryVerifyPairingRequest { diff --git a/x/pairing/keeper/grpc_query_get_pairing.go b/x/pairing/keeper/grpc_query_get_pairing.go index 10a0b109e6..dad6c0335c 100644 --- a/x/pairing/keeper/grpc_query_get_pairing.go +++ b/x/pairing/keeper/grpc_query_get_pairing.go @@ -40,7 +40,7 @@ func (k Keeper) GetPairing(goCtx context.Context, req *types.QueryGetPairingRequ } // Calculate the time left until the new epoch (when epoch changes, new pairing is generated) - timeLeftToNextPairing, err := k.calculateNextEpochTime(ctx) + timeLeftToNextPairing, nextPairingBlock, err := k.calculateNextEpochTimeAndBlock(ctx) if err != nil { // we don't want to fail the query if the calculateNextEpochTime function fails. This shouldn't happen, it's a fail-safe utils.LavaFormatError("calculate next epoch time failed. Returning default time=0", err, nil) @@ -57,5 +57,5 @@ func (k Keeper) GetPairing(goCtx context.Context, req *types.QueryGetPairingRequ } specLastUpdatedBlock := spec.BlockLastUpdated - return &types.QueryGetPairingResponse{Providers: providers, CurrentEpoch: currentEpoch, TimeLeftToNextPairing: timeLeftToNextPairing, SpecLastUpdatedBlock: specLastUpdatedBlock}, nil + return &types.QueryGetPairingResponse{Providers: providers, CurrentEpoch: currentEpoch, TimeLeftToNextPairing: timeLeftToNextPairing, SpecLastUpdatedBlock: specLastUpdatedBlock, BlockOfNextPairing: nextPairingBlock}, nil } diff --git a/x/pairing/keeper/pairing_avg_block_time_calc.go b/x/pairing/keeper/pairing_next_epoch_time_block.go similarity index 93% rename from x/pairing/keeper/pairing_avg_block_time_calc.go rename to x/pairing/keeper/pairing_next_epoch_time_block.go index 50bd3635ff..b4eb3e88d9 100644 --- a/x/pairing/keeper/pairing_avg_block_time_calc.go +++ b/x/pairing/keeper/pairing_next_epoch_time_block.go @@ -17,32 +17,35 @@ const ( ) // Function to calculate how much time (in seconds) is left until the next epoch -func (k Keeper) calculateNextEpochTime(ctx sdk.Context) (uint64, error) { +func (k Keeper) calculateNextEpochTimeAndBlock(ctx sdk.Context) (uint64, uint64, error) { // Get current epoch currentEpoch := k.epochStorageKeeper.GetEpochStart(ctx) // Calculate the average block time (i.e., how much time it takes to create a new block, in average) averageBlockTime, err := k.calculateAverageBlockTime(ctx, currentEpoch) if err != nil { - return 0, fmt.Errorf("could not calculate average block time, err: %s", err) + return 0, 0, fmt.Errorf("could not calculate average block time, err: %s", err) } // Get the next epoch nextEpochStart, err := k.epochStorageKeeper.GetNextEpoch(ctx, currentEpoch) if err != nil { - return 0, fmt.Errorf("could not get next epoch start, err: %s", err) + return 0, 0, fmt.Errorf("could not get next epoch start, err: %s", err) } // Get epochBlocksOverlap overlapBlocks := k.EpochBlocksOverlap(ctx) + // calculate the block in which the next pairing will happen (+overlap) + nextPairingBlock := nextEpochStart + overlapBlocks + // Get number of blocks from the current block to the next epoch - blocksUntilNewEpoch := nextEpochStart + overlapBlocks - uint64(ctx.BlockHeight()) + blocksUntilNewEpoch := nextPairingBlock - uint64(ctx.BlockHeight()) // Calculate the time left for the next pairing in seconds (blocks left * avg block time) timeLeftToNextEpoch := blocksUntilNewEpoch * averageBlockTime - return timeLeftToNextEpoch, nil + return timeLeftToNextEpoch, nextPairingBlock, nil } // Function to calculate the average block time (i.e., how much time it takes to create a new block, in average) diff --git a/x/pairing/types/query.pb.go b/x/pairing/types/query.pb.go index 37c0830a70..344d572ae8 100644 --- a/x/pairing/types/query.pb.go +++ b/x/pairing/types/query.pb.go @@ -363,6 +363,7 @@ type QueryGetPairingResponse struct { CurrentEpoch uint64 `protobuf:"varint,2,opt,name=currentEpoch,proto3" json:"currentEpoch,omitempty"` TimeLeftToNextPairing uint64 `protobuf:"varint,3,opt,name=timeLeftToNextPairing,proto3" json:"timeLeftToNextPairing,omitempty"` SpecLastUpdatedBlock uint64 `protobuf:"varint,4,opt,name=specLastUpdatedBlock,proto3" json:"specLastUpdatedBlock,omitempty"` + BlockOfNextPairing uint64 `protobuf:"varint,5,opt,name=blockOfNextPairing,proto3" json:"blockOfNextPairing,omitempty"` } func (m *QueryGetPairingResponse) Reset() { *m = QueryGetPairingResponse{} } @@ -426,6 +427,13 @@ func (m *QueryGetPairingResponse) GetSpecLastUpdatedBlock() uint64 { return 0 } +func (m *QueryGetPairingResponse) GetBlockOfNextPairing() uint64 { + if m != nil { + return m.BlockOfNextPairing + } + return 0 +} + type QueryVerifyPairingRequest struct { ChainID string `protobuf:"bytes,1,opt,name=chainID,proto3" json:"chainID,omitempty"` Client string `protobuf:"bytes,2,opt,name=client,proto3" json:"client,omitempty"` @@ -1260,90 +1268,91 @@ func init() { func init() { proto.RegisterFile("pairing/query.proto", fileDescriptor_6bd8a3cd41a2a1ee) } var fileDescriptor_6bd8a3cd41a2a1ee = []byte{ - // 1320 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5d, 0x6f, 0xdb, 0x54, - 0x18, 0xae, 0x93, 0xad, 0x5b, 0xdf, 0x51, 0x09, 0xce, 0xb2, 0x92, 0x59, 0x25, 0x4c, 0x66, 0xfd, - 0xda, 0x8a, 0xbd, 0x66, 0x55, 0x35, 0xb1, 0x32, 0xa9, 0x5d, 0xb7, 0xae, 0xa3, 0x82, 0x2e, 0xa3, - 0x5c, 0x70, 0x53, 0xb9, 0xc9, 0x69, 0x6a, 0xe6, 0xd8, 0xae, 0x3f, 0x4a, 0xab, 0x28, 0x02, 0x81, - 0xb8, 0x9d, 0x40, 0x70, 0xc3, 0x3d, 0x12, 0xe2, 0x86, 0x7b, 0x7e, 0x00, 0x68, 0x57, 0x68, 0xd2, - 0x6e, 0xb8, 0x01, 0xa1, 0x16, 0xf1, 0x03, 0xf8, 0x05, 0xc8, 0xe7, 0xbc, 0xc7, 0x8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15, 0x06, 0xb8, 0x42, 0xb7, 0x02, 0xea, 0xf9, 0xca, 0x23, 0xb8, 0x18, 0x7b, 0xea, - 0x39, 0xb6, 0xe5, 0x51, 0xf2, 0x0e, 0xf4, 0x73, 0x62, 0x45, 0xe9, 0x8a, 0x34, 0x7e, 0xa1, 0x3c, - 0xac, 0x26, 0xa9, 0xac, 0xf2, 0xac, 0xf9, 0x33, 0xcf, 0xfe, 0x7a, 0xb3, 0xaf, 0x82, 0x19, 0xca, - 0x14, 0x5c, 0xe2, 0x25, 0x11, 0x9f, 0xe8, 0x45, 0x8a, 0x70, 0xae, 0xba, 0xa9, 0x1b, 0xd6, 0xd2, - 0x02, 0xab, 0x3a, 0x50, 0x11, 0x4b, 0xa5, 0x05, 0x43, 0x87, 0x53, 0x10, 0xc8, 0x7b, 0x00, 0x8c, - 0xca, 0xbd, 0x90, 0x49, 0x51, 0xba, 0x92, 0x1f, 0xbf, 0x50, 0x1e, 0x89, 0x83, 0x69, 0xe7, 0xad, - 0x3e, 0x8e, 0x82, 0x11, 0x55, 0x5b, 0x3a, 0x19, 0x82, 0x7e, 0x3b, 0xf0, 0x9d, 0xc0, 0x2f, 0xe6, - 0x58, 0x7f, 0x5c, 0x29, 0x1a, 0x8a, 0x70, 0x97, 0x09, 0x9b, 0x01, 0x6f, 0x13, 0x0a, 0xf1, 0x84, - 0x97, 0x89, 0xf6, 0x21, 0x8a, 0xb5, 0x48, 0xfd, 0x15, 0xbe, 0x0f, 0x5d, 0x01, 0x87, 0xb5, 0xf8, - 0xa9, 0x11, 0xb5, 0xf8, 0x4a, 0xf9, 0x4f, 0x82, 0xd7, 0x8f, 0x14, 0x43, 0x32, 0x4b, 0x30, 0x20, - 0x8e, 0x98, 0x77, 0x1c, 0x2e, 0x07, 0xd9, 0x44, 0x81, 0x57, 0xaa, 0x81, 0xeb, 0x52, 0xcb, 0xbf, - 0x17, 0xa6, 0x30, 0x10, 0x67, 0x2a, 0xb1, 0x67, 0x64, 0x1a, 0x2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e, 0xce, 0x03, 0x75, 0x45, 0xaf, 0x53, 0xcc, 0xad, 0xb4, 0x65, 0x2a, 0x4f, 0x73, 0x28, - 0x62, 0xc6, 0xee, 0xbd, 0x8a, 0x98, 0x7f, 0x39, 0x22, 0x92, 0xc5, 0x98, 0x1e, 0x39, 0xa6, 0xc7, - 0x58, 0x57, 0x3d, 0x38, 0x9b, 0x98, 0x20, 0xef, 0xc2, 0x48, 0x74, 0xbf, 0x60, 0xf1, 0x78, 0xe3, - 0xf4, 0x43, 0xf9, 0x9d, 0x04, 0xa3, 0xdd, 0xf2, 0x51, 0xc3, 0x4f, 0x60, 0xc8, 0x49, 0x8c, 0xc0, - 0xed, 0x9c, 0xec, 0x30, 0xc2, 0x12, 0x73, 0x50, 0xaa, 0x0e, 0x15, 0x15, 0x1b, 0x59, 0xcd, 0x99, - 0x66, 0x3a, 0xab, 0xd3, 0x3a, 0x57, 0x7f, 0x0a, 0x1d, 0x52, 0x3a, 0x66, 0xd0, 0x21, 0x7f, 0xba, - 0x3a, 0x9c, 0xde, 0x31, 0x99, 0x86, 0x61, 0xb1, 0xcd, 0x6c, 0x1a, 0x60, 0x1f, 0x2f, 0xfd, 0x74, - 0x38, 0xf0, 0x46, 0x87, 0x2c, 0xd4, 0xe2, 0x03, 0x18, 0xa4, 0xed, 0x2f, 0x70, 0x07, 0xde, 0x4a, - 0x96, 0x20, 0x56, 0x03, 0x99, 0xc7, 0xf3, 0x95, 0x0d, 0xc4, 0x39, 0x67, 0x9a, 0x89, 0x38, 0x4f, - 0x6b, 0xbf, 0x7f, 0x91, 0x90, 0xda, 0xd1, 0x46, 0x9d, 0xa9, 0xe5, 0x4f, 0x42, 0xed, 0xf4, 0xf6, - 0x52, 0x47, 0xff, 0xb7, 0xea, 0x51, 0x97, 0xf9, 0x81, 0xb6, 0xd1, 0xaa, 0xd7, 0x6a, 0x2e, 0xf5, - 0x3c, 0x31, 0x5a, 0x71, 0xd9, 0x3e, 0x74, 0x73, 0xf1, 0xa1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- 0x60, 0xcc, 0x1f, 0x12, 0x2d, 0xa5, 0x7d, 0x92, 0x95, 0x95, 0x6f, 0x64, 0x4f, 0x40, 0xc8, 0x15, - 0x06, 0x79, 0x99, 0x3c, 0x4c, 0x86, 0xbc, 0xcd, 0x92, 0x52, 0x50, 0x6b, 0x4d, 0x71, 0x10, 0x5a, - 0x5a, 0x93, 0x7d, 0x54, 0x5b, 0xe4, 0xab, 0x1c, 0x28, 0xab, 0x19, 0x1c, 0x47, 0xba, 0xb8, 0x99, - 0xad, 0x9c, 0xfc, 0xe0, 0xe4, 0x85, 0x50, 0x8d, 0x65, 0xa6, 0xc6, 0x7d, 0xb2, 0x90, 0xac, 0x46, - 0xb6, 0x6f, 0xe7, 0x5a, 0x93, 0xcd, 0xaa, 0x16, 0xf9, 0x3c, 0x07, 0x23, 0xdd, 0x9b, 0xcf, 0x99, - 0x66, 0xaa, 0x14, 0xbd, 0xb8, 0xda, 0x54, 0x29, 0x7a, 0x32, 0xa8, 0xca, 0x02, 0x93, 0xe2, 0x0e, - 0x99, 0x3d, 0x89, 0x14, 0xe4, 0x85, 0x04, 0x43, 0xc9, 0x3e, 0x83, 0xdc, 0xee, 0xf2, 0xd9, 0x4a, - 0x73, 0x59, 0xf2, 0xec, 0xf1, 0x92, 0x91, 0xdb, 0x1d, 0xc6, 0xed, 0x16, 0x99, 0x49, 0xbf, 0xda, - 0x0e, 0xb3, 0x8b, 0x36, 0xf6, 0x77, 0x09, 0x2e, 0x27, 0xb7, 0x08, 0x37, 0xf3, 0x76, 0xfa, 0x1e, - 0x1c, 0x9f, 0x58, 0x57, 0x27, 0xa8, 0xcc, 0x30, 0x62, 0x37, 0x88, 0xda, 0x1b, 0x31, 0xf2, 0xb3, - 0x04, 0x83, 0x31, 0xc3, 0x40, 0xca, 0xe9, 0x02, 0x27, 0x59, 0x21, 0xf9, 0x66, 0x4f, 0x39, 0x08, - 0x79, 0x9a, 0x41, 0x56, 0xc9, 0x64, 0x32, 0xe4, 0xf8, 0xcf, 0x6a, 0xd1, 0x0e, 0xfc, 0x24, 0xc1, - 0xab, 0xb1, 0x7a, 0xa1, 0xf0, 0xe5, 0x74, 0xed, 0x7a, 0xc6, 0xdc, 0xc9, 0x89, 0x29, 0x93, 0x0c, - 0xf3, 0x28, 0xb9, 0x9a, 0x05, 0x33, 0xf9, 0x41, 0x82, 0x81, 0xc8, 0xb6, 0xa4, 0x4e, 0xec, 0xc3, - 0xfe, 0x29, 0x75, 0x62, 0x1f, 0x71, 0x42, 0xdd, 0xc6, 0x4f, 0xe0, 0x51, 0x97, 0xff, 0x3e, 0xa8, - 0x35, 0xd1, 0x86, 0xb5, 0x0e, 0x6e, 0xf4, 0xf9, 0xb9, 0x67, 0x7b, 0x25, 0xe9, 0xf9, 0x5e, 0x49, - 0xfa, 0x7b, 0xaf, 0x24, 0x7d, 0xbd, 0x5f, 0xea, 0x7b, 0xbe, 0x5f, 0xea, 0xfb, 0x63, 0xbf, 0xd4, - 0xf7, 0xf1, 0x58, 0xdd, 0xf0, 0x37, 0x83, 0x75, 0xb5, 0x6a, 0x37, 0xe2, 0x95, 0x77, 0xa2, 0xda, - 0xfe, 0xae, 0x43, 0xbd, 0xf5, 0x7e, 0xf6, 0xbb, 0xe3, 0xcd, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, - 0xc1, 0x80, 0xec, 0xd3, 0xb6, 0x15, 0x00, 0x00, + // 1335 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdf, 0x6f, 0xdb, 0xd4, + 0x17, 0xaf, 0x93, 0xb5, 0x6b, 0xcf, 0xbe, 0x95, 0xbe, 0xdc, 0x65, 0x25, 0xb3, 0x4a, 0x98, 0xcc, + 0xfa, 0x6b, 0x2b, 0xf6, 0x9a, 0x55, 0xd5, 0xc4, 0xca, 0xa4, 0x76, 0xdd, 0xba, 0x8e, 0x8a, 0x75, + 0x19, 0xe5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 0x22, 0x5f, 0x4b, 0x70, 0x1e, + 0x05, 0x35, 0x49, 0x2a, 0x3c, 0xaa, 0xd2, 0xe5, 0x6b, 0x69, 0x4c, 0x11, 0x95, 0xc6, 0x50, 0x4d, + 0x91, 0x89, 0x78, 0x54, 0x5c, 0xa0, 0xb5, 0x63, 0xfa, 0x51, 0x02, 0x38, 0x94, 0xc6, 0x24, 0x89, + 0x83, 0x63, 0x72, 0x5c, 0x7e, 0x3b, 0xa5, 0x35, 0x82, 0x9b, 0x67, 0xe0, 0xe6, 0xc8, 0x6c, 0x3c, + 0xb8, 0x1a, 0xf5, 0x37, 0xc4, 0xf7, 0x10, 0xa0, 0xd6, 0xe4, 0x98, 0x5b, 0xe4, 0x37, 0x09, 0x86, + 0x23, 0xfa, 0x90, 0x68, 0x09, 0xe9, 0xe3, 0xa4, 0xac, 0x7c, 0x23, 0xbd, 0x03, 0x42, 0x2e, 0x31, + 0xc8, 0xab, 0xe4, 0x61, 0x3c, 0xe4, 0x1d, 0xe6, 0x94, 0x80, 0x5a, 0x6b, 0x8a, 0x83, 0xd0, 0xd2, + 0x9a, 0xec, 0xa7, 0xda, 0x22, 0x5f, 0x66, 0x40, 0x59, 0x4f, 0xa1, 0x38, 0x92, 0xc9, 0x4d, 0x2d, + 0xe5, 0xe4, 0x07, 0xa7, 0x0f, 0x84, 0x6c, 0xac, 0x32, 0x36, 0xee, 0x93, 0xa5, 0x78, 0x36, 0xd2, + 0xfd, 0x9b, 0xd7, 0x9a, 0x6c, 0x56, 0xb5, 0xc8, 0x67, 0x19, 0x18, 0xeb, 0x9e, 0x7c, 0xc1, 0x34, + 0x13, 0xa9, 0xe8, 0x45, 0xd5, 0x26, 0x52, 0xd1, 0x93, 0x40, 0x55, 0x96, 0x18, 0x15, 0x77, 0xc8, + 0xfc, 0x69, 0xa8, 0x20, 0x2f, 0x25, 0x18, 0x89, 0xd7, 0x19, 0xe4, 0x76, 0x97, 0xdf, 0x56, 0x92, + 0xca, 0x92, 0xe7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 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, 0xaf, + 0x78, 0x5e, 0x80, 0xe6, 0x15, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2107,6 +2116,11 @@ func (m *QueryGetPairingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.BlockOfNextPairing != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlockOfNextPairing)) + i-- + dAtA[i] = 0x28 + } if m.SpecLastUpdatedBlock != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.SpecLastUpdatedBlock)) i-- @@ -2880,6 +2894,9 @@ func (m *QueryGetPairingResponse) Size() (n int) { if m.SpecLastUpdatedBlock != 0 { n += 1 + sovQuery(uint64(m.SpecLastUpdatedBlock)) } + if m.BlockOfNextPairing != 0 { + n += 1 + sovQuery(uint64(m.BlockOfNextPairing)) + } return n } @@ -3893,6 +3910,25 @@ func (m *QueryGetPairingResponse) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockOfNextPairing", wireType) + } + m.BlockOfNextPairing = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockOfNextPairing |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From f87d50ecef841f3c2d24c75d863ef51da628aa96 Mon Sep 17 00:00:00 2001 From: oren-lava Date: Sun, 22 Jan 2023 12:23:11 +0200 Subject: [PATCH 3/3] CNS-239: added nextPairingBlock check in unit test --- x/pairing/keeper/pairing_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/x/pairing/keeper/pairing_test.go b/x/pairing/keeper/pairing_test.go index b23d10cfda..5accb7d203 100644 --- a/x/pairing/keeper/pairing_test.go +++ b/x/pairing/keeper/pairing_test.go @@ -157,8 +157,11 @@ func TestGetPairing(t *testing.T) { // Get epochBlocksOverlap overlapBlocks := ts.keepers.Pairing.EpochBlocksOverlap(sdk.UnwrapSDKContext(ts.ctx)) + // calculate the block in which the next pairing will happen (+overlap) + nextPairingBlock := nextEpochStart + overlapBlocks + // Get number of blocks from the current block to the next epoch - blocksUntilNewEpoch := nextEpochStart + overlapBlocks - uint64(sdk.UnwrapSDKContext(ts.ctx).BlockHeight()) + blocksUntilNewEpoch := nextPairingBlock - uint64(sdk.UnwrapSDKContext(ts.ctx).BlockHeight()) // Calculate the time left for the next pairing in seconds (blocks left * avg block time) timeLeftToNextPairing := blocksUntilNewEpoch * averageBlockTime @@ -172,6 +175,9 @@ func TestGetPairing(t *testing.T) { // we've used a smaller blocktime some of the time -> averageBlockTime from get-pairing is smaller than the averageBlockTime calculated in this test require.Less(t, pairing.TimeLeftToNextPairing, timeLeftToNextPairing) } + + // verify nextPairingBlock + require.Equal(t, nextPairingBlock, pairing.BlockOfNextPairing) } })