Skip to content

Commit f9cdf28

Browse files
committed
fix: check all EVM coin info fields before returning set errors
1 parent 027c24f commit f9cdf28

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

x/vm/types/denom_config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ func GetEVMCoinDisplayDenom() string {
9797

9898
// setEVMCoinInfo allows to define denom and decimals of the coin used in the EVM.
9999
func setEVMCoinInfo(eci EvmCoinInfo) error {
100-
if evmCoinInfo != nil {
100+
if evmCoinInfo != nil && (evmCoinInfo.Denom != eci.Denom ||
101+
evmCoinInfo.ExtendedDenom != eci.ExtendedDenom ||
102+
evmCoinInfo.DisplayDenom != eci.DisplayDenom ||
103+
evmCoinInfo.Decimals != eci.Decimals) {
101104
return errors.New("EVM coin info already set")
102105
}
103106

x/vm/types/denom_config_testing.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ func GetEVMCoinDisplayDenom() string {
8484

8585
// setTestingEVMCoinInfo allows to define denom and decimals of the coin used in the EVM.
8686
func setTestingEVMCoinInfo(eci EvmCoinInfo) error {
87-
if testingEvmCoinInfo != nil {
87+
if testingEvmCoinInfo != nil && (testingEvmCoinInfo.Denom != eci.Denom ||
88+
testingEvmCoinInfo.ExtendedDenom != eci.ExtendedDenom ||
89+
testingEvmCoinInfo.DisplayDenom != eci.DisplayDenom ||
90+
testingEvmCoinInfo.Decimals != eci.Decimals) {
8891
return errors.New("testing EVM coin info already set. Make sure you run the configurator's ResetTestConfig before trying to set a new evm coin info")
8992
}
9093

0 commit comments

Comments
 (0)