From 21581b3c01058327b9566fb5961ce4dfdaaf51f7 Mon Sep 17 00:00:00 2001 From: Kirill Fedoseev Date: Mon, 7 Dec 2020 23:12:30 +0300 Subject: [PATCH] Change message status when signatures are manually submitted (#497) --- alm/src/components/ConfirmationsContainer.tsx | 4 +++- alm/src/components/ExecutionConfirmation.tsx | 5 ++++- alm/src/components/ManualExecutionButton.tsx | 12 ++++++++---- alm/src/config/descriptions.ts | 4 ++-- alm/src/hooks/useMessageConfirmations.ts | 3 ++- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/alm/src/components/ConfirmationsContainer.tsx b/alm/src/components/ConfirmationsContainer.tsx index 981d62ef..b8d98efd 100644 --- a/alm/src/components/ConfirmationsContainer.tsx +++ b/alm/src/components/ConfirmationsContainer.tsx @@ -55,7 +55,8 @@ export const ConfirmationsContainer = ({ message, receipt, fromHome, timestamp } signatureCollected, waitingBlocksResolved, setExecutionData, - executionEventsFetched + executionEventsFetched, + setPendingExecution } = useMessageConfirmations({ message, receipt, @@ -117,6 +118,7 @@ export const ConfirmationsContainer = ({ message, receipt, fromHome, timestamp } requiredSignatures={requiredSignatures} setExecutionData={setExecutionData} executionEventsFetched={executionEventsFetched} + setPendingExecution={setPendingExecution} /> )} diff --git a/alm/src/components/ExecutionConfirmation.tsx b/alm/src/components/ExecutionConfirmation.tsx index 445b98b8..f36f6c57 100644 --- a/alm/src/components/ExecutionConfirmation.tsx +++ b/alm/src/components/ExecutionConfirmation.tsx @@ -21,6 +21,7 @@ export interface ExecutionConfirmationParams { requiredSignatures: number isHome: boolean executionEventsFetched: boolean + setPendingExecution: Function } export const ExecutionConfirmation = ({ @@ -29,7 +30,8 @@ export const ExecutionConfirmation = ({ setExecutionData, requiredSignatures, isHome, - executionEventsFetched + executionEventsFetched, + setPendingExecution }: ExecutionConfirmationParams) => { const availableManualExecution = !isHome && @@ -104,6 +106,7 @@ export const ExecutionConfirmation = ({ messageData={messageData} setExecutionData={setExecutionData} requiredSignatures={requiredSignatures} + setPendingExecution={setPendingExecution} /> )} diff --git a/alm/src/components/ManualExecutionButton.tsx b/alm/src/components/ManualExecutionButton.tsx index d8ca224e..3c56acdc 100644 --- a/alm/src/components/ManualExecutionButton.tsx +++ b/alm/src/components/ManualExecutionButton.tsx @@ -19,12 +19,14 @@ interface ManualExecutionButtonParams { messageData: string setExecutionData: Function requiredSignatures: number + setPendingExecution: Function } export const ManualExecutionButton = ({ messageData, setExecutionData, - requiredSignatures + requiredSignatures, + setPendingExecution }: ManualExecutionButtonParams) => { const { home, foreign, setError } = useStateProvider() const { library, activate, account, active } = useWeb3React() @@ -73,7 +75,7 @@ export const ManualExecutionButton = ({ to: foreign.bridgeAddress, data }) - .on('transactionHash', (txHash: string) => + .on('transactionHash', (txHash: string) => { setExecutionData({ status: VALIDATOR_CONFIRMATION_STATUS.PENDING, validator: account, @@ -81,7 +83,8 @@ export const ManualExecutionButton = ({ timestamp: Math.floor(new Date().getTime() / 1000.0), executionResult: false }) - ) + setPendingExecution(true) + }) .on('error', (e: Error) => setError(e.message)) }, [ @@ -96,7 +99,8 @@ export const ManualExecutionButton = ({ setError, messageData, home.confirmations, - setExecutionData + setExecutionData, + setPendingExecution ] ) diff --git a/alm/src/config/descriptions.ts b/alm/src/config/descriptions.ts index 75107e6f..f7bf3cc7 100644 --- a/alm/src/config/descriptions.ts +++ b/alm/src/config/descriptions.ts @@ -57,9 +57,9 @@ export const CONFIRMATIONS_STATUS_DESCRIPTION_HOME: { [key: string]: string } = SUCCESS_MESSAGE_FAILED: 'The specified transaction was included in a block,\nthe validators collected signatures and the cross-chain relay was executed correctly,\nbut the contained message execution failed.\nContact the support of the application you used to produce the transaction for the clarifications.', EXECUTION_FAILED: - 'The specified transaction was included in a block\nand the validators collected signatures. The\nvalidator’s transaction with collected signatures was\nsent but did not succeed. Contact to the validators by messaging\non %linkhttps://forum.poa.network/c/support', + 'The specified transaction was included in a block\nand the validators collected signatures. The\n transaction with collected signatures was\nsent but did not succeed. Contact to the validators by messaging\non %linkhttps://forum.poa.network/c/support', EXECUTION_PENDING: - 'The specified transaction was included in a block\nand the validators collected signatures. The\nvalidator’s transaction with collected signatures was\nsent but is not yet added to a block.', + 'The specified transaction was included in a block\nand the validators collected signatures. The\n transaction with collected signatures was\nsent but is not yet added to a block.', EXECUTION_WAITING: ALM_HOME_TO_FOREIGN_MANUAL_EXECUTION ? 'The specified transaction was included in a block\nand the validators collected signatures.\nNow the manual user action is required to complete message execution.\n Please, press the "Execute" button.' : 'The specified transaction was included in a block\nand the validators collected signatures. Either\n1. One of the validators is waiting for chain finalization.\n2. A validator skipped its duty to relay signatures.\n3. The execution transaction is still pending (e.g. due to the gas price spike).\nCheck status again after a few blocks or force execution by pressing the "Execute" button.\nIf the issue still persists contact to the validators by messaging on %linkhttps://forum.poa.network/c/support', diff --git a/alm/src/hooks/useMessageConfirmations.ts b/alm/src/hooks/useMessageConfirmations.ts index 6fdf4734..7d51850d 100644 --- a/alm/src/hooks/useMessageConfirmations.ts +++ b/alm/src/hooks/useMessageConfirmations.ts @@ -371,6 +371,7 @@ export const useMessageConfirmations = ({ executionData, setExecutionData, waitingBlocksResolved, - executionEventsFetched + executionEventsFetched, + setPendingExecution } }