cosmos-sdk/x/ibc/applications/transfer/keeper/model_based_tests/Test5Packets.json

492 lines
7.7 KiB
JSON
Raw Normal View History

Model-based tests for relay functions of ICS-20 token transfer (#8145) * start on MBT for ICS20: setting and checking bank balances * add bank struct for subtracting banks * reconstruct ibc denominations in the bank * add some static tests with bank changes tracking * small fixes * better error handling * add Jsonatr transform from Apalache conterexample into OnRecvPacket test * add example Apalache CE and transformed test * changed apalache-to-recv-test.json to output arrays instead of records * add datastructures for parsing TLA+ tests * remove accidentally committed code * add conversion from TLA+ structs to Go structs * encode abstract ids into addresses via hashes * first run of auto-generated MBT tests * first run of auto-generated MBT tests: fix ports and channels * fix small inconsistencies * fix mbt_relay_test by not setting the bank balances in every iteration * add test for onTimeoutPacket * add handling of OnRecvAcknowledgement to mbt relay test * add handling of SendTransfer * add relay-test.json * revert manual changes in relay-test.json * fix handling of denominations for SendTransfer * setup two test channels A-B, B-C; fix escrow address encoding * a test for all handlers passing * generalize denom handling to arbitrary length + failing denom test * rename test function * MBT test for unsecrow tokens * add model-based generated tests * add model-based tests (prev commit: addded model) * transformed json tests with jsonatr * modify mbt_relay_test.go to execute all MBT tests * cleanup * move jsonatr transforms into another dir * add MBT_README.md Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-12-11 09:35:44 -08:00
[
{
"packet": {
"sourceChannel": "channel-0",
"sourcePort": "transfer",
"destChannel": "channel-1",
"destPort": "transfer",
"data": {
"sender": "a3",
"receiver": "a3",
"amount": 2,
"denom": [
"",
"",
"",
"",
"btc"
]
}
},
"handler": "OnRecvPacket",
"bankBefore": [
{
"address": [
"",
"",
""
],
"denom": [
"",
"",
"",
"",
""
],
"amount": 0
}
],
"bankAfter": [
{
"address": [
"",
"",
""
],
"denom": [
"",
"",
"",
"",
""
],
"amount": 0
},
{
"address": [
"",
"",
"a3"
],
"denom": [
"",
"",
"transfer",
"channel-1",
"btc"
],
"amount": 2
}
],
"error": false
},
{
"packet": {
"sourceChannel": "ethereum-hub",
"sourcePort": "channel-0",
"destChannel": "channel-1",
"destPort": "transfer",
"data": {
"sender": "a1",
"receiver": "a3",
"amount": 1,
"denom": [
"cosmos-hub",
"",
"",
"",
"btc"
]
}
},
"handler": "SendTransfer",
"bankBefore": [
{
"address": [
"",
"",
""
],
"denom": [
"",
"",
"",
"",
""
],
"amount": 0
},
{
"address": [
"",
"",
"a3"
],
"denom": [
"",
"",
"transfer",
"channel-1",
"btc"
],
"amount": 2
}
],
"bankAfter": [
{
"address": [
"",
"",
""
],
"denom": [
"",
"",
"",
"",
""
],
"amount": 0
},
{
"address": [
"",
"",
"a3"
],
"denom": [
"",
"",
"transfer",
"channel-1",
"btc"
],
"amount": 2
}
],
"error": true
},
{
"packet": {
"sourceChannel": "channel-0",
"sourcePort": "transfer",
"destChannel": "channel-1",
"destPort": "transfer",
"data": {
"sender": "a2",
"receiver": "a2",
"amount": 4,
"denom": [
"",
"",
"ethereum-hub",
"cosmos-hub",
"atom"
]
}
},
"handler": "OnRecvPacket",
"bankBefore": [
{
"address": [
"",
"",
""
],
"denom": [
"",
"",
"",
"",
""
],
"amount": 0
},
{
"address": [
"",
"",
"a3"
],
"denom": [
"",
"",
"transfer",
"channel-1",
"btc"
],
"amount": 2
}
],
"bankAfter": [
{
"address": [
"",
"",
""
],
"denom": [
"",
"",
"",
"",
""
],
"amount": 0
},
{
"address": [
"",
"",
"a2"
],
"denom": [
"transfer",
"channel-1",
"ethereum-hub",
"cosmos-hub",
"atom"
],
"amount": 4
},
{
"address": [
"",
"",
"a3"
],
"denom": [
"",
"",
"transfer",
"channel-1",
"btc"
],
"amount": 2
}
],
"error": false
},
{
"packet": {
"sourceChannel": "channel-0",
"sourcePort": "transfer",
"destChannel": "channel-1",
"destPort": "transfer",
"data": {
"sender": "",
"receiver": "a2",
"amount": 4,
"denom": [
"",
"",
"ethereum-hub",
"cosmos-hub",
"atom"
]
}
},
"handler": "OnRecvPacket",
"bankBefore": [
{
"address": [
"",
"",
""
],
"denom": [
"",
"",
"",
"",
""
],
"amount": 0
},
{
"address": [
"",
"",
"a2"
],
"denom": [
"transfer",
"channel-1",
"ethereum-hub",
"cosmos-hub",
"atom"
],
"amount": 4
},
{
"address": [
"",
"",
"a3"
],
"denom": [
"",
"",
"transfer",
"channel-1",
"btc"
],
"amount": 2
}
],
"bankAfter": [
{
"address": [
"",
"",
""
],
"denom": [
"",
"",
"",
"",
""
],
"amount": 0
},
{
"address": [
"",
"",
"a2"
],
"denom": [
"transfer",
"channel-1",
"ethereum-hub",
"cosmos-hub",
"atom"
],
"amount": 8
},
{
"address": [
"",
"",
"a3"
],
"denom": [
"",
"",
"transfer",
"channel-1",
"btc"
],
"amount": 2
}
],
"error": false
},
{
"packet": {
"sourceChannel": "cosmos-hub",
"sourcePort": "bitcoin-hub",
"destChannel": "channel-0",
"destPort": "channel-1",
"data": {
"sender": "a1",
"receiver": "",
"amount": 1,
"denom": [
"transfer",
"channel-0",
"transfer",
"channel-0",
"atom"
]
}
},
"handler": "SendTransfer",
"bankBefore": [
{
"address": [
"",
"",
""
],
"denom": [
"",
"",
"",
"",
""
],
"amount": 0
},
{
"address": [
"",
"",
"a2"
],
"denom": [
"transfer",
"channel-1",
"ethereum-hub",
"cosmos-hub",
"atom"
],
"amount": 8
},
{
"address": [
"",
"",
"a3"
],
"denom": [
"",
"",
"transfer",
"channel-1",
"btc"
],
"amount": 2
}
],
"bankAfter": [
{
"address": [
"",
"",
""
],
"denom": [
"",
"",
"",
"",
""
],
"amount": 0
},
{
"address": [
"",
"",
"a2"
],
"denom": [
"transfer",
"channel-1",
"ethereum-hub",
"cosmos-hub",
"atom"
],
"amount": 8
},
{
"address": [
"",
"",
"a3"
],
"denom": [
"",
"",
"transfer",
"channel-1",
"btc"
],
"amount": 2
}
],
"error": true
}
]