diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e6d4f478..3fea0b34 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,6 @@ # [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye ARG VARIANT="bullseye" -FROM golang:1.20.4 +FROM golang:1.21 ARG DEBIAN_FRONTEND=noninteractive @@ -14,10 +14,6 @@ RUN apt-get -y install --no-install-recommends vim # WASM dependencies + Rustup RUN apt-get -y install --no-install-recommends binaryen -# Cosmos dependencies -# Sadly Ignite + Cosmos SDK v0.47.x is broken atm -# RUN curl https://get.ignite.com/cli@nightly! | bash - # Go language extension dependencies RUN go install github.com/cweill/gotests/gotests@v1.6.0 RUN go install github.com/fatih/gomodifytags@v1.16.0 diff --git a/app/app.go b/app/app.go index 2ab9c4df..7bd10845 100644 --- a/app/app.go +++ b/app/app.go @@ -318,12 +318,14 @@ func NewApp( keys := storetypes.NewKVStoreKeys( authtypes.StoreKey, authz.ModuleName, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, - feegrant.StoreKey, evidencetypes.StoreKey, circuittypes.StoreKey, - ibctransfertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, group.StoreKey, - icacontrollertypes.StoreKey, consensusparamtypes.StoreKey, wasmstoragetypes.StoreKey, - wasmtypes.StoreKey, randomnesstypes.StoreKey, + govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, + feegrant.StoreKey, evidencetypes.StoreKey, circuittypes.StoreKey, group.StoreKey, + capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey, + wasmtypes.StoreKey, icahosttypes.StoreKey, + icacontrollertypes.StoreKey, + wasmstoragetypes.StoreKey, randomnesstypes.StoreKey, ) + tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) diff --git a/scripts/testnet/add_wasm_state_to_genesis.sh b/scripts/testnet/add_wasm_state_to_genesis.sh index 2235b5cc..59e66142 100755 --- a/scripts/testnet/add_wasm_state_to_genesis.sh +++ b/scripts/testnet/add_wasm_state_to_genesis.sh @@ -17,9 +17,11 @@ function download_contract_release() { mkdir -p $WASM_DIR function gh_curl() { + set +x curl -H "Authorization: token $GITHUB_TOKEN" \ -H "Accept: application/vnd.github.v3.raw" \ $@ + set -x } if [ "$CONTRACTS_VERSION" = "latest" ]; then @@ -35,10 +37,12 @@ function download_contract_release() { exit 1 fi; + set +x curl -sL --header "Authorization: token $GITHUB_TOKEN" \ --header 'Accept: application/octet-stream' \ https://$GITHUB_TOKEN:@api.github.com/repos/$repo/releases/assets/$asset_id \ --output-dir $WASM_DIR --output ${1} + set -x } # store_and_instantiate() stores and instantiates a contract and returns its address @@ -46,7 +50,7 @@ function download_contract_release() { # $1: Contract file name # $2: Initial state function store_and_instantiate() { - local TX_OUTPUT=$($BIN tx wasm store $WASM_DIR/$1 --from $ADDR --keyring-backend test --gas auto --gas-adjustment 1.2 --home $TMP_HOME -y --output json) + local TX_OUTPUT=$($BIN tx wasm store $WASM_DIR/$1 --from $ADDR --keyring-backend test --gas auto --gas-adjustment 1.2 --home $TMP_HOME --chain-id $TEMP_CHAIN_ID -y --output json) [[ -z "$TX_OUTPUT" ]] && { echo "failed to get tx output" ; exit 1; } local TX_HASH=$(echo $TX_OUTPUT | jq -r .txhash) sleep 10; @@ -55,12 +59,12 @@ function store_and_instantiate() { local CODE_ID=$(echo $STORE_TX_OUTPUT | jq -r '.events[] | select(.type | contains("store_code")).attributes[] | select(.key | contains("code_id")).value') [[ -z "$CODE_ID" ]] && { echo "failed to get code ID" ; exit 1; } - local INSTANTIATE_OUTPUT=$($BIN tx wasm instantiate $CODE_ID "$2" --no-admin --from $ADDR --keyring-backend test --label $CODE_ID --gas auto --gas-adjustment 1.2 --home $TMP_HOME -y --output json) + local INSTANTIATE_OUTPUT=$($BIN tx wasm instantiate $CODE_ID "$2" --no-admin --from $ADDR --keyring-backend test --label $CODE_ID --gas auto --gas-adjustment 1.2 --home $TMP_HOME --chain-id $TEMP_CHAIN_ID -y --output json) TX_HASH=$(echo "$INSTANTIATE_OUTPUT" | jq -r '.txhash') sleep 10; local INSTANTIATE_TX_OUTPUT=$($BIN query tx $TX_HASH --home $TMP_HOME --output json) - local CONTRACT_ADDRESS=$(echo $INSTANTIATE_TX_OUTPUT | jq -r '.logs[].events[] | select(.type=="instantiate") | .attributes[] | select(.key=="_contract_address") | .value') + local CONTRACT_ADDRESS=$(echo $INSTANTIATE_TX_OUTPUT | jq -r '.events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address") | .value') [[ -z "$CONTRACT_ADDRESS" ]] && { echo "failed to get contract address for ${1}" ; exit 1; } echo $CONTRACT_ADDRESS @@ -86,16 +90,19 @@ download_contract_release proxy_contract.wasm download_contract_release staking.wasm download_contract_release data_requests.wasm +TEMP_CHAIN_ID=temp-seda-chain # # SCRIPT BEGINS - START CHAIN # -$BIN init new node0 --home $TMP_HOME +$BIN init new node0 --home $TMP_HOME --chain-id $TEMP_CHAIN_ID + +cat $TMP_HOME/config/genesis.json | jq '.consensus["params"]["validator"]["pub_key_types"]=["secp256k1"]' > $TMP_HOME/config/tmp_genesis.json && mv $TMP_HOME/config/tmp_genesis.json $TMP_HOME/config/genesis.json $BIN keys add deployer --home $TMP_HOME --keyring-backend test ADDR=$($BIN keys show deployer --home $TMP_HOME --keyring-backend test -a) $BIN add-genesis-account $ADDR 100000000000000000seda --home $TMP_HOME --keyring-backend test -$BIN gentx deployer 10000000000000000seda --home $TMP_HOME --keyring-backend test +$BIN gentx deployer 10000000000000000seda --home $TMP_HOME --keyring-backend test --chain-id $TEMP_CHAIN_ID $BIN collect-gentxs --home $TMP_HOME @@ -117,9 +124,9 @@ DR_ADDR=$(store_and_instantiate data_requests.wasm "$ARG") # Call SetStaking and SetDataRequests on Proxy contract to set circular dependency -$BIN tx wasm execute $PROXY_ADDR '{"set_staking":{"contract":"'$STAKING_ADDR'"}}' --from $ADDR --gas auto --gas-adjustment 1.2 --keyring-backend test --home $TMP_HOME -y +$BIN tx wasm execute $PROXY_ADDR '{"set_staking":{"contract":"'$STAKING_ADDR'"}}' --from $ADDR --gas auto --gas-adjustment 1.2 --keyring-backend test --home $TMP_HOME --chain-id $TEMP_CHAIN_ID -y sleep 10 -$BIN tx wasm execute $PROXY_ADDR '{"set_data_requests":{"contract":"'$DR_ADDR'"}}' --from $ADDR --gas auto --gas-adjustment 1.2 --keyring-backend test --home $TMP_HOME -y +$BIN tx wasm execute $PROXY_ADDR '{"set_data_requests":{"contract":"'$DR_ADDR'"}}' --from $ADDR --gas auto --gas-adjustment 1.2 --keyring-backend test --home $TMP_HOME --chain-id $TEMP_CHAIN_ID -y sleep 10 diff --git a/scripts/testnet/create_genesis.sh b/scripts/testnet/create_genesis.sh index 0a7bd422..90c89554 100755 --- a/scripts/testnet/create_genesis.sh +++ b/scripts/testnet/create_genesis.sh @@ -25,6 +25,7 @@ $BIN init new node0 --chain-id $CHAIN_ID cat $HOME/.seda-chain/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="180s"' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json cat $HOME/.seda-chain/config/genesis.json | jq '.app_state["gov"]["params"]["voting_period"]="180s"' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json cat $HOME/.seda-chain/config/genesis.json | jq '.app_state["gov"]["params"]["max_deposit_period"]="180s"' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json +cat $HOME/.seda-chain/config/genesis.json | jq '.consensus["params"]["validator"]["pub_key_types"]=["secp256k1"]' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json # TO-DO? # - chain id @@ -66,7 +67,7 @@ for i in ${!MONIKERS[@]}; do # to output geneis file $BIN add-genesis-account $VALIDATOR_ADDRESS 500000000000000000seda - $BIN gentx ${MONIKERS[$i]} ${SELF_DELEGATION_AMOUNTS[$i]} --moniker=${MONIKERS[$i]} --keyring-backend=test --home $INDIVIDUAL_VAL_HOME_DIR --ip=${IPS[$i]} + $BIN gentx ${MONIKERS[$i]} ${SELF_DELEGATION_AMOUNTS[$i]} --moniker=${MONIKERS[$i]} --keyring-backend=test --home $INDIVIDUAL_VAL_HOME_DIR --ip=${IPS[$i]} --chain-id $CHAIN_ID cp -a $INDIVIDUAL_VAL_CONFIG_DIR/gentx/. $GENTX_DIR done