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

/block returns incorrect operation relations #102

Closed
qiwu7 opened this issue Oct 15, 2020 · 2 comments · Fixed by #103
Closed

/block returns incorrect operation relations #102

qiwu7 opened this issue Oct 15, 2020 · 2 comments · Fixed by #103

Comments

@qiwu7
Copy link

qiwu7 commented Oct 15, 2020

I am getting incorrect related_operations when querying this specific block. This could be an issue just for this block. But I am logging it here so we can investigate. Basically only the operations that are really related should be populated with related_operations information. operation_identifier.index = 2 should not be related to operation_identifier.index = 1 since they are not related. Similarly, operation_identifier.index = 4 should not be related to operation_identifier.index = 3

curl --location --request POST 'http://10.200.34.109:8080/block' \
--header 'Content-Type: application/json' \
--data-raw '{
    "network_identifier": {
        "blockchain": "Filecoin",
        "network": "ignition"
    },
    "block_identifier": {
        "index": 41281
    }
}'

partial response

{
                "transaction_identifier": {
                    "hash": "bafy2bzaced7fxmdwaz547lmf3jcolgcezicz6endgmvcm7enxez674ek4nriw"
                },
                "operations": [
                    {
                        "operation_identifier": {
                            "index": 0
                        },
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f00"
                        },
                        "amount": {
                            "value": "0",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 1
                        },
                        "related_operations": [
                            {
                                "index": 0
                            }
                        ],
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f00"
                        },
                        "amount": {
                            "value": "0",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 2
                        },
                        "related_operations": [
                            {
                                "index": 1
                            }
                        ],
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f015907"
                        },
                        "amount": {
                            "value": "-22559994676983002583",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 3
                        },
                        "related_operations": [
                            {
                                "index": 2
                            }
                        ],
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f090"
                        },
                        "amount": {
                            "value": "22559994676983002583",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 4
                        },
                        "related_operations": [
                            {
                                "index": 3
                            }
                        ],
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f3wg6t62ncadxwfl4f6kk4opixfibcicgbm5iothhjsaimn5uhvuvgmuzgchit5kb73mlaj3bbo3wkpggfdyzq"
                        },
                        "amount": {
                            "value": "-59999996797237373642",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 5
                        },
                        "related_operations": [
                            {
                                "index": 4
                            }
                        ],
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f090"
                        },
                        "amount": {
                            "value": "59999996797237373642",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
@qiwu7 qiwu7 added the P2 label Oct 15, 2020
@raynaudoe
Copy link
Collaborator

raynaudoe commented Oct 15, 2020

Yeah.. they seem to be different Send ops, but they're actually related between them because they're all subcalls of the transaction bafy2bzaced7fxmdwaz547lmf3jcolgcezicz6endgmvcm7enxez674ek4nriw

I'm not sure on other way of applying the related_operations logic to a subcall tree of StateCompute. Nevertheless I can make to only relate "in pairs" and the result should be as you say, testing it now.

@raynaudoe
Copy link
Collaborator

With the fix, the output would be:

"transactions": [
            {
                "transaction_identifier": {
                    "hash": "bafy2bzaced7fxmdwaz547lmf3jcolgcezicz6endgmvcm7enxez674ek4nriw"
                },
                "operations": [
                    {
                        "operation_identifier": {
                            "index": 0
                        },
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f00"
                        },
                        "amount": {
                            "value": "0",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 1
                        },
                        "related_operations": [
                            {
                                "index": 0
                            }
                        ],
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f00"
                        },
                        "amount": {
                            "value": "0",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 2
                        },
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f015907"
                        },
                        "amount": {
                            "value": "-22559994676983002583",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 3
                        },
                        "related_operations": [
                            {
                                "index": 2
                            }
                        ],
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f090"
                        },
                        "amount": {
                            "value": "22559994676983002583",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 4
                        },
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f3wg6t62ncadxwfl4f6kk4opixfibcicgbm5iothhjsaimn5uhvuvgmuzgchit5kb73mlaj3bbo3wkpggfdyzq"
                        },
                        "amount": {
                            "value": "-59999996797237373642",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 5
                        },
                        "related_operations": [
                            {
                                "index": 4
                            }
                        ],
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f090"
                        },
                        "amount": {
                            "value": "59999996797237373642",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 6
                        },
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f08261"
                        },
                        "amount": {
                            "value": "-201326592",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 7
                        },
                        "related_operations": [
                            {
                                "index": 6
                            }
                        ],
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f090"
                        },
                        "amount": {
                            "value": "201326592",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 8
                        },
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f03487"
                        },
                        "amount": {
                            "value": "-126828682047520473",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 9
                        },
                        "related_operations": [
                            {
                                "index": 8
                            }
                        ],
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f090"
                        },
                        "amount": {
                            "value": "126828682047520473",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 10
                        },
                        "type": "Send",
                        "status": "Ok",
                        "account": {
                            "address": "f08572"
                        },
                        "amount": {
                            "value": "-2711138148179946698940",
                            "currency": {
                                "symbol": "FIL",
                                "decimals": 18
                            }
                        }
                    },
                    {

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 a pull request may close this issue.

2 participants