-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into explore-a-running-aggregate
- Loading branch information
Showing
8 changed files
with
234 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
# clear the terminal | ||
clear | ||
|
||
# Stop execution if any command fails | ||
set -e | ||
|
||
# set variables in your .bashrc before starting this script! | ||
source ~/.bashrc | ||
|
||
export LAYER_NODE_URL=tellorlayer.com | ||
export TELLORNODE_ID=5ca2c0eccb54e907ba474ce3b6827077ae40ba53 | ||
export KEYRING_BACKEND="test" | ||
export PEERS="[email protected]:26656,[email protected]:26656,[email protected]:26656" | ||
|
||
echo "Change denom to loya in config files..." | ||
sed -i 's/([0-9]+)stake/1loya/g' ~/.layer/config/app.toml | ||
|
||
echo "Set Chain Id to layer in client config file..." | ||
sed -i 's/^chain-id = .*$/chain-id = "layer"/g' ~/.layer/config/app.toml | ||
|
||
# Modify timeout_commit in config.toml for node | ||
echo "Modifying timeout_commit in config.toml for node..." | ||
sed -i 's/timeout_commit = "5s"/timeout_commit = "1s"/' ~/.layer/config/config.toml | ||
|
||
# Open up node to outside traffic | ||
echo "Open up node to outside traffice" | ||
sed -i 's/^laddr = "tcp:\/\/127.0.0.1:26656"/laddr = "tcp:\/\/0.0.0.0:26656"/g' ~/.layer/config/config.toml | ||
|
||
sed -i 's/^address = "tcp:\/\/localhost:1317"/address = "tcp:\/\/0.0.0.0:1317"/g' ~/.layer/config/app.toml | ||
|
||
# Modify cors to accept * | ||
echo "Modify cors to accept *" | ||
sed -i 's/^cors_allowed_origins = \[\]/cors_allowed_origins = \["\*"\]/g' ~/.layer/config/config.toml | ||
|
||
# enable unsafe cors | ||
echo "Enable unsafe cors" | ||
sed -i 's/^cors_allowed_origins = \[\]/cors_allowed_origins = \["\*"\]/g' ~/.layer/config/app.toml | ||
sed -i 's/^enable-unsafe-cors = false/enable-unsafe-cors = true/g' ~/.layer/config/app.toml | ||
sed -i 's/^enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' ~/.layer/config/app.toml | ||
sed -i 's/^enable-unsafe-cors = false/enable-unsafe-cors = true/g' ~/.layer/config/app.toml | ||
|
||
# Modify keyring-backend in client.toml for node | ||
echo "Modifying keyring-backend in client.toml for node..." | ||
sed -i 's/^keyring-backend = "os"/keyring-backend = "'$KEYRING_BACKEND'"/g' ~/.layer/config/client.toml | ||
# update for main dir as well. why is this needed? | ||
sed -i 's/keyring-backend = "os"/keyring-backend = "'$KEYRING_BACKEND'"/g' ~/.layer/config/client.toml | ||
|
||
rm -f ~/.layer/config/genesis.json | ||
# get genesis file from running node's rpc | ||
echo "Getting genesis from runnning node....." | ||
curl $LAYER_NODE_URL:26657/genesis | jq '.result.genesis' > ~/.layer/config/genesis.json | ||
|
||
# set initial seeds / peers | ||
echo "Running Tellor node id: $TELLORNODE_ID" | ||
sed -i 's/seeds = ""/seeds = "'$PEERS'"/g' ~/.layer/config/config.toml | ||
sed -i 's/persistent_peers = ""/persistent_peers = "'$PEERS'"/g' ~/.layer/config/config.toml | ||
|
||
|
||
echo "layer has been configured in it's home folder!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
# clear the terminal | ||
clear | ||
|
||
# Stop execution if any command fails | ||
set -e | ||
|
||
# set variables in your .bashrc before starting this script! | ||
source ~/.zshrc | ||
|
||
export LAYER_NODE_URL=tellorlayer.com | ||
export TELLORNODE_ID=5ca2c0eccb54e907ba474ce3b6827077ae40ba53 | ||
export KEYRING_BACKEND="test" | ||
export PEERS="[email protected]:26656,[email protected]:26656,[email protected]:26656" | ||
|
||
echo "Change denom to loya in config files..." | ||
sed -i '' 's/([0-9]+)stake/1loya/g' ~/.layer/config/app.toml | ||
|
||
echo "Set Chain Id to layer in client config file..." | ||
sed -i '' 's/^chain-id = .*$/chain-id = "layer"/g' ~/.layer/config/app.toml | ||
|
||
# Modify timeout_commit in config.toml for node | ||
echo "Modifying timeout_commit in config.toml for node..." | ||
sed -i '' 's/timeout_commit = "5s"/timeout_commit = "1s"/' ~/.layer/config/config.toml | ||
|
||
# Open up node to outside traffic | ||
echo "Open up node to outside traffice" | ||
sed -i '' 's/^laddr = "tcp:\/\/127.0.0.1:26656"/laddr = "tcp:\/\/0.0.0.0:26656"/g' ~/.layer/config/config.toml | ||
|
||
sed -i '' 's/^address = "tcp:\/\/localhost:1317"/address = "tcp:\/\/0.0.0.0:1317"/g' ~/.layer/config/app.toml | ||
|
||
# Modify cors to accept * | ||
echo "Modify cors to accept *" | ||
sed -i '' 's/^cors_allowed_origins = \[\]/cors_allowed_origins = \["\*"\]/g' ~/.layer/config/config.toml | ||
|
||
# enable unsafe cors | ||
echo "Enable unsafe cors" | ||
sed -i '' 's/^cors_allowed_origins = \[\]/cors_allowed_origins = \["\*"\]/g' ~/.layer/config/app.toml | ||
sed -i '' 's/^enable-unsafe-cors = false/enable-unsafe-cors = true/g' ~/.layer/config/app.toml | ||
sed -i '' 's/^enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' ~/.layer/config/app.toml | ||
sed -i '' 's/^enable-unsafe-cors = false/enable-unsafe-cors = true/g' ~/.layer/config/app.toml | ||
|
||
# Modify keyring-backend in client.toml for node | ||
echo "Modifying keyring-backend in client.toml for node..." | ||
sed -i '' 's/^keyring-backend = "os"/keyring-backend = "'$KEYRING_BACKEND'"/g' ~/.layer/config/client.toml | ||
# update for main dir as well. why is this needed? | ||
sed -i '' 's/keyring-backend = "os"/keyring-backend = "'$KEYRING_BACKEND'"/g' ~/.layer/config/client.toml | ||
|
||
rm -f ~/.layer/config/genesis.json | ||
# get genesis file from running node's rpc | ||
echo "Getting genesis from runnning node....." | ||
curl $LAYER_NODE_URL:26657/genesis | jq '.result.genesis' > ~/.layer/config/genesis.json | ||
|
||
# set initial seeds / peers | ||
echo "Running Tellor node id: $TELLORNODE_ID" | ||
sed -i '' 's/seeds = ""/seeds = "'$PEERS'"/g' ~/.layer/config/config.toml | ||
sed -i '' 's/persistent_peers = ""/persistent_peers = "'$PEERS'"/g' ~/.layer/config/config.toml | ||
|
||
|
||
echo "layer has been configured in it's home folder!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/bash | ||
|
||
# THIS SCRIPT CAN BE USED TO TEST A CHAIN UPGRADE WHILE RUNNING THE LOCAL DEVNET | ||
# BE SURE TO SET "expedited": false FOR THE PROPOSAL. | ||
# THE LOCAL DEVNET HAS A 15s VOTING PERIOD. | ||
# RUN THIS SCRIPT AS SOON AS THE DOCKER CONTAINERS START UP. | ||
# Sleep times may need to be adjusted depending on the power of your computer. (faster computers go faster) | ||
|
||
# Stop execution if any command fails | ||
set -e | ||
|
||
# use docker ps to get the container id hashes | ||
echo "setting variables" | ||
export ETH_RPC_URL="https://sepolia.infura.io/v3/53ba4f713bf940fb87a58280912231ab" | ||
export TOKEN_BRIDGE_CONTRACT="0xFC1C57F1E466605e3Dd40840bC3e7DdAa400528c" | ||
export upgrade_binary_path="/Users/sloetter/projects/layer/local_devnet/v2.0.0-audit/layerd" | ||
export terminal="/Users/sloetter/projects/layer/local_devnet/v2.0.0-audit/layerd" | ||
|
||
# Get all container IDs into an array | ||
container_ids=($(docker ps -q)) | ||
|
||
# automatically sets a CONTAINER_ variable for all containers | ||
# (for running docker exec) | ||
for i in "${!container_ids[@]}"; do | ||
varname="CONTAINER_$((i + 1))" | ||
export "$varname=${container_ids[i]}" | ||
echo "Exported $varname=${container_ids[i]}" | ||
done | ||
|
||
# optionally view the logs in the terminal: | ||
# mac os: | ||
# osascript -e "tell application \"Terminal\" to do script \"docker logs -f $CONTAINER_1\"" | ||
# osascript -e "tell application \"Terminal\" to do script \"docker logs -f $CONTAINER_3\"" | ||
# desktop linux with gnome: | ||
# gnome-terminal -- bash -c "docker logs -f $CONTAINER_1; exec bash" | ||
# gnome-terminal -- bash -c "docker logs -f $CONTAINER_NAME; exec bash" | ||
|
||
# copy proposal to node1 container and submit proposal | ||
echo "copying the proposal to CONTAINER_1" | ||
docker cp ./proposal.json $CONTAINER_1:/bin/ | ||
|
||
echo "proposing the upgrade" | ||
docker exec $CONTAINER_1 layerd tx gov submit-proposal /bin/proposal.json --from validator --chain-id layer-1 --home /var/cosmos-chain/layer-1 --keyring-backend test --fees 510loya --yes | ||
|
||
# (optionally) check if proposal is live | ||
# docker exec $node1_id layerd query gov proposals | ||
# wait a bit | ||
echo "voting in the next block..." | ||
sleep 5 | ||
|
||
# vote on proposal | ||
echo "voting on the upgrade proposal" | ||
docker exec $CONTAINER_1 layerd tx gov vote 1 yes --from validator --chain-id layer-1 --home /var/cosmos-chain/layer-1 --keyring-backend test --fees 500loya --yes | ||
docker exec $CONTAINER_2 layerd tx gov vote 1 yes --from validator --chain-id layer-1 --home /var/cosmos-chain/layer-1 --keyring-backend test --fees 500loya --yes | ||
docker exec $CONTAINER_3 layerd tx gov vote 1 yes --from validator --chain-id layer-1 --home /var/cosmos-chain/layer-1 --keyring-backend test --fees 500loya --yes | ||
docker exec $CONTAINER_4 layerd tx gov vote 1 yes --from validator --chain-id layer-1 --home /var/cosmos-chain/layer-1 --keyring-backend test --fees 500loya --yes | ||
|
||
echo "making reporters in the next block..." | ||
sleep 5 | ||
|
||
# create 2 reporters to sanity check that reporting works before and after the upgrade | ||
echo "creating two reporters to test that reporting works before / after upgrade" | ||
docker exec $CONTAINER_3 layerd tx reporter create-reporter "2000000" "10000000" --from validator --home /var/cosmos-chain/layer-1 --keyring-dir /var/cosmos-chain/layer-1 --keyring-backend test --chain-id layer-1 --fees 500loya --yes | ||
docker exec $CONTAINER_4 layerd tx reporter create-reporter "200000" "1000000" --from validator --home /var/cosmos-chain/layer-1 --keyring-dir /var/cosmos-chain/layer-1 --keyring-backend test --chain-id layer-1 --fees 500loya --yes | ||
|
||
# wait for chain to stop | ||
sleep 30 | ||
|
||
#copy new binary into each container | ||
docker cp $upgrade_binary_path $CONTAINER_1:/bin/ | ||
docker cp $upgrade_binary_path $CONTAINER_2:/bin/ | ||
docker cp $upgrade_binary_path $CONTAINER_3:/bin/ | ||
docker cp $upgrade_binary_path $CONTAINER_4:/bin/ | ||
|
||
# all done! | ||
echo "Done!" | ||
echo "Restart the docker containers via docker desktop to verify that the upgrade was successsful." |