From a07db3584864f31f7312425fa2bb105f74ae751b Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Tue, 10 Oct 2023 01:54:33 +0300 Subject: [PATCH] overflow + enable poe test on biguint --- .../scenarios/big_uint_overflow.scen.json | 48 +++++++++++++++++++ ...g_uint_pow.json => big_uint_pow.scen.json} | 0 .../tests/basic_features_scenario_go_test.rs | 10 ++++ .../tests/basic_features_scenario_rs_test.rs | 10 ++++ 4 files changed, 68 insertions(+) create mode 100644 contracts/feature-tests/basic-features/scenarios/big_uint_overflow.scen.json rename contracts/feature-tests/basic-features/scenarios/{big_uint_pow.json => big_uint_pow.scen.json} (100%) diff --git a/contracts/feature-tests/basic-features/scenarios/big_uint_overflow.scen.json b/contracts/feature-tests/basic-features/scenarios/big_uint_overflow.scen.json new file mode 100644 index 0000000000..c7cfe8dd09 --- /dev/null +++ b/contracts/feature-tests/basic-features/scenarios/big_uint_overflow.scen.json @@ -0,0 +1,48 @@ +{ + "name": "overflow", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "sc:basic-features": { + "nonce": "0", + "balance": "0", + "storage": {}, + "code": "file:../output/basic-features.wasm" + }, + "address:an_account": { + "nonce": "0", + "balance": "0", + "storage": {}, + "code": "" + } + } + }, + { + "step": "scCall", + "id": "pow", + "tx": { + "from": "address:an_account", + "to": "sc:basic-features", + "value": "0", + "function": "pow_big_uint", + "arguments": [ + "10", + "80" + ], + "gasLimit": "50,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [ + "100000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "status": "0", + "logs": "*", + "gas": "*", + "refund": "*" + } + } + ] +} diff --git a/contracts/feature-tests/basic-features/scenarios/big_uint_pow.json b/contracts/feature-tests/basic-features/scenarios/big_uint_pow.scen.json similarity index 100% rename from contracts/feature-tests/basic-features/scenarios/big_uint_pow.json rename to contracts/feature-tests/basic-features/scenarios/big_uint_pow.scen.json diff --git a/contracts/feature-tests/basic-features/tests/basic_features_scenario_go_test.rs b/contracts/feature-tests/basic-features/tests/basic_features_scenario_go_test.rs index 95d0566f8b..55c4063c80 100644 --- a/contracts/feature-tests/basic-features/tests/basic_features_scenario_go_test.rs +++ b/contracts/feature-tests/basic-features/tests/basic_features_scenario_go_test.rs @@ -34,6 +34,16 @@ fn big_uint_sqrt_go() { world().run("scenarios/big_uint_sqrt.scen.json"); } +#[test] +fn big_uint_pow_go() { + world().run("scenarios/big_uint_pow.scen.json"); +} + +#[test] +fn big_uint_overflow_go() { + world().run("scenarios/big_uint_overflow.scen.json"); +} + #[test] fn big_uint_to_u_64_go() { world().run("scenarios/big_uint_to_u64.scen.json"); diff --git a/contracts/feature-tests/basic-features/tests/basic_features_scenario_rs_test.rs b/contracts/feature-tests/basic-features/tests/basic_features_scenario_rs_test.rs index de5da320e3..08283808b4 100644 --- a/contracts/feature-tests/basic-features/tests/basic_features_scenario_rs_test.rs +++ b/contracts/feature-tests/basic-features/tests/basic_features_scenario_rs_test.rs @@ -43,9 +43,19 @@ fn big_uint_from_u_64_rs() { #[test] fn big_uint_sqrt_rs() { + world().run("scenarios/big_uint_pow.scen.json"); +} + +#[test] +fn big_uint_pow_rs() { world().run("scenarios/big_uint_sqrt.scen.json"); } +#[test] +fn big_uint_overflow_rs() { + world().run("scenarios/big_uint_overflow.scen.json"); +} + #[test] fn big_uint_to_u_64_rs() { world().run("scenarios/big_uint_to_u64.scen.json");