Skip to content

Commit

Permalink
Merge branch 'master' into portal-api
Browse files Browse the repository at this point in the history
  • Loading branch information
belopash committed Dec 13, 2024
2 parents 5cab364 + 209f88c commit 263bab1
Show file tree
Hide file tree
Showing 109 changed files with 822 additions and 165 deletions.
70 changes: 70 additions & 0 deletions evm/evm-processor/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,76 @@
{
"name": "@subsquid/evm-processor",
"entries": [
{
"version": "1.26.1",
"tag": "@subsquid/evm-processor_v1.26.1",
"date": "Tue, 03 Dec 2024 11:47:42 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"@subsquid/util-internal-validation\" from `^0.6.0` to `0.7.0`"
}
]
}
},
{
"version": "1.26.0",
"tag": "@subsquid/evm-processor_v1.26.0",
"date": "Sun, 17 Nov 2024 06:01:50 GMT",
"comments": {
"minor": [
{
"comment": "add `tx.authorizationList` field"
}
]
}
},
{
"version": "1.25.0",
"tag": "@subsquid/evm-processor_v1.25.0",
"date": "Thu, 14 Nov 2024 12:06:12 GMT",
"comments": {
"minor": [
{
"comment": "allow to filter transactions by type"
}
]
}
},
{
"version": "1.24.0",
"tag": "@subsquid/evm-processor_v1.24.0",
"date": "Wed, 13 Nov 2024 11:28:41 GMT",
"comments": {
"patch": [
{
"comment": "properly pass timeout to debug trace config"
}
],
"minor": [
{
"comment": "add transactionStateDiffs to LogRequest"
}
]
}
},
{
"version": "1.23.0",
"tag": "@subsquid/evm-processor_v1.23.0",
"date": "Fri, 01 Nov 2024 17:26:43 GMT",
"comments": {
"minor": [
{
"comment": "allow to configure number of rpc connection errors retry attempts"
}
],
"dependency": [
{
"comment": "Updating dependency \"@subsquid/rpc-client\" from `^4.9.0` to `4.10.0`"
}
]
}
},
{
"version": "1.22.1",
"tag": "@subsquid/evm-processor_v1.22.1",
Expand Down
39 changes: 38 additions & 1 deletion evm/evm-processor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
# Change Log - @subsquid/evm-processor

This log was last generated on Thu, 24 Oct 2024 16:06:57 GMT and should not be manually modified.
This log was last generated on Tue, 03 Dec 2024 11:47:42 GMT and should not be manually modified.

## 1.26.1
Tue, 03 Dec 2024 11:47:42 GMT

_Version update only_

## 1.26.0
Sun, 17 Nov 2024 06:01:50 GMT

### Minor changes

- add `tx.authorizationList` field

## 1.25.0
Thu, 14 Nov 2024 12:06:12 GMT

### Minor changes

- allow to filter transactions by type

## 1.24.0
Wed, 13 Nov 2024 11:28:41 GMT

### Minor changes

- add transactionStateDiffs to LogRequest

### Patches

- properly pass timeout to debug trace config

## 1.23.0
Fri, 01 Nov 2024 17:26:43 GMT

### Minor changes

- allow to configure number of rpc connection errors retry attempts

## 1.22.1
Thu, 24 Oct 2024 16:06:57 GMT
Expand Down
6 changes: 3 additions & 3 deletions evm/evm-processor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@subsquid/evm-processor",
"version": "1.22.1",
"version": "1.26.1",
"description": "Data fetcher and mappings executor for EVM-based chains",
"license": "GPL-3.0-or-later",
"repository": "[email protected]:subsquid/squid.git",
Expand All @@ -19,15 +19,15 @@
"dependencies": {
"@subsquid/http-client": "^1.5.0",
"@subsquid/logger": "^1.3.3",
"@subsquid/rpc-client": "^4.9.0",
"@subsquid/rpc-client": "^4.11.0",
"@subsquid/portal-client": "^0.0.0",
"@subsquid/util-internal": "^3.2.0",
"@subsquid/util-internal-archive-client": "^0.1.2",
"@subsquid/util-internal-hex": "^1.2.2",
"@subsquid/util-internal-ingest-tools": "^1.1.4",
"@subsquid/util-internal-processor-tools": "^4.1.1",
"@subsquid/util-internal-range": "^0.3.0",
"@subsquid/util-internal-validation": "^0.6.0",
"@subsquid/util-internal-validation": "^0.7.0",
"@subsquid/util-timeout": "^2.3.2"
},
"devDependencies": {
Expand Down
11 changes: 10 additions & 1 deletion evm/evm-processor/src/ds-rpc/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {DataRequest} from '../interfaces/data-request'
function buildLogFilter(dataRequest: DataRequest): EntityFilter<Log, {
transaction?: boolean,
transactionLogs?: boolean,
transactionStateDiffs?: boolean,
transactionTraces?: boolean
}> {
let items = new EntityFilter()
Expand All @@ -31,11 +32,12 @@ function buildTransactionFilter(dataRequest: DataRequest): EntityFilter<Transact
}> {
let items = new EntityFilter()
for (let req of dataRequest.transactions || []) {
let {to, from, sighash, ...relations} = req
let {to, from, sighash, type, ...relations} = req
let filter = new FilterBuilder<Transaction>()
filter.propIn('to', to)
filter.propIn('from', from)
filter.propIn('sighash', sighash)
filter.propIn('type', type)
items.add(filter, relations)
}
return items
Expand Down Expand Up @@ -139,6 +141,7 @@ export function filterBlock(block: Block, dataRequest: DataRequest): void {

let logsByTransaction = groupBy(block.logs, log => log.transactionIndex)
let tracesByTransaction = groupBy(block.traces, trace => trace.transactionIndex)
let stateDiffsByTransaction = groupBy(block.stateDiffs, diff => diff.transactionIndex)

let include = new IncludeSet()

Expand All @@ -162,6 +165,12 @@ export function filterBlock(block: Block, dataRequest: DataRequest): void {
include.addTrace(trace)
}
}
if (rel.transactionStateDiffs) {
let stateDiffs = stateDiffsByTransaction.get(log.transactionIndex) ?? []
for (let diff of stateDiffs) {
include.addStateDiff(diff)
}
}
}
}

Expand Down
8 changes: 7 additions & 1 deletion evm/evm-processor/src/ds-rpc/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ function stateDiffsRequested(req?: DataRequest): boolean {
if (tx.stateDiffs) return true
}
}
if (req.logs) {
for (let log of req.logs) {
if (log.transactionStateDiffs) return true
}
}
return false
}

