Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

set debug based on tracer #746

Merged
merged 9 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ if [[ $1 == "pending" ]]; then
fi

# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
ethermintd start --pruning=nothing $TRACE --log_level $LOGLEVEL --minimum-gas-prices=0.0001aphoton --json-rpc.api eth,txpool,personal,net,debug,web3,miner
ethermintd start --pruning=nothing --evm.tracer=json $TRACE --log_level $LOGLEVEL --minimum-gas-prices=0.0001aphoton --json-rpc.api eth,txpool,personal,net,debug,web3,miner
4 changes: 2 additions & 2 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
DefaultJSONRPCWsAddress = "0.0.0.0:8546"

// DefaultEVMTracer is the default vm.Tracer type
DefaultEVMTracer = "json"
DefaultEVMTracer = ""

DefaultGasCap uint64 = 25000000

Expand All @@ -37,7 +37,7 @@ const (
DefaultTxFeeCap float64 = 1.0
)

var evmTracers = []string{DefaultEVMTracer, "markdown", "struct", "access_list"}
var evmTracers = []string{"json", "markdown", "struct", "access_list"}

// Config defines the server's top level configuration. It includes the default app config
// from the SDK as well as the EVM configuration to enable the JSON-RPC APIs.
Expand Down
2 changes: 1 addition & 1 deletion tests/solidity/init-test-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ ethermintd collect-gentxs
ethermintd validate-genesis

# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
ethermintd start --pruning=nothing --rpc.unsafe --keyring-backend test --trace --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3
ethermintd start --pruning=nothing --rpc.unsafe --keyring-backend test --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3
13 changes: 10 additions & 3 deletions x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,24 @@ func (k *Keeper) NewEVM(
if tracer == nil {
tracer = k.Tracer(msg, cfg.ChainConfig)
}
vmConfig := k.VMConfig(msg, cfg.Params, tracer)
vmConfig := k.VMConfig(cfg.Params, tracer)
return vm.NewEVM(blockCtx, txCtx, k, cfg.ChainConfig, vmConfig)
}

// VMConfig creates an EVM configuration from the debug setting and the extra EIPs enabled on the
// module parameters. The config generated uses the default JumpTable from the EVM.
func (k Keeper) VMConfig(msg core.Message, params types.Params, tracer vm.Tracer) vm.Config {
func (k Keeper) VMConfig(params types.Params, tracer vm.Tracer) vm.Config {
fmParams := k.feeMarketKeeper.GetParams(k.Ctx())

var debug bool
if _, ok := tracer.(types.NoOpTracer); ok {
debug = false
} else {
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
debug = true
}

return vm.Config{
Debug: k.debug,
crypto-facs marked this conversation as resolved.
Show resolved Hide resolved
Debug: debug,
Tracer: tracer,
NoRecursion: false, // TODO: consider disabling recursion though params
NoBaseFee: fmParams.NoBaseFee,
Expand Down