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

Fix #261 Failure on migration when EventsMode::CES to EventsMode::CES #262

Closed
wants to merge 2 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ All notable changes to this project will be documented in this file. The format

### Added

## Release 1.5.1

### Changed

- Add ACL in types of js_client (#256)
- Fix Wrong error on insertion of duplicated token identifier (#258)

### Added

- Optional custom string identifier in mint entrypoint (#255)

## Release 1.5.0

### Changed
Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ build-contract:
wasm-strip test-contracts/minting_contract/target/wasm32-unknown-unknown/release/minting_contract.wasm
wasm-strip test-contracts/transfer_filter_contract/target/wasm32-unknown-unknown/release/transfer_filter_contract.wasm

VERSIONS := 1_0_0 1_1_0 1_2_0 1_3_0 1_4_0 1_5_0

setup-test: build-contract
mkdir -p tests/wasm
mkdir -p tests/wasm/1_0_0; curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v1.0.0/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/1_0_0/
mkdir -p tests/wasm/1_1_0; curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v1.1.0/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/1_1_0/
mkdir -p tests/wasm/1_2_0; curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v1.2.0/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/1_2_0/
mkdir -p tests/wasm/1_3_0; curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v1.3.0/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/1_3_0/
mkdir -p tests/wasm/1_4_0; curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v1.4.0/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/1_4_0/
$(foreach version,$(VERSIONS), \
if [ ! -d "tests/wasm/$(version)" ]; then \
mkdir -p tests/wasm/$(version); \
curl -L https://github.com/casper-ecosystem/cep-78-enhanced-nft/releases/download/v$(subst _,.,$(version))/cep-78-wasm.tar.gz | tar zxv -C tests/wasm/$(version)/; \
fi; \
)

cp contract/target/wasm32-unknown-unknown/release/contract.wasm tests/wasm
cp client/mint_session/target/wasm32-unknown-unknown/release/mint_call.wasm tests/wasm
Expand Down
6 changes: 6 additions & 0 deletions client-js/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.5.1] - 2023-11-20

### Fixed

- Add ACL in types of js_client (#256)

## [1.5.0] - 2023-10-05

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion client-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "casper-cep78-js-client",
"version": "1.5.0",
"version": "1.5.1",
"description": "CEP78 Enhanced NFT JS Client",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion client/balance_of_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "balance_of_session"
version = "1.5.0"
version = "1.5.1"
edition = "2018"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/get_approved_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "get_approved_session"
version = "1.5.0"
version = "1.5.1"
edition = "2018"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/is_approved_for_all_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "is_approved_for_all_session"
version = "1.5.0"
version = "1.5.1"
edition = "2018"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/mint_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mint_session"
version = "1.5.0"
version = "1.5.1"
edition = "2018"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/owner_of_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "owner_of_session"
version = "1.5.0"
version = "1.5.1"
edition = "2018"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/transfer_session/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "transfer_session"
version = "1.5.0"
version = "1.5.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion client/updated_receipts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "updated_receipts"
version = "1.5.0"
version = "1.5.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "contract"
version = "1.5.0"
version = "1.5.1"
edition = "2018"

[dependencies]
Expand Down
22 changes: 17 additions & 5 deletions contract/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2009,15 +2009,27 @@ pub extern "C" fn migrate() {
.try_into()
.unwrap_or_revert();

match events_mode {
EventsMode::NoEvents => {}
EventsMode::CES => {
let current_events_mode = runtime::get_key(EVENTS_MODE)
.and_then(|_| {
utils::get_stored_value_with_user_errors::<u8>(
EVENTS_MODE,
NFTCoreError::MissingEventsMode,
NFTCoreError::InvalidEventsMode,
)
.try_into()
.ok()
})
.unwrap_or(EventsMode::NoEvents);

match (current_events_mode, events_mode) {
(EventsMode::CES, EventsMode::CES) => casper_event_standard::emit(Migration::new()),
(_, EventsMode::CES) => {
// Initialize events structures.
utils::init_events();
// Emit Migration event.
casper_event_standard::emit(Migration::new());
}
EventsMode::CEP47 => record_cep47_event_dictionary(CEP47Event::Migrate),
(_, EventsMode::CEP47) => record_cep47_event_dictionary(CEP47Event::Migrate),
(_, _) => {}
}

runtime::put_key(EVENTS_MODE, storage::new_uref(events_mode as u8).into());
Expand Down
2 changes: 1 addition & 1 deletion contract/src/modalities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ impl TryFrom<u8> for NamedKeyConventionMode {
}

#[repr(u8)]
#[derive(PartialEq, Eq)]
#[derive(PartialEq, Eq, Clone, Copy)]
#[allow(clippy::upper_case_acronyms)]
pub enum EventsMode {
NoEvents = 0,
Expand Down
2 changes: 1 addition & 1 deletion test-contracts/mangle_named_keys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mangle_named_keys"
version = "1.5.0"
version = "1.5.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion test-contracts/minting_contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minting_contract"
version = "1.5.0"
version = "1.5.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion test-contracts/transfer_filter_contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "transfer_filter_contract"
version = "1.5.0"
version = "1.5.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tests"
version = "1.5.0"
version = "1.5.1"
edition = "2018"
[dependencies]
casper-engine-test-support = { version = "5.0.0", default-features = false, features = [
Expand Down
Loading
Loading