Skip to content

Conversation

vladjdk
Copy link
Member

@vladjdk vladjdk commented Sep 24, 2025

closes: #617

todos for this PR before close:

  • migration guide addition
  • changelog entry

consolidates these constants into one file in /config
the test was using a duplicate eips multiplier value instead of the global one moved to config
app options is removed from new app creation.

however, we're getting a recovered panic on *restarting* the chain due to prepareproposal running before preblocker:

+0x120\ngithub.202132.xyz/cosmos/cosmos-sdk/baseapp.(*BaseApp).PrepareProposal.func1()\n\tgithub.202132.xyz/cosmos/[email protected]/baseapp/abci.go:433 +0x38\npanic({0x1061c8160?, 0x10912faa0?})\n\truntime/panic.go:783 +0x120\ngithub.202132.xyz/cosmos/evm/x/vm/types.GetEVMCoinDecimals(...)\n\tgithub.202132.xyz/cosmos/[email protected]/x/vm/types/denom_config.go:61\ngithub.202132.xyz/cosmos/evm/x/vm/types.ConvertAmountTo18DecimalsLegacy(...)\n\tgithub.202132.xyz/cosmos/[email protected]/x/vm/types/scaling.go:17\ngithub.202132.xyz/cosmos/evm/x/vm/wrappers.FeeMarketWrapper.GetBaseFee({{_, _}}, {{0x10698a810, 0x109225540}, {0x1069b51c0, 0x14001f4c200}, {{0x0, 0x0}, {0x16dc0f689, 0x4}, ...}, ...})\n\tgithub.202132.xyz/cosmos/[email protected]/x/vm/wrappers/feemarket.go:38 +0x68\ngithub.202132.xyz/cosmos/evm/x/vm/keeper.Keeper.GetBaseFee({{0x1069b4890, 0x14001eddeb0}, {0x10695e0b0, 0x14003560450}, {0x10695e240, 0x14003560490}, 0x140035637a0, {0x1400189d3e0, 0x14, 0x20}, ...}, ...)\n\tgithub.202132.xyz/cosmos/[email protected]/x/vm/keeper/keeper.go:355 +0xe4\ngithub.202132.xyz/cosmos/evm/mempool.(*ExperimentalEVMMempool).getIterators(0x14003cbd180, {0x10698a848?, 0x14002c39c08?}, {0x109225540, 0x0, 0x0})\n\tgithub.202132.xyz/cosmos/[email protected]/mempool/mempool.go:439 +0x20c\ngithub.202132.xyz/cosmos/evm/mempool.(*ExperimentalEVMMempool).SelectBy(0x14003cbd180, {0x10698a848?, 0x14002c39c08?}, {0x109225540?, 0x14000085ce8?, 0x104cce034?}, 0x140044cd540)\n\tgithub.202132.xyz/cosmos/[email protected]/mempool/mempool.go:370 +0xe0\ngithub.202132.xyz/cosmos/cosmos-sdk/types/mempool.SelectBy({0x10698a848?, 0x14002c39c08?}, {0x10698b108?, 0x14003cbd180?}, {0x109225540?, 0x0?, 0x0?}, 0x140044cd540)\n\tgithub.202132.xyz/cosmos/[email protected]/types/mempool/mempool.go:58 +0xa0\ngithub.202132.xyz/cosmos/evm/evmd.NewExampleApp.(*DefaultProposalHandler).PrepareProposalHandler.func3({{0x10698a810, 0x109225540}, {0x1069b51c0, 0x14001f4c200}, {{0x0, 0x0}, {0x16dc0f689, 0x4}, 0xd, {0x3507e5b0, ...}, ...}, ...}, ...)\n\tgithub.202132.xyz/cosmos/[email protected]/baseapp/abci_utils.go:294 +0x250\ngithub.202132.xyz/cosmos/cosmos-sdk/baseapp.(*BaseApp).PrepareProposal(0x14002d32488, 0x140015f42c0)\n\tgithub.202132.xyz/cosmos/[email protected]/baseapp/abci.go:439
the mempool needed the global variable, but that wasn't set, so we set it in the vm keeper storage and use it from there in the mempool

everything else still uses the global variable, but we now have a foundation to move it over to the state storage
we were getting the 6 decimal balance when we were operating in 18-balance territory. now that we have a separation in the ibc tests, we should check balances accordingly
@vladjdk vladjdk force-pushed the vlad/remove-app-options branch from 1b76be4 to b9fb2a7 Compare September 25, 2025 19:05
configurator.ResetTestConfig()
err := configurator.
WithChainConfig(chainConfig).
err := evmtypes.SetChainConfig(chainConfig)

Check warning

Code scanning / CodeQL

Unreachable statement Warning test

This statement is unreachable.

Copilot Autofix

AI about 13 hours ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

configurator.ResetTestConfig()
err := configurator.
WithChainConfig(chainConfig).
err := types.SetChainConfig(chainConfig)

Check warning

Code scanning / CodeQL

Unreachable statement Warning test

This statement is unreachable.

Copilot Autofix

AI 1 day ago

