Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
swelf19 committed Aug 30, 2024
2 parents c7f65c3 + 37d28b5 commit c67fcba
Show file tree
Hide file tree
Showing 11 changed files with 524 additions and 377 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"scripts": {
"test": "yarn test:parallel && yarn test:run_in_band",
"test:parallel": "vitest --run src/testcases/parallel --bail 1 --reporter=basic",
"test:run_in_band": "yarn test:feemarket && yarn test:globalfee && yarn test:interchaintx && yarn test:interchain_kv_query && yarn test:interchain_tx_query_plain && yarn test:tokenomics && yarn test:reserve && yarn test:ibc_hooks && yarn test:float && yarn test:parameters && yarn test:dex_stargate && yarn test:dex_bindings && yarn test:slinky && yarn test:chain_manager && yarn test:tokenfactory",
"test:run_in_band": "yarn test:feemarket && yarn test:globalfee && yarn test:interchaintx && yarn test:interchain_kv_query && yarn test:interchain_tx_query_plain && yarn test:tokenomics && yarn test:reserve && yarn test:ibc_hooks && yarn test:float && yarn test:parameters && yarn test:dex_grpc && yarn test:dex_bindings && yarn test:slinky && yarn test:chain_manager && yarn test:tokenfactory",
"test:ibc_transfer": "vitest --run src/testcases/parallel/ibc_transfer --bail 1",
"test:slinky": "vitest --run src/testcases/run_in_band/slinky --bail 1",
"test:stargate_queries": "vitest --run src/testcases/parallel/stargate_queries --bail 1",
"test:grpc_queries": "vitest --run src/testcases/parallel/grpc_queries --bail 1",
"test:interchaintx": "vitest --run src/testcases/run_in_band/interchaintx --bail 1",
"test:interchain_kv_query": "vitest --run src/testcases/run_in_band/interchain_kv_query --bail 1",
"test:interchain_tx_query_plain": "vitest --run src/testcases/run_in_band/interchain_tx_query_plain --bail 1",
Expand All @@ -26,7 +26,7 @@
"test:overrule": "vitest --run src/testcases/parallel/overrule --bail 1",
"test:voting_registry": "vitest --run src/testcases/parallel/voting_registry --bail 1",
"test:float": "NO_WAIT_CHANNEL1=1 NO_WAIT_HTTP2=1 NO_WAIT_CHANNEL2=1 NO_WAIT_DELAY=1 vitest --run src/testcases/run_in_band/float --bail 1",
"test:dex_stargate": "NO_WAIT_CHANNEL1=1 NO_WAIT_HTTP2=1 NO_WAIT_CHANNEL2=1 NO_WAIT_DELAY=1 vitest --run src/testcases/run_in_band/dex_stargate --bail 1",
"test:dex_grpc": "NO_WAIT_CHANNEL1=1 NO_WAIT_HTTP2=1 NO_WAIT_CHANNEL2=1 NO_WAIT_DELAY=1 vitest --run src/testcases/run_in_band/dex_grpc --bail 1",
"test:dex_bindings": "NO_WAIT_CHANNEL1=1 NO_WAIT_HTTP2=1 NO_WAIT_CHANNEL2=1 NO_WAIT_DELAY=1 vitest --run src/testcases/run_in_band/dex_bindings --bail 1",
"test:chain_manager": "vitest --run src/testcases/run_in_band/chain_manager --bail 1",
"test:feemarket": "NO_WAIT_CHANNEL1=1 NO_WAIT_HTTP2=1 NO_WAIT_CHANNEL2=1 NO_WAIT_DELAY=1 vitest --run src/testcases/run_in_band/feemarket --bail 1",
Expand Down
2 changes: 1 addition & 1 deletion setup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-neutron:
cd $(APP_DIR)/neutron && $(MAKE) build-docker-image

build-hermes:
@docker build -f dockerbuilds/Dockerfile.hermes -t hermes:1.6.0-1c1cf029 .
@docker build -f dockerbuilds/Dockerfile.hermes -t hermes:1.10.1 .

build-relayer:
cd $(APP_DIR)/neutron-query-relayer/ && make build-docker
Expand Down
2 changes: 1 addition & 1 deletion setup/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
- neutron-testing

hermes:
image: hermes:1.6.0-1c1cf029
image: hermes:1.10.1
depends_on:
- "neutron-node"
- "gaia-node"
Expand Down
26 changes: 22 additions & 4 deletions setup/dockerbuilds/Dockerfile.gaia
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
# syntax=docker/dockerfile:1

FROM golang:1.21-alpine AS builder
FROM golang:1.22-alpine AS builder
WORKDIR /src/app/
COPY --from=app go.mod go.sum* ./

RUN go mod download
COPY --from=app . .
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3

ENV PACKAGES="jq curl make git libc-dev bash file gcc linux-headers eudev-dev python3"
RUN apk add --no-cache $PACKAGES
RUN CGO_ENABLED=0 make install

# See https://github.com/CosmWasm/wasmvm/releases
ARG WASMVM_VERSION=v2.0.0
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 3b478b3e51d31e53ce9324a8895d2cd7278af5179b9a02ea55d8627958e42afa
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ca08bb7b73b49b483611d9755bb8455620bb8c0faf3014400908ed49bf3b19a5
RUN cp "/lib/libwasmvm_muslc.$(uname -m).a" /lib/libwasmvm_muslc.a

RUN go mod download

RUN LEDGER_ENABLED=true LINK_STATICALLY=true BUILD_TAGS=muslc make build
RUN echo "Ensuring binary is statically linked ..." \
&& file /src/app/build/gaiad | grep "statically linked"

FROM alpine:latest
WORKDIR /opt/node/
COPY --from=setup . setup/
ARG BINARY
COPY --from=builder /go/bin/${BINARY:-gaiad} /usr/local/bin/
COPY --from=builder /src/app/build/${BINARY:-gaiad} /usr/local/bin/

ENV PACKAGES="jq"
RUN apk add --no-cache $PACKAGES

EXPOSE 26656 26657 1317 9090
USER 0
Expand Down
2 changes: 1 addition & 1 deletion setup/dockerbuilds/Dockerfile.hermes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ COPY ./hermes/ /app/network/hermes/
WORKDIR /app
RUN apt-get update && apt-get install -y wget && \
PLATFORM=`uname -a | awk '{print $(NF-1)}'` && \
VERSION=v1.6.0 && \
VERSION=v1.10.1 && \
TARNAME="hermes-${VERSION}-${PLATFORM}-unknown-linux-gnu.tar.gz" && \
wget "https://github.com/informalsystems/hermes/releases/download/${VERSION}/${TARNAME}" && \
tar -xf "$TARNAME" && \
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const IBC_RELAYER_NEUTRON_ADDRESS =
export const CONTRACTS = {
IBC_TRANSFER: 'ibc_transfer.wasm',
MSG_RECEIVER: 'msg_receiver.wasm',
STARGATE_QUERIER: 'stargate_querier.wasm',
GRPC_QUERIER: 'grpc_querier.wasm',
INTERCHAIN_QUERIES: 'neutron_interchain_queries.wasm',
INTERCHAIN_TXS: 'neutron_interchain_txs.wasm',
REFLECT: 'reflect.wasm',
Expand Down Expand Up @@ -57,7 +57,7 @@ export const CONTRACTS = {
BEFORE_SEND_HOOK_TEST: 'before_send_hook_test.wasm',
// https://github.com/CosmWasm/cosmwasm/tree/main/contracts/floaty
FLOATY: '../contracts_thirdparty/floaty_2.0.wasm',
DEX_STARGATE: 'dex_stargate.wasm',
DEX_GRPC: 'dex_grpc.wasm',
DEX_DEV: 'dex.wasm',

// TGE liquidity migration related contracts with fixed versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { MsgCreateDenom } from '@neutron-org/neutronjs/osmosis/tokenfactory/v1be
import { COSMOS_DENOM, NEUTRON_DENOM } from '../../helpers/constants';
import config from '../../config.json';

describe('Neutron / Stargate Queries', () => {
describe('Neutron / Grpc Queries', () => {
let testState: LocalState;
let neutronClient: SigningNeutronClient;
let neutronWallet: Wallet;
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('Neutron / Stargate Queries', () => {
});

test('create denom, mint', async () => {
const denom = `teststargate`;
const denom = `testgrpc`;
const fee = {
gas: '500000',
amount: [{ denom: NEUTRON_DENOM, amount: '1250' }],
Expand Down Expand Up @@ -98,159 +98,154 @@ describe('Neutron / Stargate Queries', () => {
describe('Contract instantiation', () => {
test('instantiate', async () => {
contractAddress = await neutronClient.create(
CONTRACTS.STARGATE_QUERIER,
CONTRACTS.GRPC_QUERIER,
{},
'stargate_querier',
'grpc_querier',
);
});
});

// TODO: this function does not make much sense: remove it
async function querySmart(query: any): Promise<string> {
return await neutronClient.queryContractSmart(contractAddress, query);
}

describe('Stargate queries', () => {
describe('Grpc queries', () => {
test('bank balance should work', async () => {
const res = JSON.parse(
await querySmart({
bank_balance: {
address: neutronWallet.address,
denom: NEUTRON_DENOM,
},
}),
);
const res = await neutronClient.queryContractSmart(contractAddress, {
bank_balance: {
address: neutronWallet.address,
denom: NEUTRON_DENOM,
},
});
expect(res.balance.denom).toBe('untrn');
expect(+res.balance.amount).toBeGreaterThan(1000000);
});

test('bank denom metadata should work', async () => {
const res = JSON.parse(
await querySmart({
bank_denom_metadata: { denom: newTokenDenom },
}),
);
expect(res.metadatas[0].denom_units[0].denom).toBe(newTokenDenom);
const res = await neutronClient.queryContractSmart(contractAddress, {
bank_denom_metadata: {
denom: newTokenDenom,
},
});
expect(res.metadata.denom_units[0].denom).toBe(newTokenDenom);
});

test('bank params should work', async () => {
const res = JSON.parse(await querySmart({ bank_params: {} }));
const res = await neutronClient.queryContractSmart(contractAddress, {
bank_params: {},
});
expect(res.params.default_send_enabled).toBe(true);
});

test('bank supply of should work', async () => {
const res = JSON.parse(
await querySmart({
bank_supply_of: { denom: NEUTRON_DENOM },
}),
);
const res = await neutronClient.queryContractSmart(contractAddress, {
bank_supply_of: {
denom: NEUTRON_DENOM,
},
});
expect(res.amount.denom).toBe('untrn');
expect(+res.amount.amount).toBeGreaterThan(1000000);
});

test('auth account should work', async () => {
const res = JSON.parse(
await querySmart({
auth_account: {
address: neutronWallet.address,
},
}),
);
// response with the field of type `Any` is expected, but actual type is a different struct
test.skip('auth account should work', async () => {
const res = await neutronClient.queryContractSmart(contractAddress, {
auth_account: {
address: neutronWallet.address,
},
});
expect(res.account.address).toBe(neutronWallet.address);
});

test('transfer denom trace should work', async () => {
const res = JSON.parse(
await querySmart({
transfer_denom_trace: {
hash: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2',
},
}),
);
const res = await neutronClient.queryContractSmart(contractAddress, {
transfer_denom_trace: {
hash: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2',
},
});
expect(res.denom_trace.path).toBe('transfer/channel-0');
expect(res.denom_trace.base_denom).toBe('uatom');
});

test('ibc client state should work', async () => {
const res = JSON.parse(
await querySmart({
ibc_client_state: {
client_id: '07-tendermint-1',
},
}),
);
// response with the field of type `Any` is expected, but actual type is a different struct
test.skip('ibc client state should work', async () => {
const res = await neutronClient.queryContractSmart(contractAddress, {
ibc_client_state: {
client_id: '07-tendermint-1',
},
});
expect(res.client_state['@type']).toBe(
'/ibc.lightclients.tendermint.v1.ClientState',
);
expect(res.client_state.chain_id).toBe('test-2');
});

test('ibc consensus state should work', async () => {
const res = JSON.parse(
await querySmart({
ibc_consensus_state: {
client_id: '07-tendermint-1',
revision_number: 0,
revision_height: 0,
latest_height: true,
},
}),
);
// response with the field of type `Any` is expected, but actual type is a different struct
test.skip('ibc consensus state should work', async () => {
const res = await neutronClient.queryContractSmart(contractAddress, {
ibc_consensus_state: {
client_id: '07-tendermint-1',
revision_number: 0,
revision_height: 0,
latest_height: true,
},
});
expect(res.consensus_state['@type']).toBe(
'/ibc.lightclients.tendermint.v1.ConsensusState',
);
expect(+res.proof_height.revision_height).toBeGreaterThan(0);
});

test('ibc connection should work', async () => {
const res = JSON.parse(
await querySmart({
ibc_connection: {
connection_id: 'connection-0',
},
}),
);
const res = await neutronClient.queryContractSmart(contractAddress, {
ibc_connection: {
connection_id: 'connection-0',
},
});
expect(res.connection.client_id).toBe('07-tendermint-1');
expect(+res.proof_height.revision_height).toBeGreaterThan(0);
});

test('tokenfactory params should work', async () => {
const res = JSON.parse(await querySmart({ tokenfactory_params: {} }));
const res = await neutronClient.queryContractSmart(contractAddress, {
tokenfactory_params: {},
});
expect(res.params.denom_creation_gas_consume).toBe('0');
});

test('tokenfactory denom authority metadata should work', async () => {
const res = await querySmart({
const res = await neutronClient.queryContractSmart(contractAddress, {
tokenfactory_denom_authority_metadata: {
denom: newTokenDenom,
creator: neutronWallet.address,
subdenom: newTokenDenom,
},
});
expect(res).toBe(`{"authority_metadata":{"Admin":""}}`);
expect(res.authority_metadata.admin).toBe('');
});

test('denoms from creator should work', async () => {
const res = await querySmart({
test('tokenfactory denoms from creator should work', async () => {
const res = await neutronClient.queryContractSmart(contractAddress, {
tokenfactory_denoms_from_creator: {
creator: neutronWallet.address,
},
});
expect(res).toBe(`{"denoms":["${newTokenDenom}"]}`);
expect(res.denoms[0]).toBe(newTokenDenom);
});

test('interchaintx params should work', async () => {
const res = JSON.parse(await querySmart({ interchaintx_params: {} }));
test('interchaintxs params should work', async () => {
const res = await neutronClient.queryContractSmart(contractAddress, {
interchaintxs_params: {},
});
expect(+res.params.msg_submit_tx_max_messages).toBeGreaterThan(0);
});

test('interchainqueries params should work', async () => {
const res = JSON.parse(
await querySmart({ interchainqueries_params: {} }),
);
const res = await neutronClient.queryContractSmart(contractAddress, {
interchainqueries_params: {},
});
expect(+res.params.query_submit_timeout).toBeGreaterThan(0);
});

test('feeburner params should work', async () => {
const res = JSON.parse(await querySmart({ feeburner_params: {} }));
const res = await neutronClient.queryContractSmart(contractAddress, {
feeburner_params: {},
});
expect(res.params.neutron_denom).toBe('untrn');
});
});
Expand Down
Loading

0 comments on commit c67fcba

Please sign in to comment.