Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template renames #1184

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ permissions:
jobs:
contracts:
name: Contracts
uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v2
uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v2.3.0
with:
rust-toolchain: nightly-2022-12-08
rust-toolchain: nightly-2023-04-24
vmtools-version: v1.4.60
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,40 @@ They are:
- `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:
- Contracts can now choose their own allocator. This works in multi-contract contexts.
- New allocators: `fail` (default), `static64k`, `leaking`.
- Removed dependency to `wee_alloc`, but using it is still possible if the contract references it directly.
- Contract call stack size is now configurable in `multicontract.toml`.
- The 'panic with message' system now relies on managed buffers instead of on an allocator.
- Fixed BigUint bitwise operations in the debugger.
- When building contracts, an additional `.mxsc.json` file is created, which packs both the contract binary, the ABI, and some additional metadata.
- Refactor: reorganized the meta crate.
- Deprecated some legacy methods in the API wrappers.

## [sc 0.40.1, vm 0.2.1] - 2023-04-24
- Building contracts also triggers an EI check, which verifies compatibility with various VM versions. It currently only issues warnings.
- `ManagedVecItem` implementation for arrays.

## [sc 0.40.0, vm 0.2.0] - 2023-04-20
- Call value `egld_value` and `all_esdt_transfers` methods return `ManagedRef` instead of owned objects, because they are cached (to avoid accidental corruption of the underlying cache).

## [sc 0.39.8, vm 0.1.8] - 2023-03-29
- `multiversx-sc-meta` `test-gen` command: generates Rust integration tests based on scenarios present in the `scenarios` folder.
- `UnorderedSetMapper` `swap_indexes` method.

## [sc 0.39.7, vm 0.1.7] - 2023-03-18
- `TokenIdentifier` `ticker` method.
- `ManagedBuffer` `concat` method.
Expand Down
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
resolver = "2"

members = [
"data/codec",
"data/codec-derive",

"framework/base",
"framework/codec",
"framework/codec-derive",
"framework/derive",
"framework/meta",
"framework/scenario",
Expand All @@ -14,7 +15,6 @@ members = [
"sdk/core",
"sdk/scenario-format",

"tools/test-gen",
"tools/mxpy-snippet-generator",

"vm",
Expand All @@ -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 @@ -56,6 +58,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 <[email protected]>"]
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,4 @@
#[test]
fn large_storage_go() {
multiversx_sc_scenario::run_go("scenarios/large_storage.scen.json");
}
16 changes: 16 additions & 0 deletions contracts/benchmarks/large-storage/tests/large_storage_rs_test.rs
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() {
multiversx_sc_scenario::run_rs("scenarios/large_storage.scen.json", world());
}
Loading
Loading