chainweb-node icon indicating copy to clipboard operation
chainweb-node copied to clipboard

Validation failure of one command causes entire batch call failure

Open ggobugi27 opened this issue 6 years ago • 0 comments

When cmds are sent in batch, validation failure of one cmd prevents other valid cmds from being sent.

For example, when one valid cmd and one invalid cmd are sent in batch, the result is a validation failure message of the invalid cmd, and the valid cmd is also not sent to the mempool.

Below is an example of this behavior.

Case 1: Send an invalid cmd and a valid cmd in batch

{"cmds": [{"hash":"ZMU38iNHtridadzo6Edi5evjwI-85vXTB3lRCT60L4k","sigs":[{"sig":"da02a310040fae54ff5f4d29a575484bb769129a2acc6fcda2e3418df4ac8ced1468ffd21b5dd0f3123537066c9808fe4494c0d15d26ac890461065efce6040c"}],"cmd":"{\"networkId\":\"development\",\"payload\":{\"exec\":{\"data\":{},\"code\":\"(+ 1 2)\"}},\"signers\":[{\"clist\":[],\"pubKey\":\"368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca\"}],\"meta\":{\"sender\":\"not-valid\",\"chainId\":\"0\",\"gasPrice\":0.00001,\"gasLimit\":1000,\"ttl\":28800,\"creationTime\":1580496624},\"nonce\":\"\\\"Expect Validation Failure\\\"\"}"},{"hash":"0PzcMy7z6P9NVE2Zh-TTMG1Dk7MkOsMuTnTC4xl-bLM","sigs":[{"sig":"069fe268e13f877892936fb6798f5795c5511d2ccb94e34b54222ae451569521965272401a0d114eeddb851ea0eb59dbca0afdc7d477176866584cb59dc45701"}],"cmd":"{\"networkId\":\"development\",\"payload\":{\"exec\":{\"data\":{},\"code\":\"(+ 1 2)\"}},\"signers\":[{\"clist\":[],\"pubKey\":\"368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca\"}],\"meta\":{\"sender\":\"sender00\",\"chainId\":\"0\",\"gasPrice\":0.00001,\"gasLimit\":1000,\"ttl\":28800,\"creationTime\":1580496624},\"nonce\":\"\\\"Expect success\\\"\"}"}]}

Result : Returns Validation Failure message of Invalid cmd.

Validation failed for hash "ZMU38iNHtridadzo6Edi5evjwI-85vXTB3lRCT60L4k": Sender account has insufficient gas.

Case 2: Separate the valid cmd from Case 1 and make a separate call.

{"cmds":[{"hash":"0PzcMy7z6P9NVE2Zh-TTMG1Dk7MkOsMuTnTC4xl-bLM","sigs":[{"sig":"069fe268e13f877892936fb6798f5795c5511d2ccb94e34b54222ae451569521965272401a0d114eeddb851ea0eb59dbca0afdc7d477176866584cb59dc45701"}],"cmd":"{\"networkId\":\"development\",\"payload\":{\"exec\":{\"data\":{},\"code\":\"(+ 1 2)\"}},\"signers\":[{\"clist\":[],\"pubKey\":\"368820f80c324bbc7c2b0610688a7da43e39f91d118732671cd9c7500ff43cca\"}],\"meta\":{\"sender\":\"sender00\",\"chainId\":\"0\",\"gasPrice\":0.00001,\"gasLimit\":1000,\"ttl\":28800,\"creationTime\":1580496624},\"nonce\":\"\\\"Expect success\\\"\"}"}
]}

Result: Returns requestKey of the valid cmd.

{
    "requestKeys": [
        "0PzcMy7z6P9NVE2Zh-TTMG1Dk7MkOsMuTnTC4xl-bLM"
    ]
}

ggobugi27 avatar Jan 31 '20 18:01 ggobugi27