Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop locator #81

Draft
wants to merge 59 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
8039373
Add additional workers
keylogic1 Apr 26, 2024
267f393
Add more workers
keylogic1 Apr 26, 2024
1da4ed0
Resolve conflict in Cargo.toml
faust403 May 7, 2024
7e7fc91
Drop locator init: improve naming and add new query to get all possib…
faust403 May 6, 2024
cf291cb
Change execute_add_chain_info, now it can add list of new chains
faust403 May 6, 2024
3ab8764
Add execute_remove_chain_info
faust403 May 6, 2024
96249c5
Improve naming
faust403 May 6, 2024
4a42249
Improve naming for query
faust403 May 6, 2024
0d3ac4b
Remove config since it isn't necessary
faust403 May 6, 2024
baf9df4
Remove .vscode
faust403 May 7, 2024
12f646c
Rename contract name to avoid drop-drop-* in artifact's name
faust403 May 7, 2024
54795b2
Update QueryMsg
faust403 May 7, 2024
25cbaec
.for_each -> simple for loop
faust403 May 7, 2024
624d1f0
Error handling for chain remove
faust403 May 7, 2024
299d5a9
Move factory parts to packages/
faust403 May 7, 2024
6b7d805
Remove .clone() in query_chain
faust403 May 7, 2024
80fa617
Replace .unwrap_or_default() with ?
faust403 May 7, 2024
c03f212
Stop handling exception throwing
faust403 May 7, 2024
63d528b
Remove NeutronError from error list
faust403 May 7, 2024
eebe5a1
Remove Instantiate2AddressError, Unauthorized, Unimplemented and Unkn…
faust403 May 7, 2024
f970734
Skip check after deletion
faust403 May 7, 2024
48fcfca
Simplify ExecuteMsg structure, update contract's code
faust403 May 7, 2024
7149fbc
Move everything to FactoryState
faust403 May 7, 2024
6de41ae
Move to .to_string() method instead of .clone()
faust403 May 7, 2024
44c59e5
.range_raw() -> .range()
faust403 May 7, 2024
3abd125
Update Cargo.toml
faust403 May 7, 2024
2c76024
Add new queries
faust403 May 7, 2024
a3a236f
Update execute_remove_chains in contract.rs, integration_tests script…
faust403 May 14, 2024
a6e2556
Update debug information in execute_add_chains
faust403 May 14, 2024
bcac025
Improve query_factory_instances
faust403 May 14, 2024
eeb81f1
Move schema generator, add dropLocator to contractLib
faust403 May 14, 2024
5dec68a
Started writing integration tests, upload binaries testcase
faust403 May 15, 2024
c4bd9be
Add "Instantiate factory instances testcase"
faust403 May 15, 2024
3d93dcd
Add "contracts" field in context, update testcases
faust403 May 15, 2024
7f7a9dd
Remove unused imports
faust403 May 15, 2024
e4deac0
Add adding & removing testcases for contract
faust403 May 15, 2024
a2341c8
Remove second .clone(), add tests.rs and update lib.rs for unit tests
faust403 May 16, 2024
ed82579
Update gaia.genesis_opts
faust403 May 16, 2024
a3f072b
Update hermes.config
faust403 May 16, 2024
e178ad0
Add new testcase
faust403 May 16, 2024
3c04790
Remove unused constant
faust403 May 16, 2024
f04d8ad
Add custom querier
faust403 May 17, 2024
9927037
Unit tests for adding new chain
faust403 May 17, 2024
db816d7
Remove unused imports
faust403 May 17, 2024
728f8d6
Move cloned value into lambda
faust403 May 17, 2024
81bceb6
Improve add_factory_instances test
faust403 May 18, 2024
e67f9d7
Add tests for removing chains
faust403 May 18, 2024
400d878
Test to reveal unauthorized executions
faust403 May 18, 2024
6bd69af
Replace match with if statement
faust403 May 21, 2024
6822973
Add github actions test for drop-locator
faust403 May 21, 2024
314de4e
Remove unnecessary code
faust403 May 22, 2024
fa0e14e
Move from String::from to .to_string()
faust403 May 22, 2024
23fd3a3
Compare factory output with direct query
faust403 May 29, 2024
3178690
Move simple for to for-of loop
faust403 Jun 3, 2024
4c86196
Merge branch 'feat/audit-fixes' into drop-locator
faust403 Jun 3, 2024
9d994f7
Minor fixes in tests
faust403 Jun 3, 2024
dd95de1
Update generated lib
faust403 Jun 3, 2024
3675ad0
Replace matches with length check
faust403 Jun 3, 2024
80a875b
Update 'factory instances' testcase
faust403 Jun 3, 2024
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: 2 additions & 2 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.runner_label }}
strategy:
matrix:
runner_label: ${{ fromJSON('["lionco-runner-5", "lionco-runner-6"]') }}
runner_label: ${{ fromJSON('["lionco-runner-1", "lionco-runner-2", "lionco-runner-3", "lionco-runner-4", "lionco-runner-5", "lionco-runner-6", "lionco-runner-7", "lionco-runner-8", "lionco-runner-9", "lionco-runner-10"]') }}
steps:
- name: Stop old containers
run: docker ps -q | grep -q . && docker stop $(docker ps -q) -t0 || echo "No containers to stop"
Expand All @@ -31,7 +31,7 @@ jobs:
runs-on: ${{ matrix.runner_label }}
strategy:
matrix:
runner_label: ${{ fromJSON('["lionco-runner-5", "lionco-runner-6"]') }}
runner_label: ${{ fromJSON('["lionco-runner-1", "lionco-runner-2", "lionco-runner-3", "lionco-runner-4", "lionco-runner-5", "lionco-runner-6", "lionco-runner-7", "lionco-runner-8", "lionco-runner-9", "lionco-runner-10"]') }}
steps:
- name: Clean Workspace
if: always()
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,3 +656,48 @@ jobs:
docker stop -t0 $(docker ps -a -q) || true
docker container prune -f || true
docker volume rm $(docker volume ls -q) || true
test-locator:
name: test:locator Integration Tests
needs:
- images-prepare
- artifacts-prepare
runs-on: self-hosted
steps:
- name: Upgrade docker compose to use v2
run: sudo curl -L
"https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-$(uname
-s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x
/usr/local/bin/docker-compose
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.12.2
- name: Install Yarn
run: npm install -g yarn
- name: Log in to Private Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Clean volumes
run: docker volume prune -f
- name: Download images
run: |
cd integration_tests
yarn build-images
- name: Download artifacts
uses: actions/cache@v4
with:
path: artifacts
key: ${{ runner.os }}-${{ github.sha }}
- name: Run test test:locator
run: cd integration_tests && yarn && yarn test:locator
- name: Cleanup resources
if: always()
run: |
docker stop -t0 $(docker ps -a -q) || true
docker container prune -f || true
docker volume rm $(docker volume ls -q) || true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.idea/
.vscode/
target/
**/schema/
/artifacts/
.rtx.toml
.rtx.toml
*.lock
node_modules
6 changes: 0 additions & 6 deletions .vscode/settings.json

