From 526f500407fa748cd62056d260d7e1095c371f68 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 12 Apr 2024 23:00:25 +0800 Subject: [PATCH 1/4] fix(x/epochs): avoid invalid epoch duration in simulation for more info, https://github.com/cosmos/cosmos-sdk/actions/runs/8663743427/job/23758527794?pr=20028 --- CHANGELOG.md | 1 + x/epochs/simulation/genesis.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 084c8a8e6502..2a6bec78d5c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,6 +114,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * [#19851](https://github.com/cosmos/cosmos-sdk/pull/19851) Fix some places in which we call Remove inside a Walk (x/staking and x/gov). * (baseapp) [#19970](https://github.com/cosmos/cosmos-sdk/pull/19970) Fix default config values to use no-op mempool as default. * (x/bank) [#20028](https://github.com/cosmos/cosmos-sdk/pull/20028) Align query with multi denoms for send-enabled. +* (simulation) [#](https://github.com/cosmos/cosmos-sdk/pull/) Avoid invalid epoch duration in x/epochs simulation. ### API Breaking Changes diff --git a/x/epochs/simulation/genesis.go b/x/epochs/simulation/genesis.go index 98993af2672e..87c8b6ea1a9f 100644 --- a/x/epochs/simulation/genesis.go +++ b/x/epochs/simulation/genesis.go @@ -14,7 +14,7 @@ import ( // GenCommunityTax randomized CommunityTax func GenDuration(r *rand.Rand) time.Duration { - return time.Hour * time.Duration(r.Intn(168)) // limit 1 week + return time.Hour * time.Duration(r.Intn(167)+1) // between 1 hour to 1 week } func RandomizedEpochs(r *rand.Rand) []types.EpochInfo { From c212974fe627a538dc98665379659f4889717422 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 12 Apr 2024 23:01:26 +0800 Subject: [PATCH 2/4] update doc --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a6bec78d5c2..a5a6b38a4cf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,7 +114,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * [#19851](https://github.com/cosmos/cosmos-sdk/pull/19851) Fix some places in which we call Remove inside a Walk (x/staking and x/gov). * (baseapp) [#19970](https://github.com/cosmos/cosmos-sdk/pull/19970) Fix default config values to use no-op mempool as default. * (x/bank) [#20028](https://github.com/cosmos/cosmos-sdk/pull/20028) Align query with multi denoms for send-enabled. -* (simulation) [#](https://github.com/cosmos/cosmos-sdk/pull/) Avoid invalid epoch duration in x/epochs simulation. +* (simulation) [#20030](https://github.com/cosmos/cosmos-sdk/pull/20030) Avoid invalid epoch duration in x/epochs simulation. ### API Breaking Changes From cd39b88b9059c47519c84734ffb76d69864b8ffb Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 12 Apr 2024 23:13:33 +0800 Subject: [PATCH 3/4] Apply suggestions from code review --- x/epochs/simulation/genesis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/epochs/simulation/genesis.go b/x/epochs/simulation/genesis.go index 87c8b6ea1a9f..c236faacbb8a 100644 --- a/x/epochs/simulation/genesis.go +++ b/x/epochs/simulation/genesis.go @@ -14,7 +14,7 @@ import ( // GenCommunityTax randomized CommunityTax func GenDuration(r *rand.Rand) time.Duration { - return time.Hour * time.Duration(r.Intn(167)+1) // between 1 hour to 1 week + return time.Hour * time.Duration(r.Intn(168)+1) // between 1 hour to 1 week } func RandomizedEpochs(r *rand.Rand) []types.EpochInfo { From a2cb4e57ce69e95a7d57407d46bf010afbc8f937 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 12 Apr 2024 23:42:59 +0800 Subject: [PATCH 4/4] Apply suggestions from code review --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5a6b38a4cf9..084c8a8e6502 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,7 +114,6 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * [#19851](https://github.com/cosmos/cosmos-sdk/pull/19851) Fix some places in which we call Remove inside a Walk (x/staking and x/gov). * (baseapp) [#19970](https://github.com/cosmos/cosmos-sdk/pull/19970) Fix default config values to use no-op mempool as default. * (x/bank) [#20028](https://github.com/cosmos/cosmos-sdk/pull/20028) Align query with multi denoms for send-enabled. -* (simulation) [#20030](https://github.com/cosmos/cosmos-sdk/pull/20030) Avoid invalid epoch duration in x/epochs simulation. ### API Breaking Changes