Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RPC): debug_traceCall #1

Open
wants to merge 57 commits into
base: feature/debug_tracecall-debug
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
291bfa0
Problem: redundant parse chainID from gensis when start server (#365)
mmsqe Oct 27, 2023
b37b69f
Problem: state overrides are not supported in eth_call (#369)
yihuang Oct 31, 2023
ffcb64d
Problem: state override not replacing the whole state (#370)
yihuang Nov 1, 2023
b9078ab
Problem: precompiles don't have access to statedb (#371)
yihuang Nov 1, 2023
dab9d62
Merge branch 'develop' of github.com:crypto-org-chain/ethermint into …
XinyuCRO Nov 2, 2023
e2839c5
fix: compile
XinyuCRO Nov 2, 2023
c4a2692
fix: remove debug parameter
XinyuCRO Nov 13, 2023
c33839f
chore: update geth
XinyuCRO Nov 13, 2023
63ff4a7
test: update test
XinyuCRO Nov 13, 2023
8b1ec23
Problem: subscription refactoring not merged (#375)
yihuang Nov 14, 2023
2e70c9d
fix: balance & nonce not correct in prestateTracer
XinyuCRO Nov 16, 2023
275a7a2
fix: TracerJSONConfig type is not correct
XinyuCRO Nov 16, 2023
411e641
fix: debug_traceTransaction integration tests
XinyuCRO Nov 17, 2023
3d99b09
tests: add bigramTracers integration tests
XinyuCRO Nov 17, 2023
6d0c272
tests: add more js tracers
XinyuCRO Nov 17, 2023
31ae03c
tests: add custom js tracers
XinyuCRO Nov 17, 2023
0857f84
wip: integration tests
XinyuCRO Nov 17, 2023
befc089
Merge branch 'develop' of github.com:crypto-org-chain/ethermint into …
XinyuCRO Nov 17, 2023
c5445fa
tests: add no gas limit call to debug_traceCall
XinyuCRO Nov 17, 2023
d8eef39
feat: add stateOverrides to debug_traceCall
XinyuCRO Nov 20, 2023
c89e579
chore: update geth
XinyuCRO Nov 21, 2023
4422ae8
Problem: statik bring big binary size diff (#378)
mmsqe Nov 22, 2023
6f3ad29
Problem: go-ethereum is not updated (#377)
mmsqe Nov 22, 2023
b3fcb10
Problem: bypass withdrawals root in get block test (#379)
mmsqe Nov 23, 2023
7ff5add
Merge branch 'develop' of github.com:crypto-org-chain/ethermint into …
XinyuCRO Nov 24, 2023
a391289
fix: bypass ExecutionReverted error early return, return correspondin…
XinyuCRO Nov 27, 2023
4feeb1d
tests: update tracer tests
XinyuCRO Nov 27, 2023
ebc71a0
Problem: no interface to set the chain config for precompile contract…
mmsqe Nov 30, 2023
ccb83e2
Problem: tracer config is not aligned with go-ethereum (#382)
mmsqe Dec 4, 2023
9f62598
Problem: no access to ctx params in precompile (#383)
mmsqe Dec 5, 2023
b779425
Merge branch 'develop' of github.com:crypto-org-chain/ethermint into …
XinyuCRO Dec 7, 2023
aaff96b
Problem: latest v1.11.x change is not included (#381)
mmsqe Dec 7, 2023
49048a6
Problem: unused cancel function in filter is not cleanup (#386) (#387)
mmsqe Dec 18, 2023
aff52db
Problem: no int64 check in error msg (#388) (#389)
mmsqe Dec 22, 2023
b7e8e25
Merge branch 'develop' of github.com:crypto-org-chain/ethermint into …
XinyuCRO Jan 3, 2024
7821453
chore: add missing changes
XinyuCRO Jan 3, 2024
0a1a705
test: fix debugTraceCall unit tests
XinyuCRO Jan 4, 2024
d47b0ea
chore: revert changes
XinyuCRO Jan 4, 2024
86fdf3f
fix: safeInt
XinyuCRO Jan 4, 2024
9ff1eb4
chore: remove unused code
XinyuCRO Jan 4, 2024
ce86161
chore: update comment
XinyuCRO Jan 4, 2024
77107a4
chore: lint
XinyuCRO Jan 4, 2024
da3082a
fix: lint
XinyuCRO Jan 4, 2024
5b9fc34
fix python lint
yihuang Jan 4, 2024
7a8a460
fix: tracer config
XinyuCRO Jan 4, 2024
8a93be0
test: fix integration tests
XinyuCRO Jan 4, 2024
f480d4a
Merge branch 'feature/debug_tracecall-debug' of github.com:XinyuCRO/e…
XinyuCRO Jan 4, 2024
d377b86
Update rpc/backend/backend.go
XinyuCRO Jan 4, 2024
9a4bd5e
Update rpc/backend/tracing.go
XinyuCRO Jan 4, 2024
b98c280
Update rpc/namespaces/ethereum/debug/api.go
XinyuCRO Jan 4, 2024
883865c
Update rpc/backend/tracing.go
XinyuCRO Jan 4, 2024
a1a5c44
Merge branch 'feature/debug_tracecall-debug' of github.com:XinyuCRO/e…
XinyuCRO Jan 4, 2024
6e7469b
fix: only update balance and nonce in tracing RPC calls
XinyuCRO Jan 4, 2024
a7113f7
fix isort
yihuang Jan 4, 2024
7299413
fix python lint
yihuang Jan 4, 2024
ae45b0b
python linter
yihuang Jan 4, 2024
236f193
fix unit test
yihuang Jan 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ jobs:
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
with:
name: ethermint
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (ante) [#310](https://github.com/crypto-org-chain/ethermint/pull/310) Support blocking list of addresses in mempool.
* (evm) [#328](https://github.com/crypto-org-chain/ethermint/pull/328) Support precompile interface.
* (statedb) [#333](https://github.com/crypto-org-chain/ethermint/pull/333) Support native action in statedb, prepare for precompiles.
* (rpc) [#369](https://github.com/crypto-org-chain/ethermint/pull/369) Support state overrides in eth_call.
* (precompile) [#371](https://github.com/crypto-org-chain/ethermint/pull/371) Add StateDB itself into native context for precompiles to emit evm logs directly.

### State Machine Breaking

Expand All @@ -53,6 +55,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (feemarket) [#1790](https://github.com/evmos/ethermint/pull/1790) Raise error when get invalid consensus params
- (deps) [#1782](https://github.com/evmos/ethermint/pull/1782) Bump Cosmos-SDK to v0.47.3 and ibc-go to v7.1.0.
- (ante) [#358](https://github.com/crypto-org-chain/ethermint/pull/358) enforce user setting the From address in MsgEthereumTx
- (geth) [#377](https://github.com/crypto-org-chain/ethermint/pull/377) Update go-ethereum version to [`v1.11.2`](https://github.com/ethereum/go-ethereum/releases/tag/v1.11.2).

### Bug Fixes

Expand All @@ -63,6 +66,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (rpc) [#1773](https://github.com/evmos/ethermint/pull/1773) Avoid channel get changed when concurrent subscribe happens.
* (mempool) [#310](https://github.com/crypto-org-chain/ethermint/pull/310) disable vesting messages in check tx mode.
* (rpc) [#364](https://github.com/crypto-org-chain/ethermint/pull/364) Only use NextBaseFee as last item to avoid concurrent write in `eth_feeHistory`.
* (config) [#365](https://github.com/crypto-org-chain/ethermint/pull/365) Avoid redundant parse chainID from gensis when start server.
* (rpc) [#382](https://github.com/crypto-org-chain/ethermint/pull/382) Align tracer config with go-ethereum.
* (rpc) [#386](https://github.com/crypto-org-chain/ethermint/pull/386) Cleanup unused cancel function in filter.
* (rpc) [#388](https://github.com/crypto-org-chain/ethermint/pull/388) Avoid out of bound panic when error message.

### Improvements

Expand All @@ -73,6 +80,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (evm) [#343](https://github.com/crypto-org-chain/ethermint/pull/343) Add native event converter APIs.
- (ante) [#353](https://github.com/crypto-org-chain/ethermint/pull/353) Remove blocked address decorator and support custom decorators instead.
- (statedb) [#359](https://github.com/crypto-org-chain/ethermint/pull/359) Add `CacheContext` method to StateDB, to support efficient read-only native actions.
- (rpc) [#375](https://github.com/crypto-org-chain/ethermint/pull/375) Refactor websocket/subscription system to improve performance and stability.
- (deps) [#381](https://github.com/crypto-org-chain/ethermint/pull/381) Upgrade Go-Ethereum version to [`v1.11.6`](https://github.com/ethereum/go-ethereum/releases/tag/v1.11.6).
- (precompile) [#380](https://github.com/crypto-org-chain/ethermint/pull/380) Allow init precompiled contract with rules when new evm.
- (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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ test-import:
go test -run TestImporterTestSuite -v --vet=off github.com/evmos/ethermint/tests/importer

test-rpc:
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 2 -m "rpc" -r "true"
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 5 -m "rpc" -r "true"

run-integration-tests:
@nix-shell ./tests/integration_tests/shell.nix --run ./scripts/run-integration-tests.sh
Expand Down
13 changes: 7 additions & 6 deletions app/ante/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula
blockHeight := big.NewInt(ctx.BlockHeight())
homestead := egcd.ethCfg.IsHomestead(blockHeight)
istanbul := egcd.ethCfg.IsIstanbul(blockHeight)
shanghai := egcd.ethCfg.IsShanghai(uint64(ctx.BlockHeader().Time.Unix()))
var events sdk.Events

// Use the lowest priority of all the messages as the final one.
Expand Down Expand Up @@ -189,7 +190,7 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula
gasWanted += txData.GetGas()
}

fees, err := keeper.VerifyFee(txData, egcd.evmDenom, egcd.baseFee, homestead, istanbul, ctx.IsCheckTx())
fees, err := keeper.VerifyFee(txData, egcd.evmDenom, egcd.baseFee, homestead, istanbul, shanghai, ctx.IsCheckTx())
if err != nil {
return ctx, errorsmod.Wrapf(err, "failed to verify the fees")
}
Expand Down Expand Up @@ -283,23 +284,23 @@ func (ctd CanTransferDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
"base fee is supported but evm block context value is nil",
)
}
if coreMsg.GasFeeCap().Cmp(ctd.baseFee) < 0 {
if coreMsg.GasFeeCap.Cmp(ctd.baseFee) < 0 {
return ctx, errorsmod.Wrapf(
errortypes.ErrInsufficientFee,
"max fee per gas less than block base fee (%s < %s)",
coreMsg.GasFeeCap(), ctd.baseFee,
coreMsg.GasFeeCap, ctd.baseFee,
)
}
}

// check that caller has enough balance to cover asset transfer for **topmost** call
// NOTE: here the gas consumed is from the context with the infinite gas meter
if coreMsg.Value().Sign() > 0 && !canTransfer(ctx, ctd.evmKeeper, ctd.evmParams.EvmDenom, coreMsg.From(), coreMsg.Value()) {
if coreMsg.Value.Sign() > 0 && !canTransfer(ctx, ctd.evmKeeper, ctd.evmParams.EvmDenom, coreMsg.From, coreMsg.Value) {
return ctx, errorsmod.Wrapf(
errortypes.ErrInsufficientFunds,
"failed to transfer %s from address %s using the EVM block context transfer function",
coreMsg.Value(),
coreMsg.From(),
coreMsg.Value,
coreMsg.From,
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/ante/fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ func (empd EthMinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simul
if fee.LT(requiredFee) {
return ctx, errorsmod.Wrapf(
errortypes.ErrInsufficientFee,
"provided fee < minimum global fee (%d < %d). Please increase the priority tip (for EIP-1559 txs) or the gas prices (for access list or legacy txs)", //nolint:lll
fee.TruncateInt().Int64(), requiredFee.TruncateInt().Int64(),
"provided fee < minimum global fee (%s < %s). Please increase the priority tip (for EIP-1559 txs) or the gas prices (for access list or legacy txs)", //nolint:lll
fee, requiredFee,
)
}
}
Expand Down
3 changes: 1 addition & 2 deletions app/ante/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ func (suite *AnteTestSuite) SetupTest() {
evmGenesis.Params.ChainConfig.ArrowGlacierBlock = &maxInt
evmGenesis.Params.ChainConfig.GrayGlacierBlock = &maxInt
evmGenesis.Params.ChainConfig.MergeNetsplitBlock = &maxInt
evmGenesis.Params.ChainConfig.ShanghaiBlock = &maxInt
evmGenesis.Params.ChainConfig.CancunBlock = &maxInt
evmGenesis.Params.ChainConfig.ShanghaiTime = &maxInt
}
if suite.evmParamsOption != nil {
suite.evmParamsOption(&evmGenesis.Params)
Expand Down
11 changes: 5 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"encoding/json"
"fmt"
"io"
"io/fs"
"net/http"
"os"
"path/filepath"
Expand All @@ -28,7 +29,6 @@ import (
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"

"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"

dbm "github.com/cometbft/cometbft-db"
Expand Down Expand Up @@ -123,8 +123,7 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"

// unnamed import of statik for swagger UI support
_ "github.com/evmos/ethermint/client/docs/statik"
"github.com/evmos/ethermint/client/docs"

"github.com/evmos/ethermint/app/ante"
"github.com/evmos/ethermint/ethereum/eip712"
Expand Down Expand Up @@ -925,12 +924,12 @@ func (app *EthermintApp) RegisterNodeService(clientCtx client.Context) {

// RegisterSwaggerAPI registers swagger route with API Server
func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) {
statikFS, err := fs.New()
root, err := fs.Sub(docs.SwaggerUI, "swagger-ui")
if err != nil {
panic(err)
}

staticServer := http.FileServer(statikFS)
staticServer := http.FileServer(http.FS(root))
rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer))
}

Expand Down Expand Up @@ -959,7 +958,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
// ethermint subspaces
paramsKeeper.Subspace(evmtypes.ModuleName).WithKeyTable(evmtypes.ParamKeyTable()) //nolint: staticcheck
paramsKeeper.Subspace(evmtypes.ModuleName)
paramsKeeper.Subspace(feemarkettypes.ModuleName).WithKeyTable(feemarkettypes.ParamKeyTable())
return paramsKeeper
}
3 changes: 2 additions & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations"
v0evmtypes "github.com/evmos/ethermint/x/evm/migrations/v0/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
)
Expand Down Expand Up @@ -68,7 +69,7 @@ func (app *EthermintApp) RegisterUpgradeHandlers(cdc codec.BinaryCodec, clientKe
case ibctransfertypes.ModuleName:
keyTable = ibctransfertypes.ParamKeyTable()
case evmtypes.ModuleName:
keyTable = evmtypes.ParamKeyTable() //nolint:staticcheck
keyTable = v0evmtypes.ParamKeyTable() //nolint:staticcheck
case feemarkettypes.ModuleName:
keyTable = feemarkettypes.ParamKeyTable()
default:
Expand Down
6 changes: 6 additions & 0 deletions client/docs/embed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package docs

import "embed"

//go:embed swagger-ui
var SwaggerUI embed.FS
3 changes: 0 additions & 3 deletions client/docs/statik/init.go

This file was deleted.

14 changes: 0 additions & 14 deletions client/docs/statik/statik.go

This file was deleted.

Loading