Skip to content

Commit

Permalink
preparams caching and ssh config fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed Jun 20, 2024
1 parent cd4a5f0 commit 229ae0d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
5 changes: 3 additions & 2 deletions Dockerfile-localnet
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ RUN mkdir -p /root/.zetacored/cosmovisor/genesis/bin && \
ENV PATH /root/.zetacored/cosmovisor/current/bin/:/root/.zetaclientd/upgrades/current/:${PATH}

COPY contrib/localnet/scripts /root
COPY contrib/localnet/ssh_config /root/.ssh/config
COPY contrib/localnet/ssh_config /etc/ssh/ssh_config.d/localnet
COPY contrib/localnet/zetacored /root/zetacored

RUN chmod 755 /root/*.sh
RUN chmod 755 /root/*.sh && \
chmod 644 /etc/ssh/ssh_config.d/localnet

WORKDIR /usr/local/bin
EXPOSE 22
Expand Down
5 changes: 4 additions & 1 deletion contrib/localnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ services:
- HOTKEY_PASSWORD=password # test purposes only
volumes:
- ssh:/root/.ssh
- preparams:/root/preparams

zetaclient1:
image: zetanode:latest
Expand All @@ -101,6 +102,7 @@ services:
- HOTKEY_PASSWORD=password # test purposes only
volumes:
- ssh:/root/.ssh
- preparams:/root/preparams

eth:
image: ethereum/client-go:v1.10.26
Expand Down Expand Up @@ -147,4 +149,5 @@ services:
volumes:
- ssh:/root/.ssh
volumes:
ssh:
ssh:
preparams:
13 changes: 7 additions & 6 deletions contrib/localnet/scripts/start-zetaclientd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ set_sepolia_endpoint() {
}

# generate pre-params as early as possible
# to reach keygen height in time
#
# consider caching these on a docker volume
zetaclientd gen-pre-params ~/preParams.json
# to reach keygen height on schedule
PREPARAMS_PATH="/root/preparams/${HOSTNAME}.json"
if [ ! -f "$PREPARAMS_PATH" ]; then
zetaclientd gen-pre-params "$PREPARAMS_PATH"
fi

# Wait for authorized_keys file to exist (generated by zetacore0)
while [ ! -f ~/.ssh/authorized_keys ]; do
Expand Down Expand Up @@ -48,7 +49,7 @@ echo "Start zetaclientd"
if [[ $HOSTNAME == "zetaclient0" && ! -f ~/.zetacored/config/zetaclient_config.json ]]
then
MYIP=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
zetaclientd init --zetacore-url zetacore0 --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --keyring-backend "$BACKEND"
zetaclientd init --zetacore-url zetacore0 --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --keyring-backend "$BACKEND" --pre-params "$PREPARAMS_PATH"

# check if the option is additional-evm
# in this case, the additional evm is represented with the sepolia chain, we set manually the eth2 endpoint to the sepolia chain (11155111 -> http://eth2:8545)
Expand All @@ -67,7 +68,7 @@ then
do
SEED=$(curl --retry 30 --retry-delay 1 --max-time 1 --retry-connrefused -s zetaclient0:8123/p2p)
done
zetaclientd init --peer "/ip4/172.20.0.21/tcp/6668/p2p/${SEED}" --zetacore-url "$node" --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --log-level 1 --keyring-backend "$BACKEND"
zetaclientd init --peer "/ip4/172.20.0.21/tcp/6668/p2p/${SEED}" --zetacore-url "$node" --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --log-level 1 --keyring-backend "$BACKEND" --pre-params "$PREPARAMS_PATH"

# check if the option is additional-evm
# in this case, the additional evm is represented with the sepolia chain, we set manually the eth2 endpoint to the sepolia chain (11155111 -> http://eth2:8545)
Expand Down
3 changes: 2 additions & 1 deletion zetaclient/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ func GetPath(inputPath string) string {
return ""
}
path[0] = home
return filepath.Join(path...)

Check warning on line 94 in zetaclient/config/config.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/config/config.go#L94

Added line #L94 was not covered by tests
}
}
return filepath.Join(path...)
return inputPath

Check warning on line 97 in zetaclient/config/config.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/config/config.go#L97

Added line #L97 was not covered by tests
}

// ContainRestrictedAddress returns true if any one of the addresses is restricted
Expand Down

0 comments on commit 229ae0d

Please sign in to comment.