diff --git a/common/changes/@subsquid/evm-processor/call-from_2024-02-15-13-39.json b/common/changes/@subsquid/evm-processor/call-from_2024-02-15-13-39.json new file mode 100644 index 000000000..32455274b --- /dev/null +++ b/common/changes/@subsquid/evm-processor/call-from_2024-02-15-13-39.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@subsquid/evm-processor", + "comment": "extend `.addTrace()` with `callFrom` filter", + "type": "minor" + } + ], + "packageName": "@subsquid/evm-processor" +} diff --git a/evm/evm-processor/src/ds-rpc/filter.ts b/evm/evm-processor/src/ds-rpc/filter.ts index 544f3aef1..e43811c4b 100644 --- a/evm/evm-processor/src/ds-rpc/filter.ts +++ b/evm/evm-processor/src/ds-rpc/filter.ts @@ -54,6 +54,7 @@ function buildTraceFilter(dataRequest: DataRequest): EntityFilter 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) diff --git a/evm/evm-processor/src/interfaces/data-request.ts b/evm/evm-processor/src/interfaces/data-request.ts index 25e21fb47..a18404c19 100644 --- a/evm/evm-processor/src/interfaces/data-request.ts +++ b/evm/evm-processor/src/interfaces/data-request.ts @@ -39,6 +39,7 @@ export interface TraceRequest { type?: string[] createFrom?: Bytes20[] callTo?: Bytes20[] + callFrom?: Bytes20[] callSighash?: Bytes[] suicideRefundAddress?: Bytes[] rewardAuthor?: Bytes20[] diff --git a/evm/evm-processor/src/mapping/schema.ts b/evm/evm-processor/src/mapping/schema.ts index 96b243e7a..ebbfb6781 100644 --- a/evm/evm-processor/src/mapping/schema.ts +++ b/evm/evm-processor/src/mapping/schema.ts @@ -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,