Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed transaction status for relayed v1 & v2 intra-shard transactions #426

Merged
merged 4 commits into from
Feb 15, 2024

Conversation

iulianpascalau
Copy link
Contributor

@iulianpascalau iulianpascalau commented Feb 9, 2024

  • fixed transaction status for relayed v1 & v2 intra-shard transactions

"version": 1,
"options": 0
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing new line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"version": 1,
"options": 0
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing new line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// sanity checks
senderAddress, err := tp.pubKeyConverter.Decode(tx.Sender)
if err != nil {
return transaction.TxStatusFail
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If sender is metachain (e.g. reward transactions), works as expected?

https://testnet-gateway.multiversx.com/transaction/191a0bf2d29559181da9d93bfd35f8b9f136122006d10b51096fec6be65fb25d

On failure to decode, perhaps TxStatusUnknown?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoa, thanks for the input. Will add these examples and will come up with a fix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -484,6 +500,26 @@ func checkIfMoveBalanceNotarized(tx *transaction.ApiTransactionResult) bool {
return true
}

func (tp *TransactionProcessor) checkIfIntraShardRelayedTransaction(
Copy link
Contributor

@andreibancioiu andreibancioiu Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checks relayer shard & user shard, but not shard of innerTx.receiver. If inner tx is cross-shard, but relayed one (wrapper) is intra-shard, a "false positive" success might happen (even if tx is still pending). If so, then the check maybe should be "is tx relayed & completely intra-shard, all actors in a shard".

I am not sure about this, though - it's just a question, not a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, agree, will come up with a fix for this :)

sstanculeanu
sstanculeanu previously approved these changes Feb 9, 2024
andreibancioiu
andreibancioiu previously approved these changes Feb 9, 2024

dataField := string(tx.Data)
if strings.Index(dataField, relayedTxV1DataMarker) != 0 {
return false, fmt.Errorf("wrong relayed v1 data marker position")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, ProcessingTypeOn* identifies Relayed V1, and the check is for Relayed V1 ☑️

}

isSameShard := tp.proc.GetShardCoordinator().SameShard(senderAddress, receiverAddress)
isSameShardOnRelayed := tp.proc.GetShardCoordinator().SameShard(senderAddress, receiverAddress)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can also be written as 2 checks / 2 calls of SameShard(): (senderWhichIsRelayer, innerTx.SndAddr) and (innerTx.SndAddr, innerTx.RcvAddr) - but all right to stay as it is, as well, it's more explicit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About relayed V1 that wrap NFT transfers: not-yet-completed transactions of such an exotic kind might reach the "is relayed completely intrashard" check, and can be mistaken as completely intrashard, and thus reach an earlier "done" status - even though they are pending.

Even so, this is an extremely exotic case (no occurrence on mainnet). I think we can skip it for now, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored the solution

cristure
cristure previously approved these changes Feb 9, 2024
andreibancioiu
andreibancioiu previously approved these changes Feb 9, 2024
@@ -500,7 +499,50 @@ func checkIfMoveBalanceNotarized(tx *transaction.ApiTransactionResult) bool {
return true
}

func (tp *TransactionProcessor) checkIfCompletelyIntraShardRelayedTransaction(tx *transaction.ApiTransactionResult) (bool, error) {
func (tp *TransactionProcessor) addMissingLogsOnProcessingExceptions(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

cristure
cristure previously approved these changes Feb 12, 2024
@iulianpascalau iulianpascalau changed the title Fixed transaction status for relayed v1 intra-shard transactions Fixed transaction status for relayed v1 & v2 intra-shard transactions Feb 14, 2024
@iulianpascalau iulianpascalau merged commit 5282fa5 into master Feb 15, 2024
4 checks passed
@iulianpascalau iulianpascalau deleted the fix-tx-status-for-relayed-tx-v1 branch February 15, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants