Compare commits
2 Commits
issue-3056
...
fix-zerog-
| Author | SHA1 | Date | |
|---|---|---|---|
| cfac32736e | |||
| 799209b5d2 |
@@ -1,49 +1,64 @@
|
||||
#!/bin/sh
|
||||
# haqq entrypoint — family C, cosmos app with built-in EVM JSON-RPC (C2).
|
||||
# Uses the shared cometbft-common.sh helpers and injects official mainnet seeds.
|
||||
set -e
|
||||
. /usr/local/bin/cometbft-common.sh
|
||||
|
||||
HOME_DIR="/root/.haqqd"
|
||||
CONFIG_DIR="$HOME_DIR/config"
|
||||
CHAINID="${CHAINID:-haqq_11235-1}"
|
||||
CHAINNAME="${CHAINNAME:-mainnet}"
|
||||
API="${API:-eth,txpool,net,debug,web3}"
|
||||
GENESIS_URL="${GENESIS_URL:-https://raw.githubusercontent.com/haqq-network/${CHAINNAME}/master/genesis.json}"
|
||||
ADDRBOOK_URL="${ADDRBOOK_URL:-https://raw.githubusercontent.com/haqq-network/${CHAINNAME}/master/addrbook.json}"
|
||||
set -e # Exit on failure
|
||||
|
||||
# Official HAQQ mainnet seeds
|
||||
SEEDS="861e5892470275a394ebab407e8d62b1931843d3@192.248.181.17:26656,e1b058e5cfa2b836ddaa496b10911da62dcf182e@haqq-seed-de.allnodes.me:26656,e726816f42831689eab9378d5d577f1d06d25716@haqq-seed-us.allnodes.me:26656,0533e20e65912f72f2ad88a4c91eefbc634212d7@haqq-sync.rpc.p2p.world:26656,c45991e0098b9cacb8603caf4e1cdb7e6e5f87c0@eu.seed.haqq.network:26656,e37cb47590ba46b503269ef255873e9698244d8b@us.seed.haqq.network:26656,c593e93e1fb8be8b48d4e7bab514a227aa620bf8@as.seed.haqq.network:26656,0265238d4845e041868d610c100b88f485eeddfb@rpc.haqq.nodestake.top:666"
|
||||
echo "MONIKER: $MONIKER"
|
||||
|
||||
ct_apk curl
|
||||
CHAINID=${CHAINID:-haqq_11235-1}
|
||||
CHAINNAME=${CHAINNAME:-mainnet}
|
||||
API=${API:-eth,net,web3}
|
||||
|
||||
if haqqd init "$MONIKER" --chain-id "$CHAINID" --home "$HOME_DIR"; then
|
||||
ct_log "fresh init; fetching config"
|
||||
ct_fetch "$GENESIS_URL" "$CONFIG_DIR/genesis.json" required
|
||||
ct_fetch "$ADDRBOOK_URL" "$CONFIG_DIR/addrbook.json" optional
|
||||
ct_localize_home "$CONFIG_DIR"
|
||||
ct_set_min_gas_prices "$CONFIG_DIR/app.toml" "0.01hqq"
|
||||
CONFIG_DIR="/root/.haqqd/config"
|
||||
|
||||
# Create config directory
|
||||
mkdir -p "$CONFIG_DIR"
|
||||
|
||||
P2P_STRING="tcp:\\/\\/0\\.0\\.0\\.0\\:${P2P_PORT:-10465}"
|
||||
NAT_STRING="${IP}:${P2P_PORT:-10465}"
|
||||
|
||||
env
|
||||
|
||||
# this goes first because it won't overwrite shit
|
||||
apk add curl
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
if haqqd init ${MONIKER} --chain-id ${CHAINID} --home /root/.haqqd/; then
|
||||
# Define variables
|
||||
GENESIS_URL="https://raw.githubusercontent.com/haqq-network/${CHAINNAME}/master/genesis.json"
|
||||
ADDRESSBOOK_URL="https://raw.githubusercontent.com/haqq-network/${CHAINNAME}/master/addrbook.json"
|
||||
|
||||
# Download config files
|
||||
curl -sL "$GENESIS_URL" -o "$CONFIG_DIR/genesis.json"
|
||||
curl -sL "$ADDRESSBOOK_URL" -o "$CONFIG_DIR/addressbook.json"
|
||||
|
||||
# somehow it's better to make home static to /root
|
||||
sed -i 's|~/|/root/|g' "$CONFIG_DIR/config.toml"
|
||||
sed -i 's|~/|/root/|g' "$CONFIG_DIR/app.toml"
|
||||
else
|
||||
ct_log "already initialized, continuing"
|
||||
echo "Already initialized, continuing!" >&2
|
||||
fi
|
||||
|
||||
# Enable JSON-RPC with correct settings
|
||||
sed -i "/^\[json-rpc\]/,/^\[/{s|^enable = .*|enable = true|}" "$CONFIG_DIR/app.toml"
|
||||
|
||||
# apply a port change to the config
|
||||
sed -i "/^\[p2p\]/,/^\[/{s|^laddr = .*|laddr = \"$P2P_STRING\"|}" "$CONFIG_DIR/config.toml"
|
||||
#sed -i "s/^laddr = \".*\"/laddr = \"$P2P_STRING\"/" "$CONFIG_DIR/config.toml"
|
||||
sed -i "/^\[p2p\]/,/^\[/{s|^external_address = .*|external_address = \"$NAT_STRING\"|}" "$CONFIG_DIR/config.toml"
|
||||
|
||||
#sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0.01hqq"/g' $CONFIG_DIR/app.toml
|
||||
|
||||
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $CONFIG_DIR/app.toml
|
||||
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $CONFIG_DIR/app.toml
|
||||
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"19\"/" $CONFIG_DIR/app.toml
|
||||
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $CONFIG_DIR/config.toml
|
||||
|
||||
sed -i "/^\[json-rpc\]/,/^\[/{s|^address = .*|address = \"0.0.0.0:8545\"|}" "$CONFIG_DIR/app.toml"
|
||||
sed -i "/^\[json-rpc\]/,/^\[/{s|^ws-address = .*|ws-address = \"0.0.0.0:8546\"|}" "$CONFIG_DIR/app.toml"
|
||||
sed -i "/^\[json-rpc\]/,/^\[/{s|^metrics-address = .*|metrics-address = \"0.0.0.0:6065\"|}" "$CONFIG_DIR/app.toml"
|
||||
sed -i "/^\[json-rpc\]/,/^\[/{s|^api = .*|api = \"$API\"|}" "$CONFIG_DIR/app.toml"
|
||||
|
||||
# Pruning + indexing settings
|
||||
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" "$CONFIG_DIR/app.toml"
|
||||
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" "$CONFIG_DIR/app.toml"
|
||||
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"19\"/" "$CONFIG_DIR/app.toml"
|
||||
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" "$CONFIG_DIR/config.toml"
|
||||
# Update moniker if set
|
||||
if [ -n "$MONIKER" ] && [ -f "$CONFIG_DIR/config.toml" ]; then
|
||||
sed -i "s/^moniker = \".*\"/moniker = \"$MONIKER\"/" "$CONFIG_DIR/config.toml"
|
||||
fi
|
||||
|
||||
# P2P: bind 0.0.0.0, advertise IP + port, inject official seeds
|
||||
ct_patch_p2p "$CONFIG_DIR/config.toml" "$IP" "${P2P_PORT:-10465}"
|
||||
ct_merge_seeds "$CONFIG_DIR/config.toml" "$SEEDS"
|
||||
ct_set_moniker "$CONFIG_DIR/config.toml" "$MONIKER"
|
||||
ct_seed_priv_validator_state "$HOME_DIR"
|
||||
|
||||
exec haqqd start --chain-id "$CHAINID" "$@"
|
||||
exec haqqd start --chain-id ${CHAINID} $@
|
||||
|
||||
@@ -3720,6 +3720,7 @@
|
||||
"lagging_lag": 20,
|
||||
"syncing_lag": 40,
|
||||
"urls": [
|
||||
"https://humanity-main.g.alchemy.com/public",
|
||||
"https://humanity.drpc.org"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -35,7 +35,7 @@ services:
|
||||
context: ./zero-gravity
|
||||
dockerfile: zerog.Dockerfile
|
||||
args:
|
||||
ZERO_GRAVITY_VERSION: ${ZERO_GRAVITY_ARISTOTLE_ZEROG_VERSION:-3.0.3}
|
||||
ZERO_GRAVITY_VERSION: ${ZERO_GRAVITY_ARISTOTLE_ZEROG_VERSION:-1.0.4}
|
||||
ZERO_GRAVITY_CHAIN_SPEC: aristotle
|
||||
sysctls:
|
||||
# TCP Performance
|
||||
@@ -118,7 +118,7 @@ services:
|
||||
context: ./zero-gravity
|
||||
dockerfile: zerog.Dockerfile
|
||||
args:
|
||||
ZERO_GRAVITY_VERSION: ${ZERO_GRAVITY_ARISTOTLE_ZEROG_VERSION:-3.0.3}
|
||||
ZERO_GRAVITY_VERSION: ${ZERO_GRAVITY_ARISTOTLE_ZEROG_VERSION:-1.0.4}
|
||||
ZERO_GRAVITY_CHAIN_SPEC: aristotle
|
||||
ports:
|
||||
- 19914:19914
|
||||
|
||||
@@ -8,11 +8,46 @@ RUN chmod +x /usr/local/bin/init.sh
|
||||
|
||||
ARG ZERO_GRAVITY_VERSION
|
||||
ARG ZERO_GRAVITY_CHAIN_SPEC
|
||||
RUN if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "aristotle" ]; then \
|
||||
curl -sL https://github.com/0gfoundation/0gchain-Aristotle/releases/download/${ZERO_GRAVITY_VERSION}/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz -o /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz; \
|
||||
|
||||
# 0G publishes each network from a DIFFERENT repository, and the release-tag format is not
|
||||
# consistent within either of them. The asset filename is always "<spec>-v<version>.tar.gz";
|
||||
# only the tag varies:
|
||||
#
|
||||
# aristotle -> 0gchain-Aristotle 1.0.4 = "1.0.4" 1.0.6 = "v1.0.6"
|
||||
# galileo -> 0gchain-NG 3.0.3 = "v3.0.3" 3.0.7 = "galileo-v3.0.7" 3.0.8 = "v3.0.8"
|
||||
#
|
||||
# So the tag cannot be hardcoded. Resolve it by trying the known forms in order and taking
|
||||
# the first that actually yields the asset.
|
||||
#
|
||||
# curl uses -f (fail on HTTP error). Without it a 404 HTML body is written into the .tar.gz
|
||||
# and the build dies several layers later at "tar: not in gzip format" -- an error that
|
||||
# points nowhere near the real cause. That has cost three separate misdiagnoses.
|
||||
RUN set -eu; \
|
||||
ASSET="${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz"; \
|
||||
if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "aristotle" ]; then \
|
||||
REPO="0gfoundation/0gchain-Aristotle"; \
|
||||
TAGS="${ZERO_GRAVITY_VERSION} v${ZERO_GRAVITY_VERSION} ${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}"; \
|
||||
else \
|
||||
curl -sL https://github.com/0gfoundation/0gchain-NG/releases/download/v${ZERO_GRAVITY_VERSION}/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz -o /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz; \
|
||||
REPO="0gfoundation/0gchain-NG"; \
|
||||
TAGS="v${ZERO_GRAVITY_VERSION} ${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION} ${ZERO_GRAVITY_VERSION}"; \
|
||||
fi; \
|
||||
for TAG in ${TAGS}; do \
|
||||
URL="https://github.com/${REPO}/releases/download/${TAG}/${ASSET}"; \
|
||||
echo "0g: trying tag '${TAG}' -> ${URL}"; \
|
||||
if curl -fsSL "${URL}" -o "/tmp/${ASSET}"; then \
|
||||
echo "0g: resolved ${ZERO_GRAVITY_CHAIN_SPEC} ${ZERO_GRAVITY_VERSION} from tag '${TAG}'"; \
|
||||
break; \
|
||||
fi; \
|
||||
rm -f "/tmp/${ASSET}"; \
|
||||
done; \
|
||||
if [ ! -s "/tmp/${ASSET}" ]; then \
|
||||
echo "0g: FATAL - no release asset '${ASSET}' found in ${REPO} under any of: ${TAGS}" >&2; \
|
||||
echo "0g: aristotle and galileo are SEPARATE repos on SEPARATE version lines" >&2; \
|
||||
echo "0g: aristotle = 0gchain-Aristotle (1.0.x), galileo = 0gchain-NG (3.0.x)" >&2; \
|
||||
echo "0g: check that version '${ZERO_GRAVITY_VERSION}' exists for '${ZERO_GRAVITY_CHAIN_SPEC}'" >&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
RUN tar -xzf /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz -C /tmp
|
||||
RUN if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "galileo" ]; then \
|
||||
mv /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}/rpc /0g; \
|
||||
@@ -26,4 +61,4 @@ RUN if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "galileo" ]; then \
|
||||
RUN chmod +x /0g/bin/0gchaind
|
||||
RUN chmod +x /0g/bin/geth
|
||||
|
||||
ENTRYPOINT [ "init.sh" ]
|
||||
ENTRYPOINT [ "init.sh" ]
|
||||
|
||||
Reference in New Issue
Block a user