Skip to content

Commit

Permalink
Merge branch 'stage' into mattupham/fe-726-porfolio-v3-alloyed-conver…
Browse files Browse the repository at this point in the history
…t-button-deposit-withdraw-dropdown
  • Loading branch information
mattupham committed Sep 20, 2024
2 parents c01ae45 + 62531de commit 05faa68
Show file tree
Hide file tree
Showing 136 changed files with 3,622 additions and 1,215 deletions.
70 changes: 1 addition & 69 deletions .github/workflows/monitoring-claim-orders .yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Technical job to claim orders created by monitoring
on:
workflow_dispatch:
schedule:
- cron: "*/45 * * * *"
- cron: "19 * * * *"

jobs:
fe-claim1-tests:
Expand Down Expand Up @@ -40,40 +40,6 @@ jobs:
with:
name: claim1-test-results
path: packages/web/playwright-report
- name: Send Slack alert if test fails
id: slack
if: failure()
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🚨 Claim Tests Failure Alert 🚨"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Production App URL:* https://app.osmosis.zone"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Click here to view the run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|GitHub Actions Run>"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SERVER_E2E_TESTS_SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

fe-claim2-tests:
timeout-minutes: 10
Expand Down Expand Up @@ -109,40 +75,6 @@ jobs:
with:
name: claim2-test-results
path: packages/web/playwright-report
- name: Send Slack alert if test fails
id: slack
if: failure()
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🚨 Claim Tests Failure Alert 🚨"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Production App URL:* https://app.osmosis.zone"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Click here to view the run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|GitHub Actions Run>"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SERVER_E2E_TESTS_SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

delete-deployments:
runs-on: ubuntu-latest
Expand Down
23 changes: 19 additions & 4 deletions packages/bridge/src/skip/__tests__/skip-transfer-status.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { rest } from "msw";
import { MockChains } from "../../__tests__/mock-chains";
import { server } from "../../__tests__/msw";
import { BridgeEnvironment, TransferStatusReceiver } from "../../interface";
import { SkipTransferStatusProvider } from "../transfer-status";
import { SkipApiClient } from "../client";
import {
SkipStatusProvider,
SkipTransferStatusProvider,
} from "../transfer-status";

