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

Non-osaka EOF changes #179

Merged
merged 2 commits into from
Dec 17, 2024
Merged

Non-osaka EOF changes #179

merged 2 commits into from
Dec 17, 2024

Conversation

shemnon
Copy link
Contributor

@shemnon shemnon commented Dec 11, 2024

Adds EOF changes that don't depend on Geth EOF support or the Osaka activation.

  • opcodes for EOF
  • better immediate handling for opcodes
  • EIP-7756 flexibility on opcode and gas
  • EIP-7756 fields (section and functionDepth)

Adds EOF changes that don't depend on Geth EOF support or the Osaka activation.
* opcodes for EOF
* better immediate handling for opcodes
* EIP-7756 flexibility on opcode and gas
* EIP-7756 fields (section and functionDepth)
Copy link
Owner

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

@@ -112,7 +112,13 @@ func (vm *BesuVM) ParseStateRoot(data []byte) (string, error) {
root := string(data[start : start+2+64])
return root, nil
}
return "", errors.New("besu: no stateroot found")
start = strings.Index(string(data), `"stateRoot":"`)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any example statetest which makes besu emit this? Or is that an opcoming change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hyperledger/besu#8006 - will land in main after new year

Comment on lines 28 to 29
// Depends on Geth EOF support
// Even then, not essential to diffing
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't really depend on geth support. You can do like I do with the globals, e.g ClearGascost.

	// Besu sometimes reports GasCost of 0x7fffffffffffffff, along with ,"error":"Out of gas"
	ClearGascost = true

So you add IgnoreEOF = true, in the constants, and

if !IgnoreEOF {
	if log.Section != 0 {
		b = append(b, []byte(`,"section":`)...)
		b = strconv.AppendUint(b, uint64(log.Section), 10)
	}
	if log.FunctionDepth ... 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. Some of the commented out code depends on types from go-ethereum code. Those will remain commented out.

@@ -75,8 +83,14 @@ func (o *opLog) UnmarshalJSON(input []byte) error {
if dec.Pc != nil {
o.Pc = *dec.Pc
}
// Depends on Geth EOF support
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it? We can enable this, I think, as long as we don't use it for diffing later on

Copy link
Contributor Author

@shemnon shemnon Dec 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one will be fixed, it's from goevmlab code.

@@ -79,6 +79,9 @@ func (t *TraceLine) Get(title string) string {
return fmt.Sprintf("%v (0x%x)", op.Pc/ChunkSize, op.Pc/ChunkSize)
case "pc":
return fmt.Sprintf("%v (0x%x)", op.Pc, op.Pc)
// Depends on Geth EOF support
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really? this can be enabled, no? (and same below)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type comes from Geth. The ones that remain after my next push are all because the types need to be in Geth.

@@ -204,7 +204,7 @@ func (mgr *viewManager) onStepSelected(line *traces.TraceLine) {
mgr.opView.AddFormItem(field)
}

for _, l := range []string{"pc", "opcode", "opName", "gasCost", "gas", "memSize", "addr"} {
for _, l := range []string{"pc", "section", "opcode", "opName", "gasCost", "gas", "memSize", "addr", "functionDepth"} {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on whether IgnoreEOF is set, we could use different headings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@holiman holiman merged commit 976535b into holiman:master Dec 17, 2024
1 check failed
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

Successfully merging this pull request may close these issues.

2 participants