The best way to fix this problem is to remove the unreachable statement. Since CodeQL reports the line err := types.SetChainConfig(chainConfig) as unreachable, the fix is to delete this line, as it cannot execute in the current control flow. The edit should be constrained to the region starting on line 1607 within the function-literal block for the test case titled "pass - nil Base Fee when london hardfork not activated". No other changes are necessary if no code depends on the value of err further down in this block (verified here).

Suggested changeset 1
tests/integration/x/vm/test_grpc_query.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/integration/x/vm/test_grpc_query.go b/tests/integration/x/vm/test_grpc_query.go
--- a/tests/integration/x/vm/test_grpc_query.go
+++ b/tests/integration/x/vm/test_grpc_query.go
@@ -1604,7 +1604,6 @@
 
 				configurator := types.NewEVMConfigurator()
 				configurator.ResetTestConfig()
-				err := types.SetChainConfig(chainConfig)
 				s.Require().NoError(err)
 				err = configurator.
 					WithEVMCoinInfo(testconstants.ExampleChainCoinInfo[testconstants.ExampleChainID]).
EOF
@@ -1604,7 +1604,6 @@

configurator := types.NewEVMConfigurator()
configurator.ResetTestConfig()
err := types.SetChainConfig(chainConfig)
s.Require().NoError(err)
err = configurator.
WithEVMCoinInfo(testconstants.ExampleChainCoinInfo[testconstants.ExampleChainID]).
Copilot is powered by AI and may make mistakes. Always verify output.
s.Require().NoError(s.Network.NextBlock())
configurator := types.NewEVMConfigurator()
configurator.ResetTestConfig()
err = types.SetChainConfig(chainConfig)

Check warning

Code scanning / CodeQL

Unreachable statement Warning test

This statement is unreachable.

Copilot Autofix

AI 1 day ago

To fix the unreachable statement, we should ensure that test cleanup/configuration code (such as resetting global configuration with SetChainConfig and configurator.Configure()) is reliably executed regardless of whether earlier Require() assertions pass or fail. The best way is to move these statements into a defer block at the start of the subtest invocation function. This way, cleanup is run even if an assertion fails.

Specifically, inside the subtest closure (the argument to s.Run(tc.name, func() {...})), move the configurator reset logic and the SetChainConfig call into a single defer block placed at the very beginning of the closure. This requires no new imports, only restructuring of existing code.

Suggested changeset 1
tests/integration/x/vm/test_grpc_query.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/integration/x/vm/test_grpc_query.go b/tests/integration/x/vm/test_grpc_query.go
--- a/tests/integration/x/vm/test_grpc_query.go
+++ b/tests/integration/x/vm/test_grpc_query.go
@@ -1642,6 +1642,17 @@
 
 	for _, tc := range testCases {
 		s.Run(tc.name, func() {
+			// Always run configurator reset/SetChainConfig on subtest exit
+			defer func() {
+				configurator := types.NewEVMConfigurator()
+				configurator.ResetTestConfig()
+				err := types.SetChainConfig(chainConfig)
+				s.Require().NoError(err)
+				err = configurator.
+					WithEVMCoinInfo(coinInfo).
+					Configure()
+				s.Require().NoError(err)
+			}()
 			// Set necessary params
 			tc.setParams()
 			// Get the expected response
@@ -1659,14 +1670,6 @@
 				s.Require().Error(err)
 			}
 			s.Require().NoError(s.Network.NextBlock())
-			configurator := types.NewEVMConfigurator()
-			configurator.ResetTestConfig()
-			err = types.SetChainConfig(chainConfig)
-			s.Require().NoError(err)
-			err = configurator.
-				WithEVMCoinInfo(coinInfo).
-				Configure()
-			s.Require().NoError(err)
 		})
 	}
 }
EOF
@@ -1642,6 +1642,17 @@

for _, tc := range testCases {
s.Run(tc.name, func() {
// Always run configurator reset/SetChainConfig on subtest exit
defer func() {
configurator := types.NewEVMConfigurator()
configurator.ResetTestConfig()
err := types.SetChainConfig(chainConfig)
s.Require().NoError(err)
err = configurator.
WithEVMCoinInfo(coinInfo).
Configure()
s.Require().NoError(err)
}()
// Set necessary params
tc.setParams()
// Get the expected response
@@ -1659,14 +1670,6 @@
s.Require().Error(err)
}
s.Require().NoError(s.Network.NextBlock())
configurator := types.NewEVMConfigurator()
configurator.ResetTestConfig()
err = types.SetChainConfig(chainConfig)
s.Require().NoError(err)
err = configurator.
WithEVMCoinInfo(coinInfo).
Configure()
s.Require().NoError(err)
})
}
}
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Contributor

@cloudgray cloudgray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, LGTM — I just left a few minor comments and questions.

It’s nice and clean now that CoinInfo is being stored in the Keeper.

@vladjdk vladjdk added this pull request to the merge queue Oct 9, 2025
Merged via the queue into main with commit 18163be Oct 9, 2025
23 checks passed
@vladjdk vladjdk deleted the vlad/remove-app-options branch October 9, 2025 16:09
@almk-dev almk-dev restored the vlad/remove-app-options branch October 9, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fully remove app.go configurators
4 participants