go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

eth/tracers: fill the creationMethod in flatCall

Open jsvisa opened this issue 1 year ago • 7 comments

~@s1na PTAL, seems CreationMethod is not used anymore, should we remove it?~

jsvisa avatar Oct 02 '24 23:10 jsvisa

Can you please expand on this? Is it not part of the parity tracing response? shouldn't we in that case fill the value rather than remove it?

s1na avatar Oct 09 '24 17:10 s1na

I have consulted @ziogaschr who wrote the tracer. I think removing CreationMethod is not the way to go. We should instead try to fill the value. This is what he wrote:

So in here https://github.com/ethereum/go-ethereum/blob/2792a54adeb02032f7eace0032755c9225f75fa5/eth/tracers/native/call_flat.go#L298, we have to add CreationMethod: the actual type, which is vm.CREATE or vm.CREATE2

s1na avatar Oct 14 '24 03:10 s1na

I am sorry for missing this detail, while converting this tracer from the old JS tracers to the newer Go native ones. I can make a PR if you like.

ziogaschr avatar Oct 14 '24 05:10 ziogaschr

We should instead try to fill the value.

@s1na sorry for the inconvenience, I think I'll buy it.

jsvisa avatar Oct 14 '24 08:10 jsvisa

Filled it with vm.opcode, kindly ask @s1na @ziogaschr to take a look.

jsvisa avatar Oct 14 '24 11:10 jsvisa

BTW, as we use callType for the different call types, how about use the name createType instead of creationMethod?

jsvisa avatar Oct 14 '24 11:10 jsvisa

BTW, as we use callType for the different call types, how about use the name createType instead of creationMethod?

Thanks @jsvisa. That's indeed a nice idea. Probably it's preferable to stick with creationMethod for the JSON output, in order to not break compatibility with clients that know how to consume Parity like tracers. It's totally fine to rename the Go struct's field name though.

ziogaschr avatar Oct 14 '24 11:10 ziogaschr

eth/tracers/native/call_flat.go:299:45: unnecessary conversion (unconvert)
			CreationMethod: strings.ToLower(vm.OpCode(input.Type).String()),
			                                         ^

please fix the lint issue

fjl avatar Oct 30 '24 14:10 fjl

@ziogaschr sorry for the delay response, I think this field has not been used before, so rename to createType is ok. @s1na WDYT.

jsvisa avatar Oct 31 '24 01:10 jsvisa

@jsvisa if we want to be compatible with the old OpenEthereum label, then we have to use creationMethod. On the other hand, nobody noticed it was missing...

ziogaschr avatar Oct 31 '24 17:10 ziogaschr

I think it makes more sense to use the label that was used before, and not create a new tracing format.

fjl avatar Oct 31 '24 20:10 fjl

@ziogaschr thanks for the advice, seems Parity(legacy OpenEthereum) did include the creationMethod in v3.0.1(but not formal released), and Besu had this field in their codebase tracing/flat/Action.java#L44:

public class Action {

  private final String creationMethod;
  private final String callType;
  private final String from;
  private final String gas;
  private final String input;
  private final String to;
  private final String init;
  private final String value;
  private final String address;
  private final String balance;
  private final String refundAddress;
  private final String author;
  private final String rewardType;

So I think the creationMethod is better, reverted back. @s1na @fjl PTAL.

jsvisa avatar Nov 04 '24 01:11 jsvisa

CI was red because a new testcase that was on master (but not pulled in to this PR) was failing. It is so interesting but also in this case useful.

Anyway merged in master changes and fixed that test case. Should be good to go now.

s1na avatar Nov 04 '24 11:11 s1na