Expand All @@ -105,7 +110,8 @@ const TX_FIELDS: {[K in Exclude<keyof _EvmTx, 'hash'>]: true} = {
r: true,
s: true,
yParity: true,
chainId: true
chainId: true,
authorizationList: true,
}


Expand Down
8 changes: 4 additions & 4 deletions evm/evm-processor/src/ds-rpc/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ export class Rpc {
tracerConfig: {
onlyTopCall: false,
withLog: false, // will study log <-> frame matching problem later
timeout: req.debugTraceTimeout
}
},
timeout: req.debugTraceTimeout,
}

let call = blocks.map(block => ({
Expand Down Expand Up @@ -594,8 +594,8 @@ export class Rpc {
tracerConfig: {
onlyTopCall: false, // passing this option is incorrect, but required by Alchemy endpoints
diffMode: true,
timeout: req.debugTraceTimeout
}
},
timeout: req.debugTraceTimeout
}

let call = blocks.map(block => ({
Expand Down
2 changes: 2 additions & 0 deletions evm/evm-processor/src/interfaces/data-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ export interface LogRequest {
transaction?: boolean
transactionTraces?: boolean
transactionLogs?: boolean
transactionStateDiffs?: boolean
}


export interface TransactionRequest {
to?: Bytes20[]
from?: Bytes20[]
sighash?: Bytes[]
type?: number[]
logs?: boolean
traces?: boolean
stateDiffs?: boolean
Expand Down
11 changes: 11 additions & 0 deletions evm/evm-processor/src/interfaces/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ export interface EvmTransaction extends _EvmTx, _EvmTxReceipt {
}


export interface EIP7702Authorization {
chainId: number
nonce: number
address: Bytes20
yParity: number
r: Bytes32
s: Bytes32
}


export interface _EvmTx {
hash: Bytes32
from: Bytes20
Expand All @@ -51,6 +61,7 @@ export interface _EvmTx {
s: Bytes32
yParity?: number
chainId?: number
authorizationList?: EIP7702Authorization[]
}


Expand Down
2 changes: 2 additions & 0 deletions evm/evm-processor/src/mapping/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {formatId} from '@subsquid/util-internal-processor-tools'
import assert from 'assert'
import {Bytes, Bytes20, Bytes32, Bytes8} from '../interfaces/base'
import {
EIP7702Authorization,
EvmTraceCallAction,
EvmTraceCallResult,
EvmTraceCreateAction,
Expand Down Expand Up @@ -85,6 +86,7 @@ export class Transaction {
type?: number
status?: number
sighash?: Bytes
authorizationList?: EIP7702Authorization[]
l1Fee?: bigint
l1FeeScalar?: number
l1GasPrice?: bigint
Expand Down
11 changes: 11 additions & 0 deletions evm/evm-processor/src/mapping/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ export function getBlockHeaderProps(fields: FieldSelection['block'], forArchive:

export function getTxProps(fields: FieldSelection['transaction'], forArchive: boolean) {
let natural = forArchive ? NAT : SMALL_QTY

let Authorization = object({
chainId: natural,
nonce: natural,
address: BYTES,
yParity: natural,
r: BYTES,
s: BYTES,
})

return {
transactionIndex: natural,
...project(fields, {
Expand All @@ -64,6 +74,7 @@ export function getTxProps(fields: FieldSelection['transaction'], forArchive: bo
s: withSentinel('Transaction.s', '0x', BYTES),
yParity: option(natural),
chainId: option(natural),
authorizationList: option(array(Authorization)),
})
}
}
Expand Down
1 change: 1 addition & 0 deletions evm/evm-processor/src/mapping/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function getTxSelectionValidator() {
l1BaseFeeScalar: FIELD,
l1BlobBaseFee: FIELD,
l1BlobBaseFeeScalar: FIELD,
authorizationList: FIELD,
}
return object(fields)
}
Expand Down
12 changes: 10 additions & 2 deletions evm/evm-processor/src/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export interface RpcEndpointSettings {
* Request timeout in `ms`
*/
requestTimeout?: number
/**
* Maximum number of retry attempts.
*
* By default, retries all "retryable" errors indefinitely.
*/
retryAttempts?: number
/**
* Maximum number of requests in a single batch call
*/
Expand Down Expand Up @@ -472,7 +478,7 @@ export class EvmBatchProcessor<F extends FieldSelection = {}> {
requestTimeout: this.rpcEndpoint.requestTimeout ?? 30_000,
capacity: this.rpcEndpoint.capacity ?? 10,
rateLimit: this.rpcEndpoint.rateLimit,
retryAttempts: Number.MAX_SAFE_INTEGER,
retryAttempts: this.rpcEndpoint.retryAttempts ?? Number.MAX_SAFE_INTEGER,
log: this.getLogger().child('rpc', {rpcUrl: this.rpcEndpoint.url})
})
this.getPrometheusServer().addChainRpcMetrics(() => client.getMetrics())
Expand Down Expand Up @@ -628,7 +634,9 @@ function mapRequest<T extends BlockRange>(options: T): Omit<T, 'range'> {
for (let key in req) {
let val = (req as any)[key]
if (Array.isArray(val)) {
(req as any)[key] = val.map(s => s.toLowerCase())
(req as any)[key] = val.map(s => {
return typeof s == 'string' ? s.toLowerCase() : s
})
}
}
return req
Expand Down
12 changes: 12 additions & 0 deletions fuel/fuel-data/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "@subsquid/fuel-data",
"entries": [
{
"version": "1.1.3",
"tag": "@subsquid/fuel-data_v1.1.3",
"date": "Tue, 03 Dec 2024 11:47:42 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"@subsquid/util-internal-validation\" from `^0.6.0` to `0.7.0`"
}
]
}
},
{
"version": "1.1.2",
"tag": "@subsquid/fuel-data_v1.1.2",
Expand Down
7 changes: 6 additions & 1 deletion fuel/fuel-data/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @subsquid/fuel-data

This log was last generated on Wed, 04 Sep 2024 13:19:03 GMT and should not be manually modified.
This log was last generated on Tue, 03 Dec 2024 11:47:42 GMT and should not be manually modified.

## 1.1.3
Tue, 03 Dec 2024 11:47:42 GMT

_Version update only_

## 1.1.2
Wed, 04 Sep 2024 13:19:03 GMT
Expand Down
Loading

0 comments on commit 263bab1

Please sign in to comment.