Skip to content

Commit

Permalink
snapshot url update and silo snapshot support added
Browse files Browse the repository at this point in the history
  • Loading branch information
spilin committed Aug 17, 2023
1 parent f41424c commit fde3cab
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 28 deletions.
2 changes: 1 addition & 1 deletion contrib/config/refiner/silo_datalake.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"chain_id": %%SILO_CHAIN_ID%%,
"engine_path": "/engine",
"tx_tracker_path": "/engine/tx_tracker",
"engine_account_id": "aurora"
"engine_account_id": "%%SILO_ENGINE_ACCOUNT%%"
},
"input_mode": {
"DataLake": {
Expand Down
2 changes: 1 addition & 1 deletion contrib/config/refiner/silo_nearcore.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"chain_id": %%SILO_CHAIN_ID%%,
"engine_path": "/engine",
"tx_tracker_path": "/engine/tx_tracker",
"engine_account_id": "aurora"
"engine_account_id": "%%SILO_ENGINE_ACCOUNT%%"
},
"input_mode": {
"Nearcore": {
Expand Down
19 changes: 19 additions & 0 deletions contrib/config/silo/empower.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Defines on which network of Aurora and Near, the Silo resides. Accepted values are mainnet or testnet only
# [required config]
SILO_NETWORK: mainnet

# Chain ID of the Silo
# [required config]
SILO_CHAIN_ID: 1313161557

# A decimal number which defines the genesis block number of the Silo
# [required config]
SILO_GENESIS: 91077490

# A decimal number, defining the block number, from which the indexing of blockchain starts
# [required config]
SILO_FROM_BLOCK: 91077490

# Silo Engine Account, that has Silo deployed on it
# [required config]
SILO_ENGINE_ACCOUNT: silo-1.aurora-silo-dev.near
19 changes: 19 additions & 0 deletions contrib/config/silo/hackathon.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Defines on which network of Aurora and Near, the Silo resides. Accepted values are mainnet or testnet only
# [required config]
SILO_NETWORK: mainnet

# Chain ID of the Silo
# [required config]
SILO_CHAIN_ID: 1313161558

# A decimal number which defines the genesis block number of the Silo
# [required config]
SILO_GENESIS: 92167976

# A decimal number, defining the block number, from which the indexing of blockchain starts
# [required config]
SILO_FROM_BLOCK: 92167976

# Silo Engine Account, that has Silo deployed on it
# [required config]
SILO_ENGINE_ACCOUNT: hackathon.aurora-silo-dev.near
19 changes: 19 additions & 0 deletions contrib/config/silo/innovation.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Defines on which network of Aurora and Near, the Silo resides. Accepted values are mainnet or testnet only
# [required config]
SILO_NETWORK: mainnet

# Chain ID of the Silo
# [required config]
SILO_CHAIN_ID: 1313161556

# A decimal number which defines the genesis block number of the Silo
# [required config]
SILO_GENESIS: 84995925

# A decimal number, defining the block number, from which the indexing of blockchain starts
# [required config]
SILO_FROM_BLOCK: 84995925

# Silo Engine Account, that has Silo deployed on it
# [required config]
SILO_ENGINE_ACCOUNT: aurora-silo-dev.near
4 changes: 2 additions & 2 deletions contrib/config/silo/template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ SILO_GENESIS:
# [required config]
SILO_FROM_BLOCK:

# A path to JSON file which contains the Engine Account ID and keys of the SILO
# Silo Engine Account, that has Silo deployed on it
# [required config]
SILO_ENGINE_ACCOUNT_JSON:
SILO_ENGINE_ACCOUNT:
48 changes: 24 additions & 24 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ near_postfix="near"
network="mainnet"
near_network="mainnet"
silo_config_file=""
silo_name="mainnet"
near_source="nearcore" # nearcore or datalake
migrate_from=""
use_aurora_snapshot=1
Expand Down Expand Up @@ -58,12 +59,12 @@ apply_silo_config() {
sed "s/%%SILO_FROM_BLOCK%%/${silo_from_block}/" "${INSTALL_DIR}/docker-compose.yaml" > "${INSTALL_DIR}/docker-compose.yaml2" && \
mv "${INSTALL_DIR}/docker-compose.yaml2" "${INSTALL_DIR}/docker-compose.yaml"

engine_account_json=$(grep "SILO_ENGINE_ACCOUNT_JSON" "$silo_config_file" | cut -d ':' -f2- | awk '{$1=$1};1')
if [ ! -f "$engine_account_json" ]; then
echo "Engine account JSON file could not be found at [$engine_account_json], please check your config file [$silo_config_file]"
exit 1
fi
cp "$engine_account_json" "${INSTALL_DIR}/config/relayer/relayer.json"
filename=$(basename -- "$silo_config_file")
silo_name=$(echo "${filename%%.*}" | tr '[:upper:]' '[:lower:]')

engine_account=$(grep "SILO_ENGINE_ACCOUNT" "$silo_config_file" | cut -d ':' -f2- | awk '{$1=$1};1')
sed "s/%%SILO_ENGINE_ACCOUNT%%/${engine_account}/" "${INSTALL_DIR}/config/refiner/refiner.json" > "${INSTALL_DIR}/config/refiner/refiner.json2" && \
mv "${INSTALL_DIR}/config/refiner/refiner.json2" "${INSTALL_DIR}/config/refiner/refiner.json"

if [ ${near_source} = "datalake" ]; then
silo_datalake_network=$(to_upper_first "$silo_network")
Expand Down Expand Up @@ -168,11 +169,24 @@ install() {
cp "./${src_dir}/config/docker/${network}_${near_source}.yaml" "${INSTALL_DIR}/docker-compose.yaml"
fi

if [ "${network}" = "silo" ]; then
apply_silo_config "$silo_config_file"
near_network="$silo_network"
else
near_network="$network"
fi

if [ "${near_source}" = "nearcore" ]; then
apply_nearcore_config
else
apply_datalake_config
fi

if [ $use_aurora_snapshot -eq 1 ] || [ "x$migrate_from" != "x" ]; then
latest=""
if [ ! -f "${INSTALL_DIR}/.latest" ]; then
echo Initial
latest=$(curl -sSf https://snapshots.deploy.aurora.dev/snapshots/${network}-relayer2-latest)
latest=$(curl -sSf https://snapshots.deploy.aurora.dev/snapshots/${near_network}_${silo_name}-relayer-latest)
echo "${latest}" > "${INSTALL_DIR}/.latest"
fi
latest=$(cat "${INSTALL_DIR}/.latest")
Expand All @@ -181,26 +195,14 @@ install() {
finish=0
while [ ${finish} -eq 0 ]; do
echo "Fetching, this can take some time..."
curl -#Sf https://snapshots.deploy.aurora.dev/158c1b69348fda67682197791/${network}-relayer2-"${latest}"/data.tar | tar -xv -C "${INSTALL_DIR}/data/relayer/" >> "${INSTALL_DIR}/data/relayer/.lastfile" 2> /dev/null
curl -#Sf https://snapshots.deploy.aurora.dev/158c1b69348fda67682197791/${near_network}_${silo_name}-relayer-"${latest}"/data.tar | tar -xv -C "${INSTALL_DIR}/data/relayer/" >> "${INSTALL_DIR}/data/relayer/.lastfile" 2> /dev/null
if [ -f "${INSTALL_DIR}/data/relayer/.version" ]; then
finish=1
fi
done
fi
fi

if [ "${network}" = "silo" ]; then
apply_silo_config "$silo_config_file"
near_network="$silo_network"
else
near_network="$network"
fi

if [ "${near_source}" = "nearcore" ]; then
apply_nearcore_config
else
apply_datalake_config
fi

if [ ! -f "${INSTALL_DIR}/config/relayer/relayer.json" ]; then
echo "Generating relayer key..."
Expand Down Expand Up @@ -268,11 +270,9 @@ while getopts ":n:r:m:f:w:svh" opt; do
case "${opt}" in
n)
network="${OPTARG}"
if [ "${network}" = "silo" ]; then
use_aurora_snapshot=0
elif [ "${network}" = "testnet" ]; then
if [ "${network}" = "testnet" ]; then
near_postfix="testnet"
elif [ "${network}" != "mainnet" ]; then
elif [ "${network}" != "mainnet" ] && [ "${network}" != "silo" ] ; then
echo "Invalid Value: -${opt} cannot be '${OPTARG}'"
usage
exit 1
Expand Down

0 comments on commit fde3cab

Please sign in to comment.