jest.mock("@osmosis-labs/utils", () => ({
...jest.requireActual("@osmosis-labs/utils"),
Expand All @@ -19,6 +23,14 @@ jest.mock("@osmosis-labs/utils", () => ({
}),
}));

const SkipStatusProvider: SkipStatusProvider = {
transactionStatus: ({ chainID, txHash, env }) => {
const client = new SkipApiClient(env);
return client.transactionStatus({ chainID, txHash });
},
trackTransaction: () => Promise.resolve(),
};

// silence console errors
jest.spyOn(console, "error").mockImplementation(() => {});

Expand All @@ -31,7 +43,8 @@ describe("SkipTransferStatusProvider", () => {
beforeEach(() => {
provider = new SkipTransferStatusProvider(
"mainnet" as BridgeEnvironment,
MockChains
MockChains,
SkipStatusProvider
);
provider.statusReceiverDelegate = mockReceiver;
});
Expand Down Expand Up @@ -108,7 +121,8 @@ describe("SkipTransferStatusProvider", () => {
it("should generate correct explorer URL for testnet", () => {
const testnetProvider = new SkipTransferStatusProvider(
"testnet" as BridgeEnvironment,
MockChains
MockChains,
SkipStatusProvider
);
const url = testnetProvider.makeExplorerUrl(
JSON.stringify({
Expand All @@ -123,7 +137,8 @@ describe("SkipTransferStatusProvider", () => {
it("should generate correct explorer URL for a cosmos chain", () => {
const cosmosProvider = new SkipTransferStatusProvider(
"mainnet" as BridgeEnvironment,
MockChains
MockChains,
SkipStatusProvider
);
const url = cosmosProvider.makeExplorerUrl(
JSON.stringify({
Expand Down
3 changes: 2 additions & 1 deletion packages/bridge/src/skip/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
export class SkipApiClient {
constructor(
readonly env: BridgeEnvironment,
protected readonly apiKey = process.env.SKIP_API_KEY,
readonly baseUrl = "https://api.skip.money"
) {}

Expand Down Expand Up @@ -122,7 +123,7 @@ export class SkipApiClient {
return apiClient<Response>(args[0], args[1]);
}

const key = process.env.SKIP_API_KEY;
const key = this.apiKey;
if (!key) throw new Error("SKIP_API_KEY is not set");

return apiClient<Response>(args[0], {
Expand Down
1 change: 1 addition & 0 deletions packages/bridge/src/skip/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,4 +936,5 @@ export class SkipBridgeProvider implements BridgeProvider {
}
}

export * from "./client";
export * from "./transfer-status";
83 changes: 49 additions & 34 deletions packages/bridge/src/skip/transfer-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,23 @@ import type {
TransferStatusProvider,
TransferStatusReceiver,
} from "../interface";
import { SkipApiClient } from "./client";
import { SkipBridgeProvider } from "./index";
import { SkipTxStatusResponse } from "./types";

type Transaction = {
chainID: string;
txHash: string;
env: BridgeEnvironment;
};

export interface SkipStatusProvider {
transactionStatus: ({
chainID,
txHash,
env,
}: Transaction) => Promise<SkipTxStatusResponse>;
trackTransaction: ({ chainID, txHash, env }: Transaction) => Promise<void>;
}

/** Tracks (polls skip endpoint) and reports status updates on Skip bridge transfers. */
export class SkipTransferStatusProvider implements TransferStatusProvider {
Expand All @@ -19,12 +34,13 @@ export class SkipTransferStatusProvider implements TransferStatusProvider {

statusReceiverDelegate?: TransferStatusReceiver | undefined;

readonly skipClient: SkipApiClient;
readonly axelarScanBaseUrl: string;

constructor(env: BridgeEnvironment, protected readonly chainList: Chain[]) {
this.skipClient = new SkipApiClient(env);

constructor(
protected readonly env: BridgeEnvironment,
protected readonly chainList: Chain[],
protected readonly skipStatusProvider: SkipStatusProvider
) {
this.axelarScanBaseUrl =
env === "mainnet"
? "https://axelarscan.io"
Expand All @@ -40,39 +56,38 @@ export class SkipTransferStatusProvider implements TransferStatusProvider {

await poll({
fn: async () => {
try {
const txStatus = await this.skipClient.transactionStatus({
chainID: fromChainId.toString(),
txHash: sendTxHash,
const tx = {
chainID: fromChainId.toString(),
txHash: sendTxHash,
env: this.env,
};

const txStatus = await this.skipStatusProvider
.transactionStatus(tx)
.catch(async (error) => {
if (error instanceof Error && error.message.includes("not found")) {
// if we get an error that it's not found, prompt skip to track it first
// then try again
await this.skipStatusProvider.trackTransaction(tx);
return this.skipStatusProvider.transactionStatus(tx);
}

throw error;
});

let status: TransferStatus = "pending";
if (txStatus.state === "STATE_COMPLETED_SUCCESS") {
status = "success";
}

if (txStatus.state === "STATE_COMPLETED_ERROR") {
status = "failed";
}

return {
id: sendTxHash,
status,
};
} catch (error: any) {
if ("message" in error) {
if (error.message.includes("not found")) {
await this.skipClient.trackTransaction({
chainID: fromChainId.toString(),
txHash: sendTxHash,
});

return undefined;
}
}
let status: TransferStatus = "pending";
if (txStatus.state === "STATE_COMPLETED_SUCCESS") {
status = "success";
}

throw error;
if (txStatus.state === "STATE_COMPLETED_ERROR") {
status = "failed";
}

return {
id: sendTxHash,
status,
};
},
validate: (incomingStatus) => {
if (!incomingStatus) {
Expand Down
2 changes: 1 addition & 1 deletion packages/proto-codecs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"devDependencies": {
"@cosmology/proto-parser": "^1.5.0",
"@cosmology/telescope": "^1.5.1",
"@cosmology/telescope": "^1.8.4",
"@types/node": "^20.14.1",
"regenerator-runtime": "^0.13.11",
"rimraf": "^5.0.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/proto-codecs/scripts/generated/package-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type AvailablePackages =
| "osmosis.gamm.poolmodels.balancer.v1beta1"
| "ibc.applications.interchain_accounts.v1"
| "osmosis.concentratedliquidity.v1beta1"
| "osmosis.cosmwasmpool.v1beta1.model.v3"
| "osmosis.downtimedetector.v1beta1"
| "ibc.lightclients.solomachine.v2"
| "ibc.lightclients.solomachine.v3"
Expand All @@ -32,6 +33,7 @@ export type AvailablePackages =
| "osmosis.valsetpref.v1beta1"
| "cosmos.base.query.v1beta1"
| "cosmos.base.store.v1beta1"
| "ibc.lightclients.wasm.v1"
| "osmosis.protorev.v1beta1"
| "cosmos.base.abci.v1beta1"
| "ibc.applications.fee.v1"
Expand Down Expand Up @@ -66,6 +68,7 @@ export type AvailablePackages =
| "tendermint.abci"
| "osmosis.lockup"
| "tendermint.p2p"
| "capability.v1"
| "cosmos.msg.v1"
| "cosmos_proto"
| "google.api"
Expand Down
11 changes: 8 additions & 3 deletions packages/proto-codecs/scripts/get-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GREEN='\033[0;32m' # Green color
NC='\033[0m' # No Color

PROTO_DIR="./chain-proto"
OSMOSIS_COMMIT_HASH="b07e6725f7d97b3321c8165fc1d95a9ab6fa963b"
OSMOSIS_COMMIT_HASH="dd6442421a5643d8702200d6a46a6178160a8c76"

ICS23_COMMIT_HASH="f4deb054b697458e7f0aa353c2f45a365361e895"

Expand All @@ -26,9 +26,13 @@ git -C .repos/osmosis checkout $OSMOSIS_COMMIT_HASH


# SDK PROTOS
COSMOS_SDK_VERSION=$(awk -F '=>' '/github.com\/osmosis-labs\/cosmos-sdk/ {print $2}' .repos/osmosis/go.mod | awk '{print $NF}' | tr -d '\n')
# COSMOS_SDK_VERSION=$(awk '/github.com\/cosmos\/cosmos-sdk/ {print $2}' .repos/osmosis/go.mod | tr -d '=> ')
# COSMOS_SDK_VERSION=$(awk -F '=>' '/github.com\/osmosis-labs\/cosmos-sdk/ {print $2}' .repos/osmosis/go.mod | awk '{print $NF}' | tr -d '\n')
COSMOS_SDK_VERSION=v0.50.6-v26-osmo-2

echo -e "${GREEN}COSMOS_SDK_VERSION: $COSMOS_SDK_VERSION${NC}"

# git clone --filter=blob:none --sparse https://github.com/cosmos/cosmos-sdk.git .repos/cosmos-sdk
git clone --filter=blob:none --sparse https://github.com/osmosis-labs/cosmos-sdk.git .repos/cosmos-sdk

# Checkout to Cosmos hash commit
Expand All @@ -52,7 +56,8 @@ git -C .repos/ibc-go checkout $IBC_GO_VERSION
# WASMD PROTOS

# Extract the Wasmd version from the go.mod file
WASMD_VERSION=$(awk '/github.com\/osmosis-labs\/wasmd/ {print $4}' .repos/osmosis/go.mod | awk '{print $NF}' | tr -d '\n')
# WASMD_VERSION=$(awk '/github.com\/osmosis-labs\/wasmd/ {print $4}' .repos/osmosis/go.mod | awk '{print $NF}' | tr -d '\n')
WASMD_VERSION=de7db0dc672e7beb201e06e7eb12b2de356ac7c9
echo -e "${GREEN}WASMD_VERSION: $WASMD_VERSION${NC}"

# TROUBLESHOOTING
Expand Down
4 changes: 2 additions & 2 deletions packages/proto-codecs/src/codegen/binary.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//@ts-nocheck
/**
* This file and any referenced files were automatically generated by @cosmology/telescope@1.5.1
* This file and any referenced files were automatically generated by @cosmology/telescope@1.8.4
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or yarn proto command to regenerate this bundle.
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/

// Copyright (c) 2016, Daniel Wirtz All rights reserved.
Expand Down
Loading

0 comments on commit 05faa68

Please sign in to comment.