Skip to content
Open
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
21 changes: 11 additions & 10 deletions contracts/puppeteer/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ use drop_helpers::{
interchain::prepare_any_msg,
validation::validate_addresses,
};
use drop_proto::proto::gaia::liquid::v1beta1::{
MsgDisableTokenizeShares, MsgEnableTokenizeShares, MsgRedeemTokensForShares,
};
use drop_proto::proto::{
cosmos::{
base::v1beta1::Coin as ProtoCoin,
staking::v1beta1::{MsgDisableTokenizeShares, MsgEnableTokenizeShares},
},
cosmos::base::v1beta1::Coin as ProtoCoin,
liquidstaking::{
distribution::v1beta1::MsgWithdrawDelegatorReward,
staking::v1beta1::{MsgBeginRedelegate, MsgRedeemTokensforShares, MsgTokenizeShares},
staking::v1beta1::{MsgBeginRedelegate, MsgTokenizeShares},
},
};
use drop_puppeteer_base::{
Expand Down Expand Up @@ -354,7 +354,7 @@ fn execute_delegate(
}
);

let amount_to_stake = items.iter().map(|(_, amount)| *amount).sum();
let amount_to_stake: Uint128 = items.iter().map(|(_, amount)| *amount).sum();

ensure!(
non_staked_balance >= amount_to_stake,
Expand Down Expand Up @@ -607,7 +607,7 @@ fn execute_enable_tokenize_shares(

any_msgs.push(prepare_any_msg(
enable_tokenize_shares_msg,
"/cosmos.staking.v1beta1.MsgEnableTokenizeShares",
"/gaia.liquid.v1beta1.MsgEnableTokenizeShares",
)?);
let submsg = compose_submsg(
deps.branch(),
Expand Down Expand Up @@ -638,8 +638,9 @@ fn execute_disable_tokenize_shares(

any_msgs.push(prepare_any_msg(
disable_tokenize_shares_msg,
"/cosmos.staking.v1beta1.MsgDisableTokenizeShares",
"/gaia.liquid.v1beta1.MsgDisableTokenizeShares",
)?);

let submsg = compose_submsg(
deps.branch(),
config,
Expand Down Expand Up @@ -909,14 +910,14 @@ fn execute_redeem_shares(
let delegator = puppeteer_base.ica.get_address(deps.storage)?;
let any_msgs = items
.iter()
.map(|one| MsgRedeemTokensforShares {
.map(|one| MsgRedeemTokensForShares {
delegator_address: delegator.to_string(),
amount: Some(ProtoCoin {
denom: one.remote_denom.to_string(),
amount: one.amount.to_string(),
}),
})
.map(|msg| prepare_any_msg(msg, "/cosmos.staking.v1beta1.MsgRedeemTokensForShares"))
.map(|msg| prepare_any_msg(msg, "/gaia.liquid.v1beta1.MsgRedeemTokensForShares"))
.collect::<NeutronResult<Vec<ProtobufAny>>>()?;
let submsg = compose_submsg(
deps.branch(),
Expand Down
2 changes: 1 addition & 1 deletion contracts/puppeteer/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ fn test_execute_redeem_share() {
)
.unwrap();
let any_msg = neutron_sdk::bindings::types::ProtobufAny {
type_url: "/cosmos.staking.v1beta1.MsgRedeemTokensForShares".to_string(),
type_url: "/gaia.liquid.v1beta1.MsgRedeemTokensForShares".to_string(),
value: Binary::from(
drop_proto::proto::liquidstaking::staking::v1beta1::MsgRedeemTokensforShares {
amount: Some(drop_proto::proto::cosmos::base::v1beta1::Coin {
Expand Down
11 changes: 6 additions & 5 deletions integration_tests/dockerfiles/gaia/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM golang:1.22-alpine AS builder
FROM golang:1.23-alpine AS builder
WORKDIR /src/app/
ENV PACKAGES="curl make git libc-dev bash file gcc linux-headers eudev-dev"
ENV PACKAGES="curl build-base make git libc-dev bash file gcc linux-headers eudev-dev"
RUN apk add --no-cache $PACKAGES

ARG WASMVM_VERSION=v1.5.0
ARG WASMVM_VERSION=v2.2.3
ADD https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 2687afbdae1bc6c7c8b05ae20dfb8ffc7ddc5b4e056697d0f37853dfe294e913
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 465e3a088e96fd009a11bfd234c69fb8a0556967677e54511c084f815cf9ce63
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 6641730781bb1adc4bdf04a1e0f822b9ad4fb8ed57dcbbf575527e63b791ae41
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 32503fe35a7be202c5f7c3051497d6e4b3cd83079a61f5a0bf72a2a455b6d820
RUN cp "/lib/libwasmvm_muslc.$(uname -m).a" /lib/libwasmvm_muslc.a


COPY go.mod go.sum* ./
RUN go mod download

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/dockerfiles/gaia/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [[ "$CI" == "true" ]]; then
else
VERSION=":$VERSION"
fi
git clone https://github.com/cosmos/gaia.git -b v18.1.0
git clone https://github.com/cosmos/gaia.git -b v24.0.0-rc1
cp ./Dockerfile ./gaia

docker build gaia -t ${ORG}gaia-test${VERSION}
Expand Down
14 changes: 0 additions & 14 deletions integration_tests/dockerfiles/hermes/Dockerfile

This file was deleted.

29 changes: 29 additions & 0 deletions integration_tests/dockerfiles/hermes/Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ubuntu:20.04
ARG HERMES_VERSION=v1.12.0
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app

RUN apt-get update && apt-get install -y wget ca-certificates && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && \
ARCH=$(uname -m) && \
case "$ARCH" in \
x86_64) PLATFORM="x86_64" ;; \
aarch64) PLATFORM="aarch64" ;; \
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
esac && \
TARNAME="hermes-${HERMES_VERSION}-${PLATFORM}-unknown-linux-gnu.tar.gz" && \
wget "https://github.com/informalsystems/hermes/releases/download/${HERMES_VERSION}/${TARNAME}" && \
tar -xf "$TARNAME" && \
# определить имя файла
if [ -f "hermes" ]; then \
mv hermes /bin/hermes ; \
elif [ -f "hermes-${HERMES_VERSION}-${PLATFORM}-unknown-linux-gnu" ]; then \
mv "hermes-${HERMES_VERSION}-${PLATFORM}-unknown-linux-gnu" /bin/hermes ; \
else \
echo "Hermes binary not found after extraction!" && exit 1 ; \
fi && \
chmod +x /bin/hermes && \
rm -rf "$TARNAME"

ENTRYPOINT ["hermes", "start"]
29 changes: 29 additions & 0 deletions integration_tests/dockerfiles/hermes/Dockerfile.x86_64
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ubuntu:24.04
ARG HERMES_VERSION=v1.12.0
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app

RUN apt-get update && apt-get install -y wget ca-certificates && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && \
ARCH=$(uname -m) && \
case "$ARCH" in \
x86_64) PLATFORM="x86_64" ;; \
aarch64) PLATFORM="aarch64" ;; \
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
esac && \
TARNAME="hermes-${HERMES_VERSION}-${PLATFORM}-unknown-linux-gnu.tar.gz" && \
wget "https://github.com/informalsystems/hermes/releases/download/${HERMES_VERSION}/${TARNAME}" && \
tar -xf "$TARNAME" && \
# определить имя файла
if [ -f "hermes" ]; then \
mv hermes /bin/hermes ; \
elif [ -f "hermes-${HERMES_VERSION}-${PLATFORM}-unknown-linux-gnu" ]; then \
mv "hermes-${HERMES_VERSION}-${PLATFORM}-unknown-linux-gnu" /bin/hermes ; \
else \
echo "Hermes binary not found after extraction!" && exit 1 ; \
fi && \
chmod +x /bin/hermes && \
rm -rf "$TARNAME"

ENTRYPOINT ["hermes", "start"]
10 changes: 9 additions & 1 deletion integration_tests/dockerfiles/hermes/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@ if [[ "$CI" == "true" ]]; then
else
VERSION=":$VERSION"
fi
docker build . -t ${ORG}hermes-test${VERSION}
ARCH=$(uname -m)

if [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then
DOCKERFILE="Dockerfile.aarch64"
else
DOCKERFILE="Dockerfile.x86_64"
fi
docker build -f $DOCKERFILE -t ${ORG}hermes-test${VERSION} .


Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
DIR="$(dirname $0)"
cd $DIR
git clone -b foxpy/low-submission-margin-period https://github.com/neutron-org/neutron-query-relayer
git clone -b feat/low-submission-margin-period-updated https://github.com/neutron-org/neutron-query-relayer
VERSION=$(cat ../../package.json | jq -r '.version')
if [[ "$CI" == "true" ]]; then
VERSION="_$VERSION"
Expand Down
6 changes: 3 additions & 3 deletions integration_tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drop-cosmos-integration-tests",
"version": "1.0.34",
"version": "1.0.41",
"main": "vitest",
"license": "MIT",
"scripts": {
Expand Down Expand Up @@ -41,9 +41,9 @@
"dependencies": {
"@cosmjs/amino": "^0.32.4",
"@cosmjs/cosmwasm-stargate": "^0.32.4",
"@cosmjs/encoding": "^0.32.4",
"@cosmjs/proto-signing": "^0.32.4",
"@cosmjs/stargate": "^0.32.4",
"@cosmjs/encoding": "^0.32.4",
"@cosmjs/tendermint-rpc": "^0.32.4",
"@initia/initia.js": "^0.2.16",
"@neutron-org/client-ts": "^1.4.0",
Expand All @@ -70,4 +70,4 @@
},
"description": "Drop on Cosmos integration test",
"repository": "git@github.com:hadronlabs-org/lionco-contracts.git"
}
}
5 changes: 3 additions & 2 deletions integration_tests/src/helpers/waitForPuppeteerICQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const waitForPuppeteerICQ = async (
puppeteerContractClient?:
| InstanceType<typeof DropPuppeteerClass>
| InstanceType<typeof DropPuppeteerInitiaClass>,
waitForSeconds: number = 60,
): Promise<void> => {
const puppeteerResponse = (
await coreContractClient.queryLastPuppeteerResponse()
Expand All @@ -40,7 +41,7 @@ export const waitForPuppeteerICQ = async (
})) as any;

return remoteHeight > controlHeight;
}, 50_000);
}, waitForSeconds * 1000);

const waitForDelegations = waitFor(async () => {
const { remote_height: remoteHeight } =
Expand All @@ -50,7 +51,7 @@ export const waitForPuppeteerICQ = async (
},
})) as any;
return remoteHeight > controlHeight;
}, 50_000);
}, waitForSeconds * 1000);

await Promise.all([waitForBalances, waitForDelegations]);
};
5 changes: 5 additions & 0 deletions integration_tests/src/testSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ const relayersConfig = {
image: `${ORG}neutron-query-relayer-test${VERSION}`,
log_level: 'debug',
type: 'neutron',
environment: {
RELAYER_NEUTRON_CHAIN_DENOM: 'untrn',
RELAYER_NEUTRON_CHAIN_MAX_GAS_PRICE: 1000,
RELAYER_NEUTRON_CHAIN_GAS_PRICE_MULTIPLIER: 1.1,
},
},
};

