Skip to content

Commit

Permalink
fix: force revert (#603)
Browse files Browse the repository at this point in the history
Co-authored-by: nulnut <[email protected]>
  • Loading branch information
zakir-code and nulnut authored Jul 30, 2024
1 parent 2c20233 commit 68d31a6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Change log

## [v6.1.0]

* Fix: precompile contract revert issue

---

## [v6.0.0]

### Features
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,5 @@ replace (
// use for precompile
replace (
github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc1
github.com/evmos/ethermint => github.com/functionx/ethermint v0.22.0-fxcore-precompile-rc2
github.com/evmos/ethermint => github.com/functionx/ethermint v0.22.0-fxcore-precompile-rc2.0.20240701110919-286276c8a9bd
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/functionx/ethermint v0.22.0-fxcore-precompile-rc2 h1:Nd8qs+f/z9QFDYa2gEM9Hobq+0jCEYMMO+YBXj8FsQo=
github.com/functionx/ethermint v0.22.0-fxcore-precompile-rc2/go.mod h1:56iaMZDPOeBb1CA219jbZ8PttNFj/yrGKDqljLDSn64=
github.com/functionx/ethermint v0.22.0-fxcore-precompile-rc2.0.20240701110919-286276c8a9bd h1:tZDGwwYhAqUlzCUIIeV/EOSV444yhCr73Y9AR0yBGsE=
github.com/functionx/ethermint v0.22.0-fxcore-precompile-rc2.0.20240701110919-286276c8a9bd/go.mod h1:56iaMZDPOeBb1CA219jbZ8PttNFj/yrGKDqljLDSn64=
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
Expand Down
5 changes: 5 additions & 0 deletions x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context,
temporaryGasUsed := msg.Gas() - leftoverGas
leftoverGas += evmkeeper.GasToRefund(stateDB.GetRefund(), temporaryGasUsed, refundQuotient)

// force revert error
if vmErr == nil && stateDB.ForceRevert() {
vmErr = types.ErrExecutionForceReverted
}

// EVM execution error needs to be available for the JSON-RPC client
var vmError string
if vmErr != nil {
Expand Down

0 comments on commit 68d31a6

Please sign in to comment.