-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1400 from multiversx/rust-vm-builtin-function-hook
impl for is builtin function rust vm hook
- Loading branch information
Showing
13 changed files
with
159 additions
and
3 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
contracts/feature-tests/basic-features/scenarios/is_builtin_function.scen.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"steps": [ | ||
{ | ||
"step": "setState", | ||
"accounts": { | ||
"sc:basic-features": { | ||
"nonce": "0", | ||
"balance": "0", | ||
"code": "mxsc:../output/basic-features.mxsc.json", | ||
"codeMetadata": "0x0104" | ||
}, | ||
"address:an_account": { | ||
"nonce": "0", | ||
"balance": "0" | ||
} | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "is builtin function - true", | ||
"tx": { | ||
"from": "address:an_account", | ||
"to": "sc:basic-features", | ||
"function": "is_builtin_function", | ||
"arguments": [ | ||
"str:ESDTTransfer" | ||
], | ||
"gasLimit": "50,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [ | ||
"0x01" | ||
], | ||
"status": "", | ||
"logs": "*", | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "is builtin function - false", | ||
"tx": { | ||
"from": "address:an_account", | ||
"to": "sc:basic-features", | ||
"function": "is_builtin_function", | ||
"arguments": [ | ||
"str:anyFunction" | ||
], | ||
"gasLimit": "50,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [ | ||
"0x" | ||
], | ||
"status": "", | ||
"logs": "*", | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
contracts/feature-tests/basic-features/tests/basic_features_is_builtin_function_rs_test.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use multiversx_sc_scenario::*; | ||
|
||
fn world() -> ScenarioWorld { | ||
let mut blockchain = ScenarioWorld::new(); | ||
blockchain.set_current_dir_from_workspace("contracts/feature-tests/basic-features"); | ||
|
||
blockchain.register_contract( | ||
"mxsc:output/basic-features.mxsc.json", | ||
basic_features::ContractBuilder, | ||
); | ||
|
||
blockchain | ||
} | ||
|
||
#[test] | ||
fn is_builtin_function_test() { | ||
world().run("scenarios/is_builtin_function.scen.json"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters