Skip to content

JSON-RPC EthereumApi.Transact crashes #64

New issue

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

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

Already on GitHub? # to your account

Closed
tymat opened this issue May 29, 2014 · 2 comments
Closed

JSON-RPC EthereumApi.Transact crashes #64

tymat opened this issue May 29, 2014 · 2 comments
Assignees
Milestone

Comments

@tymat
Copy link

tymat commented May 29, 2014

Crash sending a transaction on JSON-RPC

{"id":1,"method":"EthereumApi.Transact","params":[{"recipient":"004ec17c4c9508fbb8d9834f960df510e2f7127f","value":"30","gas":"100","gasprice":"10"}]}

Stack trace

2014/05/29 19:13:26 [CHAIN] Last known block height #2054
2014/05/29 19:13:26 Last block: c3cd40805a1ae57666d2bb90dee7c5152ba7a3743f00a9ac093cf2f1692164d4
2014/05/29 19:13:26 Miner started
2014/05/29 19:13:26 Starting Ethereum GUI v0.5.0 RC11
2014/05/29 19:13:26 [JSON] Starting JSON-RPC server
2014/05/29 19:13:26 Ready and accepting connections
2014/05/29 19:13:26 [SERV] Retrieving seed nodes
2014/05/29 19:13:26 [SERV] Found DNS Go Peer: 94.242.229.217:30303
2014/05/29 19:13:26 [SERV] Adding peer (94.242.229.217:30303) 1 / 10
2014/05/29 19:13:26 [SERV] Found DNS Bootstrap Peer: 54.200.139.158:30303
2014/05/29 19:13:26 [SERV] Adding peer (54.200.139.158:30303) 2 / 10
2014/05/29 19:13:26 [GUI] Starting GUI
2014/05/29 19:13:27 Requesting blockchain c3cd4080... from peer 94.242.229.217:30303
2014/05/29 19:13:27 [PEER] [connected] (outbound) 94.242.229.217:30303  [Peer discovery | Block chain relaying | Transaction relaying]
2014/05/29 19:13:29 [PEER] Found canonical block, returning chain from: c3cd40805a1ae57666d2bb90dee7c5152ba7a3743f00a9ac093cf2f1692164d4
2014/05/29 19:13:29 Miner started
2014/05/29 19:13:29 [MINER] Mining on block. Includes 0 transactions
2014/05/29 19:13:32 [JSON] Incoming request.
2014/05/29 19:13:36 [POW] Hashing @ 181 khash
2014/05/29 19:13:38 [STATE] Added block #2055 (6cca737ec654e96b3f76ec829caeb54f34b7182e717c0704147a9be731b63cf4)
2014/05/29 19:13:38 [MINER] 🔨  Mined block 6cca737ec654e96b3f76ec829caeb54f34b7182e717c0704147a9be731b63cf4
2014/05/29 19:13:38 [MINER] Mining on block. Includes 0 transactions
panic: runtime error: slice bounds out of range

goroutine 29 [running]:
runtime.panic(0x446ea20, 0x49f972a)
    /usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/ethereum/eth-go/ethutil.BigToBytes(0xc2104c5fa0, 0x100, 0x48, 0xc211294c80, 0xc211294c80)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethutil/big.go:52 +0x1e4
github.com/ethereum/eth-go/ethchain.(*StateObject).GetStorage(0xc211294c80, 0xc2104c5fa0, 0x14)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethchain/state_object.go:85 +0x30
github.com/ethereum/eth-go/ethpub.GetAddressFromNameReg(0xc2100a1690, 0xc2115b7f30, 0x28, 0x4a2fd60, 0x1, ...)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethpub/pub.go:104 +0xd4
github.com/ethereum/eth-go/ethpub.(*PEthereum).createTx(0xc2109dafc0, 0xc211e4eaf0, 0x40, 0xc2115b7f30, 0x28, ...)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethpub/pub.go:116 +0xb41
github.com/ethereum/eth-go/ethpub.(*PEthereum).Transact(0xc2109dafc0, 0xc211e4eaf0, 0x40, 0xc2115b7f30, 0x28, ...)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethpub/pub.go:92 +0xce
github.com/ethereum/eth-go/ethrpc.(*EthereumApi).Transact(0xc21053f000, 0xc2117af000, 0xc2116c8360, 0x0, 0x0)
    /Users/aeufemio/go/src/github.com/ethereum/eth-go/ethrpc/packages.go:130 +0x10a
