From f441ecb300f8df0b2492716bde038820ddffcbf9 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Sat, 13 Apr 2024 13:36:07 +0300 Subject: [PATCH 1/3] add mandos for non payable malfunction --- .../scenarios/payable_token_5.scen.json | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 test/features/payable-features/scenarios/payable_token_5.scen.json diff --git a/test/features/payable-features/scenarios/payable_token_5.scen.json b/test/features/payable-features/scenarios/payable_token_5.scen.json new file mode 100644 index 000000000..56388dc80 --- /dev/null +++ b/test/features/payable-features/scenarios/payable_token_5.scen.json @@ -0,0 +1,121 @@ +{ + "name": "payable", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "sc:payable-features": { + "nonce": "0", + "balance": "0", + "code": "mxsc:../output/payable-features.mxsc.json", + "codeMetadata": "0x0000" + }, + "address:an-account": { + "nonce": "0", + "balance": "1,000,000,000,000", + "esdt": { + "str:PAYABLE-FEATURES-TOKEN": "1,000,000,000,000", + "str:OTHER-TOKEN": "1,000,000,000,000" + } + } + } + }, + { + "step": "scCall", + "id": "payable_token_1.1", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "function": "payable_token_1", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:function expects single ESDT payment", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "payable_token_1.2", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "egldValue": "5", + "function": "payable_token_1", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:function expects single ESDT payment", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "payable_token_1.3", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "esdtValue": [ + { + "tokenIdentifier": "str:PAYABLE-FEATURES-TOKEN", + "value": "100" + } + ], + "function": "payable_token_1", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [ + "0x64", + "0x50415941424c452d46454154555245532d544f4b454e" + ], + "status": "0", + "message": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "payable_token_1.4", + "tx": { + "from": "address:an-account", + "to": "sc:payable-features", + "esdtValue": [ + { + "tokenIdentifier": "str:OTHER-TOKEN", + "value": "100" + } + ], + "function": "payable_token_1", + "arguments": [], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:bad call value token provided", + "logs": "*", + "gas": "*", + "refund": "*" + } + } + ] +} \ No newline at end of file From f57938018e76ba9f95f44e7b2bb739312d1cd376 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Sat, 13 Apr 2024 18:37:32 +0300 Subject: [PATCH 2/3] update scenario dependency --- go.mod | 4 +++- go.sum | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4787bc357..6d7fe94dc 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/multiversx/mx-chain-core-go v1.2.18 github.com/multiversx/mx-chain-crypto-go v1.2.9 github.com/multiversx/mx-chain-logger-go v1.0.13 - github.com/multiversx/mx-chain-scenario-go v1.4.1 + github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240413152730-7374ba129c4f github.com/multiversx/mx-chain-vm-common-go v1.5.11 github.com/multiversx/mx-components-big-int v1.0.0 github.com/pelletier/go-toml v1.9.3 @@ -41,3 +41,5 @@ require ( gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/multiversx/mx-chain-scenario-go => /home/bibi/Desktop/mx-chain-scenario-go diff --git a/go.sum b/go.sum index ad7b9ca39..7017f5c32 100644 --- a/go.sum +++ b/go.sum @@ -89,8 +89,6 @@ github.com/multiversx/mx-chain-crypto-go v1.2.9 h1:OEfF2kOQrtzUl273Z3DEcshjlTVUf github.com/multiversx/mx-chain-crypto-go v1.2.9/go.mod h1:fkaWKp1rbQN9wPKya5jeoRyC+c/SyN/NfggreyeBw+8= github.com/multiversx/mx-chain-logger-go v1.0.13 h1:eru/TETo0MkO4ZTnXsQDKf4PBRpAXmqjT02klNT/JnY= github.com/multiversx/mx-chain-logger-go v1.0.13/go.mod h1:MZJhTAtZTJxT+yK2EHc4ZW3YOHUc1UdjCD0iahRNBZk= -github.com/multiversx/mx-chain-scenario-go v1.4.1 h1:CrVXb1aNBRiFfSfpoMAUoGUy2aNXke5WnoesLdFxC2g= -github.com/multiversx/mx-chain-scenario-go v1.4.1/go.mod h1:Sdgz8nzA9Ki/pdY/e2a4k90LALBKQB1Eo8HeCV3Bkzo= github.com/multiversx/mx-chain-vm-common-go v1.5.11 h1:rAQR00ALKOmWAuNA8XW8hR02M9gmrAE4WZwyJH4dMMU= github.com/multiversx/mx-chain-vm-common-go v1.5.11/go.mod h1:T04rZt/VdwjPXcXVxltMmDmrhxNXsqlByYbWNWcNLYA= github.com/multiversx/mx-components-big-int v1.0.0 h1:Wkr8lSzK2nDqixOrrBa47VNuqdhV1m/aJhaP1EMaiS8= From 28cc2a2ffa26b7a7473beb61b81b5beced189fc4 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Sat, 13 Apr 2024 18:40:56 +0300 Subject: [PATCH 3/3] remove replace line --- go.mod | 2 -- go.sum | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 6d7fe94dc..876f1afee 100644 --- a/go.mod +++ b/go.mod @@ -41,5 +41,3 @@ require ( gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace github.com/multiversx/mx-chain-scenario-go => /home/bibi/Desktop/mx-chain-scenario-go diff --git a/go.sum b/go.sum index 7017f5c32..8d78e08ff 100644 --- a/go.sum +++ b/go.sum @@ -89,6 +89,8 @@ github.com/multiversx/mx-chain-crypto-go v1.2.9 h1:OEfF2kOQrtzUl273Z3DEcshjlTVUf github.com/multiversx/mx-chain-crypto-go v1.2.9/go.mod h1:fkaWKp1rbQN9wPKya5jeoRyC+c/SyN/NfggreyeBw+8= github.com/multiversx/mx-chain-logger-go v1.0.13 h1:eru/TETo0MkO4ZTnXsQDKf4PBRpAXmqjT02klNT/JnY= github.com/multiversx/mx-chain-logger-go v1.0.13/go.mod h1:MZJhTAtZTJxT+yK2EHc4ZW3YOHUc1UdjCD0iahRNBZk= +github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240413152730-7374ba129c4f h1:4vKDKnuh/mrfTxckac7yVcR86R4ZQcdjl1YG/tWT/lw= +github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240413152730-7374ba129c4f/go.mod h1:Sdgz8nzA9Ki/pdY/e2a4k90LALBKQB1Eo8HeCV3Bkzo= github.com/multiversx/mx-chain-vm-common-go v1.5.11 h1:rAQR00ALKOmWAuNA8XW8hR02M9gmrAE4WZwyJH4dMMU= github.com/multiversx/mx-chain-vm-common-go v1.5.11/go.mod h1:T04rZt/VdwjPXcXVxltMmDmrhxNXsqlByYbWNWcNLYA= github.com/multiversx/mx-components-big-int v1.0.0 h1:Wkr8lSzK2nDqixOrrBa47VNuqdhV1m/aJhaP1EMaiS8=