Merged
Conversation
GeekArthur
reviewed
Apr 24, 2024
| if err := h.parser.ExpectedOperations(intent, observed, false, true); err != nil { | ||
| return fmt.Errorf("confirmed transaction did not match intent: %w", err) | ||
| errMsg := fmt.Errorf("confirmed transaction did not match intent: %w", err) | ||
| if !isValidStakingOperation(intent, intentMetadata) { |
Contributor
There was a problem hiding this comment.
what if confirmed transaction did not match intent but staking operation is valid, then we won't catch the error?
Contributor
Author
There was a problem hiding this comment.
This code is used for check:construction only, we never full tested staking txns in check:construction.
Staking operation looks like this:
"network_identifier": {
"blockchain": "abc",
"network": "testnet"
},
"operations": [
{
"operation_identifier": {
"index": 0
},
"type": "stake",
"status": "",
"account": {
"address": "dydx12c0xh69avh8xd0z76as9as4mcy0cfncukmmd7z",
"metadata": {}
},
"amount": {
"value": "5000000",
"currency": {
"symbol": "COSMOSDYDX",
"decimals": 18
}
}
}
],
"suggested_fee_multiplier": 2,
"metadata": {
"gas_adjustment": 0.5,
"validator_src_address": "dydxvaloper10lzv79d96l7jh07z76ry6cnn6ftnnl8fgketzu",
"validator_dst_address": ""
}
}
The amount in the preprocess API is a positive number, but our block API interprets staking as two operations; the first one is negative. Hence we get an intent mismatch.
GeekArthur
approved these changes
Apr 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes # .
Motivation
Solution
Open questions