reflect.Value.call(0x442ec00, 0x44c7440, 0x130, 0x44f2880, 0x4, ...)
    /usr/local/go/src/pkg/reflect/value.go:474 +0xe0b
reflect.Value.Call(0x442ec00, 0x44c7440, 0x130, 0x1a6dfee8, 0x3, ...)
    /usr/local/go/src/pkg/reflect/value.go:345 +0x9d
net/rpc.(*service).call(0xc2109e0000, 0xc210081680, 0xc21131f3e8, 0xc2109c7580, 0xc2119a05c0, ...)
    /usr/local/go/src/pkg/net/rpc/server.go:381 +0x159
created by net/rpc.(*Server).ServeCodec
    /usr/local/go/src/pkg/net/rpc/server.go:452 +0x3bb
@maran
Copy link
Member

maran commented May 30, 2014

Seems to be related to the new NameReg code. Assigning to Jeff.

@obscuren
Copy link
Contributor

Has been fixed on develop.

@obscuren obscuren added this to the poc5 milestone May 30, 2014
ngtuna added a commit to ngtuna/tomochain that referenced this issue Jun 29, 2018
update smart contract, hard-code first 3-masternodes
whilei pushed a commit to whilei/go-ethereum-1 that referenced this issue Apr 22, 2019
…lator-sanity

consensus,params: refactor difficulty calculator
AusIV pushed a commit to NoteGio/go-ethereum that referenced this issue Feb 24, 2020
…s-and-tests

Chainspecs and cross-client,cross-chain tests
recmo pushed a commit to recmo/go-ethereum that referenced this issue Feb 17, 2021
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue Aug 13, 2021
Inphi pushed a commit to Inphi/go-ethereum that referenced this issue Dec 2, 2022
update header sanity check & storage size estimates to consider new fields
joshuacolvin0 pushed a commit to joshuacolvin0/go-ethereum that referenced this issue Jan 4, 2023
weiihann pushed a commit to weiihann/go-ethereum that referenced this issue Feb 23, 2023
luanxu-mxc pushed a commit to MXCzkEVM/mxc-geth that referenced this issue May 27, 2023
marioevz added a commit to marioevz/go-ethereum that referenced this issue Jul 12, 2024
s1na pushed a commit to s1na/go-ethereum that referenced this issue Dec 2, 2024
…etExtraField function (ethereum#64)

* refactor initial and introduce getExtraField function

* add test for initial

* refactor snapshot

* initial first snapshot only
lochjin pushed a commit to lochjin/go-ethereum that referenced this issue Dec 16, 2024
darioush pushed a commit to darioush/go-ethereum that referenced this issue Feb 5, 2025
…ereum#64)

## Why this should be merged

Fixes tracing when a stateful precompile calls another contract that
itself accesses storage.

## How this works

The pre-state tracer from `eth/tracers/native` doesn't implement
`CaptureEnter()` (entry of a new context), instead relying on
`CaptureState()` (per-opcode tracing) to detect that a new contract has
been entered. In doing so, it [maintains an
invariant](https://github.com/ava-labs/libevm/blob/cb7eb89341132f301680848d8faea6a5568dc326/eth/tracers/native/prestate.go#L160)
that is expected when `CaptureState(vm.SLOAD, ...)` is called—breaking
the invariant results in a panic due to a nil map.

The fix involves (a) maintaining the invariant as part of
`CaptureEnter()` (previously a no-op); and (b) calling said method
inside `vm.PrecompileEnvironment.Call()`. The latter has the added
benefit of properly handling all tracing involving an outbound call from
precompiles.

## How this was tested

New integration test demonstrates that the tracer can log the retrieved
storage value.

---------

Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants