caivega / ipfslib

Other
2 stars 1 forks source link

S2 - jt_signTransaction:sequence为非正整数的情况 #77

Closed zyd82 closed 3 years ago

zyd82 commented 4 years ago

情况一: 9545上sequence为0,

{
    "jsonrpc": "2.0",
    "method": "jt_signTransaction",
    "params": [
        {
            "from": "jKm5GjzhFhZhmvq9gWNGYM9bx4SCVawPcD",
            "secret": "ssuBf1LqMCczoR45KNeFTBSEtoT6V",
            "to": "jDrF5di5jSMf4db8MMmpBPb6BB4yV5y1Tc",
            "value": "1000",
            "sequence": 0
        }
    ],
    "id": 1
}

jt_sendRawTransaction返回如下:

{
    "id": 1,
    "jsonrpc": "2.0",
    "message": "failed to submit transaction blob 120000228000000024000000006140000000000003e868400000000000000a732103702bd1efa540e7b77da42e0560a77e539ec67a8d944bbc0ac0e93a710e2c147b74473045022100b682cec98f662260b6d4889e7a8879216b0ccc7b52403774395a0b2b3b6c7a680220302167084452620d6d3b53ad51102fb7a9ce4dc0f524544e7f62d9d277d9a1a28114cde701f43c4f576507427e7bed0bde7ac653a81283148bbad00a5c1f46cf80b18070593386dca0f906f0: 
    temBAD_SEQUENCE Malformed: Sequence is not in the past.",
    "result": [
        ""
    ],
    "status": "error"
}

7545上sequence为0,jt_sendRawTransaction返回交易成功,余额发生相应变化。

情况二: 当前sequence为19,9545上sequence为17.5

{
    "jsonrpc": "2.0",
    "method": "jt_signTransaction",
    "params": [
        {
            "from": "jKm5GjzhFhZhmvq9gWNGYM9bx4SCVawPcD",
            "secret": "ssuBf1LqMCczoR45KNeFTBSEtoT6V",
            "to": "jDrF5di5jSMf4db8MMmpBPb6BB4yV5y1Tc",
            "value": "1000",
            "sequence": 17.5
        }
    ],
    "id": 1
}

jt_sendRawTransaction返回如下:

{
    "id": 1,
    "jsonrpc": "2.0",
    "message": "failed to submit transaction blob 120000228000000024000000116140000000000003e868400000000000000a732103702bd1efa540e7b77da42e0560a77e539ec67a8d944bbc0ac0e93a710e2c147b74463044022020dd00ab5241d68bad2ce9dd5ab4a340fc951841033619d681d5244d86c1d90b022072319ef0a985d81f5952d4b468dcf579b6def570d153167c87fae513f5a19fad8114cde701f43c4f576507427e7bed0bde7ac653a81283148bbad00a5c1f46cf80b18070593386dca0f906f0: 
    temUNKNOWN The transactions requires logic not implemented yet.",
    "result": [
        ""
    ],
    "status": "error"
}

当前sequence为19,7545上sequence为17.5,jt_sendRawTransaction返回如下:

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [
        ""
    ],
    "status": "success"
}

其他情况: 当前sequence为19,7545上sequence为20.5,jt_sendRawTransaction返回交易成功,余额发生相应变化 当前sequence为20,9545上sequence为21.5,jt_sendRawTransaction返回交易成功,余额发生相应变化 当前sequence为21,9545上sequence为-21.5,jt_sendRawTransaction返回交易成功,余额发生相应变化 当前sequence为22,9545上sequence为-21.5,jt_sendRawTransaction返回交易成功,余额发生相应变化

建议sequence一律为正整数,非正整数直接返回错误提示信息。

zyd82 commented 4 years ago

版本v0.2.1-testing,9545上验证通过

zyd82 commented 3 years ago

9545已验证,验证版本v0.5.3-dev

{
    "id": 1,
    "jsonrpc": "2.0",
    "message": {
        "reason": "1 errors",
        "result": [
            {
                "error": "sequence must be positive integer",
                "message": {
                    "from": "jPdx7mG595P6CowtGYbxRkik9HdWUWtB2J",
                    "memos": [
                        "abc"
                    ],
                    "sequence": -6,
                    "to": "jGQ14U9BeHn6kV9eofnVsshSCxAecBawPM",
                    "value": "10"
                },
                "status": -284
            }
        ]
    },
    "result": [
        ""
    ],
    "status": -278
}