This file was deleted.

17 changes: 17 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ members = [
"contracts/proposal-votes-poc",
"contracts/provider-proposals-poc",
"contracts/pump",
"contracts/locator",
"contracts/puppeteer",
# "contracts/puppeteer-authz",
"contracts/rewards-manager",
Expand Down
2 changes: 1 addition & 1 deletion contracts/factory/src/bin/drop-factory-schema.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_schema::write_api;
use drop_factory::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use drop_staking_base::msg::factory::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};

fn main() {
write_api! {
Expand Down
24 changes: 12 additions & 12 deletions contracts/factory/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
use crate::{
error::ContractResult,
msg::{
ExecuteMsg, InstantiateMsg, MigrateMsg, ProxyMsg, QueryMsg, UpdateConfigMsg,
ValidatorSetMsg,
},
state::{State, STATE},
};
use cosmwasm_std::{
attr, instantiate2_address, to_json_binary, Attribute, Binary, CodeInfoResponse, CosmosMsg,
Deps, DepsMut, Env, HexBinary, MessageInfo, Response, StdResult, WasmMsg,
Expand All @@ -25,6 +17,14 @@ use drop_staking_base::msg::{
},
withdrawal_voucher::InstantiateMsg as WithdrawalVoucherInstantiateMsg,
};
use drop_staking_base::{
error::factory::ContractResult,
msg::factory::{
ExecuteMsg, InstantiateMsg, MigrateMsg, ProxyMsg, QueryMsg, UpdateConfigMsg,
ValidatorSetMsg,
},
state::factory::{State, STATE},
};
use neutron_sdk::{
bindings::{msg::NeutronMsg, query::NeutronQuery},
NeutronResult,
Expand Down Expand Up @@ -344,7 +344,7 @@ pub fn query(deps: Deps<NeutronQuery>, _env: Env, msg: QueryMsg) -> StdResult<Bi
fn query_pause_info(deps: Deps<NeutronQuery>) -> StdResult<Binary> {
let state = STATE.load(deps.storage)?;

to_json_binary(&crate::state::PauseInfoResponse {
to_json_binary(&drop_staking_base::state::factory::PauseInfoResponse {
core: deps
.querier
.query_wasm_smart(state.core_contract, &CoreQueryMsg::PauseInfo {})?,
Expand Down Expand Up @@ -502,7 +502,7 @@ fn execute_proxy_msg(
}
},
ProxyMsg::Core(msg) => match msg {
crate::msg::CoreMsg::UpdateNonNativeRewardsReceivers { items } => {
drop_staking_base::msg::factory::CoreMsg::UpdateNonNativeRewardsReceivers { items } => {
messages.push(get_proxied_message(
state.core_contract,
drop_staking_base::msg::core::ExecuteMsg::UpdateNonNativeRewardsReceivers {
Expand All @@ -517,14 +517,14 @@ fn execute_proxy_msg(
denoms: items.iter().map(|one|{one.denom.to_string()}).collect() }, info.funds)?
);
}
crate::msg::CoreMsg::Pause {} => {
drop_staking_base::msg::factory::CoreMsg::Pause {} => {
messages.push(get_proxied_message(
state.core_contract,
drop_staking_base::msg::core::ExecuteMsg::Pause {},
vec![],
)?);
}
crate::msg::CoreMsg::Unpause {} => {
drop_staking_base::msg::factory::CoreMsg::Unpause {} => {
messages.push(get_proxied_message(
state.core_contract,
drop_staking_base::msg::core::ExecuteMsg::Unpause {},
Expand Down
3 changes: 0 additions & 3 deletions contracts/factory/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
pub mod contract;
pub mod error;
pub mod msg;
pub mod state;
2 changes: 2 additions & 0 deletions contracts/locator/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
schema = "run --bin drop-locator-schema"
36 changes: 36 additions & 0 deletions contracts/locator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
authors = ["Vladislav Vasilev <vfaust.thefuture@gmail.com>"]
description = "Contract to query all Drop contracts"
edition = "2021"
name = "drop-locator"
version = "1.0.0"

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw-storage-plus = { workspace = true }
cw2 = { workspace = true }
thiserror = { workspace = true }
drop-staking-base = { workspace = true }
drop-puppeteer-base = { workspace = true }
drop-helpers = { workspace = true }
drop-macros = { workspace = true }
neutron-sdk = { workspace = true }
cw-ownable = { workspace = true }
1 change: 1 addition & 0 deletions contracts/locator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# DROP Locator contract
10 changes: 10 additions & 0 deletions contracts/locator/src/bin/drop-locator-schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use cosmwasm_schema::write_api;
use drop_locator::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

fn main() {
write_api! {
instantiate: InstantiateMsg,
query: QueryMsg,
execute: ExecuteMsg
}
}
Loading
Loading