From 4f787cd3e47c45286a3eaccc9bd11421a10c9dab Mon Sep 17 00:00:00 2001 From: mmsqe Date: Thu, 9 Mar 2023 19:06:23 +0800 Subject: [PATCH] feat: add extend cb to avoid unmarshal state twice for sim test (backport: #15305) (#15321) --- CHANGELOG.md | 1 + types/simulation/types.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de3b29d16f77..5bb872ae1dc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog ## [Unreleased] +* (simapp) [#15305](https://github.com/cosmos/cosmos-sdk/pull/15305) Add `AppStateFnWithExtendedCb` with callback function to extend rawState. ## [v0.46.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.11) - 2022-03-03 diff --git a/types/simulation/types.go b/types/simulation/types.go index 2d6851394dfb..4759bba8e58c 100644 --- a/types/simulation/types.go +++ b/types/simulation/types.go @@ -193,6 +193,11 @@ type AppStateFn func(r *rand.Rand, accs []Account, config Config) ( appState json.RawMessage, accounts []Account, chainId string, genesisTimestamp time.Time, ) +// AppStateFnWithExtendedCb returns the app state json bytes and the genesis accounts +type AppStateFnWithExtendedCb func(r *rand.Rand, accs []Account, config Config) ( + appState json.RawMessage, accounts []Account, chainId string, genesisTimestamp time.Time, +) + // RandomAccountFn returns a slice of n random simulation accounts type RandomAccountFn func(r *rand.Rand, n int) []Account