Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Add error message for eth_getTransactionReceipt when ancient blocks haven't been downloaded yet (warp-sync) #9188

Closed
jimpo opened this issue Jul 22, 2018 · 11 comments · Fixed by #9475
Assignees
Labels
M4-core ⛓ Core client code / Rust. M6-rpcapi 📣 RPC API. P7-nicetohave 🐕 Issue is worth doing eventually.
Milestone

Comments

@jimpo
Copy link
Contributor

jimpo commented Jul 22, 2018

I'm running:

  • Which Parity version?: 2.0.0
  • Which operating system?: Linux
  • How installed?: from source
  • Are you fully synchronized?: yes
  • Which network are you connected to?: ethereum
  • Did you try to restart the node?: yes

A warp-synced full node returns empty responses to eth_getTransactionReceipt RPC requests for transactions before the snapshot point.

# Request transaction from recent block
$ curl -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xf8e026115bafda9efaee095d1f3342333826f53e332d4ffd7c9fb52bc499f9d5"],"id":0}' localhost:8545
{"jsonrpc":"2.0","result":{"blockHash":"0x7d24546c087fe34a595a250ba3aa3b4fa8c6cbfa20ec3963e122b1234170742b",...

# Request transaction from old block
$ curl -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x511b14d534466fdc5163d2cd7e37910a570c8e012e9970c7206272b4f8b122c5"],"id":0}' localhost:8545
{"jsonrpc":"2.0","result":null,"id":0}

I assume Parity does not back fill transaction receipts from ancient blocks in warp mode, but the current behavior seems broken. The RPC should either return an error if the receipt is missing or fetch it on demand.

@Tbaut
Copy link
Contributor

Tbaut commented Jul 23, 2018

Was your node fully synced (with blocks older than the snapshot)?
Warp-sync is a way to get in sync quickly, but the node will download and verify all the ancient blocks once the sync is performed.
The logs looks like this (see Verifying blocks after a warp sync) https://wiki.parity.io/FAQ#what-does-paritys-command-line-output-mean

@Tbaut Tbaut added Z1-question 🙋‍♀️ Issue is a question. Closer should answer. M4-core ⛓ Core client code / Rust. labels Jul 23, 2018
@Tbaut Tbaut added this to the 2.1 milestone Jul 23, 2018
@jimpo
Copy link
Contributor Author

jimpo commented Jul 24, 2018

Hmm, my ancient block download seems to be getting stuck at #54. I'll have to look into that separately.

I didn't know about the ancient block backfill, that makes sense. Thanks! But the RPC should still return an error saying "The receipt may or may not exist, but we won't know until we're done syncing" rather than null for the receipt.

@Tbaut
Copy link
Contributor

Tbaut commented Jul 24, 2018

A better error message would be nice yes. I edited your title.

@Tbaut Tbaut added P7-nicetohave 🐕 Issue is worth doing eventually. M6-rpcapi 📣 RPC API. and removed Z1-question 🙋‍♀️ Issue is a question. Closer should answer. labels Jul 24, 2018
@Tbaut Tbaut changed the title Warp-synced client does not reliably serve eth_getTransactionReceipt Add error message for eth_getTransactionReceipt when block hasn#t been downloaded yet (warp-sync) Jul 24, 2018
@olekon
Copy link

olekon commented Jul 24, 2018

Is there a way to download only event logs after warp sync?
Or is it possible to warpsync only to specific block and then switch to full sync?

@Tbaut
Copy link
Contributor

Tbaut commented Jul 24, 2018

No it's not possible. a full sync needs something like a couple days depending on your hardware.

@olekon
Copy link

olekon commented Jul 24, 2018

Is it possible to track the progress of this backfill? The block numbers in logs are unordered
47690, then 53915, then 34549

2018-07-24 21:33:01      #47690   63/100 peers    459 MiB chain  106 MiB db  0 b
ytes queue    5 MiB sync  RPC:  1 conn,  2 req/s, 197 µs
...
2018-07-24 21:34:01  Imported #6023111 0x93ec.7a4f (98 txs, 7.99 Mgas, 569 ms, 2
9.18 KiB)
2018-07-24 21:34:02      #53915   63/100 peers    469 MiB chain  105 MiB db  0 b
ytes queue    5 MiB sync  RPC:  1 conn,  2 req/s, 197 µs
2018-07-24 21:34:11  Syncing #6023111 0x93ec.7a4f     0 blk/s    0 tx/s   0 Mgas
/s      0+    0 Qed  #6023111   62/100 peers    475 MiB chain  105 MiB db  0 byt
es queue    5 MiB sync  RPC:  1 conn,  2 req/s, 265 µs
...
2018-07-24 21:35:49      #34549   66/100 peers    600 MiB chain  106 MiB db  0 b
ytes queue    6 MiB sync  RPC:  1 conn,  2 req/s, 172 µs

@Tbaut
Copy link
Contributor

Tbaut commented Jul 25, 2018

@olekon what you experience (unordered download of older blocks) is not related to the OP and looks like a bug. Could you please open a dedicated issue?

@olekon
Copy link

olekon commented Jul 25, 2018

@Tbaut I've opened #9212 earlier but you asked me to comment here for some reason

Anyway. I've got that only full sync from scrath will help me to get event logs from past blocks

@Tbaut
Copy link
Contributor

Tbaut commented Jul 25, 2018

#9212 is about logs not available for older blocks, that's fine. Now we shouldn't discuss anything else such as "the block numbers in logs are unordered". This is a different issue that I ask you to open :)

@andresilva
Copy link
Contributor

Related #7411.

@tomusdrw
Copy link
Collaborator

tomusdrw commented Sep 4, 2018

Might be quite difficult to implement, would require the warp snapshot to actually contain all transaction hashes that are expected to be in the ancient blocks.

I think much better approach in general would be to fallback to light-like mode, so if we don't find a transaction hash and we know that we warped we query peers for that hash.

seunlanlege added a commit that referenced this issue Sep 4, 2018
@5chdn 5chdn modified the milestones: 2.1, 2.2 Sep 11, 2018
seunlanlege added a commit that referenced this issue Sep 18, 2018
seunlanlege added a commit that referenced this issue Oct 2, 2018
@Tbaut Tbaut changed the title Add error message for eth_getTransactionReceipt when block hasn#t been downloaded yet (warp-sync) Add error message for eth_getTransactionReceipt when ancient blocks haven't been downloaded yet (warp-sync) Oct 22, 2018
seunlanlege added a commit that referenced this issue Oct 26, 2018
@5chdn 5chdn modified the milestones: 2.2, 2.3 Oct 29, 2018
seunlanlege added a commit that referenced this issue Nov 7, 2018
seunlanlege added a commit that referenced this issue Nov 16, 2018
sorpaas pushed a commit that referenced this issue Nov 26, 2018
* closes #9188

* check_for_unavailable_block in
eth_getTransactionByHash
eth_getTransactionByBlockHashAndIndex
eth_getTransactionByBlockNumberAndIndex
eth_getTransactionReceipt

* check for unavailable block in eth_getBlockByNumber

* corrected checks for unavailable_block

* check for block gaps in db

* corrected error messages

* corrected error information

* added allow-empty-block-result cli flag

* address grumbles

* --jsonrpc-allow-missing-blocks

* fix tests

* added checks to
    block_transaction_count_by_hash
    block_transaction_count_by_number
    block_uncles_count_by_hash
    block_uncles_count_by_number
    uncle_by_block_hash_and_index
    uncle_by_block_number_and_index
fix PR grumbles

* Update parity/cli/mod.rs

revert config name

Co-Authored-By: seunlanlege <[email protected]>

* Update parity/cli/mod.rs

revert cli arg

Co-Authored-By: seunlanlege <[email protected]>

* Apply suggestions from code review

revert config name

Co-Authored-By: seunlanlege <[email protected]>

* fix PR grumbles

* fix more PR grumbles
niklasad1 pushed a commit that referenced this issue Dec 16, 2018
* closes #9188

* check_for_unavailable_block in
eth_getTransactionByHash
eth_getTransactionByBlockHashAndIndex
eth_getTransactionByBlockNumberAndIndex
eth_getTransactionReceipt

* check for unavailable block in eth_getBlockByNumber

* corrected checks for unavailable_block

* check for block gaps in db

* corrected error messages

* corrected error information

* added allow-empty-block-result cli flag

* address grumbles

* --jsonrpc-allow-missing-blocks

* fix tests

* added checks to
    block_transaction_count_by_hash
    block_transaction_count_by_number
    block_uncles_count_by_hash
    block_uncles_count_by_number
    uncle_by_block_hash_and_index
    uncle_by_block_number_and_index
fix PR grumbles

* Update parity/cli/mod.rs

revert config name

Co-Authored-By: seunlanlege <[email protected]>

* Update parity/cli/mod.rs

revert cli arg

Co-Authored-By: seunlanlege <[email protected]>

* Apply suggestions from code review

revert config name

Co-Authored-By: seunlanlege <[email protected]>

* fix PR grumbles

* fix more PR grumbles
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
M4-core ⛓ Core client code / Rust. M6-rpcapi 📣 RPC API. P7-nicetohave 🐕 Issue is worth doing eventually.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants