Skip to content

Commit

Permalink
Merge pull request #1164 from multiversx/rc-42-merge-master
Browse files Browse the repository at this point in the history
Merge master -> rc/v0.42
  • Loading branch information
andrei-marinica committed Jul 14, 2023
2 parents 9f7d35f + 83814f7 commit c2697f8
Show file tree
Hide file tree
Showing 411 changed files with 4,625 additions and 2,325 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ They are:
- `multiversx-chain-scenario-format`, in short `scenario-format`, scenario JSON serializer/deserializer, 1 crate.
- `multiversx-sdk`, in short `sdk`, allows communication with the chain(s), 1 crate.


## [sc 0.41.3, vm 0.3.3] - 2023-06-19
- Bugfix on `ManagedBufferCachedBuilder`, involving large inputs.
- Explicit enum ABI: `OperationCompletionStatus` is now properly described in the ABI as an enum that gets serialized by name instead of discriminant.

## [sc 0.41.2, codec 0.17.2, vm 0.3.2] - 2023-06-09
- Releasing a new version of the codec, without the dependency to `wee_alloc`.

## [sc 0.41.1, vm 0.3.1] - 2023-05-15
- Fixed an edge case for the token storage mappers (`FungibleTokenMapper`, `NonFungibleTokenMapper`).

## [sc 0.41.0, vm 0.3.0] - 2023-05-05
- Fixed compatibility with rustc v1.71.0.
- Allocator system:
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ members = [
"contracts/benchmarks/mappers/single-value-repeat/meta",
"contracts/benchmarks/mappers/vec-repeat",
"contracts/benchmarks/mappers/vec-repeat/meta",
"contracts/benchmarks/large-storage",
"contracts/benchmarks/large-storage/meta",
"contracts/benchmarks/str-repeat",
"contracts/benchmarks/str-repeat/meta",
"contracts/benchmarks/send-tx-repeat",
Expand All @@ -57,6 +59,8 @@ members = [
"contracts/examples/crypto-bubbles/meta",
"contracts/examples/crypto-zombies",
"contracts/examples/crypto-zombies/meta",
"contracts/examples/check-pause",
"contracts/examples/check-pause/meta",
"contracts/examples/crypto-kitties/kitty-ownership",
"contracts/examples/crypto-kitties/kitty-ownership/meta",
"contracts/examples/crypto-kitties/kitty-genetic-alg",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The crowdfunding tutorial is a great place to start: https://docs.multiversx.com

# IDE

The framework is designed to be easiest to use with the Elrond IDE VSCode extension: https://marketplace.visualstudio.com/items?itemName=Elrond.vscode-elrond-ide
The framework is designed to be easiest to use with the IDE VSCode extension: https://marketplace.visualstudio.com/items?itemName=Elrond.vscode-elrond-ide

# Building contracts

Expand Down
7 changes: 7 additions & 0 deletions contracts/benchmarks/large-storage/.gitignore
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
17 changes: 17 additions & 0 deletions contracts/benchmarks/large-storage/Cargo.toml
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"
12 changes: 12 additions & 0 deletions contracts/benchmarks/large-storage/meta/Cargo.toml
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"
3 changes: 3 additions & 0 deletions contracts/benchmarks/large-storage/meta/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
multiversx_sc_meta::cli_main::<large_storage::AbiProvider>();
}
3 changes: 3 additions & 0 deletions contracts/benchmarks/large-storage/multiversx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"language": "rust"
}
1 change: 1 addition & 0 deletions contracts/benchmarks/large-storage/pi.txt

Large diffs are not rendered by default.

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": "*"
},
"+": ""
}
}
]
}
36 changes: 36 additions & 0 deletions contracts/benchmarks/large-storage/src/large_storage.rs
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>>;
}
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");
}
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");
}
Loading

0 comments on commit c2697f8

Please sign in to comment.