Skip to content

Commit e07bfc1

Browse files
refactor: make erc20keeper optional in x/vm (#609)
* imp: make erc20keeper optional in x/vm * add changelog --------- Co-authored-by: Vlad J <[email protected]>
1 parent 19b82ce commit e07bfc1

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- [\#582](https://github.com/cosmos/evm/pull/582) Add block max-gas (from genesis.json) and new min-tip (from app.toml/flags) ingestion into mempool config
3131
- [\#598](https://github.com/cosmos/evm/pull/598) Reduce number of times CreateQueryContext in mempool.
3232
- [\#606](https://github.com/cosmos/evm/pull/606) Regenerate mock file for bank keeper related test.
33+
- [\#609](https://github.com/cosmos/evm/pull/609) Make `erc20Keeper` optional in the EVM keeper
3334
- [\#624](https://github.com/cosmos/evm/pull/624) Cleanup unnecessary `fix-revert-gas-refund-height`.
3435
- [\#635](https://github.com/cosmos/evm/pull/635) Move DefaultStaticPrecompiles to /evm and allow projects to set it by default alongside the keeper.
3536

x/vm/keeper/keeper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ type Keeper struct {
5959
stakingKeeper types.StakingKeeper
6060
// fetch EIP1559 base fee and parameters
6161
feeMarketWrapper *wrappers.FeeMarketWrapper
62-
// erc20Keeper interface needed to instantiate erc20 precompiles
62+
// optional erc20Keeper interface needed to instantiate erc20 precompiles
6363
erc20Keeper types.Erc20Keeper
6464
// consensusKeeper is used to get consensus params during query contexts.
6565
// This is needed as block.gasLimit is expected to be available in eth_call, which is routed through Cosmos SDK's

x/vm/keeper/precompiles.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ func (k *Keeper) GetPrecompileInstance(
3333
}, found, nil
3434
}
3535

36+
// Since erc20Keeper is optional, we check if it is nil, in which case we just return that we didn't find the precompile
37+
if k.erc20Keeper == nil {
38+
return nil, false, nil
39+
}
40+
3641
// Get the precompile from the dynamic precompiles
3742
precompile, found, err := k.erc20Keeper.GetERC20PrecompileInstance(ctx, address)
3843
if err != nil || !found {

0 commit comments

Comments
 (0)