Repository: subsquid-quests/network-test-one-uniform-load-squid
Branch: master
Commit: 32a62b7cd32e
Files: 22
Total size: 26.4 KB
Directory structure:
gitextract_29u0cnn0/
├── .contract-addrs
├── .gitignore
├── LICENSE
├── README.md
├── commands.json
├── docker-compose.yml
├── package.json
├── query-gateway/
│ ├── config/
│ │ └── gateway-config.yml
│ └── keys/
│ └── .keep
├── renovate.json
├── schema.graphql
├── scripts/
│ ├── checkKey.js
│ ├── exportWalletKeyAsJson.js
│ ├── getPeerIdFromGatewayKey.js
│ └── package.json
├── squid.yaml
├── src/
│ ├── allFields.ts
│ ├── main.ts
│ ├── processor.ts
│ ├── testConfig.ts
│ └── utils.ts
└── tsconfig.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .contract-addrs
================================================
export MULTICALL_CONTRACT_ADDR=0xcA11bde05977b3631167028862bE2a173976CA11
export WORKER_REGISTRATION_CONTRACT_ADDR=0x7Bf0B1ee9767eAc70A857cEbb24b83115093477F
export NETWORK_CONTROLLER_CONTRACT_ADDR=0x938026fefC5F2b6d7c1bCC7098A3Fd1A81C2AECF
export GATEWAY_REGISTRY_CONTRACT_ADDR=0x01D7D0CC06cDdD744a9E06C9bc5249DA6da3e848
================================================
FILE: .gitignore
================================================
/node_modules
/lib
/query-gateway/keys/*.key
/query-gateway/allocations.db
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2023 Subsquid Labs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
w<p align="center">
<picture>
<source srcset="https://uploads-ssl.webflow.com/63b5a9958fccedcf67d716ac/64662df3a5a568fd99e3600c_Squid_Pose_1_White-transparent-slim%201.png" media="(prefers-color-scheme: dark)">
<img src="https://uploads-ssl.webflow.com/63b5a9958fccedcf67d716ac/64662df3a5a568fd99e3600c_Squid_Pose_1_White-transparent-slim%201.png" alt="Subsquid Logo">
</picture>
</p>
[](https://docs.subsquid.io/)
[](https://discord.gg/subsquid)
[Website](https://subsquid.io) | [Docs](https://docs.subsquid.io/) | [Discord](https://discord.gg/subsquid)
[Subsquid Network Docs](https://docs.subsquid.io/subsquid-network/)
# Network Test One: Uniform Load
Some tests of Subsquid Network Phase Two testnet require that all workers regularly serve some queries. You can help the team create this type of uniform load by running this squid.
Note: you'll need to have at least 10 tSQD to complete this quest. Obtain them by doing other quests first.
> [!TIP]
> If you locked any of your tSQD before, check if you can unlock any at the [gateways page](https://app.subsquid.io/profile/gateways?testnet).
### I. Install dependencies: Node.js, Docker, Git.
<details>
<summary>On Windows</summary>
1. Enable [Hyper-V](https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v).
2. Install [Docker for Windows](https://docs.docker.com/desktop/install/windows-install/).
3. Install NodeJS LTS using the [official installer](https://nodejs.org/en/download).
4. Install [Git for Windows](https://git-scm.com/download/win).
In all installs it is OK to leave all the options at their default values. You will need a terminal to complete this tutorial - [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) bash is the preferred option.
</details>
<details>
<summary>On Mac</summary>
1. Install [Docker for Mac](https://docs.docker.com/desktop/install/mac-install/).
2. Install Git using the [installer](https://sourceforge.net/projects/git-osx-installer/) or by [other means](https://git-scm.com/download/mac).
3. Install NodeJS LTS using the [official installer](https://nodejs.org/en/download).
We recommend configuring NodeJS to install global packages to a folder owned by an unprivileged account. Create the folder by running
```bash
mkdir ~/global-node-packages
```
then configure NodeJS to use it
```bash
npm config set prefix ~/global-node-packages
```
Make sure that the folder `~/global-node-packages/bin` is in `PATH`. That allows running globally installed NodeJS executables from any terminal. Here is a one-liner that detects your shell and takes care of setting `PATH`:
```
CURSHELL=`ps -hp $$ | awk '{print $5}'`; case `basename $CURSHELL` in 'bash') DEST="$HOME/.bash_profile";; 'zsh') DEST="$HOME/.zshenv";; esac; echo 'export PATH="${HOME}/global-node-packages/bin:$PATH"' >> "$DEST"
```
Alternatively you can add the following line to `~/.zshenv` (if you are using zsh) or `~/.bash_profile` (if you are using bash) manually:
```
export PATH="${HOME}/global-node-packages/bin:$PATH"
```
Re-open the terminal to apply the changes.
</details>
<details>
<summary>On Linux</summary>
Install [NodeJS (v16 or newer)](https://nodejs.org/en/download/package-manager), Git and Docker using your distro's package manager.
We recommend configuring NodeJS to install global packages to a folder owned by an unprivileged account. Create the folder by running
```bash
mkdir ~/global-node-packages
```
then configure NodeJS to use it
```bash
npm config set prefix ~/global-node-packages
```
Make sure that any executables globally installed by NodeJS are in `PATH`. That allows running them from any terminal. Open the `~/.bashrc` file in a text editor and add the following line at the end:
```
export PATH="${HOME}/global-node-packages/bin:$PATH"
```
Re-open the terminal to apply the changes.
</details>
### II. Install Subsquid CLI
Open a terminal and run
```bash
npm install --global @subsquid/cli@latest
```
This adds the [`sqd` command](https://docs.subsquid.io/squid-cli/). Verify that the installation was successful by running
```bash
sqd --version
```
A healthy response should look similar to
```
@subsquid/cli/2.8.0 linux-x64 node-v20.5.1
```
### III. Run the squid
1. Open a terminal, navigate to any folder for which you have write permissions and run the following commands to retrieve the squid, enter its folder and install dependencies:
```bash
sqd init uniform-load-squid -t https://github.com/subsquid-quests/network-test-one-uniform-load-squid
```
```bash
cd uniform-load-squid
```
```bash
npm ci
```
> [!IMPORTANT]
> If you're on Windows, the terminal opens in `C:\Windows\system32` by default. Do not download your squid there, navigate someplace else.
2. Press "Get Key" button in the quest card to obtain the `networkTestOneUniformLoad.key` key file. Save it to the `./query-gateway/keys` subfolder of the squid folder. The file will be used to identify your local query gateway when locking tSQD to allocate bandwidth and as it operates.
3. Get the peer ID of your future gateway by running:
```bash
sqd get-peer-id
```
4. Register your future gateway using [this page](https://app.subsquid.io/profile/gateways/add?testnet).
- Use the peer ID you obtained in the previous step.
- Leave the "Publicly available" switch disabled.
5. Lock 10 tSQD by selecting your gateway on [this page](https://app.subsquid.io/profile/gateways?testnet), clicking "Get CU" and submitting the form. Once done, you will begin getting computation units (*CUs*) once every epoch (~15 minutes).
The "Lock blocks duration" field lets you tune the length of time during which you'll be able to query the network, measured in blocks of Arbitrum Sepolia's L1 (that is, Ethereum Sepolia). The minumum is five hours, but you can opt to lock for longer if you intend to work on the quest over multiple days.
| Time | Blocks |
|:-----------------:|:------:|
| 5 hours (minimum) | 1500 |
| 24 hours | 7200 |
| 72 hours | 21600 |
Be aware that you'll need to unlock your tokens manually after the end of this period. The tokens you get back will be used in subsequent quests.
If the locking period expires before you finish your work, simply unlock your tokens, then lock them again.
6. Wait for about 15 minutes. This is the time it takes for Subsquid Network to enter a new epoch, at the beginning of which CUs will be allocated towards your gateway.
7. Start the query gateway with
```bash
sqd up
```
If you'd like to check if the locking was successful, you can inspect the logs of the query gateway container with `docker logs <query_gateway_container_name>`. After one-two minutes required for the node startup it should contain some lines like this one:
```
[2024-01-31T14:55:06Z INFO query_gateway::chain_updates] allocated CU: 48300 spent CU: 0
```
> [!TIP]
> If you get an error message about `unknown shorthand flag: 'd' in -d`, that means that you're using an old version of `docker` that does not support the `compose` command yet. Update Docker or edit the `commands.json` file as follows:
> ```diff
> "up": {
> "deps": ["check-key"],
> "description": "Start a PG database",
> - "cmd": ["docker", "compose", "up", "-d"]
> + "cmd": ["docker-compose", "up", "-d"]
> },
> "down": {
> "description": "Drop a PG database",
> - "cmd": ["docker", "compose", "down"]
> + "cmd": ["docker-compose", "down"]
> },
> ```
8. Build the squid code
```bash
sqd build
```
9. Start your squid with
```bash
sqd run .
```
The command should output lines like these:
```
[eth-processor] {"level":2,"time":1705681499120,"ns":"sqd:commands","msg":"PROCESS:ETH"}
[moonbeam-processor] {"level":2,"time":1705681499148,"ns":"sqd:commands","msg":"PROCESS:MOONBEAM"}
[base-processor] {"level":2,"time":1705681499155,"ns":"sqd:commands","msg":"PROCESS:BASE"}
[bsc-processor] {"level":2,"time":1705681499163,"ns":"sqd:commands","msg":"PROCESS:BSC"}
[eth-processor] 01:24:59 INFO sqd:processor processing blocks from 955722
[base-processor] 01:24:59 INFO sqd:processor processing blocks from 1208926
[moonbeam-processor] 01:24:59 INFO sqd:processor processing blocks from 166845
[bsc-processor] 01:24:59 INFO sqd:processor processing blocks from 16996735
[eth-processor] 01:24:59 INFO sqd:processor using archive data source
[eth-processor] 01:24:59 INFO sqd:processor prometheus metrics are served at port 34253
[base-processor] 01:24:59 INFO sqd:processor using archive data source
[base-processor] 01:24:59 INFO sqd:processor prometheus metrics are served at port 40205
[moonbeam-processor] 01:24:59 INFO sqd:processor using archive data source
[moonbeam-processor] 01:24:59 INFO sqd:processor prometheus metrics are served at port 33691
[bsc-processor] 01:24:59 INFO sqd:processor using archive data source
[bsc-processor] 01:24:59 INFO sqd:processor prometheus metrics are served at port 41199
[moonbeam-processor] 01:25:00 INFO sqd:processor:mapping Got 0 burn txs and 0 USDT transfers
[moonbeam-processor] 01:25:00 INFO sqd:processor 171971 / 5325985, rate: 3823 blocks/sec, mapping: 2729 blocks/sec, 1364 items/sec, eta: 23m
[base-processor] 01:25:00 INFO sqd:processor:mapping Got 0 burn txs and 0 USDT transfers
[base-processor] 01:25:00 INFO sqd:processor 1477379 / 9442733, rate: 175758 blocks/sec, mapping: 8032 blocks/sec, 1339 items/sec, eta: 45s
[base-processor] 01:25:02 INFO sqd:processor:mapping Got 1 burn txs and 0 USDT transfers
```
The squid should download enough data in 3-4 hours.
> [!TIP]
> Do not worry if the squid fails: any progress it made is saved. Simply restart it if it happens.
When done, stop the squid processor with Ctrl-C, then stop and remove the query gateway container with
```bash
sqd down
```
10. After the locking period ends, go to the [gateways page](https://app.subsquid.io/profile/gateways/) and unlock your tSQD - you will need them for other quests.
# Quest Info
| Category | Skill Level | Time required (minutes) | Max Participants | Reward | Status |
| ---------------- | ------------------------------------ | ----------------------- | ---------------- | ----------------------------------- | ------ |
| Squid Deployment | $\textcolor{green}{\textsf{Simple}}$ | ~250 | - | $\textcolor{red}{\textsf{75tSQD}}$ | open |
# Acceptance critera
Sync this squid using the key from the quest card. The syncing progress is tracked by the amount of data the squid has retrieved from [Subsquid Network](https://docs.subsquid.io/subsquid-network).
# About this squid
This [squid](https://docs.subsquid.io/) retrieves native token burns on ETH, BSC, Base and Moonbeam. It does not keep any data, as it's sole purpose is to stress test the network.
Data ingester ("processor") code is defined for all networks in `src/testConfig.ts`. The executable `src/main.ts` chooses the settings to use based on its sole command line argument. The scripts file `commands.json` contains commands for running each processor (`process:eth`, `process:bsc`, `process:base` and `process:moonbeam`). You can also use `sqd run` to run all the services at once; the list of services is kept in the [squid manifest](https://docs.subsquid.io/cloud/reference/manifest/) at `squid.yaml`.
The squid uses Phase Two [Subsquid Network](https://docs.subsquid.io/subsquid-network) as its primary data source.
# Troubleshooting
## Network errors
Your squid may get a variety of errors while trying to connect to your local gateway. Some are completely normal, some indicate problems.
### HTTP 503 and 504
It is normal to receive a few of this during the sync. If all the responses you get are 503s or 504s and your gateway fails to serve any data, wait for a few hours and retry. The wait is necessary because this behavior can be caused by a network upgrade, which happen frequently - it's a testnet after all.
### HTTP 403
Typically occurs when the computation units (CUs) you should get for locking your tSQD fail to reach the worker nodes of the network. Here's how to approach fixing it:
1. Make sure you waited for 20 minutes since you ran `sqd up` and try running your squid.
- You should see no tokens listed as "Pending lock" at the [gateways page](https://app.subsquid.io/profile/gateways?testnet). If you still do see some after about 40 minutes of any locking/relocking operations, [contact support](#contacting-support).
2. If you're still getting 403s, visit the [gateways page](https://app.subsquid.io/profile/gateways?testnet) and ensure that you have some locked tSQD associated with your wallet. To do that, go to your gateway's page and check if the "Unlock" button is greyed out.
- If it is **NOT**, your locking period had ended. Unlock your tokens, lock them again, restart your gateway with `sqd down` then `sqd up` and go to step 1.
- If it is, proceed to step 3.
3. If you're still getting 403s, attempt the following:
- shut your gateway down with `sqd down`
- remove `./query-gateway/allocations.db`
- start the gateway with `sqd up`
- wait for 20 minutes
- try running your squid
4. If you're still getting 403s, attempt the following
- shut your gateway down with `sqd down`
- remove `./query-gateway/allocations.db`
- **unlock your tSQDs** (may take a while)
- **lock your tSQDs again**
- start the gateway with `sqd up`
- wait for 20 minutes
- try running your squid
### Connection refused
Can be identified by `ECONNREFUSED` in the squid logs. This means that your query gateway is not running.
1. Check the logs of the gateway container to see if it really isn't running. To get the logs, run `docker logs <query_gateway_container_name>`, where the container name can be found in the output of `sqd up`.
2. Run `sqd get-peer-id` then [check](https://app.subsquid.io/profile/gateways?testnet) if your gateway is registered. If it is, try re-running `sqd up` and then the quest squid.
Alternatively, shut down all the Docker containers in your system (e.g. by rebooting) and start the quest from scratch.
### Timeouts
Try restarting your gateway container by running `sqd down` then `sqd up`. Then, wait for 20 minutes and try running your squid.
# Contacting support
If the standard [troubleshooting](#troubleshooting) fails, contact us via [Discord](https://discord.gg/subsquid). Make sure to attach the logs of your query gateway container as a txt file or via [Pastebin](https://pastebin.com). To get the logs, run `docker logs <query_gateway_container_name>`, where the container name can be found in the output of `sqd up`.
================================================
FILE: commands.json
================================================
{
"$schema": "https://cdn.subsquid.io/schemas/commands.json",
"commands": {
"clean": {
"description": "delete all build artifacts",
"cmd": ["npx", "--yes", "rimraf", "lib"]
},
"build": {
"description": "Build the squid project",
"deps": ["clean"],
"cmd": ["tsc"]
},
"check-key": {
"cmd": ["node", "scripts/checkKey.js", "query-gateway/keys/networkTestOneUniformLoad.key"],
"hidden": true
},
"get-peer-id": {
"deps": ["check-key"],
"description": "Get a peer ID given the public key",
"cmd": ["node", "scripts/getPeerIdFromGatewayKey.js", "query-gateway/keys/networkTestOneUniformLoad.key"]
},
"up": {
"deps": ["check-key"],
"description": "Start a Subsquid network gateway",
"cmd": ["docker", "compose", "up", "-d"]
},
"down": {
"description": "Stop a Subsquid network gateway",
"cmd": ["docker", "compose", "down"]
},
"process:eth": {
"description": "Load .env and start the ETH squid processor",
"cmd": ["node", "--require=dotenv/config", "lib/main.js", "eth"]
},
"process:bsc": {
"description": "Load .env and start the BSC squid processor",
"cmd": ["node", "--require=dotenv/config", "lib/main.js", "bsc"]
},
"process:base": {
"description": "Load .env and start the Base squid processor",
"cmd": ["node", "--require=dotenv/config", "lib/main.js", "base"]
},
"process:moonbeam": {
"description": "Load .env and start the Base squid processor",
"cmd": ["node", "--require=dotenv/config", "lib/main.js", "moonbeam"]
},
"check-updates": {
"cmd": ["npx", "--yes", "npm-check-updates", "--filter=/subsquid/", "--upgrade"],
"hidden": true
},
"bump": {
"description": "Bump @subsquid packages to the latest versions",
"deps": ["check-updates"],
"cmd": ["npm", "i", "-f"]
}
}
}
================================================
FILE: docker-compose.yml
================================================
version: "3.8"
services:
query_gateway:
image: subsquid/query-gateway:0.2.8
environment:
HTTP_LISTEN_ADDR: 0.0.0.0:8000
BOOT_NODES: >
12D3KooWSRvKpvNbsrGbLXGFZV7GYdcrYNh4W2nipwHHMYikzV58 /dns4/testnet.subsquid.io/tcp/22345,
12D3KooWQC9tPzj2ShLn39RFHS5SGbvbP2pEd7bJ61kSW2LwxGSB /dns4/testnet.subsquid.io/tcp/22346,
12D3KooWQER7HEpwsvqSzqzaiV36d3Bn6DZrnwEunnzS76pgZkMU /dns4/testnet.subsquid.io/tcp/32345
RPC_URL: https://sepolia-rollup.arbitrum.io/rpc
CONFIG_PATH: /app/data/config/gateway-config.yml
KEY_PATH: /app/data/keys/networkTestOneUniformLoad.key
ALLOCATIONS_DB_PATH: /app/data/allocations.db
env_file:
- .contract-addrs
volumes:
- ./query-gateway:/app/data
ports:
- "19174:8000"
================================================
FILE: package.json
================================================
{
"name": "squid-evm-template",
"private": true,
"scripts": {
"build": "rm -rf lib && tsc"
},
"dependencies": {
"@belopash/mock-store": "^0.0.0",
"@subsquid/evm-processor": "^1.13.0",
"dotenv": "^16.3.1",
"@inquirer/input": "^1.2.14",
"@inquirer/password": "^1.1.14",
"@types/node": "^20.11.5",
"ethereumjs-wallet": "^1.0.2",
"libp2p": "0.32.5",
"peer-id": "^0.16.0",
"typescript": "~5.3.3"
}
}
================================================
FILE: query-gateway/config/gateway-config.yml
================================================
scheduler_id: "12D3KooWQER7HEpwsvqSzqzaiV36d3Bn6DZrnwEunnzS76pgZkMU"
send_metrics: true
worker_inactive_threshold_sec: 60
worker_greylist_time_sec: 600
default_query_timeout_sec: 60
summary_print_interval_sec: 30
workers_update_interval_sec: 60
available_datasets:
ethereum-mainnet: "czM6Ly9ldGhlcmV1bS1tYWlubmV0LTE"
binance-mainnet: "czM6Ly9ic2MtbWFpbm5ldC0x"
base-mainnet: "czM6Ly9iYXNlLTE"
moonbeam-mainnet: "czM6Ly9tb29uYmVhbS1ldm0tMQ"
================================================
FILE: query-gateway/keys/.keep
================================================
================================================
FILE: renovate.json
================================================
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"packageRules": [
{
"groupName": "@subsquid",
"matchPackagePatterns": [
"^@subsquid/"
],
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
]
},
{
"matchPackagePatterns": ["*"],
"excludePackagePatterns": ["^@subsquid/"],
"enabled": false
}
],
"automerge": true,
"automergeType": "pr",
"automergeStrategy": "squash",
"ignoreTests": true
}
================================================
FILE: schema.graphql
================================================
type Transfer @entity {
id: ID!
network: String! @index
block: Int! @index
timestamp: DateTime! @index
from: String! @index
to: String! @index
value: BigInt!
txHash: String! @index
}
================================================
FILE: scripts/checkKey.js
================================================
import fs from 'fs'
const keyPath = process.argv[2]
if (!keyPath || !fs.existsSync(keyPath) || !fs.lstatSync(keyPath).isFile()) {
console.error(`ERROR: Key file not found at ${keyPath}`)
process.exit(1)
}
================================================
FILE: scripts/exportWalletKeyAsJson.js
================================================
import fs from 'fs'
import wallet from 'ethereumjs-wallet'
const pk = new Buffer.from(process.argv[2], 'hex') // supply a private key
const account = wallet.fromPrivateKey(pk)
const password = process.argv[3] // will be required to unlock/sign after importing
account.toV3(password)
.then(value => {
const address = account.getAddress().toString('hex')
const file = `UTC--${new Date().toISOString().replace(/[:]/g, '-')}--${address}.json`
fs.writeFileSync(file, JSON.stringify(value))
})
================================================
FILE: scripts/getPeerIdFromGatewayKey.js
================================================
import { createFromPrivKey } from 'peer-id'
import { keys } from 'libp2p-crypto'
import { readFileSync } from 'fs'
const file = readFileSync(process.argv[2])
async function main() {
const key = await keys.supportedKeys.ed25519.unmarshalEd25519PrivateKey((file))
const peerId = await createFromPrivKey(key.bytes)
console.log('Your peer ID is', peerId.toB58String())
}
main()
================================================
FILE: scripts/package.json
================================================
{
"type": "module"
}
================================================
FILE: squid.yaml
================================================
manifestVersion: subsquid.io/v0.1
name: uniform-load-squid
version: 1
description: Quest squid for loading the Phase 2 permissionless Subsquid testnet
build:
deploy:
processor:
- name: eth-processor
cmd:
- sqd
- process:eth
- name: bsc-processor
cmd:
- sqd
- process:bsc
- name: base-processor
cmd:
- sqd
- process:base
- name: moonbeam-processor
cmd:
- sqd
- process:moonbeam
================================================
FILE: src/allFields.ts
================================================
// evm-processor fields selections for all existing fields
export const allTransactionFields = {
gas: true,
gasPrice: true,
maxFeePerGas: true,
maxPriorityFeePerGas: true,
input: true,
nonce: true,
value: true,
v: true,
r: true,
s: true,
yParity: true,
chainId: true,
gasUsed: true,
cumulativeGasUsed: true,
effectiveGasPrice: true,
contractAddress: true,
type: true,
status: true,
sighash: true
}
export const allLogFields = {
transactionHash: true
}
export const allTraceFields = {
createFrom: true,
createValue: true,
createGas: true,
createInit: true,
createResultGasUsed: true,
createResultCode: true,
createResultAddress: true,
callFrom: true,
callTo: true,
callValue: true,
callGas: true,
callSighash: true,
callInput: true,
callResultGasUsed: true,
callResultOutput: true,
suicideAddress: true,
suicideRefundAddress: true,
suicideBalance: true,
rewardAuthor: true,
rewardValue: true,
rewardType: true
}
export const allStateDiffFields = {}
export const allBlockHeaderFields = {
nonce: true,
sha3Uncles: true,
logsBloom: true,
transactionsRoot: true,
stateRoot: true,
receiptsRoot: true,
mixHash: true,
miner: true,
difficulty: true,
totalDifficulty: true,
extraData: true,
size: true,
gasLimit: true,
gasUsed: true,
baseFeePerGas: true
}
export const allFields = {
transaction: allTransactionFields,
log: allLogFields,
trace: allTraceFields,
stateDiff: allStateDiffFields,
block: allBlockHeaderFields
}
================================================
FILE: src/main.ts
================================================
import {MockDatabase} from '@belopash/mock-store'
import {processor, config} from './processor'
processor.run(new MockDatabase(), config.batchHandler)
================================================
FILE: src/processor.ts
================================================
import assert from 'assert'
import {EvmBatchProcessor} from '@subsquid/evm-processor'
import {networksConfig} from './testConfig'
assert(Object.keys(networksConfig).includes(process.argv[2]), `no config for network "${process.argv[2]}"`)
export const config = networksConfig[process.argv[2] as keyof typeof networksConfig]
const processor = new EvmBatchProcessor().setGateway(config.datasetUrl)
if (config.range) processor.setBlockRange(config.range)
if (config.includeAllBlocks) processor.includeAllBlocks()
for (let txRequest of config.transactions) {
processor.addTransaction(txRequest)
}
for (let logRequest of config.logs) {
processor.addLog(logRequest)
}
for (let traceRequest of config.traces) {
processor.addTrace(traceRequest)
}
for (let stateDiffRequest of config.stateDiffs) {
processor.addStateDiff(stateDiffRequest)
}
processor.setFields(config.fields)
export { processor }
================================================
FILE: src/testConfig.ts
================================================
import {assertNotNull} from '@subsquid/util-internal'
import {allTransactionFields, allBlockHeaderFields} from './allFields'
import {getRandomInt} from './utils'
const gateway = assertNotNull(process.env.SUBSQUID_NETWORK_GATEWAY)
const commonConfig = {
batchHandler: async (ctx: any) => {
let burns = 0
for (let block of ctx.blocks) {
burns += block.transactions.length
}
ctx.log.info(`Got ${burns} burn txs`)
},
includeAllBlocks: true,
transactions: [
{
to: ['0x0000000000000000000000000000000000000000']
}
],
logs: [],
traces: [],
stateDiffs: [],
fields: {
transaction: allTransactionFields,
block: allBlockHeaderFields
}
}
export const networksConfig = {
eth: {
datasetUrl: `${gateway}/network/ethereum-mainnet`,
range: { from: getRandomInt(0, 14_000_000) },
...commonConfig
},
bsc: {
datasetUrl: `${gateway}/network/binance-mainnet`,
range: { from: getRandomInt(0, 30_000_000) },
...commonConfig
},
base: {
datasetUrl: `${gateway}/network/base-mainnet`,
range: { from: getRandomInt(0, 4_000_000) },
...commonConfig
},
moonbeam: {
datasetUrl: `${gateway}/network/moonbeam-mainnet`,
range: { from: 0 },
...commonConfig
}
}
================================================
FILE: src/utils.ts
================================================
export function getRandomInt(min: number, max: number) {
return Math.floor(Math.random() * (max - min + 1)) + min
}
================================================
FILE: tsconfig.json
================================================
{
"compilerOptions": {
"module": "commonjs",
"target": "es2020",
"outDir": "lib",
"rootDir": "src",
"strict": true,
"declaration": false,
"sourceMap": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipLibCheck": true,
"resolveJsonModule": true
},
"include": ["src"],
"exclude": [
"node_modules"
]
}
gitextract_29u0cnn0/ ├── .contract-addrs ├── .gitignore ├── LICENSE ├── README.md ├── commands.json ├── docker-compose.yml ├── package.json ├── query-gateway/ │ ├── config/ │ │ └── gateway-config.yml │ └── keys/ │ └── .keep ├── renovate.json ├── schema.graphql ├── scripts/ │ ├── checkKey.js │ ├── exportWalletKeyAsJson.js │ ├── getPeerIdFromGatewayKey.js │ └── package.json ├── squid.yaml ├── src/ │ ├── allFields.ts │ ├── main.ts │ ├── processor.ts │ ├── testConfig.ts │ └── utils.ts └── tsconfig.json
SYMBOL INDEX (2 symbols across 2 files)
FILE: scripts/getPeerIdFromGatewayKey.js
function main (line 7) | async function main() {
FILE: src/utils.ts
function getRandomInt (line 1) | function getRandomInt(min: number, max: number) {
Condensed preview — 22 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (29K chars).
[
{
"path": ".contract-addrs",
"chars": 322,
"preview": "export MULTICALL_CONTRACT_ADDR=0xcA11bde05977b3631167028862bE2a173976CA11\nexport WORKER_REGISTRATION_CONTRACT_ADDR=0x7Bf"
},
{
"path": ".gitignore",
"chars": 75,
"preview": "/node_modules\n/lib\n/query-gateway/keys/*.key\n/query-gateway/allocations.db\n"
},
{
"path": "LICENSE",
"chars": 1070,
"preview": "MIT License\n\nCopyright (c) 2023 Subsquid Labs\n\nPermission is hereby granted, free of charge, to any person obtaining a c"
},
{
"path": "README.md",
"chars": 15079,
"preview": "w<p align=\"center\">\n<picture>\n <source srcset=\"https://uploads-ssl.webflow.com/63b5a9958fccedcf67d716ac/64662df3a5a56"
},
{
"path": "commands.json",
"chars": 1944,
"preview": "{\n \"$schema\": \"https://cdn.subsquid.io/schemas/commands.json\",\n \"commands\": {\n \"clean\": {\n \"description\": \"del"
},
{
"path": "docker-compose.yml",
"chars": 789,
"preview": "version: \"3.8\"\n\nservices:\n query_gateway:\n image: subsquid/query-gateway:0.2.8\n environment:\n HTTP_LISTEN_AD"
},
{
"path": "package.json",
"chars": 451,
"preview": "{\n \"name\": \"squid-evm-template\",\n \"private\": true,\n \"scripts\": {\n \"build\": \"rm -rf lib && tsc\"\n },\n \"dependencie"
},
{
"path": "query-gateway/config/gateway-config.yml",
"chars": 448,
"preview": "scheduler_id: \"12D3KooWQER7HEpwsvqSzqzaiV36d3Bn6DZrnwEunnzS76pgZkMU\"\nsend_metrics: true\nworker_inactive_threshold_sec: 6"
},
{
"path": "query-gateway/keys/.keep",
"chars": 0,
"preview": ""
},
{
"path": "renovate.json",
"chars": 565,
"preview": "{\n \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n \"extends\": [\n \"config:base\"\n ],\n \"packageRule"
},
{
"path": "schema.graphql",
"chars": 199,
"preview": "type Transfer @entity {\n id: ID!\n network: String! @index\n block: Int! @index\n timestamp: DateTime! @index\n from: S"
},
{
"path": "scripts/checkKey.js",
"chars": 207,
"preview": "import fs from 'fs'\nconst keyPath = process.argv[2]\nif (!keyPath || !fs.existsSync(keyPath) || !fs.lstatSync(keyPath).is"
},
{
"path": "scripts/exportWalletKeyAsJson.js",
"chars": 498,
"preview": "import fs from 'fs'\nimport wallet from 'ethereumjs-wallet'\n\nconst pk = new Buffer.from(process.argv[2], 'hex') // supply"
},
{
"path": "scripts/getPeerIdFromGatewayKey.js",
"chars": 381,
"preview": "import { createFromPrivKey } from 'peer-id'\nimport { keys } from 'libp2p-crypto'\nimport { readFileSync } from 'fs'\n\ncons"
},
{
"path": "scripts/package.json",
"chars": 23,
"preview": "{\n \"type\": \"module\"\n}\n"
},
{
"path": "squid.yaml",
"chars": 484,
"preview": "manifestVersion: subsquid.io/v0.1\nname: uniform-load-squid\nversion: 1\ndescription: Quest squid for loading the Phase 2 p"
},
{
"path": "src/allFields.ts",
"chars": 1477,
"preview": "// evm-processor fields selections for all existing fields\n\nexport const allTransactionFields = {\n\tgas: true,\n\tgasPrice:"
},
{
"path": "src/main.ts",
"chars": 152,
"preview": "import {MockDatabase} from '@belopash/mock-store'\nimport {processor, config} from './processor'\n\nprocessor.run(new MockD"
},
{
"path": "src/processor.ts",
"chars": 907,
"preview": "import assert from 'assert'\nimport {EvmBatchProcessor} from '@subsquid/evm-processor'\nimport {networksConfig} from './te"
},
{
"path": "src/testConfig.ts",
"chars": 1385,
"preview": "import {assertNotNull} from '@subsquid/util-internal'\n\nimport {allTransactionFields, allBlockHeaderFields} from './allFi"
},
{
"path": "src/utils.ts",
"chars": 120,
"preview": "export function getRandomInt(min: number, max: number) {\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"
},
{
"path": "tsconfig.json",
"chars": 410,
"preview": "{\n \"compilerOptions\": {\n \"module\": \"commonjs\",\n \"target\": \"es2020\",\n \"outDir\": \"lib\",\n \"rootDir\": \"src\",\n "
}
]
About this extraction
This page contains the full source code of the subsquid-quests/network-test-one-uniform-load-squid GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 22 files (26.4 KB), approximately 7.9k tokens, and a symbol index with 2 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.