Change message status when signatures are manually submitted (#497)

This commit is contained in:
Kirill Fedoseev 2020-12-07 23:12:30 +03:00 committed by GitHub
parent bbc68f9fa2
commit 21581b3c01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 9 deletions

@ -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}
/>
)}
</StyledConfirmationContainer>

@ -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}
/>
</td>
)}

@ -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
]
)

@ -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\nvalidators 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\nvalidators 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',

@ -371,6 +371,7 @@ export const useMessageConfirmations = ({
executionData,
setExecutionData,
waitingBlocksResolved,
executionEventsFetched
executionEventsFetched,
setPendingExecution
}
}