Skip to content

eth/tracers: testcase for crashing duktape ref: #21879 #21913

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions eth/tracers/tracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,34 @@ func TestHaltBetweenSteps(t *testing.T) {
t.Errorf("Expected timeout error, got %v", err)
}
}

// TestPanicLargeTrace tests a large trace, e.g. this tx
// https://etherscan.io/tx/0x0c10fafe0cdbfff32abfe53d57ec861d09986cc1050c850481f79b1a862bb10a
// has 1025 nested calls as output, and crashes duktape
func TestPanicDeepNesting(t *testing.T) {
// This test crashes if i is set to 1000. It's not related to the actual
// size of the bulk data, but rather some magic limit at exactly 1000 nested
// levels
tracer, err := New(`
{ depths: [],
step: function(log, db) {},
fault: function() {},
result: function() {
x = {"i": 0}
y = x
for (i = 0 ; i < 1000 ; i++){
var z = {"i" : i}
y.v = z
y = z
}
return x
}
}
`)
if err != nil {
t.Fatal(err)
}
if data, err := runTrace(tracer); err != nil {
t.Fatal(err)
}
}