From 019ecf118b7bbb9328a7a0c2e8d523bec8964548 Mon Sep 17 00:00:00 2001 From: Brandon Weng <18161326+BrandonWeng@users.noreply.github.com> Date: Sat, 20 May 2023 00:27:48 -0400 Subject: [PATCH 1/3] Clear cache --- app/app.go | 4 ++++ x/dex/cache/cache.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 25a194503c..4a997b56e1 100644 --- a/app/app.go +++ b/app/app.go @@ -1195,6 +1195,7 @@ func (app *App) ProcessTxs( dependencyDag.BlockingSignalsMap, dependencyDag.TxMsgAccessOpMapping, ) + oldDexMemState := dexutils.GetMemState(ctx.Context()).DeepCopy() if ok { // Write the results back to the concurrent contexts - if concurrent execution fails, // this should not be called and the state is rolled back and retried with synchronous execution @@ -1207,6 +1208,9 @@ func (app *App) ProcessTxs( // Clear the memcache context from the previous state as it failed, we no longer need to commit the data ctx.ContextMemCache().Clear() + oldDexMemStateCtx := context.WithValue(ctx.Context(), dexutils.DexMemStateContextKey, oldDexMemState) + ctx = ctx.WithContext(oldDexMemStateCtx) + txResults := app.ProcessBlockSynchronous(ctx, txs) processBlockCache.Write() return txResults, ctx diff --git a/x/dex/cache/cache.go b/x/dex/cache/cache.go index a14b643ac9..c1d70240ec 100644 --- a/x/dex/cache/cache.go +++ b/x/dex/cache/cache.go @@ -23,7 +23,7 @@ type MemState struct { } func NewMemState(storeKey sdk.StoreKey) *MemState { - contractsToProcess := datastructures.NewSyncSet[string]([]string{}) + contractsToProcess := datastructures.NewSyncSet([]string{}) return &MemState{ storeKey: storeKey, contractsToProcess: &contractsToProcess, From 8cbb3827283b8cadc6f24e2ee6dc4806f9e79dcb Mon Sep 17 00:00:00 2001 From: Brandon Weng <18161326+BrandonWeng@users.noreply.github.com> Date: Sat, 20 May 2023 00:34:46 -0400 Subject: [PATCH 2/3] Update app.go --- app/app.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/app.go b/app/app.go index 4a997b56e1..4450936ca5 100644 --- a/app/app.go +++ b/app/app.go @@ -1210,6 +1210,10 @@ func (app *App) ProcessTxs( oldDexMemStateCtx := context.WithValue(ctx.Context(), dexutils.DexMemStateContextKey, oldDexMemState) ctx = ctx.WithContext(oldDexMemStateCtx) + + dexMemState := dexutils.GetMemState(ctx.Context()) + dexMemState.Clear(ctx) + dexMemState.ClearContractToDependencies() txResults := app.ProcessBlockSynchronous(ctx, txs) processBlockCache.Write() From 2a19393cd6ccc0193bc26739c8e07343d387f5a0 Mon Sep 17 00:00:00 2001 From: Brandon Weng <18161326+BrandonWeng@users.noreply.github.com> Date: Sat, 20 May 2023 00:50:00 -0400 Subject: [PATCH 3/3] sd --- app/app.go | 2 +- x/oracle/simulation/operations.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/app.go b/app/app.go index 4450936ca5..f8d3e8b44c 100644 --- a/app/app.go +++ b/app/app.go @@ -1210,7 +1210,7 @@ func (app *App) ProcessTxs( oldDexMemStateCtx := context.WithValue(ctx.Context(), dexutils.DexMemStateContextKey, oldDexMemState) ctx = ctx.WithContext(oldDexMemStateCtx) - + dexMemState := dexutils.GetMemState(ctx.Context()) dexMemState.Clear(ctx) dexMemState.ClearContractToDependencies() diff --git a/x/oracle/simulation/operations.go b/x/oracle/simulation/operations.go index 2028e73625..3988c4b164 100644 --- a/x/oracle/simulation/operations.go +++ b/x/oracle/simulation/operations.go @@ -65,7 +65,7 @@ func WeightedOperations( } // SimulateMsgAggregateExchangeRateVote generates a MsgAggregateExchangeRateVote with random values. -// nolint: funlen +//nolint: funlen func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, @@ -122,7 +122,7 @@ func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankK } // SimulateMsgDelegateFeedConsent generates a MsgDelegateFeedConsent with random values. -// nolint: funlen +//nolint: funlen func SimulateMsgDelegateFeedConsent(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,