support for golang tracers + add golang callTracer#558
support for golang tracers + add golang callTracer#558liam-lai merged 15 commits intodev-upgradefrom
Conversation
minor changes in API refine api_tracer.go refine Tracer interface
|
This PR's XXX_legacy.js tracers are not completely equal to XXX.js tracers before this PR. Shall we make XXX_legacy.js equal to prior XXX.js? |
There was a problem hiding this comment.
This change is for preparation of EIP2028. The reason we need EIP2028 is as follows:
If EIP2028 is not enabled, the test revert_reason.json will not pass unless we change the test itself. Check this commit that change the test json itself: 0a496c3
So actually this code change does not necessary belong to this PR. Do you want me to undo it?
There was a problem hiding this comment.
The consensus will be changed if we enable eip-2028. I can include it in the PR of EIP-1559 if you need it.
There was a problem hiding this comment.
Yes please let's remove that from this PR. It would be a separate discussion if EIP-2028 is useful for XDC.
There was a problem hiding this comment.
Yes please let's remove that from this PR. It would be a separate discussion if EIP-2028 is useful for XDC.
I removed it and force pushed commits.
There was a problem hiding this comment.
The consensus will be changed if we enable eip-2028. I can include it in the PR of EIP-1559 if you need it.
No hurry. At the time of eip2028, we need to remember to undo this commit: e1b7ba6
There was a problem hiding this comment.
I think we can directly make this default callTracer
There was a problem hiding this comment.
Sure. Then this tracer will override js tracer with the same name. Shall we name the js tracer?
There was a problem hiding this comment.
Right callTracer should be the native tracer. IMO the old one can be kept as callTracerLegacy and the "new" JS call tracer I don't think it's really necessary.
There was a problem hiding this comment.
Changed native tracer to the default one, for call tracer and noop tracer.
Can you post the diff? |
Sure. The diff by running For other tracers, legacy tracer and dev-upgrade tracer are the same. |
between those two files |
So I guess |
|
Request: curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_traceBlockByNumber",
"params": [
"latest",
{"tracer":"callTracer"}
]
}' | jqResponse: {
"jsonrpc": "2.0",
"id": 1001,
"result": [
{
"result": {
"type": "CALL",
"from": "xdc4398241671b3dd484fe3213a4fb7511f30e7d7c0",
"to": "xdc0000000000000000000000000000000000000089",
"value": "0x0",
"gas": "0x2b068",
"gasUsed": "0x147ce",
"input": "0xe341eaa400000000000000000000000000000000000000000000000000000000002b85b848d26996721c2750b15a0a5d37de015365ae688b0bb031e52723d6e4d73d63ae",
"output": "0x"
}
}
]
}Why from and to are xdc prefix ? |
There was a problem hiding this comment.
Why call strings.ToLower ? I think return string(s) is enough:
- We should keep the address is checksumed
- reduce CPU cost and network response time
There was a problem hiding this comment.
Ok. Ethereum uses lower case. If we don't need lower case we can just return the string(s)
|
The |
| // balance transfer may never fail. | ||
| if vmerr == vm.ErrInsufficientBalance { | ||
| return nil, 0, false, vmerr, nil | ||
| return nil, 0, false, nil, vmerr |
There was a problem hiding this comment.
Can you explain this change? It is a sensitive part of the code.
There was a problem hiding this comment.
I am convinced this will introduce a bug and should be resolved.
There was a problem hiding this comment.
I agree. I checked history geth commit: ethereum@b9df7ec
Although the variable name is vmerr, this error means no balance to pay for the tx. It should be consensus err and should be returned in 4-th err place.
I'll revert this
| @@ -1,4 +1,4 @@ | |||
| // Copyright 2017 The go-ethereum Authors | |||
| // Copyright 2021 The go-ethereum Authors | |||
There was a problem hiding this comment.
I believe there is no way to access this particular tracer. It has the same name as the native callTracer. IMHO we can simply drop this (or replace the callTracerLegacy with it). Depends if we want users to still access the "old tracer".
There was a problem hiding this comment.
I think we can drop it.
There was a problem hiding this comment.
I believe there is no way to access this particular tracer. It has the same name as the native callTracer. IMHO we can simply drop this (or replace the
callTracerLegacywith it). Depends if we want users to still access the "old tracer".
fixed and code pushed
* feat: rename Tracer interface to EVMLogger; minor changes in API refine api_tracer.go refine Tracer interface * fix: broken tracer tests * feat: add BenchmarkTransactionTrace * feat: tracer CaptureEnter CaptureExit in evm * feat: upgrade js tracers with geth upstream * chore: clean test * feat: eth/tracers: support for golang tracers + add golang callTracer cf. ethereum#23708 * chore: clean testdata json * fix: change test due to IntrinsicGas is not upgraded * feat: make native Tracer the default Tracer * fix: update tracers.New in api * fix: addr prefix in callTracer * fix: remove `native` in BenchmarkTracers * fix: return consensus error of InsufficientBalance for tx, instead of vmerr * chore: drop js tracers: call and noop
Proposed changes
support for golang tracers + add golang callTracer
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which part of the codebase this PR will touch base on,
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that