-
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 #1164 from multiversx/rc-42-merge-master
Merge master -> rc/v0.42
- Loading branch information
Showing
411 changed files
with
4,625 additions
and
2,325 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
*/target/ | ||
|
||
# The mxpy output | ||
output |
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,17 @@ | ||
[package] | ||
name = "large-storage" | ||
version = "0.0.0" | ||
authors = ["Andrei Marinica <andrei.marinica@multiversx.com>"] | ||
edition = "2021" | ||
publish = false | ||
|
||
[lib] | ||
path = "src/large_storage.rs" | ||
|
||
[dependencies.multiversx-sc] | ||
version = "0.41.3" | ||
path = "../../../framework/base" | ||
|
||
[dev-dependencies.multiversx-sc-scenario] | ||
version = "0.41.3" | ||
path = "../../../framework/scenario" |
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,12 @@ | ||
[package] | ||
name = "large-storage-meta" | ||
version = "0.0.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies.large-storage] | ||
path = ".." | ||
|
||
[dependencies.multiversx-sc-meta] | ||
version = "0.41.3" | ||
path = "../../../../framework/meta" |
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,3 @@ | ||
fn main() { | ||
multiversx_sc_meta::cli_main::<large_storage::AbiProvider>(); | ||
} |
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,3 @@ | ||
{ | ||
"language": "rust" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
contracts/benchmarks/large-storage/scenarios/large_storage.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,82 @@ | ||
{ | ||
"name": "large-storage", | ||
"steps": [ | ||
{ | ||
"step": "setState", | ||
"accounts": { | ||
"address:owner": { | ||
"nonce": "0", | ||
"balance": "0" | ||
} | ||
}, | ||
"newAddresses": [ | ||
{ | ||
"creatorAddress": "address:owner", | ||
"creatorNonce": "0", | ||
"newAddress": "sc:contract" | ||
} | ||
] | ||
}, | ||
{ | ||
"step": "scDeploy", | ||
"id": "deploy", | ||
"tx": { | ||
"from": "address:owner", | ||
"contractCode": "file:../output/large-storage.wasm", | ||
"arguments": [], | ||
"gasLimit": "2,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [], | ||
"status": "", | ||
"logs": [], | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "save", | ||
"tx": { | ||
"from": "address:owner", | ||
"to": "sc:contract", | ||
"function": "saveStructure", | ||
"arguments": [ | ||
"str:abc", | ||
"1", | ||
"file:../pi.txt" | ||
], | ||
"gasLimit": "600,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [], | ||
"status": "", | ||
"logs": [], | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
}, | ||
{ | ||
"step": "checkState", | ||
"accounts": { | ||
"sc:contract": { | ||
"nonce": "0", | ||
"balance": "0", | ||
"storage": { | ||
"str:savedStructure": [ | ||
"u32:3", | ||
"str:abc", | ||
"1", | ||
"u32:40330", | ||
"file:../pi.txt" | ||
] | ||
}, | ||
"code": "*" | ||
}, | ||
"+": "" | ||
} | ||
} | ||
] | ||
} |
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,36 @@ | ||
#![no_std] | ||
|
||
multiversx_sc::imports!(); | ||
multiversx_sc::derive_imports!(); | ||
|
||
#[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)] | ||
pub enum SampleEnum { | ||
Value1, | ||
Value2, | ||
} | ||
#[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)] | ||
pub struct Structure<M: ManagedTypeApi> { | ||
pub field1: ManagedBuffer<M>, | ||
pub field2: SampleEnum, | ||
pub field3: ManagedBuffer<M>, | ||
} | ||
|
||
#[multiversx_sc::contract] | ||
pub trait LargeStorageBenchmark { | ||
#[init] | ||
fn init(&self) {} | ||
|
||
#[endpoint(saveStructure)] | ||
fn save_structure(&self, field1: ManagedBuffer, field2: SampleEnum, field3: ManagedBuffer) { | ||
let s = Structure { | ||
field1, | ||
field2, | ||
field3, | ||
}; | ||
self.structure().set(s); | ||
} | ||
|
||
#[view(savedStructure)] | ||
#[storage_mapper("savedStructure")] | ||
fn structure(&self) -> SingleValueMapper<Structure<Self::Api>>; | ||
} |
10 changes: 10 additions & 0 deletions
10
contracts/benchmarks/large-storage/tests/large_storage_scenario_go_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,10 @@ | ||
use multiversx_sc_scenario::*; | ||
|
||
fn world() -> ScenarioWorld { | ||
ScenarioWorld::vm_go() | ||
} | ||
|
||
#[test] | ||
fn large_storage_go() { | ||
world().run("scenarios/large_storage.scen.json"); | ||
} |
16 changes: 16 additions & 0 deletions
16
contracts/benchmarks/large-storage/tests/large_storage_scenario_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,16 @@ | ||
use multiversx_sc_scenario::*; | ||
|
||
fn world() -> ScenarioWorld { | ||
let mut blockchain = ScenarioWorld::new(); | ||
blockchain.set_current_dir_from_workspace("contracts/benchmarks/large-storage"); | ||
blockchain.register_contract( | ||
"file:output/large-storage.wasm", | ||
large_storage::ContractBuilder, | ||
); | ||
blockchain | ||
} | ||
|
||
#[test] | ||
fn large_storage_rs() { | ||
world().run("scenarios/large_storage.scen.json"); | ||
} |
Oops, something went wrong.