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

eth/tracers: prevent the calltracer from crashing #22725

Closed
wants to merge 1 commit into from

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Apr 23, 2021

This PR fixes #16426 and #21879.

Note: it does not fix the root problem, just makes it so that the calltracer specifically does not run into it. It will generate an erroneous trace, but should no longer lead to a full scale node-crash.

@holiman
Copy link
Contributor Author

holiman commented May 11, 2021

repro non-crasher:

func TestRecursion(t *testing.T) {
	vmctx := testCtx()
	tracer, err := New(`{
			step: function() {}, 
			fault: function() {},
			result: function() {
				var o = {}
				var x = o
				for (i = 0; i < 1000; i++){
					o.foo = {}
					o = o.foo
				}
				return JSON.stringify(x)
			}}
	`, vmctx.txCtx)
	if err != nil {
		t.Fatal(err)
	}
	out, err := runTrace(tracer, vmctx)
	fmt.Printf("Err: %v\n", err)
	fmt.Printf(string(out))
}

Change return JSON.stringify(x) to return x to make it crash

@karalabe
Copy link
Member

Closing in favor of #22857, that one is a generic fix for all tracers and also returns a real error instead of silently stopping tracing midway through.

@karalabe karalabe closed this May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

geth crashes while tracing a specific transaction
2 participants