Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,6 @@ data-agent/**
# cosmos
wasm_client_data/**

*.wasm
*.wasm

.secret/**
115 changes: 110 additions & 5 deletions flake/release.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ self, ... }: {
perSystem =
{ config, self', inputs', pkgs, system, crane, systemCommonRust, ... }: {
perSystem = { config, self', inputs', pkgs, system, crane, systemCommonRust
, devnetTools, ... }: {
packages = let
nix-config = ''
--allow-import-from-derivation --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config --option sandbox relaxed'';
Expand Down Expand Up @@ -64,7 +64,7 @@

delete-release-tag-unsafe = pkgs.writeShellApplication {
name = "delete-release-tag-unsafe";
runtimeInputs = [ pkgs.git pkgs.yq ];
runtimeInputs = [ pkgs.git ];
text = ''
# shellcheck disable=SC2015
git tag --delete "release-v$1" || true && git push --delete origin "release-v$1"
Expand All @@ -73,8 +73,7 @@

generate-release-artifacts = pkgs.writeShellApplication {
name = "generate-release-artifacts";
runtimeInputs =
[ pkgs.bash pkgs.binutils pkgs.coreutils pkgs.cacert ];
runtimeInputs = devnetTools.withBuildTools;
text = ''
mkdir -p release-artifacts/to-upload/

Expand Down Expand Up @@ -143,6 +142,112 @@
'';
};

release-xcvm-osmosis = pkgs.writeShellApplication {
runtimeInputs = devnetTools.withBaseContainerTools
++ [ packages.osmosisd pkgs.jq ];
name = "release-xcvm-osmosis";
text = ''
if [[ -f .secret/CI_COSMOS_MNEMONIC ]]; then
CI_COSMOS_MNEMONIC="$(cat .secret/CI_COSMOS_MNEMONIC)"
fi
FEE=uosmo
NETWORK_ID=3
CHAIN_ID=osmo-test-5
CI_COSMOS_MNEMONIC="''${1-$CI_COSMOS_MNEMONIC}"
NETWORK_ID=''${2-$NETWORK_ID}
DIR=.osmosisd
BINARY=osmosisd
NODE=https://rpc.testnet.osmosis.zone:443

rm --force --recursive .secret/$DIR
mkdir --parents .secret/$DIR
INTERPRETER="${packages.xc-cw-contracts}/lib/cw_xc_interpreter.wasm"
GATEWAY="${packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm"

echo "$CI_COSMOS_MNEMONIC" | "$BINARY" keys add CI_COSMOS_MNEMONIC --recover --keyring-backend test --home .secret/$DIR --output json

ADDRESS=$("$BINARY" keys show CI_COSMOS_MNEMONIC --keyring-backend test --home .secret/$DIR --output json | jq -r '.address')

echo "$ADDRESS"
GATEWAY=$("$BINARY" tx wasm store "$GATEWAY" --keyring-backend test --home .secret/$DIR --output json --node "$NODE" --from CI_COSMOS_MNEMONIC --gas-prices 0.1uosmo --gas auto --gas-adjustment 1.3 --chain-id "$CHAIN_ID" --yes --broadcast-mode block)
echo "$GATEWAY"
GATEWAY_CODE_ID=$(echo "$GATEWAY" | jq -r '.logs[0].events[1].attributes[1].value')
echo "$GATEWAY_CODE_ID" > .secret/$DIR/GATEWAY_CODE_ID

INTERPRETER=$("$BINARY" tx wasm store "$INTERPRETER" --keyring-backend test --home .secret/$DIR --output json --node "$NODE" --from CI_COSMOS_MNEMONIC --gas-prices 0.1uosmo --gas auto --gas-adjustment 1.3 --chain-id "$CHAIN_ID" --yes --broadcast-mode block)
echo "$INTERPRETER"

INTERPRETER_CODE_ID=$(echo "$INTERPRETER" | jq -r '.logs[0].events[1].attributes[1].value')
echo "$INTERPRETER_CODE_ID" > .secret/$DIR/INTERPRETER_CODE_ID

INSTANTIATE=$(cat << EOF
{
"admin" : "$ADDRESS",
"network_id" : $NETWORK_ID
}
EOF
)

INSTANTIATE=$("$BINARY" tx wasm instantiate "$GATEWAY_CODE_ID" "$INSTANTIATE" --label "xc-gateway-2" --keyring-backend test --home .secret/$DIR --output json --node "$NODE" --from CI_COSMOS_MNEMONIC --gas-prices 0.1$FEE --gas auto --gas-adjustment 1.3 --chain-id "$CHAIN_ID" --yes --broadcast-mode block --admin "$ADDRESS")
echo "$INSTANTIATE"
GATEWAY_CONTRACT_ADDRESS=$(echo "$INSTANTIATE" | jq -r '.logs[0].events[] | select(.type == "instantiate") | .attributes[0].value')
echo "$GATEWAY_CONTRACT_ADDRESS" > .secret/$DIR/GATEWAY_CONTRACT_ADDRESS
'';
};

release-xcvm-centauri = pkgs.writeShellApplication {
runtimeInputs = devnetTools.withBaseContainerTools
++ [ packages.centaurid pkgs.jq ];
name = "release-xcvm-centauri";
text = ''
if [[ -f .secret/CI_COSMOS_MNEMONIC ]]; then
CI_COSMOS_MNEMONIC="$(cat .secret/CI_COSMOS_MNEMONIC)"
fi
FEE=ppica
NETWORK_ID=2
CHAIN_ID=banksy-testnet-3
CI_COSMOS_MNEMONIC="''${1-$CI_COSMOS_MNEMONIC}"
NETWORK_ID=''${2-$NETWORK_ID}
DIR=.centaurid
BINARY=centaurid
NODE=https://rpc-t.composable.nodestake.top:443

rm --force --recursive .secret/$DIR
mkdir --parents .secret/$DIR
INTERPRETER="${packages.xc-cw-contracts}/lib/cw_xc_interpreter.wasm"
GATEWAY="${packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm"

echo "$CI_COSMOS_MNEMONIC" | "$BINARY" keys add CI_COSMOS_MNEMONIC --recover --keyring-backend test --home .secret/$DIR --output json

ADDRESS=$("$BINARY" keys show CI_COSMOS_MNEMONIC --keyring-backend test --home .secret/$DIR --output json | jq -r '.address')

echo "$ADDRESS" > .secret/$DIR/ADDRESS
GATEWAY=$("$BINARY" tx wasm store "$GATEWAY" --keyring-backend test --home .secret/$DIR --output json --node "$NODE" --from CI_COSMOS_MNEMONIC --gas-prices 0.1uosmo --gas auto --gas-adjustment 1.3 --chain-id "$CHAIN_ID" --yes --broadcast-mode block)
echo "$GATEWAY"
GATEWAY_CODE_ID=$(echo "$GATEWAY" | jq -r '.logs[0].events[1].attributes[1].value')
echo "$GATEWAY_CODE_ID" > .secret/$DIR/GATEWAY_CODE_ID

INTERPRETER=$("$BINARY" tx wasm store "$INTERPRETER" --keyring-backend test --home .secret/$DIR --output json --node "$NODE" --from CI_COSMOS_MNEMONIC --gas-prices 0.1uosmo --gas auto --gas-adjustment 1.3 --chain-id "$CHAIN_ID" --yes --broadcast-mode block)
echo "$INTERPRETER"

INTERPRETER_CODE_ID=$(echo "$INTERPRETER" | jq -r '.logs[0].events[1].attributes[1].value')
echo "$INTERPRETER_CODE_ID" > .secret/$DIR/INTERPRETER_CODE_ID

INSTANTIATE=$(cat << EOF
{
"admin" : "$ADDRESS",
"network_id" : $NETWORK_ID
}
EOF
)

INSTANTIATE=$("$BINARY" tx wasm instantiate "$GATEWAY_CODE_ID" "$INSTANTIATE" --label "xc-gateway-2" --keyring-backend test --home .secret/$DIR --output json --node "$NODE" --from CI_COSMOS_MNEMONIC --gas-prices 0.1$FEE --gas auto --gas-adjustment 1.3 --chain-id "$CHAIN_ID" --yes --broadcast-mode block --admin "$ADDRESS")
echo "$INSTANTIATE"
GATEWAY_CONTRACT_ADDRESS=$(echo "$INSTANTIATE" | jq -r '.logs[0].events[] | select(.type == "instantiate") | .attributes[0].value')
echo "$GATEWAY_CONTRACT_ADDRESS" > .secret/$DIR/GATEWAY_CONTRACT_ADDRESS
'';
};

};

};
Expand Down
1 change: 1 addition & 0 deletions tools/devnet-tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
withDevNetContainerTools = with pkgs;
[ bottom gawk gnugrep less nettools nix self'.packages.bech32cli ]
++ withBaseContainerTools ++ withUserContainerTools;
withBuildTools = with pkgs; [ binutils ] ++ withBaseContainerTools;

buildDevnetImage = { name, devNet, container-tools }:
pkgs.dockerTools.buildImage {
Expand Down