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

Can (and should?) we get PC_NEW from Besu ? #882

Open
Tracked by #865
OlivierBBB opened this issue Jul 27, 2024 · 1 comment
Open
Tracked by #865

Can (and should?) we get PC_NEW from Besu ? #882

OlivierBBB opened this issue Jul 27, 2024 · 1 comment

Comments

@OlivierBBB
Copy link
Collaborator

OlivierBBB commented Jul 27, 2024

We currently hand compute PC_NEW. In Besu the program counter (and gas) are updated before calling tracePostExecution hook. However tracePostExecution isn't called at all if operationResult == null.

It seems there are 3 possibilities if we want to grab the updated program counter:

  • current solution (hand computed)
  • call tracePostExecution regardless of operationResult which may be undesirable for Besu
  • add a Linea specific hook tracePostExecutionForLinea that triggers before the operationResult == null check

Note: we may require the naïve value of PC_NEW in all cases, exceptional or not, except for when the underlying opcode is a JUMP(I) in which case it's more complex.

@OlivierBBB OlivierBBB mentioned this issue Jul 27, 2024
13 tasks
@OlivierBBB OlivierBBB changed the title Should we get PC_NEW from Besu ? Can (and should?) we get PC_NEW from Besu ? Jul 27, 2024
@lu-pinto
Copy link
Collaborator

call tracePostExecution regardless of operationResult which may be undesirable for Besu

Seems like the right option. I don't see any case where it wouldn't call tracePostExecution as we do not return anywhere before inside EVM.runToHalt() method. Even exceptions are swallowed for the code to continue. Inside the operations themselves there might be adjustments to PC accordingly (JMP, JUMPI, PUSH, ...) but IMO it feels like tracePostExecution is the right safe point to take the accurate PC value.

Precompiles don't seem to use PC which makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants