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

eth_createAccessList handler crashed #23223

Closed
ghost opened this issue Jul 16, 2021 · 1 comment · Fixed by #23225
Closed

eth_createAccessList handler crashed #23223

ghost opened this issue Jul 16, 2021 · 1 comment · Fixed by #23225
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Jul 16, 2021

System information

Geth version:
Geth
Version: 1.10.5-stable
Git Commit: 33ca98e
Git Commit Date: 20210714
Architecture: amd64
Go Version: go1.16.6
Operating System: linux
GOPATH=
GOROOT=go

OS & Version: latest docker on Mac
Commit hash : (if develop)

Expected behaviour

Actual behaviour

Steps to reproduce the behaviour

start node shell

geth --datadir $(pwd)/tmp/geth --nodiscover \
    --gcmode=archive --syncmode full --dev --dev.period 15 \
    --http --http.addr 0.0.0.0 --http.api "net,web3,eth,debug" --http.corsdomain=* --http.vhosts=* \
    --ws --ws.addr 0.0.0.0 --ws.api "net,web3,eth,debug" --ws.origins=*

deploy a simple ERC20 contract

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

contract ERC20 {
    string constant public symbol = "TEST";
    string constant public name = "TEST";
    uint8 constant public decimals = 6;
    uint256 public totalSupply = 1e8 * 10 ** uint256(decimals);

    mapping(address => uint256) balances;

    event Transfer(address indexed from, address indexed to, uint256 tokens);

    constructor() {
        balances[msg.sender] = totalSupply;
        emit Transfer(address(0), msg.sender, totalSupply);
    }

    function balanceOf(address tokenOwner)
        public
        view
        returns (uint256 balance)
    {
        return balances[tokenOwner];
    }

    function transfer(address to, uint256 tokens)
        public
        returns (bool success)
    {
        require(balances[msg.sender] >= tokens, "insufficient balance");
        balances[msg.sender] -= tokens;
        balances[to] += tokens;
        emit Transfer(msg.sender, to, tokens);
        return true;
    }
}

Request

curl --location --request POST 'http://127.0.0.1:8545' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": "1",
    "jsonrpc": "2.0",
    "method": "eth_createAccessList",
    "params": [
        {
            "from": "0xDD71ed3203c79A6073980Ec1faa44063B1EC9956",
            "to": "0x28fDB06D263674bF2B8eD55181Ed80afcBaE8976",
            "gas": "0x1547b",
            "data": "0xa9059cbb0000000000000000000000006cc8dcbca746a6e4fdefb98e1d0df903b107fd210000000000000000000000000000000000000000000000000000000009d91453"
        }
    ]
}'
{
    "jsonrpc": "2.0",
    "id": "1",
    "error": {
        "code": -32000,
        "message": "method handler crashed"
    }
}

Backtrace

RPC method eth_createAccessList crashed: runtime error: invalid memory address or nil pointer dereference
goroutine 42462 [running]:
github.com/ethereum/go-ethereum/rpc.(*callback).call.func1(0xc009a0cf00, 0x14, 0xc0005d9d58)
        github.com/ethereum/go-ethereum/rpc/service.go:200 +0xbd
panic(0x4e87cc0, 0x5a79450)
        runtime/panic.go:965 +0x1b9
math/big.(*Int).Set(...)
        math/big/int.go:75
github.com/ethereum/go-ethereum/core.NewEVMTxContext(0x524d9a0, 0xc0001d3050, 0x0, 0x0, 0x0, 0x0)
        github.com/ethereum/go-ethereum/core/evm.go:71 +0xc5
github.com/ethereum/go-ethereum/eth.(*EthAPIBackend).GetEVM(0xc00011b170, 0x523ebb8, 0xc0095def80, 0x524d9a0, 0xc0001d3050, 0xc00a3aad80, 0xc00910d440, 0xc00b000000, 0xc00025c140, 0x9, ...)
        github.com/ethereum/go-ethereum/eth/api_backend.go:204 +0x7f
