Skip to content

Commit

Permalink
Merge main branch into release/v2.x (#205)
Browse files Browse the repository at this point in the history
* added github workflow for continuous deployment of contracts to Neutron testnet

* Allow proposals to be posted for future rounds

* Disallow previous rounds

* Remove 'one round in the future' from constraints of create prop

* Regenerate artifacts

* added checkout icq relayer step

* store hydro sc address in github env for later use

* increase sleep time for txs

* run ICQs setup script from github workflow- first atempt

* increase sleep time betwen txs again

* Make lockup schedule a variable instead of hardcoded

* Regenerate and fix tests

* Add changelog

* fixed sed commands

* fix another err, temporary disable bids&tributes creation

* escape values read from the configuration file

* fixing "unable to find neutrond binary" and "failed to find testnet_deployer key" errors

* trying to stop ICQ relayer after 5mins of running

* split instantiate and populate in two different scripts

* shorten ICQ relayer run to 4 minutes and output contract addresses in the end

* - fixed typos
- added readme.md
- removed github job to run e2e tests since they just instantiate the contracts

* - don't run on every PR
- have props with different deployment durations

* Use struct instead of tuple vector for internal storage

* Adjust calls in tests

* Fix instantiation

* Regenerate'

* Add non-native tribute tokens for mainnet deploy

* Switch date invocation based on OS

* Gitignore result files from deployment runs

* Ignore tx files from deployment runs

* Add PR trigger for deployment workflow

* Upload log files from deploy

* Produce artifacts only on failure

* Add script for testnet deployment

* Fix Hydro contract init to work with round_lock_power_schedule

* Remove workflow trigger on PR

* Revoting bug fix (#195)

* fixed revoting bug

* added changelog entry, recompiled contracts, regenerated schema

* generate changelog for v2.0.3 release (#198) (#199)

* fixed instantiation msg in interchain tests (#201)

* bring v2.0.4 changelog to main (#202)

* Disable voting in next round with locks that were used to vote for longer deployment proposal through "auto-voting" mechanism (#203)

* disable voting in next round with locks that were used to vote for longer deployment proposal through "auto-voting" mechanism

* CR changes

* - set new contracts version to v2.1.0
- adjust migration to v2.0.4->v2.1.0
- recompile contracts
- regenerate schema

* generate v2.1.0 changelog

---------

Co-authored-by: Philip Offtermatt <[email protected]>
Co-authored-by: Philip Offtermatt <[email protected]>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent 354c254 commit de07455
Show file tree
Hide file tree
Showing 46 changed files with 1,401 additions and 178 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Disable voting in next round with locks that were used in previous round to vote for longer deployment proposal through the "auto-voting" mechanism.
([\#203](https://github.com/informalsystems/hydro/pull/203))
2 changes: 2 additions & 0 deletions .changelog/v2.1.0/features/193-allow-proposals-in-future.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Allow proposals to be created in future rounds.
([\#193](https://github.com/informalsystems/hydro/pull/193))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Store the lockup schedule as a constant to allow programmatic updates.
([\#194](https://github.com/informalsystems/hydro/pull/194))
1 change: 1 addition & 0 deletions .changelog/v2.1.0/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Date: December 12th, 2024
98 changes: 98 additions & 0 deletions .github/workflows/deploy-latest-contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Deploy latest contracts

on:
push:
branches: [ "main" ]

jobs:
deploy-latest-contracts:
runs-on: ubuntu-latest
timeout-minutes: 7
steps:
# Checkout Hydro repository
- name: Checkout repository
uses: actions/checkout@v4

# Download specific neutrond binary and add it to the PATH so it can be used by other scripts
- name: Download Neutron chain binary
run: |
curl -L -o neutrond https://github.com/neutron-org/neutron/releases/download/v5.0.2/neutrond-linux-amd64
chmod +x neutrond
echo "$(pwd)" >> $GITHUB_PATH
# Checkout Neutron ICQ relayer repository
- name: Checkout Neutron ICQ relayer repository
uses: actions/checkout@v4
with:
repository: neutron-org/neutron-query-relayer
path: ./neutron-query-relayer # directory to checkout the repo into
ref: 'refs/tags/v0.3.0' # tag to checkout

# Run scripts to store the codes, instantiate contracts and create proposals with tributes
- name: Deploy contracts
env:
TESTNET_MNEMONIC: ${{ secrets.E2E_TESTS_MNEMONIC }}
run: |
CONFIG_FILE="./tools/deployment/config_testnet.json"
TX_SENDER_WALLET=$(jq -r '.tx_sender_wallet' $CONFIG_FILE)
echo $TESTNET_MNEMONIC | neutrond keys add $TX_SENDER_WALLET --keyring-backend test --recover
chmod +x ./tools/deployment/store_instantiate.sh
chmod +x ./tools/deployment/populate_contracts.sh
source ./tools/deployment/store_instantiate.sh $CONFIG_FILE true
source ./tools/deployment/populate_contracts.sh $CONFIG_FILE
# Run tools/script.sh to create validator ICQs in the contract and run the ICQ relayer to
# get the results into the contract
- name: Run ICQs setup script
run: |
cp ./tools/script.sh .
chmod +x script.sh
CONFIG_FILE="./tools/deployment/config_testnet.json"
CHAIN_ID=$(echo $(jq -r '.chain_id' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
NEUTRON_RPC_NODE=$(echo $(jq -r '.neutron_rpc_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
NEUTRON_API_NODE=$(echo $(jq -r '.neutron_api_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
TX_SENDER_WALLET=$(echo $(jq -r '.tx_sender_wallet' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
HUB_CONNECTION_ID=$(echo $(jq -r '.hub_connection_id' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
HUB_RPC_NODE=$(echo $(jq -r '.hub_rpc_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
HUB_API_NODE=$(echo $(jq -r '.hub_api_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
sed -i "s|^RELAYER_REPO_PATH=.*$|RELAYER_REPO_PATH=\.\/neutron-query-relayer|" ./script.sh
sed -i "s/^export NEUTRON_CHAIN_ID=.*$/export NEUTRON_CHAIN_ID=$CHAIN_ID/" ./script.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_RPC_ADDR=.*$/export RELAYER_NEUTRON_CHAIN_RPC_ADDR=$NEUTRON_RPC_NODE/" ./script.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_REST_ADDR=.*$/export RELAYER_NEUTRON_CHAIN_REST_ADDR=$NEUTRON_API_NODE/" ./script.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=.*$/export RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=$TX_SENDER_WALLET/" ./script.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_CONNECTION_ID=.*$/export RELAYER_NEUTRON_CHAIN_CONNECTION_ID=$HUB_CONNECTION_ID/" ./script.sh
sed -i "s/^export RELAYER_TARGET_CHAIN_RPC_ADDR=.*$/export RELAYER_TARGET_CHAIN_RPC_ADDR=$HUB_RPC_NODE/" ./script.sh
sed -i "s/^export RELAYER_TARGET_CHAIN_API_ADDR=.*$/export RELAYER_TARGET_CHAIN_API_ADDR=$HUB_API_NODE/" ./script.sh
sed -i "s/^export RELAYER_REGISTRY_ADDRESSES=.*$/export RELAYER_REGISTRY_ADDRESSES=$HYDRO_CONTRACT_ADDRESS/" ./script.sh
sed -i "s/^export BATCH_SIZE=.*$/export BATCH_SIZE=5/" ./script.sh
sed -i "s/^export NUM_VALIDATORS_TO_ADD=.*$/export NUM_VALIDATORS_TO_ADD=5/" ./script.sh
sed -i "s/^export RELAYER_STORAGE_PATH=.*$/export RELAYER_STORAGE_PATH=\.neutron_queries_relayer\/leveldb/" ./script.sh
sed -i "s|^go run main\.go.*$|go run \./tools/main\.go|" ./script.sh
stop_icq_relayer() {
sleep 240
killall neutron_query_relayer
}
stop_icq_relayer &
bash ./script.sh
echo 'Latest contracts are deployed and ready for testing!'
echo 'Hydro contract address:' $HYDRO_CONTRACT_ADDRESS
echo 'Tribute contract address:' $TRIBUTE_CONTRACT_ADDRESS
- name: Archive log files
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
path: |
*_res.json
*_tx.json
12 changes: 0 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ on:
- Cargo.toml
- Cargo.lock
- contracts/**
- packages/interface/**
- test/e2e/**
- artifacts/**
pull_request:
paths:
- .github/workflows/tests.yml
- Cargo.toml
- Cargo.lock
- contracts/**
- packages/interface/**
- test/e2e/**
- artifacts/**

env:
Expand All @@ -31,11 +27,3 @@ jobs:
- uses: actions/checkout@v4
- name: Unit tests
run: make test-unit
test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: E2E tests
env:
E2E_TESTS_MNEMONIC: ${{ secrets.E2E_TESTS_MNEMONIC }}
run: make test-e2e
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ Cargo.toml.orig

# macOS specific
**/.DS_Store

# log files from deployments
*_res.json
*_tx.json
16 changes: 16 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# CHANGELOG

## v2.1.0

Date: December 12th, 2024

### BUG FIXES

- Disable voting in next round with locks that were used in previous round to vote for longer deployment proposal through the "auto-voting" mechanism.
([\#203](https://github.com/informalsystems/hydro/pull/203))

### FEATURES

- Allow proposals to be created in future rounds.
([\#193](https://github.com/informalsystems/hydro/pull/193))
- Store the lockup schedule as a constant to allow programmatic updates.
([\#194](https://github.com/informalsystems/hydro/pull/194))

## v2.0.4

Date: December 9th, 2024
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
a6776a5163a701a20bd789f331e781d013755ebfc985aabf9b0306dcc106cd65 hydro.wasm
c6766be58bfc7bd482e5c9e8fbdac3dfa29ee8eeebedd782e4ed49bb3f26a4ff tribute.wasm
a99875e8e9fe0a9fdc4dd162f30c439594668b19fa25675c7ea27bb078fd08cd hydro.wasm
de282a84a0c8179a35ddfb8aca950ade2207b235c0b2d9b7fe6bd5b23537aef0 tribute.wasm
Binary file modified artifacts/hydro.wasm
Binary file not shown.
Binary file modified artifacts/tribute.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion contracts/hydro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hydro"
version = "2.0.4"
version = "2.1.0"
authors = ["Jehan Tremback", "Philip Offtermatt", "Dusan Maksimovic"]
edition = "2018"

Expand Down
47 changes: 42 additions & 5 deletions contracts/hydro/schema/constants_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
"hub_connection_id",
"hub_transfer_channel_id",
"icq_update_period",
"is_in_pilot_mode",
"lock_epoch_length",
"max_deployment_duration",
"max_locked_tokens",
"max_validator_shares_participating",
"paused",
"round_length"
"round_length",
"round_lock_power_schedule"
],
"properties": {
"first_round_start": {
Expand All @@ -42,9 +42,6 @@
"format": "uint64",
"minimum": 0.0
},
"is_in_pilot_mode": {
"type": "boolean"
},
"lock_epoch_length": {
"type": "integer",
"format": "uint64",
Expand Down Expand Up @@ -72,6 +69,46 @@
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"round_lock_power_schedule": {
"$ref": "#/definitions/RoundLockPowerSchedule"
}
},
"additionalProperties": false
},
"Decimal": {
"description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)",
"type": "string"
},
"LockPowerEntry": {
"type": "object",
"required": [
"locked_rounds",
"power_scaling_factor"
],
"properties": {
"locked_rounds": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"power_scaling_factor": {
"$ref": "#/definitions/Decimal"
}
},
"additionalProperties": false
},
"RoundLockPowerSchedule": {
"type": "object",
"required": [
"round_lock_power_schedule"
],
"properties": {
"round_lock_power_schedule": {
"type": "array",
"items": {
"$ref": "#/definitions/LockPowerEntry"
}
}
},
"additionalProperties": false
Expand Down
8 changes: 8 additions & 0 deletions contracts/hydro/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@
"minimum_atom_liquidity_request": {
"$ref": "#/definitions/Uint128"
},
"round_id": {
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"title": {
"type": "string"
},
Expand Down
Loading

0 comments on commit de07455

Please sign in to comment.