Unverified Commit 69cd40e2 authored by Michael Müller's avatar Michael Müller
Browse files

Revert me: Add minimal contract which reproduces bug

parent aa725606
Pipeline #113424 passed with stages
in 5 minutes and 4 seconds
# Ignore build artifacts from the local tests sub-crate.
/target/
# Ignore backup files creates by cargo fmt.
**/*.rs.bk
# Remove Cargo.lock when creating an executable, leave it for libraries
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
Cargo.lock
\ No newline at end of file
[package]
name = "bug"
version = "3.0.0-rc2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
ink_primitives = { version = "3.0.0-rc2", path = "../../crates/primitives", default-features = false }
ink_metadata = { version = "3.0.0-rc2", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true }
ink_env = { version = "3.0.0-rc2", path = "../../crates/env", default-features = false }
ink_storage = { version = "3.0.0-rc2", path = "../../crates/storage", default-features = false }
ink_lang = { version = "3.0.0-rc2", path = "../../crates/lang", default-features = false }
scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true }
generic-array = "0.14.1"
[lib]
name = "bug"
path = "lib.rs"
crate-type = ["cdylib"]
[features]
default = ["std"]
std = [
"ink_primitives/std",
"ink_metadata",
"ink_metadata/std",
"ink_env/std",
"ink_storage/std",
"ink_lang/std",
"scale/std",
"scale-info",
"scale-info/std",
]
ink-as-dependency = []
// Copyright 2018-2020 Parity Technologies (UK) Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::new_without_default)]
use ink_lang as ink;
#[ink::contract]
mod bug {
use ink_storage::Lazy;
#[ink(storage)]
pub struct Bug {
opt: Option<u32>,
some_val: Lazy<u32>,
}
impl Bug {
#[ink(constructor)]
pub fn new() -> Self {
Self {
opt: None,
some_val: Lazy::new(27),
}
}
#[ink(message)]
pub fn bug(&mut self) -> Result<(), ()> {
ink_env::debug_println("get some_val");
let _ = *self.some_val;
ink_env::debug_println("set opt");
self.opt = Some(13);
ink_env::debug_println("end");
Ok(())
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment