ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
46.86k stars 19.79k forks source link

Add support for overlay_getLogs and overlay_callConstructor #29481

Open joshstevens19 opened 3 months ago

joshstevens19 commented 3 months ago

Describe the feature

We just seen erigon just merge a PR to allow you with a single RPC request to modify the contract injecting your own events and get the new logs back.. more information on the feature: https://github.com/ledgerwatch/erigon/pull/9438

Would be cool to see it here!

fuelmessenger commented 3 months ago

:sparkles: Thanks to the community, there's an estimated bounty value of $10.90 USD for a successful merge request of this issue via contributions such as 0.975 UNI tokens. Happy coding :grinning: Details and T&Cs at joinfuel.io

s1na commented 3 months ago

This feature requires an archive node. IMO we should tackle this only once we have pbss archive index in geth.

holiman commented 3 months ago

PSA: @fuelmessenger is not anything we're familiar with , might be a scam, so I'll hide those posts

crebsy commented 3 months ago

hey, glad to see this issue here!

Here are some integration tests for a few contracts deployed on ethereum mainnet: https://github.com/ledgerwatch/erigon/blob/devel/cmd/rpcdaemon/postman/Overlay_Testing.json Anyone who plans implementing the two new rpc methods, can run those tests against an archive node with postman until they're all 🟢

There's also a minimal README for overlays: https://github.com/ledgerwatch/erigon/blob/devel/turbo/jsonrpc/overlay/README.md but the tests are probably more fun to play with 😄

For op-geth I have this open PR, maybe some things might be reused quite easily.

kaber2 commented 3 months ago

I've been considering implementing something vaguely similar, but not requiring source code of the contract in question. Basically I would like to set storage "watchpoints" that can emit custom events. The use case is to deal with contracts emitting no events or unusable events lacking vital information. Source code may or may not be available, but one of the main points is that it is supposed to work programatically, probing the relevant storage address through accesslist tracing and then adding a watchpoint without requiring manually changing the source code. Similar to your proposal, this would only work for an archive node or live blocks.

Given your proposal, I thought I'd mention my idea to see if there is some overlap, but as far as I can tell, these mechanisms would be more complementary as opposed to something that could/should be integrated with each other.