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

Synthetic events in separate sei endpoints #1867

Merged
merged 14 commits into from
Sep 24, 2024

Conversation

jewei1997
Copy link
Contributor

@jewei1997 jewei1997 commented Sep 21, 2024

Describe your changes and provide context

Make sei_ specific endpoints that will serve synthetic txs with synthetic events alongside all the eth txs. A synthetic event are CW20 and CW721 wasm events that will get surfaced on the evm side, but only through these sei_ endpoints. The eth_ endpoints will continue to only serve native EVM txs. The reason why we needed to separate them is because when combined, we break indexing for any pure EVM indexer like The Graph.

This PR creates sei_ specific endpoints for any filter, block, or tx endpoint, so we now have:

  • sei_getLogs
  • sei_getBlockByNumber
  • sei_getBlockByHash

The tx endpoints like eth_getTransactionByHash are left as-is because there's not really a need to exclude synthetic txs. They will just show synthetic tx info if you put in a tx hash that is for a synthetic one.

Testing performed to validate your change

unit tests + integration tests.

evmrpc/block_sei.go Fixed Show fixed Hide fixed
evmrpc/block_sei.go Fixed Show fixed Hide fixed
evmrpc/tx_sei.go Fixed Show fixed Hide fixed
evmrpc/tx_sei.go Fixed Show fixed Hide fixed
@@ -101,7 +103,7 @@
_ context.Context,
crit filters.FilterCriteria,
) (id ethrpc.ID, err error) {
defer recordMetrics("eth_newFilter", a.connectionType, time.Now(), err == nil)
defer recordMetrics(fmt.Sprintf("%s_newFilter", a.namespace), a.connectionType, time.Now(), err == nil)

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
@@ -117,7 +119,7 @@
func (a *FilterAPI) NewBlockFilter(
_ context.Context,
) (id ethrpc.ID, err error) {
defer recordMetrics("eth_newBlockFilter", a.connectionType, time.Now(), err == nil)
defer recordMetrics(fmt.Sprintf("%s_newBlockFilter", a.namespace), a.connectionType, time.Now(), err == nil)

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
@@ -133,7 +135,7 @@
ctx context.Context,
filterID ethrpc.ID,
) (res interface{}, err error) {
defer recordMetrics("eth_getFilterChanges", a.connectionType, time.Now(), err == nil)
defer recordMetrics(fmt.Sprintf("%s_getFilterChanges", a.namespace), a.connectionType, time.Now(), err == nil)

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
@@ -184,7 +186,7 @@
ctx context.Context,
filterID ethrpc.ID,
) (res []*ethtypes.Log, err error) {
defer recordMetrics("eth_getFilterLogs", a.connectionType, time.Now(), err == nil)
defer recordMetrics(fmt.Sprintf("%s_getFilterLogs", a.namespace), a.connectionType, time.Now(), err == nil)

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
func (a *FilterAPI) GetLogs(
ctx context.Context,
crit filters.FilterCriteria,
) (res []*ethtypes.Log, err error) {
defer recordMetrics("eth_getLogs", a.connectionType, time.Now(), err == nil)
defer recordMetrics(fmt.Sprintf("%s_getLogs", a.namespace), a.connectionType, time.Now(), err == nil)

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
@@ -260,7 +263,7 @@
_ context.Context,
filterID ethrpc.ID,
) (res bool) {
defer recordMetrics("eth_uninstallFilter", a.connectionType, time.Now(), res)
defer recordMetrics(fmt.Sprintf("%s_uninstallFilter", a.namespace), a.connectionType, time.Now(), res)

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
Copy link

codecov bot commented Sep 22, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 13 lines in your changes missing coverage. Please review.

Project coverage is 61.14%. Comparing base (e8e4b3b) to head (d9df235).
Report is 174 commits behind head on main.

Files with missing lines Patch % Lines
evmrpc/block.go 89.85% 3 Missing and 4 partials ⚠️
evmrpc/filter.go 75.00% 3 Missing and 1 partial ⚠️
evmrpc/utils.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1867      +/-   ##
==========================================
- Coverage   61.64%   61.14%   -0.51%     
==========================================
  Files         365      261     -104     
  Lines       26178    23182    -2996     
==========================================
- Hits        16138    14175    -1963     
+ Misses       8967     8007     -960     
+ Partials     1073     1000      -73     
Flag Coverage Δ
61.14% <87.50%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
evmrpc/server.go 87.58% <100.00%> (-3.19%) ⬇️
evmrpc/utils.go 65.64% <50.00%> (-10.40%) ⬇️
evmrpc/filter.go 75.84% <75.00%> (-1.63%) ⬇️
evmrpc/block.go 73.02% <89.85%> (+5.00%) ⬆️

... and 203 files with indirect coverage changes

@jewei1997 jewei1997 force-pushed the synthetic_events_in_separate_sei_endpts branch from c12b68a to 6be061d Compare September 23, 2024 13:15
@jewei1997 jewei1997 merged commit 4890dcc into main Sep 24, 2024
49 checks passed
@jewei1997 jewei1997 deleted the synthetic_events_in_separate_sei_endpts branch September 24, 2024 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants