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

Calling debug_traceBlock Against Current State Using Arbitrarily Generated Block #22994

Closed
m-e-r-k-l-e-root opened this issue Jun 4, 2021 · 1 comment

Comments

@m-e-r-k-l-e-root
Copy link

m-e-r-k-l-e-root commented Jun 4, 2021

Can debug_traceBlock be used for tracing an arbitrarily generated block against current state?

I.e. assume there are 2 transactions,

tx #1 looks something along the lines of:

{
  from: "0xdeadbeef000000000000000000000000000000000, 
  to: "0x55550000000000000000000000000000000000000", 
  gas: "0x77777", 
  data: "0x00"
}

and tx #2 looks something along the lines of:

{
  from: "0xdead0000000000000000000000000000000000000, 
  to:"0x22220000000000000000000000000000000000000", 
  gas: "0x77777", 
  data: "0x00"
}

Is it possible to RLP encode these 2 transactions into a 'custom' block then call debug_traceBlock using the RLP for this 'custom' block in which only contains these 2 tx's? If this is not possible via the usage of debug_traceBlock is there any other way to achieve this?

Here's some pseudocode demonstrating what I'm attempting to achieve:

//calling
var listOfTxns = [
  {
    from: "0xdeadbeef000000000000000000000000000000000, 
    to: "0x55550000000000000000000000000000000000000", 
    gas: "0x77777", 
    data: "0x00"
  },
  {
    from: "0xdead0000000000000000000000000000000000000, 
    to:"0x22220000000000000000000000000000000000000", 
    gas: "0x77777", 
    data: "0x00"
  }
];

var txListToRlpEncodedBlock = rlpEncode(listOfTxns);

debug_traceCustomBlock(currentBlockNumber, txListToRlpEncodedBlock)

//return value
[
    {
        <trace results for tx #1>
    },
    {
        <trace results for tx #2>
    }
]
@m-e-r-k-l-e-root m-e-r-k-l-e-root changed the title Calling debug_traceBlock Against Current State Using 'Custom' Block Calling debug_traceBlock Against Current State Using 'Custom' Block (similar to Parity's trace_callMany method) Jun 4, 2021
@m-e-r-k-l-e-root
Copy link
Author

m-e-r-k-l-e-root commented Jun 5, 2021

After overviewing the geth codebase I've come to the conclusion there does not appear to be a built-in way to achieve what I'm trying to do, therefore I ended up writing my own go implementation for what I've described above.

@m-e-r-k-l-e-root m-e-r-k-l-e-root changed the title Calling debug_traceBlock Against Current State Using 'Custom' Block (similar to Parity's trace_callMany method) Calling debug_traceBlock Against Current State Using Arbitrarily Generated Block Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant