From d3523702043261d0ed416a1d9a275a948d3e85d3 Mon Sep 17 00:00:00 2001 From: insumity Date: Thu, 7 Mar 2024 16:19:51 +0100 Subject: [PATCH] feat!: introduce epochs (#1660) * cleanup ./changelog entries * rebase * fix!: Validation of SlashAcks fails due to marshaling to Bech32 (backport #1570) (#1577) fix!: Validation of SlashAcks fails due to marshaling to Bech32 (#1570) * add different Bech32Prefix for consumer and provider * separate app encoding and params * remove ConsumerValPubKey from ValidatorConfig * update addresses in tests * make SlashAcks consistent across chains * add comments for clarity * Regenerate traces * Fix argument order * set bech32prefix for provider to cosmos * add changelog entries * add consumer-double-downtime e2e test * update nightly-e2e workflow * fix typo * add consumer-double-downtime to testConfigs * remove changes on provider * skip invalid SlashAcks * seal the config * clear the outstanding downtime flag for new vals * add info on upgrading to v4.0.0 * fix upgrade handler * fix changeover e2e test * Update tests/e2e/config.go Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * Update tests/e2e/config.go Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * add AccountPrefix to ChainConfig * fix docstrings * update AccountAddressPrefix in app.go * fix consumer-misb e2e test --------- Co-authored-by: Philip Offtermatt Co-authored-by: Simon Noetzlin Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> (cherry picked from commit 86046926502f7b0ba795bebcdd1fdc97ac776573) Co-authored-by: Marius Poke * docs: update changelog for v4.0.0 (#1578) update changelog * docs: prepare for v4.0.0 (#1581) * unclog build * update release notes * update release date * added proto declaration * temp commit * temp commit * more changes * first commit * add param and fix tests * reduce epoch size for e2e * clean up * mbt fix * fix diff bug * cleaning up * cleaning up * cleaning up * cleaning up * cleaning up * cleaning up * added more tests * more fixes * nit fixes * cleaning up * increase downtime by one block * fix logs * took into account Marius' comments * tiny fixes * Update x/ccv/provider/keeper/params.go Co-authored-by: Simon Noetzlin * use Bech32 addresses as keys for maps * refactor nextBlocks(epoch) to nextEpoch * fixed comment * Remove new block creation during consumer chain setup * Revert "Remove new block creation during consumer chain setup" This reverts commit 85a52b74c1998dfebadfedbf287c9c9547cfec78. * added simple param test * added upper bound and addressed a comment * Add another edge case for diffing * used smarted solution (based on Philip's comment) for diffing validators * refactor!: remove key-assignment replacements (#1672) * initial commit * removed KeyAssignmentReplacementsKey * refactor: simplify key-assignment logic (#1684) * fixed typo: depreciated to deprecated --------- Co-authored-by: Marius Poke * add the epoch param in the docs --------- Co-authored-by: mpoke Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Simon Noetzlin Co-authored-by: Philip Offtermatt --- tests/mbt/driver/mbt_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index df748ea11f..ebc24e4197 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -198,6 +198,12 @@ func RunItfTrace(t *testing.T, path string) { driver.endAndBeginBlock("provider", 1*time.Nanosecond) } + // set `BlocksPerEpoch` to 10: a reasonable small value greater than 1 that prevents waiting for too + // many blocks and slowing down the tests + providerParams := driver.providerKeeper().GetParams(driver.providerCtx()) + providerParams.BlocksPerEpoch = 10 + driver.providerKeeper().SetParams(driver.providerCtx(), providerParams) + // remember the time offsets to be able to compare times to the model // this is necessary because the system needs to do many steps to initialize the chains, // which is abstracted away in the model @@ -255,6 +261,7 @@ func RunItfTrace(t *testing.T, path string) { stats.numStartedChains += len(consumersToStart) stats.numStops += len(consumersToStop) +<<<<<<< HEAD // get the block height in the model modelHeight := ProviderHeight(currentModelState) @@ -282,6 +289,24 @@ func RunItfTrace(t *testing.T, path string) { UpdateProviderClientOnConsumer(t, driver, consumer.ChainId) } driver.endAndBeginBlock("provider", time.Duration(timeAdvancement)*time.Second-1*time.Nanosecond) +======= + // we need at least 2 blocks, because for a packet sent at height H, the receiving chain + // needs a header of height H+1 to accept the packet + // so, we do `blocksPerEpoch` time advancements with a very small increment, + // and then increment the rest of the time + runningConsumersBefore := driver.runningConsumers() + + // going through `blocksPerEpoch` blocks to take into account an epoch + blocksPerEpoch := driver.providerKeeper().GetBlocksPerEpoch(driver.providerCtx()) + for i := int64(0); i < blocksPerEpoch; i = i + 1 { + driver.endAndBeginBlock("provider", 1*time.Nanosecond) + } + for _, consumer := range driver.runningConsumers() { + UpdateProviderClientOnConsumer(t, driver, consumer.ChainId) + } + + driver.endAndBeginBlock("provider", time.Duration(timeAdvancement)*time.Second-time.Nanosecond*time.Duration(blocksPerEpoch)) +>>>>>>> adae28ee (feat!: introduce epochs (#1660)) runningConsumersAfter := driver.runningConsumers()