Skip to content

Commit 4c69cf8

Browse files
authored
Merge pull request #860 from onflow/mpeter/e2e-tests-erc7562Tracer
Add E2E tests for built-in `erc7562Tracer`
2 parents 96eff65 + e69970a commit 4c69cf8

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

tests/web3js/debug_traces_test.js

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,53 @@ it('should retrieve transaction traces', async () => {
174174
{ '0x6babb224-32': 1 }
175175
)
176176

177+
response = await helpers.callRPCMethod(
178+
'debug_traceTransaction',
179+
[receipt.transactionHash, { tracer: 'erc7562Tracer' }]
180+
)
181+
assert.equal(response.status, 200)
182+
assert.isDefined(response.body.result)
183+
184+
// Assert proper response for `erc7562Tracer`
185+
txTrace = response.body.result
186+
assert.deepEqual(
187+
txTrace,
188+
{
189+
from: '0xfacf71692421039876a5bb4f10ef7a439d8ef61e',
190+
gas: '0x6f9a',
191+
gasUsed: '0x6e3f',
192+
to: '0x99a64c993965f8d69f985b5171bc20065cc32fab',
193+
input: '0x6babb2240000000000000000000000000000000000000000000000000000000000000064',
194+
value: '0x0',
195+
accessedSlots: {
196+
reads: {},
197+
writes: {
198+
'0x0000000000000000000000000000000000000000000000000000000000000000': 1
199+
},
200+
transientReads: {},
201+
transientWrites: {}
202+
},
203+
extCodeAccessInfo: [],
204+
usedOpcodes: {
205+
'0x0': 1,
206+
'0x33': 1,
207+
'0x34': 1,
208+
'0x35': 2,
209+
'0x36': 2,
210+
'0x51': 2,
211+
'0x52': 1,
212+
'0x55': 1,
213+
'0x56': 10,
214+
'0x57': 9,
215+
'0x5b': 15,
216+
'0xa3': 1
217+
},
218+
contractSize: {},
219+
outOfGas: false,
220+
type: 'CALL'
221+
}
222+
)
223+
177224
response = await helpers.callRPCMethod(
178225
'debug_traceBlockByNumber',
179226
[web3.utils.toHex(receipt.blockNumber), { tracer: null }]
@@ -535,6 +582,54 @@ it('should retrieve call traces', async () => {
535582
{ '0x2e64cec1-0': 1 }
536583
)
537584

585+
response = await helpers.callRPCMethod(
586+
'debug_traceCall',
587+
[traceCall, 'latest', { tracer: 'erc7562Tracer' }]
588+
)
589+
assert.equal(response.status, 200)
590+
assert.isDefined(response.body)
591+
592+
// Assert proper response for `erc7562Tracer`
593+
txTrace = response.body.result
594+
assert.deepEqual(
595+
txTrace,
596+
{
597+
from: '0xfacf71692421039876a5bb4f10ef7a439d8ef61e',
598+
gas: '0x75ab',
599+
gasUsed: '0x5be0',
600+
to: '0x99a64c993965f8d69f985b5171bc20065cc32fab',
601+
input: '0x2e64cec1',
602+
output: '0x0000000000000000000000000000000000000000000000000000000000000064',
603+
value: '0x0',
604+
accessedSlots: {
605+
reads: {
606+
'0x0000000000000000000000000000000000000000000000000000000000000000': [
607+
'0x0000000000000000000000000000000000000000000000000000000000000064'
608+
]
609+
},
610+
writes: {},
611+
transientReads: {},
612+
transientWrites: {}
613+
},
614+
extCodeAccessInfo: [],
615+
usedOpcodes: {
616+
'0x34': 1,
617+
'0x35': 1,
618+
'0x36': 1,
619+
'0x51': 2,
620+
'0x52': 2,
621+
'0x54': 1,
622+
'0x56': 8,
623+
'0x57': 5,
624+
'0x5b': 12,
625+
'0xf3': 1
626+
},
627+
contractSize: {},
628+
outOfGas: false,
629+
type: 'CALL'
630+
}
631+
)
632+
538633
let jsTracer = '{hist: {}, nops: 0, step: function(log, db) { var op = log.op.toString(); if (this.hist[op]){ this.hist[op]++; } else { this.hist[op] = 1; } this.nops++; }, fault: function(log, db) {}, result: function(ctx) { return this.hist; }}'
539634
response = await helpers.callRPCMethod(
540635
'debug_traceCall',

0 commit comments

Comments
 (0)