github.com/ethereum/go-ethereum/internal/ethapi.AccessList(0x523ebb8, 0xc0095def80, 0x5258318, 0xc00011b170, 0xc00c3e6f08, 0x0, 0x4ebe000, 0xc009a0cf18, 0xc009a0cf30, 0xc00c3e6f00, ...)
        github.com/ethereum/go-ethereum/internal/ethapi/api.go:1449 +0x957
github.com/ethereum/go-ethereum/internal/ethapi.(*PublicBlockChainAPI).CreateAccessList(0xc00011ced0, 0x523ebb8, 0xc0095def80, 0xc009a0cf18, 0xc009a0cf30, 0xc00c3e6f00, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/ethereum/go-ethereum/internal/ethapi/api.go:1386 +0x138
reflect.Value.call(0xc00026e580, 0xc000011760, 0x13, 0x500d6d0, 0x4, 0xc00d775aa0, 0x4, 0x4, 0xc00d775ad0, 0xc00dc7c7b0, ...)
        reflect/value.go:476 +0x8e7
reflect.Value.Call(0xc00026e580, 0xc000011760, 0x13, 0xc00d775aa0, 0x4, 0x4, 0x0, 0x0, 0x4f07520)
        reflect/value.go:337 +0xb9
github.com/ethereum/go-ethereum/rpc.(*callback).call(0xc008a31080, 0x523ebb8, 0xc0095def80, 0xc009a0cf00, 0x14, 0xc00dc7c7b0, 0x2, 0x2, 0x0, 0x0, ...)
        github.com/ethereum/go-ethereum/rpc/service.go:206 +0x2c5
github.com/ethereum/go-ethereum/rpc.(*handler).runMethod(0xc0001d2ea0, 0x523ebb8, 0xc0095def80, 0xc00edece00, 0xc008a31080, 0xc00dc7c7b0, 0x2, 0x2, 0x2)
        github.com/ethereum/go-ethereum/rpc/handler.go:389 +0x8a
github.com/ethereum/go-ethereum/rpc.(*handler).handleCall(0xc0001d2ea0, 0xc00dc7c720, 0xc00edece00, 0x203003)
        github.com/ethereum/go-ethereum/rpc/handler.go:337 +0x265
github.com/ethereum/go-ethereum/rpc.(*handler).handleCallMsg(0xc0001d2ea0, 0xc00dc7c720, 0xc00edece00, 0x5231201)
        github.com/ethereum/go-ethereum/rpc/handler.go:298 +0x1be
github.com/ethereum/go-ethereum/rpc.(*handler).handleMsg.func1(0xc00dc7c720)
        github.com/ethereum/go-ethereum/rpc/handler.go:139 +0x46
github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc.func1(0xc0001d2ea0, 0xc00011a360)
        github.com/ethereum/go-ethereum/rpc/handler.go:226 +0xd2
created by github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc
        github.com/ethereum/go-ethereum/rpc/handler.go:222 +0x66

When submitting logs: please submit them as text and not screenshots.

@LasTshaMAN
Copy link

Just from the cursory code overview, gasPrice seems to be a mandatory parameter in this API call,

try adding it to your request:

curl --location --request POST 'http://127.0.0.1:8545' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": "1",
    "jsonrpc": "2.0",
    "method": "eth_createAccessList",
    "params": [
        {
            "from": "0xDD71ed3203c79A6073980Ec1faa44063B1EC9956",
            "to": "0x28fDB06D263674bF2B8eD55181Ed80afcBaE8976",
            "gas": "0x1547b",
            "gasPrice": "10000000000",
            "data": "0xa9059cbb0000000000000000000000006cc8dcbca746a6e4fdefb98e1d0df903b107fd210000000000000000000000000000000000000000000000000000000009d91453"
        }
    ]
}'

Although some kind of validation for mandatory params should exists for this API to allow for graceful error-reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants