From cd684b1e95628ed53fcfb86c1ab8ad716b6e7325 Mon Sep 17 00:00:00 2001 From: Jonas Pauli <49498646+jonas089@users.noreply.github.com> Date: Mon, 26 Feb 2024 17:06:38 +0100 Subject: [PATCH] Clippy eliminate warnings & seperate workspace for kairos-deposit-contract --- Cargo.lock | 122 +-- Cargo.toml | 9 +- kairos-contract-cli/src/cli.rs | 24 +- .../src/deployments/call_create_purse.rs | 7 +- .../src/deployments/call_incr_counter.rs | 5 +- .../src/deployments/get_counter.rs | 5 - .../src/deployments/get_deposit_event.rs | 4 - .../src/deployments/put_deposit_session.rs | 5 +- .../src/deployments/put_withdrawal_session.rs | 6 +- .../Cargo.lock | 0 .../Cargo.toml | 2 +- .../rust-toolchain.toml | 0 .../src/integration_tests.rs | 7 +- .../src/test_fixture.rs | 17 +- .../src/test_fixture/utils.rs | 2 +- kairos-deposit-contract/Cargo.lock | 857 ++++++++++++++++++ kairos-deposit-contract/Cargo.toml | 16 + .../build-macos-darwin-feat-2.0.sh | 20 +- .../build-ubuntu-feat-2.0.sh | 20 +- kairos-deposit-contract/contract/Cargo.toml | 4 +- .../contract/src/address.rs | 8 +- .../contract/src/constants.rs | 24 +- .../contract/src/detail.rs | 5 +- kairos-deposit-contract/contract/src/main.rs | 2 +- .../deposit-session/src/main.rs | 9 +- .../malicious-reader/src/main.rs | 10 +- .../malicious-session/src/main.rs | 9 +- kairos-deposit-contract/readme.md | 6 +- .../withdrawal-session/src/main.rs | 9 +- 29 files changed, 985 insertions(+), 229 deletions(-) rename {kairos-deposit-contract/tests => kairos-deposit-contract-tests}/Cargo.lock (100%) rename {kairos-deposit-contract/tests => kairos-deposit-contract-tests}/Cargo.toml (95%) rename {kairos-deposit-contract/tests => kairos-deposit-contract-tests}/rust-toolchain.toml (100%) rename {kairos-deposit-contract/tests => kairos-deposit-contract-tests}/src/integration_tests.rs (94%) rename {kairos-deposit-contract/tests => kairos-deposit-contract-tests}/src/test_fixture.rs (92%) rename {kairos-deposit-contract/tests => kairos-deposit-contract-tests}/src/test_fixture/utils.rs (97%) create mode 100644 kairos-deposit-contract/Cargo.lock create mode 100644 kairos-deposit-contract/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index ff886a32..5fe10b7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -235,7 +235,7 @@ checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object", @@ -381,7 +381,6 @@ source = "git+https://github.com/jonas089/casper-node?rev=0bcc25f4a203be4e78eed6 dependencies = [ "casper-types", "hex_fmt", - "wee_alloc", ] [[package]] @@ -570,12 +569,6 @@ dependencies = [ "libc", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -644,16 +637,6 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "contract" -version = "0.1.0" -dependencies = [ - "casper-contract", - "casper-types", - "contract-types", - "serde-json-wasm", -] - [[package]] name = "contract-types" version = "0.1.0" @@ -747,7 +730,7 @@ version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest 0.10.7", @@ -789,14 +772,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "deposit-session" -version = "0.1.0" -dependencies = [ - "casper-contract", - "casper-types", -] - [[package]] name = "der" version = "0.7.8" @@ -950,7 +925,7 @@ version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1128,7 +1103,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi", ] @@ -1571,7 +1546,7 @@ version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa", "elliptic-curve", "sha2", @@ -1593,6 +1568,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "kairos-deposit-contract-tests" +version = "0.1.0" +dependencies = [ + "base64 0.21.7", + "casper-contract", + "casper-engine-test-support", + "casper-execution-engine", + "casper-types", +] + [[package]] name = "kairos-server" version = "0.1.0" @@ -1708,22 +1694,6 @@ dependencies = [ "value-bag", ] -[[package]] -name = "malicious-reader" -version = "0.1.0" -dependencies = [ - "casper-contract", - "casper-types", -] - -[[package]] -name = "malicious-session" -version = "0.1.0" -dependencies = [ - "casper-contract", - "casper-types", -] - [[package]] name = "match_cfg" version = "0.1.0" @@ -1947,7 +1917,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ "bitflags 2.4.2", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -2006,7 +1976,7 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -2532,15 +2502,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-json-wasm" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5" -dependencies = [ - "serde", -] - [[package]] name = "serde-map-to-array" version = "1.1.1" @@ -2635,7 +2596,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.7", ] @@ -2646,7 +2607,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.7", ] @@ -2820,7 +2781,7 @@ version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "redox_syscall", "rustix", @@ -2846,17 +2807,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "tests" -version = "0.1.0" -dependencies = [ - "base64 0.21.7", - "casper-contract", - "casper-engine-test-support", - "casper-execution-engine", - "casper-types", -] - [[package]] name = "thiserror" version = "1.0.56" @@ -2883,7 +2833,7 @@ version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -3209,7 +3159,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f21b881cd6636ece9735721cf03c1fe1e774fe258683d084bb2812ab67435749" dependencies = [ "anyhow", - "cfg-if 1.0.0", + "cfg-if", "enum-iterator", "getset", "git2", @@ -3254,7 +3204,7 @@ version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -3279,7 +3229,7 @@ version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -3324,18 +3274,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - [[package]] name = "winapi" version = "0.3.9" @@ -3505,18 +3443,10 @@ version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "windows-sys 0.48.0", ] -[[package]] -name = "withdrawal-session" -version = "0.1.0" -dependencies = [ - "casper-contract", - "casper-types", -] - [[package]] name = "yansi" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index 02a94010..40546f16 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,17 +4,12 @@ resolver = "2" members = [ "kairos-cli", "kairos-server", - "kairos-deposit-contract/contract", - "kairos-deposit-contract/malicious-reader", - "kairos-deposit-contract/malicious-session", - "kairos-deposit-contract/tests", - "kairos-deposit-contract/withdrawal-session", + "kairos-deposit-contract-tests", "kairos-deposit-contract/contract-types", - "kairos-deposit-contract/deposit-session", "kairos-contract-cli" ] [workspace.package] name = "kairos" version = "0.1.0" -edition = "2021" +edition = "2021" \ No newline at end of file diff --git a/kairos-contract-cli/src/cli.rs b/kairos-contract-cli/src/cli.rs index b4663595..d714b977 100644 --- a/kairos-contract-cli/src/cli.rs +++ b/kairos-contract-cli/src/cli.rs @@ -1,12 +1,11 @@ use std::i64; use crate::deployments::{ - call_create_purse, call_incr_counter, deploy_handler, get_deposit_event, put_deposit_session, + call_create_purse, call_incr_counter, get_counter, get_deposit_event, put_deposit_session, put_withdrawal_session, }; use casper_types::{URef, U512}; -use clap::{Command, Parser, Subcommand}; -use kairos_contract_cli::deployments::get_counter; +use clap::{Parser, Subcommand}; #[derive(Parser)] #[command(author, version, about, long_about = None)] #[command(propagate_version = true)] @@ -15,6 +14,10 @@ struct Cli { command: Option, } +// I want to allow CAPS here, +// because these enum variants are constant methods. +#[allow(non_camel_case_types)] +#[allow(clippy::upper_case_acronyms)] #[derive(Subcommand)] enum Commands { CREATE_PURSE { @@ -139,7 +142,7 @@ pub async fn commander() { wasm_path, contract_addr, U512::from(*amount), - URef::from_formatted_str(&destination).unwrap(), + URef::from_formatted_str(destination).unwrap(), ) .await; println!("Deploy Hash: {:?}", &withdrawal_hash); @@ -167,20 +170,19 @@ pub async fn commander() { let value = get_counter::get( node_address, rpc_port.to_owned(), - URef::from_formatted_str(&counter_uref).unwrap(), + URef::from_formatted_str(counter_uref).unwrap(), ) .await; println!("Counter value: {:?}", &value); } None => { println!( + " + Possible commands: + + create_purse, get_counter, get_deposit, incr_counter, deposit, withdrawal " - This cli-tool is used in a complex build environment that depends on many branches and is only for development. - \n - If you're not sure how to use this tool, then it is currently not for you. Please check back later and follow R&D progress on Kairos L2 development. - \n - Much love :) - "); + ); } } } diff --git a/kairos-contract-cli/src/deployments/call_create_purse.rs b/kairos-contract-cli/src/deployments/call_create_purse.rs index 92ca8b8e..d147cd49 100644 --- a/kairos-contract-cli/src/deployments/call_create_purse.rs +++ b/kairos-contract-cli/src/deployments/call_create_purse.rs @@ -29,7 +29,7 @@ pub async fn call( let secret_key_bytes = fs::read(secret_key_path).unwrap(); let secret_key: SecretKey = SecretKey::from_pem(secret_key_bytes.clone()).unwrap(); let layer_one_deploy_handler = LayerOneDeployHandler { - node_address: node_address, + node_address, rpc_port: JsonRpcId::String(rpc_port), secret_key, }; @@ -37,9 +37,8 @@ pub async fn call( chain_name, raw_deploy, &SecretKey::from_pem(secret_key_bytes.clone()).unwrap(), - 10_000_000_0000u64, + 100_000_000_000u64, ); deploy.sign(&SecretKey::from_pem(secret_key_bytes).unwrap()); - let deploy_result = layer_one_deploy_handler.put_deploy(deploy).await; - deploy_result + layer_one_deploy_handler.put_deploy(deploy).await } diff --git a/kairos-contract-cli/src/deployments/call_incr_counter.rs b/kairos-contract-cli/src/deployments/call_incr_counter.rs index 2f994231..ccb0643f 100644 --- a/kairos-contract-cli/src/deployments/call_incr_counter.rs +++ b/kairos-contract-cli/src/deployments/call_incr_counter.rs @@ -29,7 +29,7 @@ pub async fn call( let secret_key_bytes = fs::read(secret_key_path).unwrap(); let secret_key: SecretKey = SecretKey::from_pem(secret_key_bytes.clone()).unwrap(); let layer_one_deploy_handler = LayerOneDeployHandler { - node_address: node_address, + node_address, rpc_port: JsonRpcId::String(rpc_port), secret_key, }; @@ -40,6 +40,5 @@ pub async fn call( 100_000_000_000u64, ); deploy.sign(&SecretKey::from_pem(secret_key_bytes).unwrap()); - let deploy_result = layer_one_deploy_handler.put_deploy(deploy).await; - deploy_result + layer_one_deploy_handler.put_deploy(deploy).await } diff --git a/kairos-contract-cli/src/deployments/get_counter.rs b/kairos-contract-cli/src/deployments/get_counter.rs index a7d1ecad..55572400 100644 --- a/kairos-contract-cli/src/deployments/get_counter.rs +++ b/kairos-contract-cli/src/deployments/get_counter.rs @@ -1,10 +1,5 @@ use casper_client::{get_state_root_hash, query_global_state, JsonRpcId, Verbosity}; use casper_types::{URef, U512}; -use contract_types::Deposit; -use serde_json; -extern crate alloc; -use alloc::{string::ToString, vec::Vec}; - /* GET_COUNTER { node_address: String, diff --git a/kairos-contract-cli/src/deployments/get_deposit_event.rs b/kairos-contract-cli/src/deployments/get_deposit_event.rs index ec9e78af..44fe41e0 100644 --- a/kairos-contract-cli/src/deployments/get_deposit_event.rs +++ b/kairos-contract-cli/src/deployments/get_deposit_event.rs @@ -1,10 +1,6 @@ use casper_client::{get_dictionary_item, get_state_root_hash, JsonRpcId, Verbosity}; use casper_types::URef; use contract_types::Deposit; -use serde_json; -extern crate alloc; -use alloc::{string::ToString, vec::Vec}; - /* GET_DEPOSIT { node_address: String, diff --git a/kairos-contract-cli/src/deployments/put_deposit_session.rs b/kairos-contract-cli/src/deployments/put_deposit_session.rs index 30f9f2bf..43af7a98 100644 --- a/kairos-contract-cli/src/deployments/put_deposit_session.rs +++ b/kairos-contract-cli/src/deployments/put_deposit_session.rs @@ -38,7 +38,7 @@ pub async fn put( let secret_key_bytes = fs::read(secret_key_path).unwrap(); let secret_key: SecretKey = SecretKey::from_pem(secret_key_bytes.clone()).unwrap(); let layer_one_deploy_handler = LayerOneDeployHandler { - node_address: node_address, + node_address, rpc_port: JsonRpcId::String(rpc_port), secret_key, }; @@ -49,6 +49,5 @@ pub async fn put( 100_000_000_000u64, ); deploy.sign(&SecretKey::from_pem(secret_key_bytes).unwrap()); - let deploy_result = layer_one_deploy_handler.put_deploy(deploy).await; - deploy_result + layer_one_deploy_handler.put_deploy(deploy).await } diff --git a/kairos-contract-cli/src/deployments/put_withdrawal_session.rs b/kairos-contract-cli/src/deployments/put_withdrawal_session.rs index e47b711f..ea2646bd 100644 --- a/kairos-contract-cli/src/deployments/put_withdrawal_session.rs +++ b/kairos-contract-cli/src/deployments/put_withdrawal_session.rs @@ -18,6 +18,7 @@ use std::fs; destination: String */ +#[allow(clippy::too_many_arguments)] pub async fn put( node_address: String, rpc_port: String, @@ -42,7 +43,7 @@ pub async fn put( let secret_key_bytes = fs::read(secret_key_path).unwrap(); let secret_key: SecretKey = SecretKey::from_pem(secret_key_bytes.clone()).unwrap(); let layer_one_deploy_handler = LayerOneDeployHandler { - node_address: node_address, + node_address, rpc_port: JsonRpcId::String(rpc_port), secret_key, }; @@ -53,6 +54,5 @@ pub async fn put( 100_000_000_000u64, ); deploy.sign(&SecretKey::from_pem(secret_key_bytes).unwrap()); - let deploy_result = layer_one_deploy_handler.put_deploy(deploy).await; - deploy_result + layer_one_deploy_handler.put_deploy(deploy).await } diff --git a/kairos-deposit-contract/tests/Cargo.lock b/kairos-deposit-contract-tests/Cargo.lock similarity index 100% rename from kairos-deposit-contract/tests/Cargo.lock rename to kairos-deposit-contract-tests/Cargo.lock diff --git a/kairos-deposit-contract/tests/Cargo.toml b/kairos-deposit-contract-tests/Cargo.toml similarity index 95% rename from kairos-deposit-contract/tests/Cargo.toml rename to kairos-deposit-contract-tests/Cargo.toml index 77d49517..9c3566f5 100644 --- a/kairos-deposit-contract/tests/Cargo.toml +++ b/kairos-deposit-contract-tests/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tests" +name = "kairos-deposit-contract-tests" version = "0.1.0" edition = "2021" diff --git a/kairos-deposit-contract/tests/rust-toolchain.toml b/kairos-deposit-contract-tests/rust-toolchain.toml similarity index 100% rename from kairos-deposit-contract/tests/rust-toolchain.toml rename to kairos-deposit-contract-tests/rust-toolchain.toml diff --git a/kairos-deposit-contract/tests/src/integration_tests.rs b/kairos-deposit-contract-tests/src/integration_tests.rs similarity index 94% rename from kairos-deposit-contract/tests/src/integration_tests.rs rename to kairos-deposit-contract-tests/src/integration_tests.rs index bc4bc01b..bb31bc54 100644 --- a/kairos-deposit-contract/tests/src/integration_tests.rs +++ b/kairos-deposit-contract-tests/src/integration_tests.rs @@ -2,10 +2,7 @@ mod test_fixture; #[cfg(test)] mod tests { use crate::test_fixture::TestContext; - use casper_types::{ - account::{self, AccountHash}, - U512, - }; + use casper_types::{account::AccountHash, U512}; #[test] fn should_install() { @@ -14,7 +11,7 @@ mod tests { } fn setup() -> (TestContext, AccountHash) { - let mut fixture: TestContext = TestContext::new(); + let fixture: TestContext = TestContext::new(); let installer = fixture.account_1; return (fixture, installer); } diff --git a/kairos-deposit-contract/tests/src/test_fixture.rs b/kairos-deposit-contract-tests/src/test_fixture.rs similarity index 92% rename from kairos-deposit-contract/tests/src/test_fixture.rs rename to kairos-deposit-contract-tests/src/test_fixture.rs index cd2fb24f..8cb86bc9 100644 --- a/kairos-deposit-contract/tests/src/test_fixture.rs +++ b/kairos-deposit-contract-tests/src/test_fixture.rs @@ -3,10 +3,9 @@ use casper_engine_test_support::{ ExecuteRequestBuilder, LmdbWasmTestBuilder, DEFAULT_ACCOUNT_ADDR, PRODUCTION_RUN_GENESIS_REQUEST, }; -use casper_execution_engine::Address; use casper_types::{ - account::AccountHash, addressable_entity::NamedKeys, bytesrepr::FromBytes, runtime_args, - AddressableEntityHash, Key, RuntimeArgs, URef, U512, + account::AccountHash, addressable_entity::NamedKeys, runtime_args, AddressableEntityHash, Key, + URef, U512, }; use utils::create_funded_dummy_account; @@ -14,9 +13,6 @@ pub const ACCOUNT_USER_1: [u8; 32] = [1u8; 32]; pub const ACCOUNT_USER_2: [u8; 32] = [2u8; 32]; pub const ACCOUNT_USER_3: [u8; 32] = [3u8; 32]; -#[derive(Clone, Copy)] -pub struct Sender(pub AccountHash); - #[cfg(test)] pub struct TestContext { pub builder: LmdbWasmTestBuilder, @@ -125,6 +121,7 @@ impl TestContext { seed_uref } + #[allow(dead_code)] pub fn get_contract_purse_balance(&self, account: AccountHash) -> U512 { let seed_uref: URef = *self .contract_named_keys("kairos_deposit_contract", "kairos_deposit_purse", account) @@ -154,8 +151,10 @@ impl TestContext { amount: U512, account: AccountHash, ) { + /* let contract_hash: AddressableEntityHash = self.contract_hash("kairos_deposit_contract", account); + */ let session_args = runtime_args! { "amount" => amount, "deposit_contract" => self.contract_hash("kairos_deposit_contract", account) @@ -175,8 +174,6 @@ impl TestContext { amount: U512, account: AccountHash, ) { - let contract_hash: AddressableEntityHash = - self.contract_hash("kairos_deposit_contract", account); let session_args = runtime_args! { "amount" => amount, "deposit_contract" => self.contract_hash("kairos_deposit_contract", account) @@ -196,8 +193,6 @@ impl TestContext { amount: U512, account: AccountHash, ) { - let contract_hash: AddressableEntityHash = - self.contract_hash("kairos_deposit_contract", account); let session_args = runtime_args! { "amount" => amount, "deposit_contract" => self.contract_hash("kairos_deposit_contract", account) @@ -218,8 +213,6 @@ impl TestContext { account: AccountHash, deposit_purse_uref: URef, ) { - let contract_hash: AddressableEntityHash = - self.contract_hash("kairos_deposit_contract", account); let session_args = runtime_args! { "amount" => amount, "deposit_contract" => self.contract_hash("kairos_deposit_contract", account), diff --git a/kairos-deposit-contract/tests/src/test_fixture/utils.rs b/kairos-deposit-contract-tests/src/test_fixture/utils.rs similarity index 97% rename from kairos-deposit-contract/tests/src/test_fixture/utils.rs rename to kairos-deposit-contract-tests/src/test_fixture/utils.rs index daa72ade..93bbe1a3 100644 --- a/kairos-deposit-contract/tests/src/test_fixture/utils.rs +++ b/kairos-deposit-contract-tests/src/test_fixture/utils.rs @@ -6,7 +6,7 @@ use casper_types::{ account::AccountHash, runtime_args, system::{handle_payment::ARG_TARGET, mint::ARG_ID}, - PublicKey, RuntimeArgs, SecretKey, + PublicKey, SecretKey, }; // Creates a dummy account and transfer funds to it diff --git a/kairos-deposit-contract/Cargo.lock b/kairos-deposit-contract/Cargo.lock new file mode 100644 index 00000000..d5b30a3e --- /dev/null +++ b/kairos-deposit-contract/Cargo.lock @@ -0,0 +1,857 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base16" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27c3610c36aee21ce8ac510e6224498de4228ad772a171ed65643a24693a5a8" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "blake2" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174" +dependencies = [ + "crypto-mac", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "casper-contract" +version = "3.0.0" +source = "git+https://github.com/jonas089/casper-node?rev=0bcc25f4a203be4e78eed679b54127ab1ed848ab#0bcc25f4a203be4e78eed679b54127ab1ed848ab" +dependencies = [ + "casper-types", + "hex_fmt", + "wee_alloc", +] + +[[package]] +name = "casper-types" +version = "3.0.0" +source = "git+https://github.com/jonas089/casper-node?rev=0bcc25f4a203be4e78eed679b54127ab1ed848ab#0bcc25f4a203be4e78eed679b54127ab1ed848ab" +dependencies = [ + "base16", + "base64", + "bitflags", + "blake2", + "derive_more", + "ed25519-dalek", + "hex", + "hex_fmt", + "itertools", + "k256", + "num", + "num-derive", + "num-integer", + "num-rational", + "num-traits", + "rand", + "serde", + "serde-map-to-array", + "serde_bytes", + "serde_json", + "tracing", + "uint", +] + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "contract" +version = "0.1.0" +dependencies = [ + "casper-contract", + "casper-types", + "contract-types", + "serde-json-wasm", +] + +[[package]] +name = "contract-types" +version = "0.1.0" +dependencies = [ + "casper-types", + "serde", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "platforms", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.51", +] + +[[package]] +name = "deposit-session" +version = "0.1.0" +dependencies = [ + "casper-contract", + "casper-types", +] + +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex_fmt" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if 1.0.0", + "ecdsa", + "elliptic-curve", + "sha2", +] + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "malicious-reader" +version = "0.1.0" +dependencies = [ + "casper-contract", + "casper-types", +] + +[[package]] +name = "malicious-session" +version = "0.1.0" +dependencies = [ + "casper-contract", + "casper-types", +] + +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + +[[package]] +name = "num" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "platforms" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" + +[[package]] +name = "serde" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-json-wasm" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5" +dependencies = [ + "serde", +] + +[[package]] +name = "serde-map-to-array" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c14b52efc56c711e0dbae3f26e0cc233f5dac336c1bf0b07e1b7dc2dca3b2cc7" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_bytes" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.51", +] + +[[package]] +name = "serde_json" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wee_alloc" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "memory_units", + "winapi", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "withdrawal-session" +version = "0.1.0" +dependencies = [ + "casper-contract", + "casper-types", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/kairos-deposit-contract/Cargo.toml b/kairos-deposit-contract/Cargo.toml new file mode 100644 index 00000000..6586b22c --- /dev/null +++ b/kairos-deposit-contract/Cargo.toml @@ -0,0 +1,16 @@ +[workspace] +resolver = "2" + +members = [ + "malicious-reader", + "malicious-session", + "withdrawal-session", + "deposit-session", + "contract-types", + "contract" +] + +[workspace.package] +name = "kairos-deposit-contract" +version = "0.1.0" +edition = "2021" \ No newline at end of file diff --git a/kairos-deposit-contract/build-macos-darwin-feat-2.0.sh b/kairos-deposit-contract/build-macos-darwin-feat-2.0.sh index b256b91e..e18b6ae3 100755 --- a/kairos-deposit-contract/build-macos-darwin-feat-2.0.sh +++ b/kairos-deposit-contract/build-macos-darwin-feat-2.0.sh @@ -7,21 +7,21 @@ rustup target add wasm32-unknown-unknown mkdir -p /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release cargo build -p contract --release --target wasm32-unknown-unknown -wasm-opt --strip-debug --signext-lowering ../target/wasm32-unknown-unknown/release/deposit-contract.wasm -o ../target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm +wasm-opt --strip-debug --signext-lowering ./target/wasm32-unknown-unknown/release/deposit-contract.wasm -o ./target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm cargo build -p deposit-session --release --target wasm32-unknown-unknown -wasm-opt --strip-debug --signext-lowering ../target/wasm32-unknown-unknown/release/deposit-session.wasm -o ../target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm -cp ../target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm -cp ../target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm +wasm-opt --strip-debug --signext-lowering ./target/wasm32-unknown-unknown/release/deposit-session.wasm -o ./target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm +cp ./target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm +cp ./target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm cargo build -p malicious-session --release --target wasm32-unknown-unknown -wasm-opt --strip-debug --signext-lowering ../target/wasm32-unknown-unknown/release/malicious-session.wasm -o ../target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm -cp ../target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm +wasm-opt --strip-debug --signext-lowering ./target/wasm32-unknown-unknown/release/malicious-session.wasm -o ./target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm +cp ./target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm cargo build -p withdrawal-session --release --target wasm32-unknown-unknown -wasm-opt --strip-debug --signext-lowering ../target/wasm32-unknown-unknown/release/withdrawal-session.wasm -o ../target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm -cp ../target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm +wasm-opt --strip-debug --signext-lowering ./target/wasm32-unknown-unknown/release/withdrawal-session.wasm -o ./target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm +cp ./target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm cargo build -p malicious-reader --release --target wasm32-unknown-unknown -wasm-opt --strip-debug --signext-lowering ../target/wasm32-unknown-unknown/release/malicious-reader.wasm -o ../target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm -cp ../target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm +wasm-opt --strip-debug --signext-lowering ./target/wasm32-unknown-unknown/release/malicious-reader.wasm -o ./target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm +cp ./target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm /Users/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm diff --git a/kairos-deposit-contract/build-ubuntu-feat-2.0.sh b/kairos-deposit-contract/build-ubuntu-feat-2.0.sh index abc6cecb..daa5ef10 100755 --- a/kairos-deposit-contract/build-ubuntu-feat-2.0.sh +++ b/kairos-deposit-contract/build-ubuntu-feat-2.0.sh @@ -6,21 +6,21 @@ rustup target add wasm32-unknown-unknown mkdir -p /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release cargo build -p contract --release --target wasm32-unknown-unknown -wasm-opt --strip-debug --signext-lowering ../target/wasm32-unknown-unknown/release/deposit-contract.wasm -o ../target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm +wasm-opt --strip-debug --signext-lowering ./target/wasm32-unknown-unknown/release/deposit-contract.wasm -o ./target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm cargo build -p deposit-session --release --target wasm32-unknown-unknown -wasm-opt --strip-debug --signext-lowering ../target/wasm32-unknown-unknown/release/deposit-session.wasm -o ../target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm -cp ../target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm -cp ../target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm +wasm-opt --strip-debug --signext-lowering ./target/wasm32-unknown-unknown/release/deposit-session.wasm -o ./target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm +cp ./target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/deposit-session-optimized.wasm +cp ./target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/deposit-contract-optimized.wasm cargo build -p malicious-session --release --target wasm32-unknown-unknown -wasm-opt --strip-debug --signext-lowering ../target/wasm32-unknown-unknown/release/malicious-session.wasm -o ../target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm -cp ../target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm +wasm-opt --strip-debug --signext-lowering ./target/wasm32-unknown-unknown/release/malicious-session.wasm -o ./target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm +cp ./target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/malicious-session-optimized.wasm cargo build -p withdrawal-session --release --target wasm32-unknown-unknown -wasm-opt --strip-debug --signext-lowering ../target/wasm32-unknown-unknown/release/withdrawal-session.wasm -o ../target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm -cp ../target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm +wasm-opt --strip-debug --signext-lowering ./target/wasm32-unknown-unknown/release/withdrawal-session.wasm -o ./target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm +cp ./target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/withdrawal-session-optimized.wasm cargo build -p malicious-reader --release --target wasm32-unknown-unknown -wasm-opt --strip-debug --signext-lowering ../target/wasm32-unknown-unknown/release/malicious-reader.wasm -o ../target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm -cp ../target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm +wasm-opt --strip-debug --signext-lowering ./target/wasm32-unknown-unknown/release/malicious-reader.wasm -o ./target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm +cp ./target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm /home/$user/.cargo/git/checkouts/casper-node-$version/target/wasm32-unknown-unknown/release/malicious-reader-optimized.wasm diff --git a/kairos-deposit-contract/contract/Cargo.toml b/kairos-deposit-contract/contract/Cargo.toml index e3596de2..0064f5c5 100644 --- a/kairos-deposit-contract/contract/Cargo.toml +++ b/kairos-deposit-contract/contract/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -casper-contract = {git = "https://github.com/jonas089/casper-node", rev="0bcc25f4a203be4e78eed679b54127ab1ed848ab", default-features=false} -casper-types = {git = "https://github.com/jonas089/casper-node", rev="0bcc25f4a203be4e78eed679b54127ab1ed848ab"} +casper-contract = {git = "https://github.com/jonas089/casper-node", rev="0bcc25f4a203be4e78eed679b54127ab1ed848ab", features=["std"]} +casper-types = {git = "https://github.com/jonas089/casper-node", rev="0bcc25f4a203be4e78eed679b54127ab1ed848ab", default-features=false} contract-types = {path = "../contract-types"} serde-json-wasm = "1.0.1" diff --git a/kairos-deposit-contract/contract/src/address.rs b/kairos-deposit-contract/contract/src/address.rs index 27ada440..b028a269 100644 --- a/kairos-deposit-contract/contract/src/address.rs +++ b/kairos-deposit-contract/contract/src/address.rs @@ -1,11 +1,5 @@ //! Implementation of an `Address` which refers either an account hash, or a contract hash. -use alloc::vec::Vec; -use casper_types::{ - account::AccountHash, - bytesrepr::{self, FromBytes, ToBytes}, - contracts::ContractPackageHash, - AddressableEntity, AddressableEntityHash, CLType, CLTyped, Key, PackageHash, -}; +use casper_types::{account::AccountHash, CLType, CLTyped, Key, PackageHash}; /// An enum representing an [`AccountHash`] or a [`ContractPackageHash`]. #[derive(PartialOrd, Ord, PartialEq, Eq, Hash, Clone, Copy, Debug)] diff --git a/kairos-deposit-contract/contract/src/constants.rs b/kairos-deposit-contract/contract/src/constants.rs index 339ab085..1b29462a 100644 --- a/kairos-deposit-contract/contract/src/constants.rs +++ b/kairos-deposit-contract/contract/src/constants.rs @@ -1,14 +1,14 @@ -pub const KAIROS_DEPOSIT_CONTRACT_NAME: &'static str = "kairos_deposit_contract"; -pub const KAIROS_DEPOSIT_CONTRACT_PACKAGE: &'static str = "deposit_contract_package"; -pub const KAIROS_DEPOSIT_CONTRACT: &'static str = "deposit_contract"; +pub const KAIROS_DEPOSIT_CONTRACT_NAME: &str = "kairos_deposit_contract"; +pub const KAIROS_DEPOSIT_CONTRACT_PACKAGE: &str = "deposit_contract_package"; +pub const KAIROS_DEPOSIT_CONTRACT: &str = "deposit_contract"; -pub const KAIROS_DEPOSIT_EVENT_DICT: &'static str = "kairos_deposit_event_dict"; -pub const KAIROS_MOST_RECENT_DEPOSIT_COUNTER: &'static str = "most_recent_deposit_counter"; -pub const KAIROS_LAST_PROCESSED_DEPOSIT_COUNTER: &'static str = "last_processed_deposit_counter"; -pub const KAIROS_DEPOSIT_PURSE: &'static str = "kairos_deposit_purse"; -pub const KAIROS_AMOUNT: &'static str = "amount"; +pub const KAIROS_DEPOSIT_EVENT_DICT: &str = "kairos_deposit_event_dict"; +pub const KAIROS_MOST_RECENT_DEPOSIT_COUNTER: &str = "most_recent_deposit_counter"; +pub const KAIROS_LAST_PROCESSED_DEPOSIT_COUNTER: &str = "last_processed_deposit_counter"; +pub const KAIROS_DEPOSIT_PURSE: &str = "kairos_deposit_purse"; +pub const KAIROS_AMOUNT: &str = "amount"; -pub const KAIROS_ADMIN: &'static str = "admin"; -pub const KAIROS_NEW_ADMIN: &'static str = "new_admin"; -pub const KAIROS_TEMP_PURSE: &'static str = "temp_purse"; -pub const KAIROS_DESTINATION_PURSE: &'static str = "destination_purse"; +pub const KAIROS_ADMIN: &str = "admin"; +pub const KAIROS_NEW_ADMIN: &str = "new_admin"; +pub const KAIROS_TEMP_PURSE: &str = "temp_purse"; +pub const KAIROS_DESTINATION_PURSE: &str = "destination_purse"; diff --git a/kairos-deposit-contract/contract/src/detail.rs b/kairos-deposit-contract/contract/src/detail.rs index 266a3baa..6b56d6a0 100644 --- a/kairos-deposit-contract/contract/src/detail.rs +++ b/kairos-deposit-contract/contract/src/detail.rs @@ -3,9 +3,10 @@ use casper_contract::{ contract_api::{runtime, storage}, unwrap_or_revert::UnwrapOrRevert, }; -use casper_types::{bytesrepr::FromBytes, system::CallStackElement, ApiError, CLTyped, Key, URef}; +use casper_types::{bytesrepr::FromBytes, system::CallStackElement, ApiError, CLTyped, URef}; use core::convert::TryInto; +#[allow(dead_code)] /// Gets [`URef`] under a name. pub(crate) fn get_uref(name: &str) -> URef { let key = runtime::get_key(name) @@ -14,6 +15,7 @@ pub(crate) fn get_uref(name: &str) -> URef { key.try_into().unwrap_or_revert() } +#[allow(dead_code)] /// Reads value from a named key. pub(crate) fn read_from(name: &str) -> T where @@ -41,6 +43,7 @@ fn call_stack_element_to_address(call_stack_element: CallStackElement) -> Addres } } +#[allow(clippy::manual_next_back)] pub(crate) fn get_immediate_caller_address() -> Result { let call_stack = runtime::get_call_stack(); let top_of_the_stack = call_stack diff --git a/kairos-deposit-contract/contract/src/main.rs b/kairos-deposit-contract/contract/src/main.rs index 880481d9..75825491 100644 --- a/kairos-deposit-contract/contract/src/main.rs +++ b/kairos-deposit-contract/contract/src/main.rs @@ -91,7 +91,7 @@ pub extern "C" fn deposit() { .unwrap(); let new_deposit_record: Deposit = Deposit { account: Key::from(get_second_caller_address().unwrap_or_revert()), - amount: amount, + amount, }; let kairos_deposit_event_dict_uref = runtime::get_key(KAIROS_DEPOSIT_EVENT_DICT) diff --git a/kairos-deposit-contract/deposit-session/src/main.rs b/kairos-deposit-contract/deposit-session/src/main.rs index b54cf12a..c24499b4 100644 --- a/kairos-deposit-contract/deposit-session/src/main.rs +++ b/kairos-deposit-contract/deposit-session/src/main.rs @@ -1,12 +1,7 @@ #![no_std] #![no_main] -extern crate alloc; -use alloc::string::String; -use casper_contract::{ - contract_api::{account, runtime, storage, system}, - unwrap_or_revert::UnwrapOrRevert, -}; -use casper_types::{runtime_args, AddressableEntityHash, ApiError, Key, RuntimeArgs, URef, U512}; +use casper_contract::contract_api::{account, runtime, system}; +use casper_types::{runtime_args, AddressableEntityHash, URef, U512}; #[no_mangle] pub extern "C" fn call() { diff --git a/kairos-deposit-contract/malicious-reader/src/main.rs b/kairos-deposit-contract/malicious-reader/src/main.rs index 8935de87..ad2b77d0 100644 --- a/kairos-deposit-contract/malicious-reader/src/main.rs +++ b/kairos-deposit-contract/malicious-reader/src/main.rs @@ -1,16 +1,10 @@ #![no_std] #![no_main] -extern crate alloc; -use alloc::string::String; -use casper_contract::{ - contract_api::{account, runtime, storage, system}, - unwrap_or_revert::UnwrapOrRevert, -}; -use casper_types::{runtime_args, AddressableEntityHash, ApiError, Key, RuntimeArgs, URef, U512}; +use casper_contract::contract_api::{account, runtime, system}; +use casper_types::{URef, U512}; #[no_mangle] pub extern "C" fn call() { - let contract_hash: AddressableEntityHash = runtime::get_named_arg("deposit_contract"); let amount: U512 = runtime::get_named_arg("amount"); let purse_uref: URef = runtime::get_named_arg("purse_uref"); let destination_purse: URef = account::get_main_purse(); diff --git a/kairos-deposit-contract/malicious-session/src/main.rs b/kairos-deposit-contract/malicious-session/src/main.rs index 7ede6070..1073af7b 100644 --- a/kairos-deposit-contract/malicious-session/src/main.rs +++ b/kairos-deposit-contract/malicious-session/src/main.rs @@ -1,12 +1,7 @@ #![no_std] #![no_main] -extern crate alloc; -use alloc::string::String; -use casper_contract::{ - contract_api::{account, runtime, storage, system}, - unwrap_or_revert::UnwrapOrRevert, -}; -use casper_types::{runtime_args, AddressableEntityHash, ApiError, Key, RuntimeArgs, URef, U512}; +use casper_contract::contract_api::{account, runtime, system}; +use casper_types::{runtime_args, AddressableEntityHash, URef, U512}; #[no_mangle] pub extern "C" fn call() { diff --git a/kairos-deposit-contract/readme.md b/kairos-deposit-contract/readme.md index 9dddae7d..1645b82b 100644 --- a/kairos-deposit-contract/readme.md +++ b/kairos-deposit-contract/readme.md @@ -99,6 +99,8 @@ or, on Ubuntu/Debian: then: ```bash -cd tests -cargo test +# navigate to the root +cd kairos +# run the contract-specific tests +cargo test -p kairos-deposit-contract-tests ``` diff --git a/kairos-deposit-contract/withdrawal-session/src/main.rs b/kairos-deposit-contract/withdrawal-session/src/main.rs index 643f73a1..e84acfcb 100644 --- a/kairos-deposit-contract/withdrawal-session/src/main.rs +++ b/kairos-deposit-contract/withdrawal-session/src/main.rs @@ -1,12 +1,7 @@ #![no_std] #![no_main] -extern crate alloc; -use alloc::string::String; -use casper_contract::{ - contract_api::{account, runtime, storage, system}, - unwrap_or_revert::UnwrapOrRevert, -}; -use casper_types::{runtime_args, AddressableEntityHash, ApiError, Key, RuntimeArgs, URef, U512}; +use casper_contract::contract_api::{account, runtime}; +use casper_types::{runtime_args, AddressableEntityHash, URef, U512}; #[no_mangle] pub extern "C" fn call() {