Skip to content

Commit

Permalink
Reduce the consistency level of attest token
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbqds committed Aug 29, 2023
1 parent 14dcc6a commit e69052f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions bridge_ui/src/components/Attest/Send.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CHAIN_ID_SOLANA, CHAIN_ID_TERRA } from "@alephium/wormhole-sdk";
import { CHAIN_ID_ALEPHIUM, CHAIN_ID_SOLANA, CHAIN_ID_TERRA } from "@alephium/wormhole-sdk";
import { Alert } from "@material-ui/lab";
import { Link, makeStyles } from "@material-ui/core";
import { useMemo } from "react";
Expand All @@ -16,7 +16,7 @@ import ButtonWithLoader from "../ButtonWithLoader";
import KeyAndBalance from "../KeyAndBalance";
import TransactionProgress from "../TransactionProgress";
import WaitingForWalletMessage from "./WaitingForWalletMessage";
import { SOLANA_TOKEN_METADATA_PROGRAM_URL } from "../../utils/consts";
import { ALEPHIUM_ATTEST_TOKEN_CONSISTENCY_LEVEL, SOLANA_TOKEN_METADATA_PROGRAM_URL } from "../../utils/consts";
import TerraFeeDenomPicker from "../TerraFeeDenomPicker";

const useStyles = makeStyles((theme) => ({
Expand Down Expand Up @@ -80,6 +80,7 @@ function Send() {
chainId={sourceChain}
tx={attestTx}
isSendComplete={isSendComplete}
consistencyLevel={sourceChain === CHAIN_ID_ALEPHIUM ? ALEPHIUM_ATTEST_TOKEN_CONSISTENCY_LEVEL : undefined}
/>
</>
);
Expand Down
7 changes: 5 additions & 2 deletions bridge_ui/src/components/TransactionProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ export default function TransactionProgress({
chainId,
tx,
isSendComplete,
consistencyLevel
}: {
chainId: ChainId;
tx: Transaction | undefined;
isSendComplete: boolean;
consistencyLevel?: number
}) {
const classes = useStyles();
const { provider } = useEthereumProvider();
Expand Down Expand Up @@ -128,7 +130,8 @@ export default function TransactionProgress({
} else {
const blockDiff =
tx && tx.block && currentBlock ? currentBlock - tx.block : undefined;
const expectedBlocks = // minimum confirmations enforced by guardians or specified by the contract
// minimum confirmations enforced by guardians or specified by the contract
const expectedBlocks = consistencyLevel ?? (
chainId === CHAIN_ID_POLYGON
? CLUSTER === "testnet"
? 64
Expand All @@ -147,7 +150,7 @@ export default function TransactionProgress({
? DefaultEVMChainConfirmations
: chainId === CHAIN_ID_ALEPHIUM
? ALEPHIUM_MINIMAL_CONSISTENCY_LEVEL
: 1;
: 1);
if (
!isSendComplete &&
(chainId === CHAIN_ID_SOLANA || isEVMChain(chainId) || chainId === CHAIN_ID_ALEPHIUM) &&
Expand Down
4 changes: 2 additions & 2 deletions bridge_ui/src/hooks/useHandleAttest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import {
import { getAndCheckLocalTokenInfo, isValidAlephiumTokenId, waitTxConfirmedAndGetTxInfo } from "../utils/alephium";
import { signSendAndConfirmAlgorand } from "../utils/algorand";
import {
ALEPHIUM_MINIMAL_CONSISTENCY_LEVEL,
ALEPHIUM_ATTEST_TOKEN_CONSISTENCY_LEVEL,
ALEPHIUM_TOKEN_BRIDGE_CONTRACT_ID,
ALEPHIUM_MESSAGE_FEE,
ALGORAND_BRIDGE_ID,
Expand Down Expand Up @@ -319,7 +319,7 @@ async function alephium(
tokenInfo.name,
wallet.account.address,
ALEPHIUM_MESSAGE_FEE,
ALEPHIUM_MINIMAL_CONSISTENCY_LEVEL
ALEPHIUM_ATTEST_TOKEN_CONSISTENCY_LEVEL
)
dispatch(setIsWalletApproved(true))
const txInfo = await waitTxConfirmedAndGetTxInfo(wallet.nodeProvider, result.txId);
Expand Down
1 change: 1 addition & 0 deletions bridge_ui/src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ export const ALEPHIUM_MINIMAL_CONSISTENCY_LEVEL =
: CLUSTER === "testnet"
? TESTNET_ALPH_MINIMAL_CONSISTENCY_LEVEL
: DEVNET_ALPH_MINIMAL_CONSISTENCY_LEVEL;
export const ALEPHIUM_ATTEST_TOKEN_CONSISTENCY_LEVEL = 10
export const ALEPHIUM_NETWORK_ID =
CLUSTER === "mainnet"
? alephiumMainnetConfig.networkId
Expand Down

0 comments on commit e69052f

Please sign in to comment.