Skip to content

Commit

Permalink
extend addTrace with callFrom (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgroul authored Feb 17, 2024
1 parent 0ea7ccf commit 587d5f5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@subsquid/evm-processor",
"comment": "extend `.addTrace()` with `callFrom` filter",
"type": "minor"
}
],
"packageName": "@subsquid/evm-processor"
}
2 changes: 2 additions & 0 deletions evm/evm-processor/src/ds-rpc/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function buildTraceFilter(dataRequest: DataRequest): EntityFilter<Trace, {
type,
createFrom,
callTo,
callFrom,
callSighash,
suicideRefundAddress,
rewardAuthor,
Expand All @@ -63,6 +64,7 @@ function buildTraceFilter(dataRequest: DataRequest): EntityFilter<Trace, {
filter.propIn('type', type as Trace['type'][])
filter.getIn(trace => trace.type === 'create' && assertNotNull(trace.action?.from), createFrom)
filter.getIn(trace => trace.type === 'call' && assertNotNull(trace.action?.to), callTo)
filter.getIn(trace => trace.type === 'call' && assertNotNull(trace.action?.from), callFrom)
filter.getIn(trace => trace.type === 'call' && assertNotNull(trace.action?.sighash), callSighash)
filter.getIn(trace => trace.type === 'suicide' && assertNotNull(trace.action?.refundAddress), suicideRefundAddress)
filter.getIn(trace => trace.type === 'reward' && assertNotNull(trace.action?.author), rewardAuthor)
Expand Down
1 change: 1 addition & 0 deletions evm/evm-processor/src/interfaces/data-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface TraceRequest {
type?: string[]
createFrom?: Bytes20[]
callTo?: Bytes20[]
callFrom?: Bytes20[]
callSighash?: Bytes[]
suicideRefundAddress?: Bytes[]
rewardAuthor?: Bytes20[]
Expand Down
2 changes: 1 addition & 1 deletion evm/evm-processor/src/mapping/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export function getTraceFrameValidator(fields: FieldSelection['trace'], forArchi

let traceCallAction = project({
callType: fields?.callCallType,
from: fields?.callFrom,
from: forArchive ? fields?.callFrom : true,
to: forArchive ? fields?.callTo : true,
value: fields?.callValue,
gas: fields?.callGas,
Expand Down

0 comments on commit 587d5f5

Please sign in to comment.