Skip to content

Commit

Permalink
Problem: no access to ctx params in precompile (#383)
Browse files Browse the repository at this point in the history
* Problem: no access to ctx params in precompile

* Update CHANGELOG.md

Signed-off-by: mmsqe <mavis@crypto.com>

---------

Signed-off-by: mmsqe <mavis@crypto.com>
  • Loading branch information
mmsqe authored and fbac committed Jul 18, 2024
1 parent ede500e commit d947584
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (ante) [#1717](https://github.com/evmos/ethermint/pull/1717) Reuse sender recovery result.
- (cli) [#246](https://github.com/crypto-org-chain/ethermint/pull/246) Call app.Close to cleanup resource on graceful shutdown.
- (precompile) [#380](https://github.com/crypto-org-chain/ethermint/pull/380) Allow init precompiled contract with rules when new evm.
- (statedb) [#359](https://github.com/crypto-org-chain/ethermint/pull/359) Add `CacheContext` method to StateDB, to support efficient read-only native actions.
- (evm) [#343](https://github.com/crypto-org-chain/ethermint/pull/343) Add native event converter APIs.

- (precompile) [#383](https://github.com/crypto-org-chain/ethermint/pull/383) Allow init precompiled contract with ctx.

## [v0.21.0] - 2023-01-26

Expand Down
4 changes: 2 additions & 2 deletions x/evm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import (
"github.com/evmos/ethermint/x/evm/types"
)

// CustomContractFn defines a custom precompiled contract generator with rules and returns a precompiled contract.
type CustomContractFn func(params.Rules) vm.PrecompiledContract
// CustomContractFn defines a custom precompiled contract generator with ctx, rules and returns a precompiled contract.
type CustomContractFn func(sdk.Context, params.Rules) vm.PrecompiledContract

type EventConverter = func([]abci.EventAttribute) []*ethtypes.Log

Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (k *Keeper) NewEVM(
active = append(active, addr)
}
for _, fn := range k.customContractFns {
c := fn(rules)
c := fn(ctx, rules)
addr := c.Address()
contracts[addr] = c
active = append(active, addr)
Expand Down

0 comments on commit d947584

Please sign in to comment.