Expand Down
10 changes: 9 additions & 1 deletion integration_tests/src/testcases/auto-withdrawer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ describe('Auto withdrawer', () => {
gaia: {
genesis_opts: {
'app_state.staking.params.unbonding_time': `${UNBONDING_TIME}s`,
'app_state.staking.params.validator_bond_factor': '250000',
'app_state.staking.params.global_liquid_staking_cap': '1',
'app_state.staking.params.validator_liquid_staking_cap': '1',
},
},
},
Expand Down Expand Up @@ -1215,6 +1218,11 @@ describe('Auto withdrawer', () => {
puppeteerContractClient,
} = context;

await context.park.executeInNetwork(
'gaia',
`${context.park.config.networks['gaia'].binary} tx bank send demo1 ${context.icaAddress} 10000stake --keyring-backend=test --home=/opt --fees 10000stake -y`,
);

await waitForPuppeteerICQ(
gaiaClient,
coreContractClient,
Expand Down Expand Up @@ -1526,7 +1534,7 @@ describe('Auto withdrawer', () => {
'stake',
);
const newBalance = parseInt(res.amount);
expect(newBalance).toBeGreaterThan(balance);
expect(newBalance + 10000).toBeGreaterThan(balance);
});
it('wait for balance to update', async () => {
const { remote_height: currentHeight } =
Expand Down
8 changes: 8 additions & 0 deletions integration_tests/src/testcases/core-slashing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ describe('Core Slashing', () => {
gaia: {
genesis_opts: {
'app_state.staking.params.unbonding_time': `${UNBONDING_TIME}s`,
'app_state.staking.params.validator_bond_factor': '250000',
'app_state.staking.params.global_liquid_staking_cap': '1',
'app_state.staking.params.validator_liquid_staking_cap': '1',
},
},
},
Expand Down Expand Up @@ -1063,6 +1066,11 @@ describe('Core Slashing', () => {
puppeteerContractClient,
} = context;

await context.park.executeInNetwork(
'gaia',
`${context.park.config.networks['gaia'].binary} tx bank send demo1 ${context.icaAddress} 10000stake --keyring-backend=test --home=/opt --fees 10000stake -y`,
);

await waitForPuppeteerICQ(
gaiaClient,
coreContractClient,
Expand Down
18 changes: 13 additions & 5 deletions integration_tests/src/testcases/core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ describe('Core', () => {
gaia: {
genesis_opts: {
'app_state.staking.params.unbonding_time': `${UNBONDING_TIME}s`,
'app_state.staking.params.validator_bond_factor': '250000',
'app_state.staking.params.global_liquid_staking_cap': '1',
'app_state.staking.params.validator_liquid_staking_cap': '1',
},
},
},
Expand Down Expand Up @@ -231,7 +234,7 @@ describe('Core', () => {
});

afterAll(async () => {
await context.park.stop();
// await context.park.stop();
});

it('transfer tokens to neutron', async () => {
Expand Down Expand Up @@ -1166,7 +1169,7 @@ describe('Core', () => {
it('tokenize share on gaia side', async () => {
const res = await context.park.executeInNetwork(
'gaia',
`gaiad tx staking tokenize-share ${context.validatorAddress} 600000stake ${context.gaiaUserAddress} --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --gas-prices 0.025stake --output json`,
`gaiad tx liquid tokenize-share ${context.validatorAddress} 600000stake ${context.gaiaUserAddress} --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --gas-prices 0.025stake --output json`,
);
expect(res.exitCode).toBe(0);
const out = JSON.parse(res.out);
Expand Down Expand Up @@ -1745,6 +1748,11 @@ describe('Core', () => {
puppeteerContractClient,
} = context;

await context.park.executeInNetwork(
'gaia',
`${context.park.config.networks['gaia'].binary} tx bank send demo1 ${context.puppeteerIcaAddress} 10000stake --keyring-backend=test --home=/opt --fees 10000stake -y`,
);

await waitForPuppeteerICQ(
gaiaClient,
coreContractClient,
Expand Down Expand Up @@ -2420,7 +2428,7 @@ describe('Core', () => {
{
const res = await context.park.executeInNetwork(
'gaia',
`gaiad tx staking tokenize-share ${context.validatorAddress} 60000stake ${context.gaiaUserAddress} --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --gas-prices 0.025stake --output json`,
`gaiad tx liquid tokenize-share ${context.validatorAddress} 60000stake ${context.gaiaUserAddress} --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --gas-prices 0.025stake --output json`,
);
expect(res.exitCode).toBe(0);
const out = JSON.parse(res.out);
Expand All @@ -2442,7 +2450,7 @@ describe('Core', () => {
{
const res = await context.park.executeInNetwork(
'gaia',
`gaiad tx staking tokenize-share ${context.secondValidatorAddress} 60000stake ${context.gaiaUserAddress} --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --gas-prices 0.025stake --output json`,
`gaiad tx liquid tokenize-share ${context.secondValidatorAddress} 60000stake ${context.gaiaUserAddress} --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --gas-prices 0.025stake --output json`,
);
expect(res.exitCode).toBe(0);
const out = JSON.parse(res.out);
Expand Down Expand Up @@ -3464,7 +3472,7 @@ describe('Core', () => {
);
expect(balances).toEqual([
{
amount: '1000000',
amount: '1010000',
denom: context.park.config.networks.gaia.denom,
},
]);
Expand Down
Loading
Loading