caivega / ipfslib

Other
2 stars 1 forks source link

S4 - jt_getTransactionByIndex:index参数过大时错误提示信息不准确 #183

Closed zyd82 closed 3 years ago

zyd82 commented 3 years ago

测试版本:v0.5.4-dev-20210207-db1bf99761871c1bbe1b67e2bd6286eba58177fc 用例编号:FCJT_getTransactionByIndex_000020

正确的address参数,但是index是一个很大的数值"984503284032",这个请求的返回结果是:"can't find transaction: jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J, 955773248"。返回结果中的955773248和请求中的984503284032并不一致,此处可以考虑二者保持一致。

{
    "jsonrpc": "2.0",
    "method": "jt_getTransactionByIndex",
    "params": [
        {
            "address": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
            "index": "984503284032",
            "full": true
        }
    ],
    "id": 1
}
{
    "error": {
        "count": 1,
        "desc": "The compound error.",
        "info": "1 errors"
    },
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "error": {
                "desc": "No matching entry found.",
                "info": "can't find transaction: jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J, 955773248"
            },
            "status": 140,
            "type": "tecNO_ENTRY"
        }
    ],
    "status": 1000,
    "type": "tedCOMPOUND"
}

jt_getTransactionByBlockHashAndIndex和jt_getTransactionByBlockNumberAndIndex也有类似的问题。

caivega commented 3 years ago

这个rpc的index实际上对应的是帐户的sequence, 现在sequence是uint32类型,所以,需要加一个uint32的值范围检查

caivega commented 3 years ago

与sequence相关的,uint32检查已经加上,会返回bad_sequence error, 已经修复,下一个build验证

zyd82 commented 3 years ago

在v0.6.4-dev-20210219-ae3070493c2d87812731c2583fe3820089246ee7版本上jt_getTransactionByIndex的问题已经解决。

但是jt_getTransactionByBlockHashAndIndex和jt_getTransactionByBlockNumberAndIndex上面类似的问题仍然存在:输入的index是984503284032984503284032,但是返回结果中是9223372036854775807。

{
    "jsonrpc": "2.0",
    "method": "jt_getTransactionByBlockHashAndIndex",
    "params": [
        {
            "hash": "57FF84996DACF570E2F7B613255BD1FFAF6759202FC990A3106EA93DA8D630BC",
            "index": "984503284032984503284032",
            "full": true
        }
    ],
    "id": 1
}
{
    "error": {
        "count": 1,
        "desc": "The compound error.",
        "info": "1 errors"
    },
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "error": {
                "desc": "No matching entry found.",
                "info": "can't find transaction in block: 57FF84996DACF570E2F7B613255BD1FFAF6759202FC990A3106EA93DA8D630BC, 9223372036854775807"
            },
            "status": 140,
            "type": "tecNO_ENTRY"
        }
    ],
    "status": 1000,
    "type": "tedCOMPOUND"
}
caivega commented 3 years ago

等待build环境版本更新,我在这个版本上,2021.02.19: 0.6.4-dev, ae3070493c2d87812731c2583fe3820089246ee7 返回的是

{
    "error": {
        "count": 1,
        "desc": "The compound error.",
        "info": "1 errors"
    },
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        {
            "error": {
                "desc": "Malformed: Bad sequence.",
                "info": "invalid parameter 984503284032 for sequence"
            },
            "status": -284,
            "type": "temBAD_SEQUENCE"
        }
    ],
    "status": 1000,
    "type": "tedCOMPOUND"
}
zyd82 commented 3 years ago

目前环境已经是v0.6.4-dev-20210219-ae3070493c2d87812731c2583fe3820089246ee7这个版本了,现在jt_getTransactionByIndex上面问题已经解决,但是jt_getTransactionByBlockHashAndIndex和jt_getTransactionByBlockNumberAndIndex上面问题仍然存在。

caivega commented 3 years ago

后边这两个index, 不是sequence, 只是数组的下标,估计没有检查越界,我加一下

caivega commented 3 years ago

已经修复,下一个build验证

zyd82 commented 3 years ago

v0.6.4-dev-20210301-f0ae0dfed6982ab2222339a7bed661355df68136版本上验证通过。