diff --git a/.gitignore b/.gitignore index 36a2594ba56..233d26d5fc5 100644 --- a/.gitignore +++ b/.gitignore @@ -105,4 +105,6 @@ data-agent/** # cosmos wasm_client_data/** -*.wasm \ No newline at end of file +*.wasm + +.secret/** \ No newline at end of file diff --git a/flake/release.nix b/flake/release.nix index 5faedbb163a..d338017d3b7 100644 --- a/flake/release.nix +++ b/flake/release.nix @@ -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''; @@ -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" @@ -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/ @@ -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 + ''; + }; + }; }; diff --git a/tools/devnet-tools.nix b/tools/devnet-tools.nix index 5e799d0df67..d549fed7be9 100644 --- a/tools/devnet-tools.nix +++ b/tools/devnet-tools.nix @@ -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 {