Skip to content

Commit

Permalink
substrate-processor: fix archive error when limiting item request by …
Browse files Browse the repository at this point in the history
…block range
eldargab committed Jan 1, 2024
1 parent 4d9629c commit fa73e87
Showing 2 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@subsquid/substrate-processor",
"comment": "fix archive error when limiting item request by block range",
"type": "patch"
}
],
"packageName": "@subsquid/substrate-processor"
}
29 changes: 18 additions & 11 deletions substrate/substrate-processor/src/processor.ts
Original file line number Diff line number Diff line change
@@ -311,49 +311,56 @@ export class SubstrateBatchProcessor<F extends FieldSelection = {}> {

addEvent(options: EventRequest & BlockRange): this {
this.assertNotRunning()
this.add({events: [options]}, options.range)
let {range, ...req} = options
this.add({events: [req]}, range)
return this
}

addCall(options: CallRequest & BlockRange): this {
this.assertNotRunning()
this.add({calls: [options]}, options.range)
let {range, ...req} = options
this.add({calls: [req]}, range)
return this
}

addEvmLog(options: EvmLogRequest & BlockRange): this {
this.assertNotRunning()
let {range, address, ...req} = options
this.add({evmLogs: [{
...options,
address: options.address?.map(s => s.toLowerCase())
}]}, options.range)
...req,
address: address?.map(s => s.toLowerCase())
}]}, range)
return this
}

addEthereumTransaction(options: EthereumTransactRequest & BlockRange): this {
this.assertNotRunning()
let {range, to, ...req} = options
this.add({ethereumTransactions: [{
...options,
to: options.to?.map(s => s.toLowerCase())
}]}, options.range)
...req,
to: to?.map(s => s.toLowerCase())
}]}, range)
return this
}

addContractsContractEmitted(options: ContractsContractEmittedRequest & BlockRange): this {
this.assertNotRunning()
this.add({contractsEvents: [options]}, options.range)
let {range, ...req} = options
this.add({contractsEvents: [req]}, range)
return this
}

addGearMessageQueued(options: GearMessageQueuedRequest & BlockRange): this {
this.assertNotRunning()
this.add({gearMessagesQueued: [options]}, options.range)
let {range, ...req} = options
this.add({gearMessagesQueued: [req]}, range)
return this
}

addGearUserMessageSent(options: GearUserMessageSentRequest & BlockRange): this {
this.assertNotRunning()
this.add({gearUserMessagesSent: [options]}, options.range)
let {range, ...req} = options
this.add({gearUserMessagesSent: [req]}, range)
return this
}

0 comments on commit fa73e87

Please sign in to comment.