Skip to content

Commit

Permalink
Fixing dump dependencies. (#298)
Browse files Browse the repository at this point in the history
* Fixing dump dependencies

* verifying profile

* Fixing test delay
  • Loading branch information
hbulgarini authored Oct 30, 2021
1 parent 483d7e6 commit aa15668
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions e2e/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ describe('<App />', () => {
await page
.waitForSelector(`#test-step-message-dispatch-confirmation > ${ids.checkCircleComponent}`)
.then(() => logger.info(' -- Step 5 "Message dispatch confirmation" completed'));
await page.waitForTimeout(15000);
await page
.waitForSelector(`#test-step-finalized-message > ${ids.checkCircleComponent}`)
.then(() => logger.info(' -- Step 6 "Finalize message" completed'));
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ export const TIMER_DURATION = 30000;

export const MESSAGE_DISPATCH_EVENT = 'MessageDispatched';
export const MESSAGE_NONCE_TYPE = 'MessageNonce';
export const OK = 'OK';
export const OK = 'Ok';
export const TX_CANCELLED = 'Cancelled';
6 changes: 3 additions & 3 deletions src/hooks/subscriptions/useMessagesLane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const useMessagesLane = ({ isApiReady, api, chain }: SubscriptionInput): Output
const getOutboundLaneData = useCallback(
() =>
api.query[bridgedMessages].outboundLanes(laneId, (res: any) => {
const latest_generated_nonce = res.get('latest_generated_nonce').toString();
const latest_received_nonce = res.get('latest_received_nonce').toString();
const latest_generated_nonce = res.get('latestGeneratedNonce').toString();
const latest_received_nonce = res.get('latestReceivedNonce').toString();
const pendingMessages = new BN(latest_generated_nonce).sub(new BN(latest_received_nonce));

setOutboudLanes({
Expand All @@ -64,7 +64,7 @@ const useMessagesLane = ({ isApiReady, api, chain }: SubscriptionInput): Output
const getInboundLaneData = useCallback(
() =>
api.query[bridgedMessages].inboundLanes(laneId, (res: any) => {
setBridgesReceivedMessages(res.get('last_confirmed_nonce').toString());
setBridgesReceivedMessages(res.get('lastConfirmedNonce').toString());
}),
[api.query, bridgedMessages, laneId, setBridgesReceivedMessages]
);
Expand Down
6 changes: 4 additions & 2 deletions src/util/transactions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
Step
} from '../../types/transactionTypes';
import shortenItem from '../shortenItem';
import has from 'lodash/has';
import { Subscriptions } from '../../types/subscriptionsTypes';
import { encodeAddress } from '@polkadot/util-crypto';
import { SourceTargetState } from '../../types/sourceTargetTypes';
Expand Down Expand Up @@ -188,7 +189,7 @@ interface InputTransactionUpdates {

function deepFind(data: any[], value: string) {
function iter(subData: any) {
if (value === OK ? subData.toJSON().ok : subData.toString() === value) {
if (value === OK ? has(subData.toJSON(), 'ok') : subData.toString() === value) {
result = subData;
return true;
}
Expand Down Expand Up @@ -297,7 +298,8 @@ export const handleTransactionUpdates = async ({
const messageFinalizedOnTarget = stepEvaluator(transaction.messageNonce, nonceOfFinalTargetBlock);

// 5. Once the source chain is confirms through the latestReceivedNonceOnSource, that target chain is aware about the message nonce, the transaction is completed.
const sourceConfirmationReceived = stepEvaluator(transaction.messageNonce, latestReceivedNonceOnSource);
const sourceConfirmationReceived =
stepEvaluator(transaction.messageNonce, latestReceivedNonceOnSource) && messageFinalizedOnTarget;
const onChainCompleted = (value: boolean) => completionStatus(value) === TransactionStatusEnum.COMPLETED;

// 4.1 * We catch the best block on target related to the message delivery.
Expand Down

0 comments on commit aa15668

Please sign in to comment.