Skip to content

Commit 6a67161

Browse files
committed
override precompiles
1 parent e9dead4 commit 6a67161

File tree

2 files changed

+3
-29
lines changed

2 files changed

+3
-29
lines changed

x/vm/keeper/precompiles.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,3 @@ func (k *Keeper) GetPrecompilesCallHook(ctx sdktypes.Context) types.CallHook {
7171
return nil
7272
}
7373
}
74-
75-
// GetPrecompileRecipientCallHook returns a closure that can be used to instantiate the EVM with a specific
76-
// recipient from precompiles.
77-
func (k *Keeper) GetPrecompileRecipientCallHook(ctx sdktypes.Context) types.CallHook {
78-
return func(evm *vm.EVM, _ common.Address, recipient common.Address) error {
79-
// Check if the recipient is a precompile contract and if so, load the precompile instance
80-
_, found, err := k.GetPrecompileInstance(ctx, recipient)
81-
if err != nil {
82-
return err
83-
}
84-
85-
// If the precompile instance is created, we have to update the EVM with
86-
// only the recipient precompile and add it's address to the access list.
87-
if found {
88-
evm.StateDB.AddAddressToAccessList(recipient)
89-
}
90-
91-
return nil
92-
}
93-
}

x/vm/keeper/state_transition.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,9 @@ func (k *Keeper) NewEVMWithOverridePrecompiles(
7373
evmHooks.AddCallHooks(
7474
accessControl.GetCallHook(signer),
7575
)
76-
if overridePrecompiles {
77-
evmHooks.AddCallHooks(
78-
k.GetPrecompilesCallHook(ctx),
79-
)
80-
} else {
81-
evmHooks.AddCallHooks(
82-
k.GetPrecompileRecipientCallHook(ctx),
83-
)
84-
}
76+
evmHooks.AddCallHooks(
77+
k.GetPrecompilesCallHook(ctx),
78+
)
8579
return vm.NewEVMWithHooks(evmHooks, blockCtx, txCtx, stateDB, ethCfg, vmConfig)
8680
}
8781

0 commit comments

Comments
 (0)