mandos 0.4.0

Parser/writer of the Mandos test format
Documentation
{
    "name": "example scenario file",
    "comment": "comments are nice",
    "checkGas": false,
    "steps": [
        {
            "step": "externalSteps",
            "path": "other.scen.json"
        },
        {
            "step": "setState",
            "comment": "not much to comment here, but we can",
            "accounts": {
                "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b000000000000000000000000": {
                    "comment": "we can comment on individual account initializations",
                    "nonce": "0",
                    "balance": "0xe8d4a51000",
                    "storage": {},
                    "esdt": {
                        "str:MyToken": "400,000,000,000"
                    },
                    "code": ""
                },
                "address:smart_contract_address": {
                    "nonce": "0x00",
                    "balance": "23,000",
                    "storage": {
                        "0x19efaebcc296cffac396adb4a60d54c05eff43926a6072498a618e943908efe1": "-5",
                        "``32_byte_key_____________________": "``string___interpreted___as__bytes",
                        "``serialized_list_example": [
                            "``component1",
                            "``component2"
                        ],
                        "``serialized_map_example": {
                            "``field1": "u32:5",
                            "``field2": [
                                "``field2elem1",
                                "u64:0",
                                "``field2elem3"
                            ]
                        }
                    },
                    "code": "file:smart-contract.wasm"
                }
            },
            "newAddresses": [
                {
                    "creatorAddress": "address:creator",
                    "creatorNonce": "1234",
                    "newAddress": "address:creator"
                }
            ],
            "blockHashes": [
                "0x24a30e4305ac41674b26493c800c05f507e98d3b8bceb0a314f9b9bc43622736",
                "0x00"
            ]
        },
        {
            "step": "setState",
            "comment": "only set block info this time",
            "previousBlockInfo": {
                "blockNonce": "222",
                "blockRound": "333",
                "blockEpoch": "444"
            },
            "currentBlockInfo": {
                "blockTimestamp": "511",
                "blockNonce": "522",
                "blockRound": "533",
                "blockEpoch": "544"
            }
        },
        {
            "step": "scCall",
            "txId": "1",
            "comment": "just an example",
            "tx": {
                "from": "address:an_address",
                "to": "0x1000000000000000000000000000000000000000000000000000000000000000",
                "value": "0x00",
                "function": "someFunctionName",
                "arguments": [
                    "0x1234123400000000000000000000000000000000000000000000000000000004",
                    "0x00",
                    "",
                    "``a message (as bytes)",
                    [
                        "``serialized_list_item_1",
                        "``serialized_list_item_2"
                    ],
                    {
                        "``field1": "u32:5",
                        "``field2": "5"
                    }
                ],
                "gasLimit": "0x100000",
                "gasPrice": "0x01"
            },
            "expect": {
                "out": [
                    "5",
                    "*",
                    [
                        "``serialized_list_item_1",
                        "``serialized_list_item_2"
                    ],
                    {
                        "``field1": "u32:5",
                        "``field2": "5"
                    }
                ],
                "status": "",
                "logs": [
                    {
                        "address": "address:smart_contract_address",
                        "identifier": "0xf099cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9",
                        "topics": [
                            "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b000000000000000000000000",
                            "0x1234123400000000000000000000000000000000000000000000000000000004"
                        ],
                        "data": "0x00"
                    }
                ],
                "gas": "0x1234",
                "refund": "*"
            }
        },
        {
            "step": "scCall",
            "txId": "1b",
            "comment": "without expected result",
            "tx": {
                "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b000000000000000000000000",
                "to": "0x1000000000000000000000000000000000000000000000000000000000000000",
                "value": "0x00",
                "esdtValue": "250,000,000,000",
                "esdtTokenName": "str:MyToken",
                "function": "someFunctionName",
                "arguments": [],
                "gasLimit": "0x100000",
                "gasPrice": "0"
            }
        },
        {
            "step": "scCall",
            "txId": "1b",
            "comment": "with minimal expected result",
            "tx": {
                "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b000000000000000000000000",
                "to": "0x1000000000000000000000000000000000000000000000000000000000000000",
                "value": "0x00",
                "function": "someFunctionName",
                "arguments": [],
                "gasLimit": "0x100000",
                "gasPrice": "0"
            },
            "expect": {
                "out": [],
                "status": "",
                "logs": "*"
            }
        },
        {
            "step": "scCall",
            "txId": "1c",
            "comment": "without logs",
            "tx": {
                "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b000000000000000000000000",
                "to": "0x1000000000000000000000000000000000000000000000000000000000000000",
                "value": "0x00",
                "function": "someFunctionName",
                "arguments": [],
                "gasLimit": "0x100000",
                "gasPrice": "0"
            },
            "expect": {
                "out": [],
                "status": ""
            }
        },
        {
            "step": "scDeploy",
            "txId": "2",
            "comment": "another",
            "tx": {
                "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b000000000000000000000000",
                "value": "0x00",
                "esdtValue": "250,000,000,000",
                "esdtTokenName": "str:CrowdToken",
                "contractCode": "``new contract code here",
                "arguments": [
                    "0x1234123400000000000000000000000000000000000000000000000000000004",
                    "0x00",
                    "",
                    "``a message (as bytes)"
                ],
                "gasLimit": "0x100000",
                "gasPrice": "0x01"
            },
            "expect": {
                "out": [],
                "status": "",
                "logs": [],
                "gas": "*",
                "refund": "5"
            }
        },
        {
            "step": "transfer",
            "txId": "3",
            "comment": "simple transfer, no VM",
            "tx": {
                "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b000000000000000000000000",
                "to": "0x1000000000000000000000000000000000000000000000000000000000000000",
                "value": "1234",
                "esdtValue": "250,000,000,000",
                "esdtTokenName": "str:MyToken"
            }
        },
        {
            "step": "validatorReward",
            "txId": "4",
            "comment": "system send out validator rewards",
            "tx": {
                "to": "``delegation_contract___________s1",
                "value": "555,000,000"
            }
        },
        {
            "step": "checkState",
            "comment": "check that previous tx did the right thing",
            "accounts": {
                "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b000000000000000000000000": {
                    "comment": "we can comment on individual account checks",
                    "nonce": "1",
                    "balance": "0xe8d4951000",
                    "storage": {},
                    "code": ""
                },
                "address:account_with_defaults": {
                    "storage": "*"
                },
                "address:smart_contract_address": {
                    "nonce": "0x00",
                    "balance": "23,000",
                    "storage": {
                        "0x19efaebcc296cffac396adb4a60d54c05eff43926a6072498a618e943908efe1": "-5",
                        "``32_byte_key_____________________": "``string___interpreted___as__bytes",
                        "``serialized_map_example": {
                            "``field1": "u32:5",
                            "``field2": [
                                "``field2elem1",
                                "u64:0",
                                "``field2elem3"
                            ]
                        }
                    },
                    "code": "file:smart-contract.wasm"
                },
                "address:smart_contract_address_2": {
                    "nonce": "*",
                    "balance": "*",
                    "storage": "*",
                    "code": "*",
                    "asyncCallData": "``func@arg1@arg2"
                },
                "+": ""
            }
        },
        {
            "step": "dumpState",
            "comment": "print everything to console"
        }
    ]
}