-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indexers v2 #132
Indexers v2 #132
Conversation
indexers-v2/main.py
Outdated
print(f"Network '{network_name}' not found in {path}/network_config.yaml") | ||
sys.exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using raise Exception("{message}")
is a cleaner way to print and exit with code 1
indexers-v2/Dockerfile
Outdated
RUN pip install --upgrade pip | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
ENTRYPOINT ["sh", "-c", "python3 main.py --network_name \"$NETWORK_NAME\" --rpc_endpoint \"$RPC_ENDPOINT\" && npm run generate:processor && npm run build && (npm run generate:migration || true) && npm run start"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can simplify this entrypoint, potentially just make a shell script that calls this stuff in order. It would simplify the docker compose commands if we can just call a script with configurations
package: perpsFactory | ||
- name: buyback_snx | ||
package: buyback_snx | ||
contracts_from_abi: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing these separately, we can just include the address in the abi files similar to the cannon ones. This way we can consolidate to one format {'abi': {}, 'address': '0x...'}
.
@@ -0,0 +1,9 @@ | |||
arbitrum_mainnet: | |||
archive_url: "https://v2.archive.subsquid.io/network/arbitrum-one" | |||
contracts: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This format is different from the base one
indexers-v2/main.py
Outdated
if name == "buyback_snx": | ||
name = "BuybackSnx" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? I know the contract is named something weird, but we don't want to handle that logic here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcus-snx still need to fix this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah somehow I managed to discard this change. Thanks for the reminder!
indexers-v2/main.py
Outdated
logging.basicConfig(level=logging.INFO) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can simplify a bit by leaving this out, and using snx.logger.info
indexers-v2/main.py
Outdated
write_yaml(squidgen_config, "squidgen.yaml") | ||
|
||
squid_config = create_squid_config(args.network_name) | ||
write_yaml(squid_config, "squid.yaml") | ||
|
||
print( | ||
logging.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use snx.logger.info
@Tburm I've removed some stuff that is only needed for postgres targeting since this service will be focusing on parquet. We can re-add that functionality at some later point if we need it again |
The new
Indexers
service is a single image that can be used to created separate indexer containers for each network by generating the necessary subsquid config files and grabbing the ABIs of contracts (specified innetworks.yaml
) using the Synthetix Python SDKTo run with docker,
$RPC_ENDPOINT
and$NETWORK_NAME
must be set.TODO: