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

RPC endpoints for excluding tracing failures #1995

Merged
merged 20 commits into from
Dec 22, 2024
Merged

Conversation

jewei1997
Copy link
Contributor

@jewei1997 jewei1997 commented Dec 18, 2024

Describe your changes and provide context

  • add 3 new endpoints
  • add unit tests
  • name them all *ExcludeTracingFail for clarity
  • write a README about old synthetic endpoints + these new endpoints
  • test endpoints on RPC

A panic tx is a tx which fails tracing. This can be due to several issues such as nonce errors, insufficient funds, etc. Adding 3 new endpoints for excluding panic txs.

  • sei_traceBlockByNumberExcludeTraceFail
  • sei_getBlockByNumberExcludeTraceFail + sei_getBlockByHashExcludeTraceFail
  • sei_getTransactionByReceiptExcludeTraceFail

Relies on sei-protocol/go-ethereum#40

Testing performed to validate your change

added unit tests in rpc layer + test on RPC node

return &SeiBlockAPI{
BlockAPI: blockAPI,
isPanicTx: isPanicTx,
}

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
func NewDebugAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txDecoder sdk.TxDecoder, config *SimulateConfig, connectionType ConnectionType) *DebugAPI {
backend := NewBackend(ctxProvider, k, txDecoder, tmClient, config)
tracersAPI := tracers.NewAPI(backend)
return &DebugAPI{tracersAPI: tracersAPI, tmClient: tmClient, keeper: k, ctxProvider: ctxProvider, txDecoder: txDecoder, connectionType: connectionType}
}

func NewSeiDebugAPI(
tmClient rpcclient.Client,

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 Dec 18, 2024

Codecov Report

Attention: Patch coverage is 64.08451% with 51 lines in your changes missing coverage. Please review.

Project coverage is 61.51%. Comparing base (e8e4b3b) to head (b9849c0).
Report is 230 commits behind head on main.

Files with missing lines Patch % Lines
evmrpc/tracers.go 44.26% 32 Missing and 2 partials ⚠️
evmrpc/block.go 78.26% 6 Missing and 4 partials ⚠️
evmrpc/server.go 84.21% 2 Missing and 1 partial ⚠️
evmrpc/tx.go 80.00% 3 Missing ⚠️
app/app.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1995      +/-   ##
==========================================
- Coverage   61.64%   61.51%   -0.13%     
==========================================
  Files         365      263     -102     
  Lines       26178    24480    -1698     
==========================================
- Hits        16138    15060    -1078     
+ Misses       8967     8298     -669     
- Partials     1073     1122      +49     
Files with missing lines Coverage Δ
app/app.go 66.19% <0.00%> (+1.26%) ⬆️
evmrpc/server.go 86.82% <84.21%> (-3.95%) ⬇️
evmrpc/tx.go 68.16% <80.00%> (+1.96%) ⬆️
evmrpc/block.go 75.98% <78.26%> (+7.96%) ⬆️
evmrpc/tracers.go 59.52% <44.26%> (-40.48%) ⬇️

... and 219 files with indirect coverage changes

@jewei1997 jewei1997 changed the title Exclude panic txs RPC endpoints for excluding panic txs Dec 18, 2024
fullTx bool,
isPanicTx func(ctx context.Context, hash common.Hash) (bool, error),
) (result map[string]interface{}, returnErr error) {
startTime := time.Now()

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
evmrpc/block.go Outdated Show resolved Hide resolved
@jewei1997 jewei1997 changed the title RPC endpoints for excluding panic txs RPC endpoints for excluding tracing failures Dec 22, 2024
@jewei1997 jewei1997 enabled auto-merge (squash) December 22, 2024 17:21
@jewei1997 jewei1997 disabled auto-merge December 22, 2024 17:21
@@ -36,6 +73,59 @@
return
}

func (api *SeiDebugAPI) TraceBlockByNumberExcludeTraceFail(ctx context.Context, number rpc.BlockNumber, config *tracers.TraceConfig) (result interface{}, returnErr error) {
startTime := time.Now()

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
@jewei1997 jewei1997 enabled auto-merge (squash) December 22, 2024 17:33
@jewei1997 jewei1997 merged commit fce45fd into main Dec 22, 2024
46 of 47 checks passed
@jewei1997 jewei1997 deleted the exclude-panic-txs branch December 22, 2024 19:24
jewei1997 added a commit that referenced this pull request Dec 23, 2024
* add sei_getTransactionReceipt

* add logic to exclude panic txs from getBlockByNumber

* fixed compilation errs

* test both sei_traceBlock and sei_getTransactionReceipt

* fix block_test

* update go.mod

* fixed tracer test

* tests seem to all work now

* fix genesis code

* remove unnecessary isPanicTx param

* remove prints

* fix complilation

* use a trace block + cache to do isPanic

* catch panic in traceTx

* fix

* add README + change name to *TraceFail

* update geth dep

* update geth dep
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.

3 participants