Merge pull request #25397 from karalabe/fix-tracer-capitalization

eth/tracers/js: fix capitalization in tests
This commit is contained in:
Péter Szilágyi 2022-07-25 16:50:40 +03:00 committed by GitHub
commit 2b6a761238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,15 +103,15 @@ func TestTracer(t *testing.T) {
{ // tests that we don't panic on bad arguments to memory access { // tests that we don't panic on bad arguments to memory access
code: "{depths: [], step: function(log) { this.depths.push(log.memory.slice(-1,-2)); }, fault: function() {}, result: function() { return this.depths; }}", code: "{depths: [], step: function(log) { this.depths.push(log.memory.slice(-1,-2)); }, fault: function() {}, result: function() { return this.depths; }}",
want: ``, want: ``,
fail: "Tracer accessed out of bound memory: offset -1, end -2 at step (<eval>:1:53(15)) in server-side tracer function 'step'", fail: "tracer accessed out of bound memory: offset -1, end -2 at step (<eval>:1:53(15)) in server-side tracer function 'step'",
}, { // tests that we don't panic on bad arguments to stack peeks }, { // tests that we don't panic on bad arguments to stack peeks
code: "{depths: [], step: function(log) { this.depths.push(log.stack.peek(-1)); }, fault: function() {}, result: function() { return this.depths; }}", code: "{depths: [], step: function(log) { this.depths.push(log.stack.peek(-1)); }, fault: function() {}, result: function() { return this.depths; }}",
want: ``, want: ``,
fail: "Tracer accessed out of bound stack: size 0, index -1 at step (<eval>:1:53(13)) in server-side tracer function 'step'", fail: "tracer accessed out of bound stack: size 0, index -1 at step (<eval>:1:53(13)) in server-side tracer function 'step'",
}, { // tests that we don't panic on bad arguments to memory getUint }, { // tests that we don't panic on bad arguments to memory getUint
code: "{ depths: [], step: function(log, db) { this.depths.push(log.memory.getUint(-64));}, fault: function() {}, result: function() { return this.depths; }}", code: "{ depths: [], step: function(log, db) { this.depths.push(log.memory.getUint(-64));}, fault: function() {}, result: function() { return this.depths; }}",
want: ``, want: ``,
fail: "Tracer accessed out of bound memory: available 0, offset -64, size 32 at step (<eval>:1:58(13)) in server-side tracer function 'step'", fail: "tracer accessed out of bound memory: available 0, offset -64, size 32 at step (<eval>:1:58(13)) in server-side tracer function 'step'",
}, { // tests some general counting }, { // tests some general counting
code: "{count: 0, step: function() { this.count += 1; }, fault: function() {}, result: function() { return this.count; }}", code: "{count: 0, step: function() { this.count += 1; }, fault: function() {}, result: function() { return this.count; }}",
want: `3`, want: `3`,
@ -232,7 +232,7 @@ func TestIsPrecompile(t *testing.T) {
t.Error(err) t.Error(err)
} }
if string(res) != "false" { if string(res) != "false" {
t.Errorf("Tracer should not consider blake2f as precompile in byzantium") t.Errorf("tracer should not consider blake2f as precompile in byzantium")
} }
tracer, _ = newJsTracer("{addr: toAddress('0000000000000000000000000000000000000009'), res: null, step: function() { this.res = isPrecompiled(this.addr); }, fault: function() {}, result: function() { return this.res; }}", nil) tracer, _ = newJsTracer("{addr: toAddress('0000000000000000000000000000000000000009'), res: null, step: function() { this.res = isPrecompiled(this.addr); }, fault: function() {}, result: function() { return this.res; }}", nil)
@ -242,7 +242,7 @@ func TestIsPrecompile(t *testing.T) {
t.Error(err) t.Error(err)
} }
if string(res) != "true" { if string(res) != "true" {
t.Errorf("Tracer should consider blake2f as precompile in istanbul") t.Errorf("tracer should consider blake2f as precompile in istanbul")
} }
} }