Commit Graph

18 Commits

Author SHA1 Message Date
J1ang
83dae8dad3
feat: enhance API erigon_getLatestLogs (#6078)
feat:
1. `erigon_getLatestLogs` doesn't have to match the exact position of
the topics. It will match logs that contain the topics regardless of the
topics' position with original bloom filter. And it accepts `blockCount`
& `crit.ToBlock` params for better pagination.
2022-11-29 15:14:41 +07:00
J1ang
7f9edd68aa
feat: add erigon_getLatestLogs as a new feature API. (#5875)
feat: add `erigon_getLatestLogs` as a new feature API.
1. `erigon_getLatestLogs` returns latest logs that match the filter with
`logCount` length. Implementation is similar to `erigon_getLogs` but it
uses `ReverseIterator` which makes it more efficient to fetch the latest
logs.
2022-11-08 08:35:00 +07:00
a
ad7be30679
jsonrpc HTTP Get handler & logs topic filter with map (#5922)
this pr has two things in it

1. changed filter logs to use a map for the topics. this will speed up
queries with many topics in them. I still don't have a use case for this
though. i put is as a method of Logs, since that made sense to me, happy
to move it back out though.

2. allows json-rpc over http get request. since firefox is a great json
viewer (can search through, collapse large results) i often use it to
debug. it is also useful for sharing data with those who are less
familiar with command line / programming.
example get request:

http://rpcdaemon/?method=eth_getLogs&params=[{"fromBlock":"0xf2316b","toBlock":"0xf2316b"}]

it is based on the old jsonrpc http specification
https://www.jsonrpc.org/historical/json-rpc-over-http.html#encoded-parameters
except we also accept not base64 encoded params. since every eth rpc
request has a [], it will immediately fail validation for base64 and
attempt to use the parameters as a they are. otherwise it will attempt
to parse the rest of the payload as base64 and use that.

Co-authored-by: a <a@a.a>
Co-authored-by: gfx <86091021+gfxlabs@users.noreply.github.com>
2022-11-03 09:09:04 +07:00
Alex Sharov
8d1ed547b0
E3: parallel exec, apply on roTx (#5879) 2022-10-28 08:47:45 +07:00
a
d697b6fe7c
large performance optimization for filterLogs (getLogs) when doing queries with many addresses and logs. (#5805)
this pr changes filterLogs to use a pre computed hashset of addresses,
instead of iterating across the list of addresses once per log.

this greatly increases the speed of filter queries that use many
addresses and also return a large number of logs. In our case, we are
performing a query for all the trades performed in a uniswap v3 pool in
a 250 block range.
 
my benchmarks were performed with the data & code below:
 
address list gist is here
[addrs](2c30b0df43/gistfile1.txt)

 ```
 c := NewRpcClient()
 addrs := []common.Address{AddressListGist}
logs, err := c.FilterLogs(context.TODO(), ethereum.FilterQuery{
	FromBlock:big.NewInt(15640000),
	ToBlock:   big.NewInt(15640250),
	Addresses: addrs,
	Topics: [][]common.Hash{
		{

common.HexToHash("c42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67"),
		},
	},
```
the query contains 8442 addresses, while the response contains 1277 logs

On average, current devel averages a 15.57 second response time on my machine after 10 runs, while the new filterLogs averages 1.05 seconds.

for CURRENT DEVEL, the profile is here: https://pprof.aaaaa.news/cd8dkv0tidul37sctmi0/flamegraph 

for the filterLogs branch, the profile is here: https://pprof.aaaaa.news/cd8dlmgtidul37sctmig/flamegraph

while the tests pass with this branch, I am not really sure why filterLogs was originally programmed the way it was. Is there some sort of edge case / compatibility thing that I am missing with this change?

Co-authored-by: a <a@a.a>
2022-10-20 17:34:20 +07:00
Enrique Jose Avila Asapche
81cec4dd68
checking if bor log (#5739)
Fixing this err= ```EROR[10-13|08:27:56.405] RPC method eth_getLogs
crashed: runtime error: index out of range [289] with length 289
[service.go:217 panic.go:838 panic.go:93 eth_receipts.go:222
value.go:556 value.go:339 service.go:222 handler.go:494 handler.go:444
handler.go:392 handler.go:223 handler.go:316 asm_amd64.s:1571]```
2022-10-13 22:14:50 +01:00
Alex Sharov
37f76c9a9e
bitmapdb (#5593) 2022-10-02 10:54:40 +07:00
a
7c8b3c2ba1
[rpcdaemon] greatly increase speed of {eth,erigon}_getLogs (#5572) 2022-10-02 10:51:19 +07:00
Enrique Jose Avila Asapche
c2a1558923
changed erigon logs fields (#5476)
* changed erigon logs fields

* lint

* Update erigon_receipts.go (#5485)

* lint

Co-authored-by: a <edward9.lee@gmail.com>
2022-09-28 20:46:42 +01:00
Enrique Jose Avila Asapche
e53fec1977
appending log into erigonLogs (#5419)
* appending log into erigonLogs

* Revert "appending log into erigonLogs"

This reverts commit 37ceb2fa3da156977bba764d7d9e77f27ae360d7.

* ops
2022-09-19 16:25:10 +03:00
Enrique Jose Avila Asapche
01dbad0979
Separating ErigonLogs from Logs (#5219) 2022-08-30 09:49:05 +07:00
Enrique Jose Avila Asapche
30df8a9765
Solving log index out of bound error (#5009) 2022-08-11 19:08:20 +03:00
fenghaojiang
12cf311b7c
feat: add erigon_getLogs with timestamp field to erigon rpcdaemon and fix the issue 4982 (#4968)
* add_abigen_error_handle

* add abigen error type test code

* add field timestamp in `eth_getLogs` api

add field timestamp in `eth_getLogs` api

* undo add field timestamp in `eth_getLogs`

* add `erigon_getLogs` api and add field `timestamp`

add `erigon_getLogs` api and add field `timestamp`

* feat: add `erigon_getLogs` with timestamp field to erigon rpcdaemon

feat: add `erigon_getLogs` with timestamp field to erigon rpcdaemon

* fix: issue `4982` roaring out of range

fix: issue 4982 roaring out of range

* convert rangeEnd to latest

convert rangeEnd to latest when range end is a big value that go out of range of MaxUint32

* add begin condition

add begin condition in case of bigger than latest block

* add annotation to unreachable code
2022-08-11 09:16:40 +07:00
ledgerwatch
ca2b0f19c1
Fix checkChangeSets and RPC daemon commands accessing history (#4365)
* Simplifications

* Print

* Fix

* Clean up

* Fixed RPC daemon command accessing history

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-06-04 23:06:30 +01:00
Andrea Lanfranchi
c913f35c2e
Inner errors (#2774) 2021-10-04 22:16:52 +07:00
Alex Sharov
2d98c3bd0d
Remote RPC: add blocksLRU (#2744) 2021-09-29 13:51:51 +07:00
Alex Sharov
52d35930e8
simplify receipts reading (#2094)
* simplify receipts reading

* test
2021-06-04 13:28:18 +01:00
Evgeny Danilenko
74847d77e6
Rename to Erigon (#2018)
* turbo-geth to erigon

* tg, turbo to erigon
2021-05-26 11:35:39 +01:00