Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
graph-node-alternate/
# graph-node-alternate/
networks/testing-alt
.idea/
.idea/
kachra/*
32 changes: 23 additions & 9 deletions base/persistencecore/genesis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ spec:
spec:
initContainers:
- name: init-genesis
image: docker.io/persistenceone/persistencecore:v7.0.0-fh
image: persistenceone/persistencecore:v12-alliance-rc0
imagePullPolicy: Always
env:
- name: COINS
value: "100000000000000000uxprt"
value: "100000000000000000uxprt,100000000000000000stk/uxprt,100000000000000000stk/uatom,100000000000000000stk/udydx,100000000000000000stk/uosmo"
- name: CHAIN_ID
valueFrom:
configMapKeyRef:
Expand All @@ -86,53 +86,66 @@ spec:
jq -r ".genesis[0].mnemonic" /configs/validators.json | persistenceCore keys add $(jq -r ".genesis[0].name" /configs/validators.json) --recover --keyring-backend='test' --home $HOME_DIR

# Provide genesis validator self deligations
persistenceCore add-genesis-account $(jq -r .genesis[$i].address /configs/validators.json) $COINS --keyring-backend='test' --home $HOME_DIR
persistenceCore genesis add-genesis-account $(jq -r .genesis[$i].address /configs/validators.json) $COINS --keyring-backend='test' --home $HOME_DIR

# Give Validator addresses initial coins
for ((i=0; i<$(jq -r '.validators | length' /configs/validators.json); i++))
do
jq -r ".validators[$i].mnemonic" /configs/validators.json | persistenceCore keys add $(jq -r ".validators[$i].name" /configs/validators.json) --recover --keyring-backend='test' --home $HOME_DIR
persistenceCore add-genesis-account $(jq -r .validators[$i].address /configs/validators.json) $COINS --keyring-backend='test' --home $HOME_DIR
persistenceCore genesis add-genesis-account $(jq -r .validators[$i].address /configs/validators.json) $COINS --keyring-backend='test' --home $HOME_DIR
done

persistenceCore gentx $(jq -r ".genesis[0].name" /configs/validators.json) 5000000000uxprt --keyring-backend="test" --chain-id $CHAIN_ID --home $HOME_DIR
persistenceCore genesis gentx $(jq -r ".genesis[0].name" /configs/validators.json) 5000000000uxprt --keyring-backend="test" --chain-id $CHAIN_ID --home $HOME_DIR
echo "Output of gentx"
cat $HOME_DIR/config/gentx/*.json | jq

echo "Running collect-gentxs"
persistenceCore collect-gentxs --home $HOME_DIR
persistenceCore genesis collect-gentxs --home $HOME_DIR

sed -i 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' $HOME_DIR/config/config.toml
sed -i 's/timeout_commit = "5s"/timeout_commit = "1s"/g' $HOME_DIR/config/config.toml
sed -i 's/timeout_propose = "3s"/timeout_propose = "1s"/g' $HOME_DIR/config/config.toml
sed -i 's/index_all_keys = false/index_all_keys = true/g' $HOME_DIR/config/config.toml
sed -i 's/unsafe = false/unsafe = true/g' $HOME_DIR/config/config.toml
sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0.00uxprt"/g' $HOME_DIR/config/config.toml
sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0.01uxprt"/g' $HOME_DIR/config/config.toml
sed -i 's/cors_allowed_origins = []/cors_allowed_origins = ["*"]/g' $HOME_DIR/config/config.toml

sed -i 's/enable = false/enable = true/g' $HOME_DIR/config/app.toml
sed -i 's/swagger = false/swagger = true/g' $HOME_DIR/config/app.toml
sed -i 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' $HOME_DIR/config/app.toml
sed -i 's/min-gas-prices = ""/min-gas-prices = "0.01uxprt"/g' $HOME_DIR/config/app.toml

jq '.consensus_params.block.max_bytes |= "42020096"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
jq '.app_state.gov.voting_params.voting_period |= "30s"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
jq '.app_state.gov.params.voting_period |= "30s"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
jq '.app_state.gov.tally_params.quorum |= "0.0"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
jq '.app_state.gov.params.quorum |= "0.0"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
jq '.app_state.gov.deposit_params.min_deposit[0].amount |= "10"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
jq '.app_state.gov.params.min_deposit[0].amount |= "10"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json

jq '.app_state.crisis.constant_fee.denom |= "uxprt"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
jq '.app_state.gov.deposit_params.min_deposit[0].denom |= "uxprt"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
jq '.app_state.liquidity.params.pool_creation_fee[0].denom |= "uxprt"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
jq '.app_state.gov.params.min_deposit[0].denom |= "uxprt"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
# jq '.app_state.liquidity.params.pool_creation_fee[0].denom |= "uxprt"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
# mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
jq '.app_state.mint.params.mint_denom |= "uxprt"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json
jq '.app_state.staking.params.bond_denom |= "uxprt"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json

# update slash_window parameter (app_state.oracle.slash_window) from 1 day and 4 hours to an year in seconds
jq '.app_state.oracle.params.slash_window |= "31536000"' $HOME_DIR/config/genesis.json | tee $HOME_DIR/config/genesis.new.json
mv $HOME_DIR/config/genesis.new.json $HOME_DIR/config/genesis.json

echo "TRYING TO PRINT GENESIS JSON"
cat $HOME_DIR/config/genesis.json | jq
Expand All @@ -152,7 +165,7 @@ spec:
name: addresses
containers:
- name: validator
image: docker.io/persistenceone/persistencecore:v7.0.0-fh
image: persistenceone/persistencecore:v9.2.1-fh
imagePullPolicy: Always
env:
- name: CHAIN_ID
Expand All @@ -166,6 +179,7 @@ spec:
- bash
- "-c"
- |
# sleep infinity
persistenceCore start --home $HOME_DIR
resources:
limits:
Expand Down
1 change: 1 addition & 0 deletions base/persistencecore/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
resources:
- genesis.yaml
# - configmap.yaml
- validator.yaml

generatorOptions:
Expand Down
4 changes: 2 additions & 2 deletions base/persistencecore/validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
spec:
initContainers:
- name: wait-for-genesis
image: docker.io/persistenceone/persistencecore:v7.0.0-fh
image:persistenceone/persistencecore:v12-alliance-rc0
imagePullPolicy: Always
env:
- name: GENESIS_HOST
Expand All @@ -68,7 +68,7 @@ spec:
echo "Ready to start"
exit 0
- name: init-validator
image: docker.io/persistenceone/persistencecore:v7.0.0-fh
image:persistenceone/persistencecore:v12-alliance-rc0
imagePullPolicy: Always
env:
- name: CHAIN_ID
Expand Down
14 changes: 14 additions & 0 deletions docker/firecosmos.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine AS release

RUN apk add wget
RUN apk add bash
RUN wget https://github.com/graphprotocol/firehose-cosmos/releases/download/v0.6.0/firecosmos_linux_amd64 -O firecosmos

# make executable
RUN chmod +x firecosmos

# move firecosmos to bin
RUN mv firecosmos /usr/local/bin

# set as cmd
# CMD ["firecosmos"]
87 changes: 87 additions & 0 deletions docker/firepersistence-core.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# syntax=docker/dockerfile:1

# Multi-stage build producing:
# - firecore (from streamingfast/firehose-core)
# - chain poller binary (default: firepersistence) from persistenceOne/firehose-cosmos

ARG FIRECORE_REPO=https://github.com/streamingfast/firehose-core.git
ARG FIRECORE_REF=v1.11.1
ARG FIRECHAIN_REPO=https://github.com/persistenceOne/firehose-cosmos.git
ARG FIRECHAIN_REF=betterclever/persistence-support
ARG CHAIN_BINARY_NAME=firepersistence

FROM golang:1.24 AS firecore_builder

ARG FIRECORE_REPO
ARG FIRECORE_REF

WORKDIR /src/firecore
RUN git clone --depth=1 -b ${FIRECORE_REF} ${FIRECORE_REPO} . \
&& if [ -f go.mod ]; then go mod download; fi

# Build firecore binary
ENV GOTOOLCHAIN=auto
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates build-essential clang pkg-config \
&& rm -rf /var/lib/apt/lists/*
RUN CGO_ENABLED=1 go build -o /out/firecore ./cmd/firecore


FROM golang:1.24 AS firechain_builder

ARG FIRECHAIN_REPO
ARG FIRECHAIN_REF
ARG CHAIN_BINARY_NAME

WORKDIR /src/firechain
RUN git clone --depth=1 -b ${FIRECHAIN_REF} ${FIRECHAIN_REPO} . \
&& if [ -f go.mod ]; then go mod download; fi

ENV GOTOOLCHAIN=auto
RUN set -e; \
mkdir -p /out; \
found=""; \
for name in "${CHAIN_BINARY_NAME}" firepersistence firecosmos fireinjective firemantra; do \
for path in "./${name}" "./cmd/${name}"; do \
if [ -d "$path" ]; then \
echo "Building $name from $path"; \
(cd "$path" && CGO_ENABLED=0 go build -o "/out/${name}"); \
found="$name"; \
break; \
fi; \
done; \
if [ -n "$found" ]; then break; fi; \
done; \
if [ -z "$found" ]; then \
echo "Could not locate chain binary source dir (tried ${CHAIN_BINARY_NAME}, firepersistence, firecosmos, fireinjective, firemantra)"; \
find . -maxdepth 3 -type d -print; \
exit 1; \
fi; \
# Ensure default name is firepersistence inside image
if [ "$found" != "firepersistence" ]; then \
cp "/out/$found" "/out/firepersistence"; \
fi


FROM ubuntu:24.04 AS runtime

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates bash curl jq \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY --from=firecore_builder /out/firecore /usr/local/bin/firecore
COPY --from=firechain_builder /out/ /usr/local/bin/

ENV PATH="/usr/local/bin:${PATH}"

# Data directory used by firecore --data-dir
RUN mkdir -p /app/data

EXPOSE 9000 9102

# Default to show help; override in k8s CMD/args
CMD ["firecore", "--help"]


19 changes: 19 additions & 0 deletions graph-node-alternate/base/config-graph/config-graph-node-v1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[deployment]
[[deployment.rule]]
shard = "primary"
indexers = [ "index_node_cosmos_1" ]

[store]
[store.primary]
connection = "postgresql://POSTGRES_USER:POSTGRES_PASSWORD@POSTGRES_HOST:POSTGRES_PORT/POSTGRES_DB"
pool_size = 10

[chains]
ingestor = "block_ingestor_node"

[chains.persistence]
shard = "primary"
protocol = "cosmos"
provider = [
{ label = "persistence", details = { type = "firehose", url = "http://FIREHOSE_HOST:FIREHOSE_PORT" }},
]
27 changes: 27 additions & 0 deletions graph-node-alternate/base/config-graph/config-graph-node-v2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[deployment]
[[deployment.rule]]
shard = "primary"
indexers = [ "index_node_cosmos_2" ]

[store]
[store.primary]
connection = "postgresql://POSTGRES_USER:POSTGRES_PASSWORD@POSTGRES_HOST:POSTGRES_PORT/POSTGRES_DB_SUBSTREAMS"
pool_size = 10

[chains]
ingestor = "block_ingestor_node"

[chains.babylon]
shard = "primary"
protocol = "substreams"
provider = [
{ label = "substreams", details = { type = "substreams", url = "http://159.89.170.65:10016" }},
]

[chains.persistence]
shard = "primary"
protocol = "substreams"
provider = [
{ label = "substreams", details = { type = "substreams", url = "https://substreams.core.persistence.one:443" }},
]

26 changes: 26 additions & 0 deletions graph-node-alternate/base/config-graph/config-graph-node.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[deployment]
[[deployment.rule]]
shard = "primary"
indexers = [ "index_node_cosmos_1", "index_node_cosmos_2" ]

[store]
[store.primary]
connection = "postgresql://POSTGRES_USER:POSTGRES_PASSWORD@POSTGRES_HOST:POSTGRES_PORT/POSTGRES_DB"
pool_size = 10

[chains]
ingestor = "block_ingestor_node"

[chains.persistence]
shard = "primary"
protocol = "cosmos"
provider = [
{ label = "persistence", details = { type = "firehose", url = "http://FIREHOSE_HOST:FIREHOSE_PORT" }},
]

[chains.babylon]
shard = "primary"
protocol = "substreams"
provider = [
{ label = "babylon", details = { type = "substreams", url = "http://159.89.170.65:10016" }},
]
6 changes: 6 additions & 0 deletions graph-node-alternate/base/config-graph/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#######################################################
### Extractor Configuration Options ###
#######################################################
[extractor]
enabled = true
output_file = "stdout"
14 changes: 14 additions & 0 deletions graph-node-alternate/base/config-graph/firehose-node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"firehose_nodes": [
{
"name": "firehose-node-1",
"type": "local",
"address": "persistence1y3x3uaqnnlhulway8g5dvm4erpd5r4f0d29hn5",
"pubkey": {
"@type": "/cosmos.crypto.secp256k1.PubKey",
"key": "Agn5q1U2vLjdAhg4dcKuUKm3ZwdmrrFmVnlnqsqkXoIA"
},
"mnemonic": "tag apart multiply food bleak isolate describe stand guide field session design cable combine excess shrug abuse pause course ketchup umbrella program labor ripple"
}
]
}
15 changes: 15 additions & 0 deletions graph-node-alternate/base/config-graph/firehose-reader.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
start:
args:
- reader
flags:
# Common flags
common-first-streamable-block: 0

# reader specific flags
reader-mode: node
reader-node-path: /usr/bin/persistenceCore
reader-node-args: start --x-crisis-skip-assert-invariants --home /persistencecore
reader-node-logs-filter: "module=(p2p|pex|consensus|x/bank|x/wasm)"

common-one-block-store-url: 's3://sgp1.digitaloceanspaces.com/dexter-zone/one-blocks?region=us-east-1'
common-merged-blocks-store-url: 's3://sgp1.digitaloceanspaces.com/dexter-zone/merged-blocks?region=us-east-1'
15 changes: 15 additions & 0 deletions graph-node-alternate/base/config-graph/firehose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
start:
args:
- reader
- merger
- relayer
- firehose
flags:
# Common flags
common-first-streamable-block: 0

# reader specific flags
reader-mode: node
reader-node-path: /usr/bin/persistenceCore
reader-node-args: start --x-crisis-skip-assert-invariants --home /persistencecore
reader-node-logs-filter: "module=(p2p|pex|consensus|x/bank|x/wasm)"
Loading