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, signatureCollected,
waitingBlocksResolved, waitingBlocksResolved,
setExecutionData, setExecutionData,
executionEventsFetched executionEventsFetched,
setPendingExecution
} = useMessageConfirmations({ } = useMessageConfirmations({
message, message,
receipt, receipt,
@ -117,6 +118,7 @@ export const ConfirmationsContainer = ({ message, receipt, fromHome, timestamp }
requiredSignatures={requiredSignatures} requiredSignatures={requiredSignatures}
setExecutionData={setExecutionData} setExecutionData={setExecutionData}
executionEventsFetched={executionEventsFetched} executionEventsFetched={executionEventsFetched}
setPendingExecution={setPendingExecution}
/> />
)} )}
</StyledConfirmationContainer> </StyledConfirmationContainer>

@ -21,6 +21,7 @@ export interface ExecutionConfirmationParams {
requiredSignatures: number requiredSignatures: number
isHome: boolean isHome: boolean
executionEventsFetched: boolean executionEventsFetched: boolean
setPendingExecution: Function
} }
export const ExecutionConfirmation = ({ export const ExecutionConfirmation = ({
@ -29,7 +30,8 @@ export const ExecutionConfirmation = ({
setExecutionData, setExecutionData,
requiredSignatures, requiredSignatures,
isHome, isHome,
executionEventsFetched executionEventsFetched,
setPendingExecution
}: ExecutionConfirmationParams) => { }: ExecutionConfirmationParams) => {
const availableManualExecution = const availableManualExecution =
!isHome && !isHome &&
@ -104,6 +106,7 @@ export const ExecutionConfirmation = ({
messageData={messageData} messageData={messageData}
setExecutionData={setExecutionData} setExecutionData={setExecutionData}
requiredSignatures={requiredSignatures} requiredSignatures={requiredSignatures}
setPendingExecution={setPendingExecution}
/> />
</td> </td>
)} )}

@ -19,12 +19,14 @@ interface ManualExecutionButtonParams {
messageData: string messageData: string
setExecutionData: Function setExecutionData: Function
requiredSignatures: number requiredSignatures: number
setPendingExecution: Function
} }
export const ManualExecutionButton = ({ export const ManualExecutionButton = ({
messageData, messageData,
setExecutionData, setExecutionData,
requiredSignatures requiredSignatures,
setPendingExecution
}: ManualExecutionButtonParams) => { }: ManualExecutionButtonParams) => {
const { home, foreign, setError } = useStateProvider() const { home, foreign, setError } = useStateProvider()
const { library, activate, account, active } = useWeb3React() const { library, activate, account, active } = useWeb3React()
@ -73,7 +75,7 @@ export const ManualExecutionButton = ({
to: foreign.bridgeAddress, to: foreign.bridgeAddress,
data data
}) })
.on('transactionHash', (txHash: string) => .on('transactionHash', (txHash: string) => {
setExecutionData({ setExecutionData({
status: VALIDATOR_CONFIRMATION_STATUS.PENDING, status: VALIDATOR_CONFIRMATION_STATUS.PENDING,
validator: account, validator: account,
@ -81,7 +83,8 @@ export const ManualExecutionButton = ({
timestamp: Math.floor(new Date().getTime() / 1000.0), timestamp: Math.floor(new Date().getTime() / 1000.0),
executionResult: false executionResult: false
}) })
) setPendingExecution(true)
})
.on('error', (e: Error) => setError(e.message)) .on('error', (e: Error) => setError(e.message))
}, },
[ [
@ -96,7 +99,8 @@ export const ManualExecutionButton = ({
setError, setError,
messageData, messageData,
home.confirmations, home.confirmations,
setExecutionData setExecutionData,
setPendingExecution
] ]
) )

@ -57,9 +57,9 @@ export const CONFIRMATIONS_STATUS_DESCRIPTION_HOME: { [key: string]: string } =
SUCCESS_MESSAGE_FAILED: 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.', '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: 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: 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 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.\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', : '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, executionData,
setExecutionData, setExecutionData,
waitingBlocksResolved, waitingBlocksResolved,
executionEventsFetched executionEventsFetched,
setPendingExecution
} }
} }