diff --git a/dongle-smartcontract/build_errors.log b/dongle-smartcontract/build_errors.log new file mode 100644 index 0000000..0a64036 --- /dev/null +++ b/dongle-smartcontract/build_errors.log @@ -0,0 +1,81 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error[E0753]: expected outer doc comment + --> src\lib.rs:11:1 + | +11 | //! # Dongle Smart Contract + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +help: you might have meant to write a regular comment + | +11 - //! # Dongle Smart Contract +11 + // # Dongle Smart Contract + | + +error[E0753]: expected outer doc comment + --> src\lib.rs:12:1 + | +12 | //! + | ^^^^ + | + = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +help: you might have meant to write a regular comment + | +12 - //! +12 + // + | + +error[E0753]: expected outer doc comment + --> src\lib.rs:13:1 + | +13 | //! A decentralized project registry and discovery platform built on Stellar/Soroban. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +help: you might have meant to write a regular comment + | +13 - //! A decentralized project registry and discovery platform built on Stellar/Soroban. +13 + // A decentralized project registry and discovery platform built on Stellar/Soroban. + | + +error[E0753]: expected outer doc comment + --> src\lib.rs:14:1 + | +14 | //! This contract enables transparent project registration, community reviews, and + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +help: you might have meant to write a regular comment + | +14 - //! This contract enables transparent project registration, community reviews, and +14 + // This contract enables transparent project registration, community reviews, and + | + +error[E0753]: expected outer doc comment + --> src\lib.rs:15:1 + | +15 | //! verification processes for the Stellar ecosystem. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +16 | +17 | mod types; + | ---------- the inner doc comment doesn't annotate this module + | +help: to annotate the module, change the doc comment from inner to outer style + | +15 - //! verification processes for the Stellar ecosystem. +15 + /// verification processes for the Stellar ecosystem. + | + +error: expected item, found keyword `let` + --> src\lib.rs:175:9 + | +175 | let owner = Address::generate(&env); + | ^^^ + | | + | `let` cannot be used for global variables + | help: consider using `static` or `const` instead of `let` + | + = note: for a full list of items that can appear in modules, see + +For more information about this error, try `rustc --explain E0753`. +error: could not compile `dongle-contract` (lib) due to 6 previous errors diff --git a/dongle-smartcontract/build_errors_2.log b/dongle-smartcontract/build_errors_2.log new file mode 100644 index 0000000..20852e8 --- /dev/null +++ b/dongle-smartcontract/build_errors_2.log @@ -0,0 +1,631 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error[E0432]: unresolved import `crate::events::VerificationApproved` + --> src\verification_registry.rs:5:5 + | +5 | use crate::events::VerificationApproved; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `VerificationApproved` in `events` + +error[E0432]: unresolved import `crate::events::VerificationRejected` + --> src\verification_registry.rs:6:5 + | +6 | use crate::events::VerificationRejected; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `VerificationRejected` in `events` + +error[E0432]: unresolved import `crate::events::VerificationRequested` + --> src\verification_registry.rs:7:5 + | +7 | use crate::events::VerificationRequested; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `VerificationRequested` in `events` + +error[E0432]: unresolved import `crate::events::FeePaid` + --> src\fee_manager.rs:4:5 + | +4 | use crate::events::FeePaid; + | ^^^^^^^^^^^^^^^^^^^^^^ no `FeePaid` in `events` + +error[E0432]: unresolved import `crate::events::FeeSet` + --> src\fee_manager.rs:5:5 + | +5 | use crate::events::FeeSet; + | ^^^^^^^^^^^^^^^^^^^^^ no `FeeSet` in `events` + +error[E0432]: unresolved import `crate::storage_keys` + --> src\project_registry.rs:2:12 + | +2 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^ could not find `storage_keys` in the crate root + +error[E0432]: unresolved import `crate::storage_keys` + --> src\review_registry.rs:2:12 + | +2 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^ could not find `storage_keys` in the crate root + +error[E0432]: unresolved import `crate::storage_keys` + --> src\verification_registry.rs:8:12 + | +8 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^ could not find `storage_keys` in the crate root + +error[E0432]: unresolved import `crate::storage_keys` + --> src\fee_manager.rs:6:12 + | +6 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^ could not find `storage_keys` in the crate root + +error[E0432]: unresolved import `crate::storage_keys` + --> src\utils.rs:2:12 + | +2 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^ could not find `storage_keys` in the crate root + +error[E0433]: failed to resolve: use of undeclared type `DataKey` + --> src\project_registry.rs:45:19 + | +45 | .get(&DataKey::ProjectCount) + | ^^^^^^^ use of undeclared type `DataKey` + | +help: consider importing this enum + | + 1 + use crate::types::DataKey; + | + +error[E0433]: failed to resolve: use of undeclared type `VerificationStatus` + --> src\project_registry.rs:59:34 + | +59 | verification_status: VerificationStatus::Unverified, + | ^^^^^^^^^^^^^^^^^^ use of undeclared type `VerificationStatus` + | +help: consider importing this enum + | + 1 + use crate::types::VerificationStatus; + | + +error[E0433]: failed to resolve: use of undeclared type `DataKey` + --> src\project_registry.rs:66:19 + | +66 | .set(&DataKey::Project(count), &project); + | ^^^^^^^ use of undeclared type `DataKey` + | +help: consider importing this enum + | + 1 + use crate::types::DataKey; + | + +error[E0433]: failed to resolve: use of undeclared type `DataKey` + --> src\project_registry.rs:69:19 + | +69 | .set(&DataKey::ProjectCount, &count); + | ^^^^^^^ use of undeclared type `DataKey` + | +help: consider importing this enum + | + 1 + use crate::types::DataKey; + | + +error[E0425]: cannot find type `Vec` in this scope + --> src\project_registry.rs:71:33 + | +71 | let mut owner_projects: Vec = env + | ^^^ not found in this scope + | +help: consider importing one of these structs + | + 1 + use crate::Vec; + | + 1 + use soroban_sdk::Vec; + | + +error[E0433]: failed to resolve: use of undeclared type `DataKey` + --> src\project_registry.rs:74:19 + | +74 | .get(&DataKey::OwnerProjects(owner.clone())) + | ^^^^^^^ use of undeclared type `DataKey` + | +help: consider importing this enum + | + 1 + use crate::types::DataKey; + | + +error[E0433]: failed to resolve: use of undeclared type `Vec` + --> src\project_registry.rs:75:24 + | +75 | .unwrap_or(Vec::new(env)); + | ^^^ use of undeclared type `Vec` + | +help: consider importing one of these structs + | + 1 + use crate::Vec; + | + 1 + use soroban_sdk::Vec; + | + +error[E0425]: cannot find value `project_id` in this scope + --> src\project_registry.rs:79:39 + | +79 | .get(&StorageKey::Project(project_id)) + | ^^^^^^^^^^ help: a local variable with a similar name exists: `project` + +error[E0433]: failed to resolve: use of undeclared type `DataKey` + --> src\project_registry.rs:130:19 + | +130 | .get(&DataKey::Project(project_id)) + | ^^^^^^^ use of undeclared type `DataKey` + | +help: consider importing this enum + | + 1 + use crate::types::DataKey; + | + +error[E0425]: cannot find type `Vec` in this scope + --> src\project_registry.rs:133:64 + | +133 | pub fn get_projects_by_owner(env: &Env, owner: Address) -> Vec { + | ^^^ not found in this scope + | +help: consider importing one of these structs + | + 1 + use crate::Vec; + | + 1 + use soroban_sdk::Vec; + | + +error[E0425]: cannot find type `Vec` in this scope + --> src\project_registry.rs:134:18 + | +134 | let ids: Vec = env + | ^^^ not found in this scope + | +help: consider importing one of these structs + | + 1 + use crate::Vec; + | + 1 + use soroban_sdk::Vec; + | + +error[E0433]: failed to resolve: use of undeclared type `DataKey` + --> src\project_registry.rs:137:19 + | +137 | .get(&DataKey::OwnerProjects(owner)) + | ^^^^^^^ use of undeclared type `DataKey` + | +help: consider importing this enum + | + 1 + use crate::types::DataKey; + | + +error[E0433]: failed to resolve: use of undeclared type `Vec` + --> src\project_registry.rs:138:24 + | +138 | .unwrap_or(Vec::new(env)); + | ^^^ use of undeclared type `Vec` + | +help: consider importing one of these structs + | + 1 + use crate::Vec; + | + 1 + use soroban_sdk::Vec; + | + +error[E0433]: failed to resolve: use of undeclared type `Vec` + --> src\project_registry.rs:140:28 + | +140 | let mut projects = Vec::new(env); + | ^^^ use of undeclared type `Vec` + | +help: consider importing one of these structs + | + 1 + use crate::Vec; + | + 1 + use soroban_sdk::Vec; + | + +error[E0425]: cannot find type `Vec` in this scope + --> src\project_registry.rs:154:17 + | +154 | ) -> Result, ContractError> { + | ^^^ not found in this scope + | +help: consider importing one of these structs + | + 1 + use crate::Vec; + | + 1 + use soroban_sdk::Vec; + | + +error[E0425]: cannot find type `Vec` in this scope + --> src\verification_registry.rs:54:17 + | +54 | ) -> Result, ContractError> { + | ^^^ not found in this scope + | +help: consider importing one of these structs + | + 3 + use crate::Vec; + | + 3 + use soroban_sdk::Vec; + | + +error[E0425]: cannot find type `DataKey` in this scope + --> src\utils.rs:60:38 + | +60 | pub fn get_storage_key(data_key: DataKey) -> DataKey { + | ^^^^^^^ not found in this scope + | +help: consider importing this enum + | + 1 + use crate::types::DataKey; + | + +error[E0425]: cannot find type `DataKey` in this scope + --> src\utils.rs:60:50 + | +60 | pub fn get_storage_key(data_key: DataKey) -> DataKey { + | ^^^^^^^ not found in this scope + | +help: consider importing this enum + | + 1 + use crate::types::DataKey; + | + +warning: unused import: `ReviewEventData` + --> src\review_registry.rs:3:42 + | +3 | use crate::types::{Review, ReviewAction, ReviewEventData}; + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +error[E0592]: duplicate definitions with name `register_project` + --> src\project_registry.rs:30:5 + | + 9 | / pub fn register_project( +10 | | env: &Env, +11 | | owner: Address, +12 | | name: String, +... | +17 | | metadata_cid: Option, +18 | | ) -> u64 { + | |____________- other definition for `register_project` +... +30 | / pub fn register_project( +31 | | env: &Env, +32 | | owner: Address, +33 | | name: String, +... | +38 | | metadata_cid: Option, +39 | | ) -> u64 { + | |____________^ duplicate definitions for `register_project` + +error[E0592]: duplicate definitions with name `update_project` + --> src\project_registry.rs:82:5 + | +25 | pub fn update_project(env: &Env, project_id: u64, caller: Address) { + | ------------------------------------------------------------------ other definition for `update_project` +... +82 | / pub fn update_project( +83 | | env: &Env, +84 | | project_id: u64, +85 | | caller: Address, +... | +91 | | metadata_cid: Option>, +92 | | ) -> Option { + | |________________________^ duplicate definitions for `update_project` + +error[E0277]: the trait bound `VerificationStatus: TryFromVal` is not satisfied + --> src\types.rs:56:1 + | +56 | #[contracttype] + | ^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `TryFromVal` is not implemented for `VerificationStatus` + --> src\types.rs:50:1 + | +50 | pub enum VerificationStatus { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: the following other types implement trait `TryFromVal`: + `()` implements `TryFromVal` + `()` implements `TryFromVal` + `()` implements `TryFromVal` + `(T0, T1)` implements `TryFromVal` + `(T0, T1)` implements `TryFromVal` + `(T0, T1, T2)` implements `TryFromVal` + `(T0, T1, T2)` implements `TryFromVal` + `(T0, T1, T2, T3)` implements `TryFromVal` + and 327 others + = note: required for `soroban_sdk::Val` to implement `TryIntoVal` + = note: the full name for the type has been written to 'C:\Users\user\Dongle-Smartcontract\dongle-smartcontract\target\debug\deps\dongle_contract.long-type-10308784675139276474.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `soroban_sdk::Val: TryFromVal` is not satisfied + --> src\types.rs:56:1 + | +56 | #[contracttype] + | ^^^^^^^^^^^^^^^ the trait `TryFromVal` is not implemented for `soroban_sdk::Val` + | + = help: the following other types implement trait `TryFromVal`: + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + and 113 others + = note: required for `VerificationStatus` to implement `TryIntoVal` + = note: the full name for the type has been written to 'C:\Users\user\Dongle-Smartcontract\dongle-smartcontract\target\debug\deps\dongle_contract.long-type-10308784675139276474.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0560]: struct `Project` has no field named `owner` + --> src\project_registry.rs:52:13 + | +52 | owner: owner.clone(), + | ^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `name` + --> src\project_registry.rs:53:13 + | +53 | name, + | ^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `description` + --> src\project_registry.rs:54:13 + | +54 | description, + | ^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `category` + --> src\project_registry.rs:55:13 + | +55 | category, + | ^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `website` + --> src\project_registry.rs:56:13 + | +56 | website, + | ^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `logo_cid` + --> src\project_registry.rs:57:13 + | +57 | logo_cid, + | ^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `metadata_cid` + --> src\project_registry.rs:58:13 + | +58 | metadata_cid, + | ^^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `verification_status` + --> src\project_registry.rs:59:13 + | +59 | verification_status: VerificationStatus::Unverified, + | ^^^^^^^^^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `created_at` + --> src\project_registry.rs:60:13 + | +60 | created_at: now, + | ^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `updated_at` + --> src\project_registry.rs:61:13 + | +61 | updated_at: now, + | ^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0308]: mismatched types + --> src\project_registry.rs:77:9 + | +39 | ) -> u64 { + | --- expected `u64` because of return type +... +77 | / env.storage() +78 | | .persistent() +79 | | .get(&StorageKey::Project(project_id)) + | |__________________________________________________^ expected `u64`, found `Option<_>` + | + = note: expected type `u64` + found enum `core::option::Option<_>` +help: consider using `Option::expect` to unwrap the `core::option::Option<_>` value, panicking if the value is an `Option::None` + | +79 | .get(&StorageKey::Project(project_id)).expect("REASON") + | +++++++++++++++++ + +error[E0609]: no field `owner` on type `Project` + --> src\project_registry.rs:96:20 + | +96 | if project.owner != caller { + | ^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `name` on type `Project` + --> src\project_registry.rs:101:21 + | +101 | project.name = value; + | ^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `description` on type `Project` + --> src\project_registry.rs:104:21 + | +104 | project.description = value; + | ^^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `category` on type `Project` + --> src\project_registry.rs:107:21 + | +107 | project.category = value; + | ^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `website` on type `Project` + --> src\project_registry.rs:110:21 + | +110 | project.website = value; + | ^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `logo_cid` on type `Project` + --> src\project_registry.rs:113:21 + | +113 | project.logo_cid = value; + | ^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `metadata_cid` on type `Project` + --> src\project_registry.rs:116:21 + | +116 | project.metadata_cid = value; + | ^^^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `updated_at` on type `Project` + --> src\project_registry.rs:119:17 + | +119 | project.updated_at = env.ledger().timestamp(); + | ^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +warning: unused variable: `env` + --> src\project_registry.rs:10:9 + | +10 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `owner` + --> src\project_registry.rs:11:9 + | +11 | owner: Address, + | ^^^^^ help: if this is intentional, prefix it with an underscore: `_owner` + +warning: unused variable: `name` + --> src\project_registry.rs:12:9 + | +12 | name: String, + | ^^^^ help: if this is intentional, prefix it with an underscore: `_name` + +warning: unused variable: `description` + --> src\project_registry.rs:13:9 + | +13 | description: String, + | ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_description` + +warning: unused variable: `category` + --> src\project_registry.rs:14:9 + | +14 | category: String, + | ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_category` + +warning: unused variable: `website` + --> src\project_registry.rs:15:9 + | +15 | website: Option, + | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_website` + +warning: unused variable: `logo_cid` + --> src\project_registry.rs:16:9 + | +16 | logo_cid: Option, + | ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_logo_cid` + +warning: unused variable: `metadata_cid` + --> src\project_registry.rs:17:9 + | +17 | metadata_cid: Option, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_metadata_cid` + +warning: unused variable: `env` + --> src\project_registry.rs:25:27 + | +25 | pub fn update_project(env: &Env, project_id: u64, caller: Address) { + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + +warning: unused variable: `project_id` + --> src\project_registry.rs:25:38 + | +25 | pub fn update_project(env: &Env, project_id: u64, caller: Address) { + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `caller` + --> src\project_registry.rs:25:55 + | +25 | pub fn update_project(env: &Env, project_id: u64, caller: Address) { + | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_caller` + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +Some errors have detailed explanations: E0277, E0308, E0425, E0432, E0433, E0560, E0592, E0609. +For more information about an error, try `rustc --explain E0277`. +warning: `dongle-contract` (lib) generated 18 warnings +error: could not compile `dongle-contract` (lib) due to 51 previous errors; 18 warnings emitted diff --git a/dongle-smartcontract/build_errors_3.log b/dongle-smartcontract/build_errors_3.log new file mode 100644 index 0000000..4b97dd9 --- /dev/null +++ b/dongle-smartcontract/build_errors_3.log @@ -0,0 +1,378 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error[E0432]: unresolved import `crate::storage_keys` + --> src\project_registry.rs:2:12 + | +2 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^ could not find `storage_keys` in the crate root + +error[E0432]: unresolved import `crate::storage_keys` + --> src\utils.rs:2:12 + | +2 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^ could not find `storage_keys` in the crate root + +error[E0425]: cannot find type `DataKey` in this scope + --> src\utils.rs:60:38 + | +60 | pub fn get_storage_key(data_key: DataKey) -> DataKey { + | ^^^^^^^ not found in this scope + | +help: consider importing this enum + | + 1 + use crate::types::DataKey; + | + +error[E0425]: cannot find type `DataKey` in this scope + --> src\utils.rs:60:50 + | +60 | pub fn get_storage_key(data_key: DataKey) -> DataKey { + | ^^^^^^^ not found in this scope + | +help: consider importing this enum + | + 1 + use crate::types::DataKey; + | + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +error[E0277]: the trait bound `VerificationStatus: TryFromVal` is not satisfied + --> src\types.rs:56:1 + | +56 | #[contracttype] + | ^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `TryFromVal` is not implemented for `VerificationStatus` + --> src\types.rs:50:1 + | +50 | pub enum VerificationStatus { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: the following other types implement trait `TryFromVal`: + `()` implements `TryFromVal` + `()` implements `TryFromVal` + `()` implements `TryFromVal` + `(T0, T1)` implements `TryFromVal` + `(T0, T1)` implements `TryFromVal` + `(T0, T1, T2)` implements `TryFromVal` + `(T0, T1, T2)` implements `TryFromVal` + `(T0, T1, T2, T3)` implements `TryFromVal` + and 327 others + = note: required for `soroban_sdk::Val` to implement `TryIntoVal` + = note: the full name for the type has been written to 'C:\Users\user\Dongle-Smartcontract\dongle-smartcontract\target\debug\deps\dongle_contract.long-type-9707364526710188667.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `soroban_sdk::Val: TryFromVal` is not satisfied + --> src\types.rs:56:1 + | +56 | #[contracttype] + | ^^^^^^^^^^^^^^^ the trait `TryFromVal` is not implemented for `soroban_sdk::Val` + | + = help: the following other types implement trait `TryFromVal`: + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + and 113 others + = note: required for `VerificationStatus` to implement `TryIntoVal` + = note: the full name for the type has been written to 'C:\Users\user\Dongle-Smartcontract\dongle-smartcontract\target\debug\deps\dongle_contract.long-type-9707364526710188667.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0599]: no variant or associated item named `ProjectCount` found for enum `DataKey` in the current scope + --> src\project_registry.rs:24:28 + | +24 | .get(&DataKey::ProjectCount) + | ^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `ProjectCount` not found for this enum + +error[E0560]: struct `Project` has no field named `owner` + --> src\project_registry.rs:31:13 + | +31 | owner: owner.clone(), + | ^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `name` + --> src\project_registry.rs:32:13 + | +32 | name, + | ^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `description` + --> src\project_registry.rs:33:13 + | +33 | description, + | ^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `category` + --> src\project_registry.rs:34:13 + | +34 | category, + | ^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `website` + --> src\project_registry.rs:35:13 + | +35 | website, + | ^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `logo_cid` + --> src\project_registry.rs:36:13 + | +36 | logo_cid, + | ^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `metadata_cid` + --> src\project_registry.rs:37:13 + | +37 | metadata_cid, + | ^^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `verification_status` + --> src\project_registry.rs:38:13 + | +38 | verification_status: VerificationStatus::Unverified, + | ^^^^^^^^^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0599]: no variant or associated item named `Unverified` found for enum `VerificationStatus` in the current scope + --> src\project_registry.rs:38:54 + | +38 | verification_status: VerificationStatus::Unverified, + | ^^^^^^^^^^ variant or associated item not found in `VerificationStatus` + | + ::: src\types.rs:50:1 + | +50 | pub enum VerificationStatus { + | --------------------------- variant or associated item `Unverified` not found for this enum + | +help: there is a variant with a similar name + | +38 - verification_status: VerificationStatus::Unverified, +38 + verification_status: VerificationStatus::Verified, + | + +error[E0560]: struct `Project` has no field named `created_at` + --> src\project_registry.rs:39:13 + | +39 | created_at: now, + | ^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `updated_at` + --> src\project_registry.rs:40:13 + | +40 | updated_at: now, + | ^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0599]: no variant or associated item named `ProjectCount` found for enum `DataKey` in the current scope + --> src\project_registry.rs:48:28 + | +48 | .set(&DataKey::ProjectCount, &count); + | ^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `ProjectCount` not found for this enum + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:53:28 + | +53 | .get(&DataKey::OwnerProjects(owner.clone())) + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:58:28 + | +58 | .set(&DataKey::OwnerProjects(owner.clone()), &owner_projects); + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +error[E0609]: no field `owner` on type `Project` + --> src\project_registry.rs:77:20 + | +77 | if project.owner != caller { + | ^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `name` on type `Project` + --> src\project_registry.rs:82:21 + | +82 | project.name = value; + | ^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `description` on type `Project` + --> src\project_registry.rs:85:21 + | +85 | project.description = value; + | ^^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `category` on type `Project` + --> src\project_registry.rs:88:21 + | +88 | project.category = value; + | ^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `website` on type `Project` + --> src\project_registry.rs:91:21 + | +91 | project.website = value; + | ^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `logo_cid` on type `Project` + --> src\project_registry.rs:94:21 + | +94 | project.logo_cid = value; + | ^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `metadata_cid` on type `Project` + --> src\project_registry.rs:97:21 + | +97 | project.metadata_cid = value; + | ^^^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `updated_at` on type `Project` + --> src\project_registry.rs:100:17 + | +100 | project.updated_at = env.ledger().timestamp(); + | ^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:118:28 + | +118 | .get(&DataKey::OwnerProjects(owner)) + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | + 38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +Some errors have detailed explanations: E0277, E0425, E0432, E0560, E0599, E0609. +For more information about an error, try `rustc --explain E0277`. +warning: `dongle-contract` (lib) generated 11 warnings +error: could not compile `dongle-contract` (lib) due to 30 previous errors; 11 warnings emitted diff --git a/dongle-smartcontract/build_errors_4.log b/dongle-smartcontract/build_errors_4.log new file mode 100644 index 0000000..7aa71e2 --- /dev/null +++ b/dongle-smartcontract/build_errors_4.log @@ -0,0 +1,350 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error[E0432]: unresolved import `crate::storage_keys` + --> src\project_registry.rs:2:12 + | +2 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^ could not find `storage_keys` in the crate root + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +error[E0277]: the trait bound `VerificationStatus: TryFromVal` is not satisfied + --> src\types.rs:56:1 + | +56 | #[contracttype] + | ^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `TryFromVal` is not implemented for `VerificationStatus` + --> src\types.rs:50:1 + | +50 | pub enum VerificationStatus { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: the following other types implement trait `TryFromVal`: + `()` implements `TryFromVal` + `()` implements `TryFromVal` + `()` implements `TryFromVal` + `(T0, T1)` implements `TryFromVal` + `(T0, T1)` implements `TryFromVal` + `(T0, T1, T2)` implements `TryFromVal` + `(T0, T1, T2)` implements `TryFromVal` + `(T0, T1, T2, T3)` implements `TryFromVal` + and 327 others + = note: required for `soroban_sdk::Val` to implement `TryIntoVal` + = note: the full name for the type has been written to 'C:\Users\user\Dongle-Smartcontract\dongle-smartcontract\target\debug\deps\dongle_contract.long-type-14145236618166622193.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `soroban_sdk::Val: TryFromVal` is not satisfied + --> src\types.rs:56:1 + | +56 | #[contracttype] + | ^^^^^^^^^^^^^^^ the trait `TryFromVal` is not implemented for `soroban_sdk::Val` + | + = help: the following other types implement trait `TryFromVal`: + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + and 113 others + = note: required for `VerificationStatus` to implement `TryIntoVal` + = note: the full name for the type has been written to 'C:\Users\user\Dongle-Smartcontract\dongle-smartcontract\target\debug\deps\dongle_contract.long-type-14145236618166622193.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0599]: no variant or associated item named `ProjectCount` found for enum `DataKey` in the current scope + --> src\project_registry.rs:24:28 + | +24 | .get(&DataKey::ProjectCount) + | ^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `ProjectCount` not found for this enum + +error[E0560]: struct `Project` has no field named `owner` + --> src\project_registry.rs:31:13 + | +31 | owner: owner.clone(), + | ^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `name` + --> src\project_registry.rs:32:13 + | +32 | name, + | ^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `description` + --> src\project_registry.rs:33:13 + | +33 | description, + | ^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `category` + --> src\project_registry.rs:34:13 + | +34 | category, + | ^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `website` + --> src\project_registry.rs:35:13 + | +35 | website, + | ^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `logo_cid` + --> src\project_registry.rs:36:13 + | +36 | logo_cid, + | ^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `metadata_cid` + --> src\project_registry.rs:37:13 + | +37 | metadata_cid, + | ^^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `verification_status` + --> src\project_registry.rs:38:13 + | +38 | verification_status: VerificationStatus::Unverified, + | ^^^^^^^^^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0599]: no variant or associated item named `Unverified` found for enum `VerificationStatus` in the current scope + --> src\project_registry.rs:38:54 + | +38 | verification_status: VerificationStatus::Unverified, + | ^^^^^^^^^^ variant or associated item not found in `VerificationStatus` + | + ::: src\types.rs:50:1 + | +50 | pub enum VerificationStatus { + | --------------------------- variant or associated item `Unverified` not found for this enum + | +help: there is a variant with a similar name + | +38 - verification_status: VerificationStatus::Unverified, +38 + verification_status: VerificationStatus::Verified, + | + +error[E0560]: struct `Project` has no field named `created_at` + --> src\project_registry.rs:39:13 + | +39 | created_at: now, + | ^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `updated_at` + --> src\project_registry.rs:40:13 + | +40 | updated_at: now, + | ^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0599]: no variant or associated item named `ProjectCount` found for enum `DataKey` in the current scope + --> src\project_registry.rs:48:28 + | +48 | .set(&DataKey::ProjectCount, &count); + | ^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `ProjectCount` not found for this enum + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:53:28 + | +53 | .get(&DataKey::OwnerProjects(owner.clone())) + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:58:28 + | +58 | .set(&DataKey::OwnerProjects(owner.clone()), &owner_projects); + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +error[E0609]: no field `owner` on type `Project` + --> src\project_registry.rs:77:20 + | +77 | if project.owner != caller { + | ^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `name` on type `Project` + --> src\project_registry.rs:82:21 + | +82 | project.name = value; + | ^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `description` on type `Project` + --> src\project_registry.rs:85:21 + | +85 | project.description = value; + | ^^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `category` on type `Project` + --> src\project_registry.rs:88:21 + | +88 | project.category = value; + | ^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `website` on type `Project` + --> src\project_registry.rs:91:21 + | +91 | project.website = value; + | ^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `logo_cid` on type `Project` + --> src\project_registry.rs:94:21 + | +94 | project.logo_cid = value; + | ^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `metadata_cid` on type `Project` + --> src\project_registry.rs:97:21 + | +97 | project.metadata_cid = value; + | ^^^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `updated_at` on type `Project` + --> src\project_registry.rs:100:17 + | +100 | project.updated_at = env.ledger().timestamp(); + | ^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:118:28 + | +118 | .get(&DataKey::OwnerProjects(owner)) + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | + 38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +Some errors have detailed explanations: E0277, E0432, E0560, E0599, E0609. +For more information about an error, try `rustc --explain E0277`. +warning: `dongle-contract` (lib) generated 11 warnings +error: could not compile `dongle-contract` (lib) due to 27 previous errors; 11 warnings emitted diff --git a/dongle-smartcontract/build_errors_5.log b/dongle-smartcontract/build_errors_5.log new file mode 100644 index 0000000..563c1dd --- /dev/null +++ b/dongle-smartcontract/build_errors_5.log @@ -0,0 +1,344 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +error[E0277]: the trait bound `VerificationStatus: TryFromVal` is not satisfied + --> src\types.rs:56:1 + | +56 | #[contracttype] + | ^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `TryFromVal` is not implemented for `VerificationStatus` + --> src\types.rs:50:1 + | +50 | pub enum VerificationStatus { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: the following other types implement trait `TryFromVal`: + `()` implements `TryFromVal` + `()` implements `TryFromVal` + `()` implements `TryFromVal` + `(T0, T1)` implements `TryFromVal` + `(T0, T1)` implements `TryFromVal` + `(T0, T1, T2)` implements `TryFromVal` + `(T0, T1, T2)` implements `TryFromVal` + `(T0, T1, T2, T3)` implements `TryFromVal` + and 327 others + = note: required for `soroban_sdk::Val` to implement `TryIntoVal` + = note: the full name for the type has been written to 'C:\Users\user\Dongle-Smartcontract\dongle-smartcontract\target\debug\deps\dongle_contract.long-type-1954397857825036664.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `soroban_sdk::Val: TryFromVal` is not satisfied + --> src\types.rs:56:1 + | +56 | #[contracttype] + | ^^^^^^^^^^^^^^^ the trait `TryFromVal` is not implemented for `soroban_sdk::Val` + | + = help: the following other types implement trait `TryFromVal`: + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + and 113 others + = note: required for `VerificationStatus` to implement `TryIntoVal` + = note: the full name for the type has been written to 'C:\Users\user\Dongle-Smartcontract\dongle-smartcontract\target\debug\deps\dongle_contract.long-type-1954397857825036664.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0599]: no variant or associated item named `ProjectCount` found for enum `DataKey` in the current scope + --> src\project_registry.rs:23:28 + | +23 | .get(&DataKey::ProjectCount) + | ^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `ProjectCount` not found for this enum + +error[E0560]: struct `Project` has no field named `owner` + --> src\project_registry.rs:30:13 + | +30 | owner: owner.clone(), + | ^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `name` + --> src\project_registry.rs:31:13 + | +31 | name, + | ^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `description` + --> src\project_registry.rs:32:13 + | +32 | description, + | ^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `category` + --> src\project_registry.rs:33:13 + | +33 | category, + | ^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `website` + --> src\project_registry.rs:34:13 + | +34 | website, + | ^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `logo_cid` + --> src\project_registry.rs:35:13 + | +35 | logo_cid, + | ^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `metadata_cid` + --> src\project_registry.rs:36:13 + | +36 | metadata_cid, + | ^^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `verification_status` + --> src\project_registry.rs:37:13 + | +37 | verification_status: VerificationStatus::Unverified, + | ^^^^^^^^^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0599]: no variant or associated item named `Unverified` found for enum `VerificationStatus` in the current scope + --> src\project_registry.rs:37:54 + | +37 | verification_status: VerificationStatus::Unverified, + | ^^^^^^^^^^ variant or associated item not found in `VerificationStatus` + | + ::: src\types.rs:50:1 + | +50 | pub enum VerificationStatus { + | --------------------------- variant or associated item `Unverified` not found for this enum + | +help: there is a variant with a similar name + | +37 - verification_status: VerificationStatus::Unverified, +37 + verification_status: VerificationStatus::Verified, + | + +error[E0560]: struct `Project` has no field named `created_at` + --> src\project_registry.rs:38:13 + | +38 | created_at: now, + | ^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `updated_at` + --> src\project_registry.rs:39:13 + | +39 | updated_at: now, + | ^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0599]: no variant or associated item named `ProjectCount` found for enum `DataKey` in the current scope + --> src\project_registry.rs:47:28 + | +47 | .set(&DataKey::ProjectCount, &count); + | ^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `ProjectCount` not found for this enum + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:52:28 + | +52 | .get(&DataKey::OwnerProjects(owner.clone())) + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:57:28 + | +57 | .set(&DataKey::OwnerProjects(owner.clone()), &owner_projects); + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +error[E0609]: no field `owner` on type `Project` + --> src\project_registry.rs:76:20 + | +76 | if project.owner != caller { + | ^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `name` on type `Project` + --> src\project_registry.rs:81:21 + | +81 | project.name = value; + | ^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `description` on type `Project` + --> src\project_registry.rs:84:21 + | +84 | project.description = value; + | ^^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `category` on type `Project` + --> src\project_registry.rs:87:21 + | +87 | project.category = value; + | ^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `website` on type `Project` + --> src\project_registry.rs:90:21 + | +90 | project.website = value; + | ^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `logo_cid` on type `Project` + --> src\project_registry.rs:93:21 + | +93 | project.logo_cid = value; + | ^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `metadata_cid` on type `Project` + --> src\project_registry.rs:96:21 + | +96 | project.metadata_cid = value; + | ^^^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `updated_at` on type `Project` + --> src\project_registry.rs:99:17 + | +99 | project.updated_at = env.ledger().timestamp(); + | ^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:117:28 + | +117 | .get(&DataKey::OwnerProjects(owner)) + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | + 38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +Some errors have detailed explanations: E0277, E0560, E0599, E0609. +For more information about an error, try `rustc --explain E0277`. +warning: `dongle-contract` (lib) generated 11 warnings +error: could not compile `dongle-contract` (lib) due to 26 previous errors; 11 warnings emitted diff --git a/dongle-smartcontract/build_errors_6.log b/dongle-smartcontract/build_errors_6.log new file mode 100644 index 0000000..d79ff9a --- /dev/null +++ b/dongle-smartcontract/build_errors_6.log @@ -0,0 +1,344 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +error[E0277]: the trait bound `VerificationStatus: TryFromVal` is not satisfied + --> src\types.rs:56:1 + | +56 | #[contracttype] + | ^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `TryFromVal` is not implemented for `VerificationStatus` + --> src\types.rs:50:1 + | +50 | pub enum VerificationStatus { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: the following other types implement trait `TryFromVal`: + `()` implements `TryFromVal` + `()` implements `TryFromVal` + `()` implements `TryFromVal` + `(T0, T1)` implements `TryFromVal` + `(T0, T1)` implements `TryFromVal` + `(T0, T1, T2)` implements `TryFromVal` + `(T0, T1, T2)` implements `TryFromVal` + `(T0, T1, T2, T3)` implements `TryFromVal` + and 327 others + = note: required for `soroban_sdk::Val` to implement `TryIntoVal` + = note: the full name for the type has been written to 'C:\Users\user\Dongle-Smartcontract\dongle-smartcontract\target\debug\deps\dongle_contract.long-type-2280732467449148111.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `soroban_sdk::Val: TryFromVal` is not satisfied + --> src\types.rs:56:1 + | +56 | #[contracttype] + | ^^^^^^^^^^^^^^^ the trait `TryFromVal` is not implemented for `soroban_sdk::Val` + | + = help: the following other types implement trait `TryFromVal`: + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + `soroban_sdk::Val` implements `TryFromVal` + and 113 others + = note: required for `VerificationStatus` to implement `TryIntoVal` + = note: the full name for the type has been written to 'C:\Users\user\Dongle-Smartcontract\dongle-smartcontract\target\debug\deps\dongle_contract.long-type-2280732467449148111.txt' + = note: consider using `--verbose` to print the full type name to the console + = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0599]: no variant or associated item named `ProjectCount` found for enum `DataKey` in the current scope + --> src\project_registry.rs:23:28 + | +23 | .get(&DataKey::ProjectCount) + | ^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `ProjectCount` not found for this enum + +error[E0560]: struct `Project` has no field named `owner` + --> src\project_registry.rs:30:13 + | +30 | owner: owner.clone(), + | ^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `name` + --> src\project_registry.rs:31:13 + | +31 | name, + | ^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `description` + --> src\project_registry.rs:32:13 + | +32 | description, + | ^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `category` + --> src\project_registry.rs:33:13 + | +33 | category, + | ^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `website` + --> src\project_registry.rs:34:13 + | +34 | website, + | ^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `logo_cid` + --> src\project_registry.rs:35:13 + | +35 | logo_cid, + | ^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `metadata_cid` + --> src\project_registry.rs:36:13 + | +36 | metadata_cid, + | ^^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `verification_status` + --> src\project_registry.rs:37:13 + | +37 | verification_status: VerificationStatus::Unverified, + | ^^^^^^^^^^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0599]: no variant or associated item named `Unverified` found for enum `VerificationStatus` in the current scope + --> src\project_registry.rs:37:54 + | +37 | verification_status: VerificationStatus::Unverified, + | ^^^^^^^^^^ variant or associated item not found in `VerificationStatus` + | + ::: src\types.rs:50:1 + | +50 | pub enum VerificationStatus { + | --------------------------- variant or associated item `Unverified` not found for this enum + | +help: there is a variant with a similar name + | +37 - verification_status: VerificationStatus::Unverified, +37 + verification_status: VerificationStatus::Verified, + | + +error[E0560]: struct `Project` has no field named `created_at` + --> src\project_registry.rs:38:13 + | +38 | created_at: now, + | ^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0560]: struct `Project` has no field named `updated_at` + --> src\project_registry.rs:39:13 + | +39 | updated_at: now, + | ^^^^^^^^^^ `Project` does not have this field + | + = note: all struct fields are already assigned + +error[E0599]: no variant or associated item named `ProjectCount` found for enum `DataKey` in the current scope + --> src\project_registry.rs:47:28 + | +47 | .set(&DataKey::ProjectCount, &count); + | ^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `ProjectCount` not found for this enum + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:52:28 + | +52 | .get(&DataKey::OwnerProjects(owner.clone())) + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:57:28 + | +57 | .set(&DataKey::OwnerProjects(owner.clone()), &owner_projects); + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | +38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +error[E0609]: no field `owner` on type `Project` + --> src\project_registry.rs:76:20 + | +76 | if project.owner != caller { + | ^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `name` on type `Project` + --> src\project_registry.rs:81:21 + | +81 | project.name = value; + | ^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `description` on type `Project` + --> src\project_registry.rs:84:21 + | +84 | project.description = value; + | ^^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `category` on type `Project` + --> src\project_registry.rs:87:21 + | +87 | project.category = value; + | ^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `website` on type `Project` + --> src\project_registry.rs:90:21 + | +90 | project.website = value; + | ^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `logo_cid` on type `Project` + --> src\project_registry.rs:93:21 + | +93 | project.logo_cid = value; + | ^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `metadata_cid` on type `Project` + --> src\project_registry.rs:96:21 + | +96 | project.metadata_cid = value; + | ^^^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0609]: no field `updated_at` on type `Project` + --> src\project_registry.rs:99:17 + | +99 | project.updated_at = env.ledger().timestamp(); + | ^^^^^^^^^^ unknown field + | + = note: available field is: `id` + +error[E0599]: no variant or associated item named `OwnerProjects` found for enum `DataKey` in the current scope + --> src\project_registry.rs:117:28 + | +117 | .get(&DataKey::OwnerProjects(owner)) + | ^^^^^^^^^^^^^ variant or associated item not found in `DataKey` + | + ::: src\types.rs:38:1 + | + 38 | pub enum DataKey { + | ---------------- variant or associated item `OwnerProjects` not found for this enum + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +Some errors have detailed explanations: E0277, E0560, E0599, E0609. +For more information about an error, try `rustc --explain E0277`. +warning: `dongle-contract` (lib) generated 11 warnings +error: could not compile `dongle-contract` (lib) due to 26 previous errors; 11 warnings emitted diff --git a/dongle-smartcontract/build_errors_7.log b/dongle-smartcontract/build_errors_7.log new file mode 100644 index 0000000..c72ae98 --- /dev/null +++ b/dongle-smartcontract/build_errors_7.log @@ -0,0 +1,79 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +warning: `dongle-contract` (lib) generated 11 warnings (run `cargo fix --lib -p dongle-contract` to apply 11 suggestions) + Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.33s diff --git a/dongle-smartcontract/clippy_wasm_errors.txt b/dongle-smartcontract/clippy_wasm_errors.txt new file mode 100644 index 0000000..d0ac72c --- /dev/null +++ b/dongle-smartcontract/clippy_wasm_errors.txt @@ -0,0 +1,20 @@ + Checking dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error: manual `!RangeInclusive::contains` implementation + --> src\review_registry.rs:23:12 + | +23 | if rating < 1 || rating > 5 { + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `!(1..=5).contains(&rating)` + | + = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#manual_range_contains + = note: `-D clippy::manual-range-contains` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::manual_range_contains)]` + +error: manual `!RangeInclusive::contains` implementation + --> src\review_registry.rs:102:12 + | +102 | if rating < 1 || rating > 5 { + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `!(1..=5).contains(&rating)` + | + = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#manual_range_contains + +error: could not compile `dongle-contract` (lib) due to 2 previous errors diff --git a/dongle-smartcontract/src/constants.rs b/dongle-smartcontract/src/constants.rs index a3e77ce..436e3be 100644 --- a/dongle-smartcontract/src/constants.rs +++ b/dongle-smartcontract/src/constants.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] //! Contract limits and validation constants. Kept in one place for easy future updates. /// Maximum number of projects a single user (address) can register. Prevents abuse. diff --git a/dongle-smartcontract/src/errors.rs b/dongle-smartcontract/src/errors.rs index b7621c4..3d76372 100644 --- a/dongle-smartcontract/src/errors.rs +++ b/dongle-smartcontract/src/errors.rs @@ -42,7 +42,7 @@ pub enum ContractError { /// Treasury address not set TreasuryNotSet = 18, /// User has already reviewed this project - AlreadyReviewed = 19, // I added your error here with a new unique ID + DuplicateReview = 19, /// Review is already deleted ReviewAlreadyDeleted = 20, } diff --git a/dongle-smartcontract/src/fee_manager.rs b/dongle-smartcontract/src/fee_manager.rs index fa15986..889a7a1 100644 --- a/dongle-smartcontract/src/fee_manager.rs +++ b/dongle-smartcontract/src/fee_manager.rs @@ -1,89 +1,123 @@ //! Fee configuration and payment with validation and events. use crate::errors::ContractError; -use crate::events::publish_fee_set_event; -use crate::types::{DataKey, FeeConfig}; +use crate::events::{publish_fee_paid_event, publish_fee_set_event}; +use crate::storage_keys::StorageKey; +use crate::types::FeeConfig; use soroban_sdk::{Address, Env}; pub struct FeeManager; +#[allow(dead_code)] impl FeeManager { pub fn set_fee( env: &Env, - _admin: Address, + admin: Address, token: Option
, amount: u128, treasury: Address, ) -> Result<(), ContractError> { + // Authorization check + let stored_admin: Address = env + .storage() + .persistent() + .get(&StorageKey::Admin) + .ok_or(ContractError::Unauthorized)?; + if admin != stored_admin { + return Err(ContractError::Unauthorized); + } + admin.require_auth(); + let config = FeeConfig { token, verification_fee: amount, registration_fee: 0, }; - env.storage().persistent().set(&DataKey::FeeConfig, &config); env.storage() .persistent() - .set(&DataKey::Treasury, &treasury); + .set(&StorageKey::FeeConfig, &config); + env.storage() + .persistent() + .set(&StorageKey::Treasury, &treasury); publish_fee_set_event(env, amount, 0); Ok(()) } pub fn pay_fee( - _env: &Env, - _payer: Address, - _project_id: u64, + env: &Env, + payer: Address, + project_id: u64, _token: Option
, ) -> Result<(), ContractError> { - todo!("Fee payment logic not implemented") - } + payer.require_auth(); + + let config = Self::get_fee_config(env)?; + let treasury = Self::get_treasury(env)?; + + if config.verification_fee > 0 { + if let Some(token_address) = config.token { + let client = soroban_sdk::token::Client::new(env, &token_address); + client.transfer(&payer, &treasury, &(config.verification_fee as i128)); + } else { + // Native XLM transfer not directly supported in this simple way via token client if it's not a token address + // Assuming token address is provided for now as per implementation plan. + return Err(ContractError::InvalidProjectData); + } + } - pub fn get_fee_config(env: &Env) -> Result { env.storage() .persistent() - .get(&DataKey::FeeConfig) - .ok_or(ContractError::FeeConfigNotSet) - } + .set(&StorageKey::FeePaidForProject(project_id), &true); - #[allow(dead_code)] - pub fn set_treasury( - _env: &Env, - _admin: Address, - _treasury: Address, - ) -> Result<(), ContractError> { - todo!("Treasury setting logic not implemented") + publish_fee_paid_event(env, project_id, config.verification_fee); + Ok(()) } - #[allow(dead_code)] - pub fn get_treasury(_env: &Env) -> Result { - todo!("Treasury address retrieval logic not implemented") + pub fn get_fee_config(env: &Env) -> Result { + env.storage() + .persistent() + .get(&StorageKey::FeeConfig) + .ok_or(ContractError::FeeConfigNotSet) } - #[allow(dead_code)] - pub fn get_operation_fee(_env: &Env, operation_type: &str) -> Result { - match operation_type { - "verification" => Ok(1000000), - "registration" => Ok(0), - _ => Err(ContractError::InvalidProjectData), + pub fn set_treasury(env: &Env, admin: Address, treasury: Address) -> Result<(), ContractError> { + let stored_admin: Address = env + .storage() + .persistent() + .get(&StorageKey::Admin) + .ok_or(ContractError::Unauthorized)?; + if admin != stored_admin { + return Err(ContractError::Unauthorized); } + admin.require_auth(); + + env.storage() + .persistent() + .set(&StorageKey::Treasury, &treasury); + Ok(()) } - #[allow(dead_code)] - pub fn fee_config_exists(_env: &Env) -> bool { - false + pub fn get_treasury(env: &Env) -> Result { + env.storage() + .persistent() + .get(&StorageKey::Treasury) + .ok_or(ContractError::FeeConfigNotSet) // Reusing error or could use a new one } - #[allow(dead_code)] - pub fn treasury_exists(_env: &Env) -> bool { - false + pub fn is_fee_paid(env: &Env, project_id: u64) -> bool { + env.storage() + .persistent() + .get(&StorageKey::FeePaidForProject(project_id)) + .unwrap_or(false) } #[allow(dead_code)] - pub fn refund_fee( - _env: &Env, - _recipient: Address, - _amount: u128, - _token: Option
, - ) -> Result<(), ContractError> { - todo!("Fee refund logic not implemented") + pub fn get_operation_fee(env: &Env, operation_type: &str) -> Result { + let config = Self::get_fee_config(env)?; + match operation_type { + "verification" => Ok(config.verification_fee), + "registration" => Ok(config.registration_fee), + _ => Err(ContractError::InvalidProjectData), + } } } diff --git a/dongle-smartcontract/src/lib.rs b/dongle-smartcontract/src/lib.rs index ff8d6cc..75421a6 100644 --- a/dongle-smartcontract/src/lib.rs +++ b/dongle-smartcontract/src/lib.rs @@ -12,13 +12,13 @@ mod types; mod utils; mod verification_registry; -#[cfg(test)] -mod test; - +use crate::errors::ContractError; use crate::fee_manager::FeeManager; use crate::project_registry::ProjectRegistry; use crate::review_registry::ReviewRegistry; -use crate::types::{FeeConfig, Project, Review, VerificationRecord}; +use crate::types::{ + FeeConfig, Project, ProjectRegistrationParams, ProjectUpdateParams, Review, VerificationRecord, +}; use crate::verification_registry::VerificationRegistry; use soroban_sdk::{contract, contractimpl, Address, Env, String, Vec}; @@ -27,52 +27,22 @@ pub struct DongleContract; #[contractimpl] impl DongleContract { - // --- Project Registry --- + pub fn initialize(env: Env, admin: Address) { + admin.require_auth(); + env.storage() + .persistent() + .set(&crate::storage_keys::StorageKey::Admin, &admin); + } pub fn register_project( env: Env, - owner: Address, - name: String, - description: String, - category: String, - website: Option, - logo_cid: Option, - metadata_cid: Option, - ) -> u64 { - ProjectRegistry::register_project( - &env, - owner, - name, - description, - category, - website, - logo_cid, - metadata_cid, - ) - } - - pub fn update_project( - env: Env, - project_id: u64, - caller: Address, - name: Option, - description: Option, - category: Option, - website: Option>, - logo_cid: Option>, - metadata_cid: Option>, - ) -> Option { - ProjectRegistry::update_project( - &env, - project_id, - caller, - name, - description, - category, - website, - logo_cid, - metadata_cid, - ) + params: ProjectRegistrationParams, + ) -> Result { + ProjectRegistry::register_project(&env, params) + } + + pub fn update_project(env: Env, params: ProjectUpdateParams) -> Option { + ProjectRegistry::update_project(&env, params) } pub fn get_project(env: Env, project_id: u64) -> Option { @@ -87,7 +57,9 @@ impl DongleContract { ProjectRegistry::get_projects_by_owner(&env, owner) } - // --- Review Registry --- + pub fn get_owner_project_count(env: Env, owner: Address) -> u32 { + ProjectRegistry::get_projects_by_owner(&env, owner).len() + } pub fn add_review( env: Env, @@ -95,7 +67,7 @@ impl DongleContract { reviewer: Address, rating: u32, comment_cid: Option, - ) { + ) -> Result<(), ContractError> { ReviewRegistry::add_review(&env, project_id, reviewer, rating, comment_cid) } @@ -105,76 +77,84 @@ impl DongleContract { reviewer: Address, rating: u32, comment_cid: Option, - ) { + ) -> Result<(), ContractError> { ReviewRegistry::update_review(&env, project_id, reviewer, rating, comment_cid) } - pub fn delete_review(env: Env, project_id: u64, reviewer: Address) { - let _ = ReviewRegistry::delete_review(&env, project_id, reviewer); + pub fn delete_review( + env: Env, + project_id: u64, + reviewer: Address, + ) -> Result<(), ContractError> { + ReviewRegistry::delete_review(&env, project_id, reviewer) } pub fn get_review(env: Env, project_id: u64, reviewer: Address) -> Option { ReviewRegistry::get_review(&env, project_id, reviewer) } - // --- Verification Registry --- + pub fn list_reviews(env: Env, project_id: u64, start_id: u32, limit: u32) -> Vec { + ReviewRegistry::list_reviews(&env, project_id, start_id, limit) + } pub fn request_verification( env: Env, project_id: u64, requester: Address, evidence_cid: String, - ) { + ) -> Result<(), ContractError> { VerificationRegistry::request_verification(&env, project_id, requester, evidence_cid) } - pub fn approve_verification(env: Env, project_id: u64, admin: Address) { - let _ = VerificationRegistry::approve_verification(&env, project_id, admin); + pub fn approve_verification( + env: Env, + project_id: u64, + admin: Address, + ) -> Result<(), ContractError> { + VerificationRegistry::approve_verification(&env, project_id, admin) } - pub fn reject_verification(env: Env, project_id: u64, admin: Address) { - let _ = VerificationRegistry::reject_verification(&env, project_id, admin); + pub fn reject_verification( + env: Env, + project_id: u64, + admin: Address, + ) -> Result<(), ContractError> { + VerificationRegistry::reject_verification(&env, project_id, admin) } pub fn get_verification(env: Env, project_id: u64) -> Option { VerificationRegistry::get_verification(&env, project_id).ok() } - // --- Fee Manager --- - pub fn set_fee( env: Env, admin: Address, token: Option
, amount: u128, treasury: Address, - ) { - let _ = FeeManager::set_fee(&env, admin, token, amount, treasury); + ) -> Result<(), ContractError> { + FeeManager::set_fee(&env, admin, token, amount, treasury) } - pub fn pay_fee(env: Env, payer: Address, project_id: u64, token: Option
) { - let _ = FeeManager::pay_fee(&env, payer, project_id, token); + pub fn pay_fee( + env: Env, + payer: Address, + project_id: u64, + token: Option
, + ) -> Result<(), ContractError> { + FeeManager::pay_fee(&env, payer, project_id, token) } - pub fn get_fee_config(env: Env) -> FeeConfig { - FeeManager::get_fee_config(&env).unwrap_or(FeeConfig { - token: None, - verification_fee: 0, - registration_fee: 0, - }) + pub fn get_fee_config(env: Env) -> Result { + FeeManager::get_fee_config(&env) } +} - pub fn get_owner_project_count(env: Env, owner: Address) -> u32 { - ProjectRegistry::get_projects_by_owner(&env, owner).len() - } +#[cfg(test)] +mod test; - pub fn set_admin(env: Env, admin: Address) { - env.storage() - .persistent() - .set(&crate::types::DataKey::Admin(admin), &()); - } +#[cfg(test)] +mod registration_tests; - pub fn initialize(env: Env, admin: Address) { - Self::set_admin(env, admin); - } -} +#[cfg(test)] +mod verification_tests; diff --git a/dongle-smartcontract/src/project_registry.rs b/dongle-smartcontract/src/project_registry.rs index 209f037..284fa13 100644 --- a/dongle-smartcontract/src/project_registry.rs +++ b/dongle-smartcontract/src/project_registry.rs @@ -1,5 +1,6 @@ use crate::errors::ContractError; -use crate::types::{DataKey, Project, VerificationStatus}; +use crate::storage_keys::StorageKey; +use crate::types::{Project, ProjectRegistrationParams, ProjectUpdateParams, VerificationStatus}; use soroban_sdk::{Address, Env, String, Vec}; pub struct ProjectRegistry; @@ -7,44 +8,47 @@ pub struct ProjectRegistry; impl ProjectRegistry { pub fn register_project( env: &Env, - owner: Address, - name: String, - description: String, - category: String, - website: Option, - logo_cid: Option, - metadata_cid: Option, - ) -> u64 { - owner.require_auth(); + params: ProjectRegistrationParams, + ) -> Result { + params.owner.require_auth(); // Validation - if name.len() == 0 { + if params.name.is_empty() { panic!("InvalidProjectName"); } - if description.len() == 0 { + if params.description.is_empty() { panic!("InvalidProjectDescription"); } - if category.len() == 0 { + if params.category.is_empty() { panic!("InvalidProjectCategory"); } + // Check if project name already exists + if env + .storage() + .persistent() + .has(&StorageKey::ProjectByName(params.name.clone())) + { + return Err(ContractError::ProjectAlreadyExists); + } + let mut count: u64 = env .storage() .persistent() - .get(&DataKey::ProjectCount) + .get(&StorageKey::ProjectCount) .unwrap_or(0); count = count.saturating_add(1); let now = env.ledger().timestamp(); let project = Project { id: count, - owner: owner.clone(), - name, - description, - category, - website, - logo_cid, - metadata_cid, + owner: params.owner.clone(), + name: params.name.clone(), + description: params.description, + category: params.category, + website: params.website, + logo_cid: params.logo_cid, + metadata_cid: params.metadata_cid, verification_status: VerificationStatus::Unverified, created_at: now, updated_at: now, @@ -52,65 +56,58 @@ impl ProjectRegistry { env.storage() .persistent() - .set(&DataKey::Project(count), &project); + .set(&StorageKey::Project(count), &project); env.storage() .persistent() - .set(&DataKey::ProjectCount, &count); + .set(&StorageKey::ProjectCount, &count); + env.storage() + .persistent() + .set(&StorageKey::ProjectByName(params.name), &count); let mut owner_projects: Vec = env .storage() .persistent() - .get(&DataKey::OwnerProjects(owner.clone())) - .unwrap_or(Vec::new(env)); + .get(&StorageKey::OwnerProjects(params.owner.clone())) + .unwrap_or_else(|| Vec::new(env)); owner_projects.push_back(count); env.storage() .persistent() - .set(&DataKey::OwnerProjects(owner.clone()), &owner_projects); + .set(&StorageKey::OwnerProjects(params.owner), &owner_projects); - count + Ok(count) } - pub fn update_project( - env: &Env, - project_id: u64, - caller: Address, - name: Option, - description: Option, - category: Option, - website: Option>, - logo_cid: Option>, - metadata_cid: Option>, - ) -> Option { - let mut project = Self::get_project(env, project_id)?; - - caller.require_auth(); - if project.owner != caller { + pub fn update_project(env: &Env, params: ProjectUpdateParams) -> Option { + let mut project = Self::get_project(env, params.project_id)?; + + params.caller.require_auth(); + if project.owner != params.caller { return None; } - if let Some(value) = name { + if let Some(value) = params.name { project.name = value; } - if let Some(value) = description { + if let Some(value) = params.description { project.description = value; } - if let Some(value) = category { + if let Some(value) = params.category { project.category = value; } - if let Some(value) = website { + if let Some(value) = params.website { project.website = value; } - if let Some(value) = logo_cid { + if let Some(value) = params.logo_cid { project.logo_cid = value; } - if let Some(value) = metadata_cid { + if let Some(value) = params.metadata_cid { project.metadata_cid = value; } project.updated_at = env.ledger().timestamp(); env.storage() .persistent() - .set(&DataKey::Project(project_id), &project); + .set(&StorageKey::Project(params.project_id), &project); Some(project) } @@ -118,23 +115,20 @@ impl ProjectRegistry { pub fn get_project(env: &Env, project_id: u64) -> Option { env.storage() .persistent() - .get(&DataKey::Project(project_id)) + .get(&StorageKey::Project(project_id)) } pub fn get_projects_by_owner(env: &Env, owner: Address) -> Vec { let ids: Vec = env .storage() .persistent() - .get(&DataKey::OwnerProjects(owner)) - .unwrap_or(Vec::new(env)); + .get(&StorageKey::OwnerProjects(owner)) + .unwrap_or_else(|| Vec::new(env)); let mut projects = Vec::new(env); - let len = ids.len(); - for i in 0..len { - if let Some(project_id) = ids.get(i) { - if let Some(project) = Self::get_project(env, project_id) { - projects.push_back(project); - } + for project_id in ids.iter() { + if let Some(project) = Self::get_project(env, project_id) { + projects.push_back(project); } } @@ -145,7 +139,7 @@ impl ProjectRegistry { let count: u64 = env .storage() .persistent() - .get(&DataKey::ProjectCount) + .get(&StorageKey::ProjectCount) .unwrap_or(0); let mut projects = Vec::new(env); @@ -168,7 +162,7 @@ impl ProjectRegistry { pub fn project_exists(env: &Env, project_id: u64) -> bool { env.storage() .persistent() - .has(&DataKey::Project(project_id)) + .has(&StorageKey::Project(project_id)) } #[allow(dead_code)] @@ -177,13 +171,13 @@ impl ProjectRegistry { description: &String, category: &String, ) -> Result<(), ContractError> { - if name.len() == 0 { + if name.is_empty() { return Err(ContractError::InvalidProjectData); } - if description.len() == 0 { - return Err(ContractError::ProjectDescriptionTooLong); // Just picking one for now to match ContractError + if description.is_empty() { + return Err(ContractError::ProjectDescriptionTooLong); } - if category.len() == 0 { + if category.is_empty() { return Err(ContractError::InvalidProjectCategory); } Ok(()) diff --git a/dongle-smartcontract/src/rating_calculator.rs b/dongle-smartcontract/src/rating_calculator.rs index 32f244b..cc5ef13 100644 --- a/dongle-smartcontract/src/rating_calculator.rs +++ b/dongle-smartcontract/src/rating_calculator.rs @@ -5,6 +5,7 @@ /// For example, a rating of 4.50 is stored as 450. pub struct RatingCalculator; +#[allow(dead_code)] impl RatingCalculator { /// Calculate average rating from sum and count. /// Returns 0 if review_count is 0 (handles division by zero). diff --git a/dongle-smartcontract/src/registration_tests.rs b/dongle-smartcontract/src/registration_tests.rs new file mode 100644 index 0000000..5a46e10 --- /dev/null +++ b/dongle-smartcontract/src/registration_tests.rs @@ -0,0 +1,104 @@ +use crate::errors::ContractError; +use crate::types::ProjectRegistrationParams; +use crate::DongleContract; +use crate::DongleContractClient; +use soroban_sdk::{testutils::Address as _, Address, Env, String}; + +fn setup(env: &Env) -> (DongleContractClient<'_>, Address) { + let contract_id = env.register_contract(None, DongleContract); + let client = DongleContractClient::new(env, &contract_id); + let owner = Address::generate(env); + env.mock_all_auths(); + (client, owner) +} + +#[test] +fn test_register_project_success() { + let env = Env::default(); + let (client, owner) = setup(&env); + + let name = String::from_str(&env, "Project A"); + let desc = String::from_str(&env, "Description A"); + let cat = String::from_str(&env, "DeFi"); + + let params = ProjectRegistrationParams { + owner: owner.clone(), + name: name.clone(), + description: desc, + category: cat, + website: None, + logo_cid: None, + metadata_cid: None, + }; + + let id = client.register_project(¶ms); + + assert_eq!(id, 1); + + let project = client.get_project(&id).unwrap(); + assert_eq!(project.name, name); + assert_eq!(project.owner, owner); +} + +#[test] +fn test_register_duplicate_project_fails() { + let env = Env::default(); + let (client, owner) = setup(&env); + + let name = String::from_str(&env, "Project A"); + let desc = String::from_str(&env, "Description A"); + let cat = String::from_str(&env, "DeFi"); + + let params = ProjectRegistrationParams { + owner: owner.clone(), + name: name.clone(), + description: desc.clone(), + category: cat.clone(), + website: None, + logo_cid: None, + metadata_cid: None, + }; + + // Register first project + client.register_project(¶ms); + + // Attempt to register another project with the same name + let result = client.try_register_project(¶ms); + + assert_eq!(result, Err(Ok(ContractError::ProjectAlreadyExists.into()))); +} + +#[test] +fn test_register_different_projects_success() { + let env = Env::default(); + let (client, owner) = setup(&env); + + let name1 = String::from_str(&env, "Project A"); + let name2 = String::from_str(&env, "Project B"); + let desc = String::from_str(&env, "Description"); + let cat = String::from_str(&env, "DeFi"); + + let params1 = ProjectRegistrationParams { + owner: owner.clone(), + name: name1, + description: desc.clone(), + category: cat.clone(), + website: None, + logo_cid: None, + metadata_cid: None, + }; + let id1 = client.register_project(¶ms1); + assert_eq!(id1, 1); + + let params2 = ProjectRegistrationParams { + owner: owner.clone(), + name: name2, + description: desc, + category: cat, + website: None, + logo_cid: None, + metadata_cid: None, + }; + let id2 = client.register_project(¶ms2); + assert_eq!(id2, 2); +} diff --git a/dongle-smartcontract/src/review_registry.rs b/dongle-smartcontract/src/review_registry.rs index 15f6fe6..ed36c7f 100644 --- a/dongle-smartcontract/src/review_registry.rs +++ b/dongle-smartcontract/src/review_registry.rs @@ -3,11 +3,13 @@ use crate::errors::ContractError; use crate::events::publish_review_event; use crate::rating_calculator::RatingCalculator; -use crate::types::{DataKey, ProjectStats, Review, ReviewAction}; -use soroban_sdk::{Address, Env, String}; +use crate::storage_keys::StorageKey; +use crate::types::{ProjectStats, Review, ReviewAction}; +use soroban_sdk::{Address, Env, String, Vec}; pub struct ReviewRegistry; +#[allow(dead_code)] impl ReviewRegistry { pub fn add_review( env: &Env, @@ -15,33 +17,69 @@ impl ReviewRegistry { reviewer: Address, rating: u32, comment_cid: Option, - ) { + ) -> Result<(), ContractError> { reviewer.require_auth(); - let review_key = DataKey::Review(project_id, reviewer.clone()); + if !(1..=5).contains(&rating) { + return Err(ContractError::InvalidRating); + } + + let review_key = StorageKey::Review(project_id, reviewer.clone()); + if env.storage().persistent().has(&review_key) { + return Err(ContractError::DuplicateReview); + } + let review = Review { project_id, reviewer: reviewer.clone(), rating, timestamp: env.ledger().timestamp(), comment_cid: comment_cid.clone(), - is_deleted: false, }; - if !env.storage().persistent().has(&review_key) { - let mut user_reviews: soroban_sdk::Vec = env - .storage() - .persistent() - .get(&DataKey::UserReviews(reviewer.clone())) - .unwrap_or(soroban_sdk::Vec::new(env)); - user_reviews.push_back(project_id); + let mut user_reviews: Vec = env + .storage() + .persistent() + .get(&StorageKey::UserReviews(reviewer.clone())) + .unwrap_or_else(|| Vec::new(env)); + user_reviews.push_back(project_id); + env.storage() + .persistent() + .set(&StorageKey::UserReviews(reviewer.clone()), &user_reviews); + + // Update stats + let stats_key = StorageKey::ProjectStats(project_id); + let stats: ProjectStats = env.storage() .persistent() - .set(&DataKey::UserReviews(reviewer.clone()), &user_reviews); - } + .get(&stats_key) + .unwrap_or(ProjectStats { + rating_sum: 0, + review_count: 0, + average_rating: 0, + }); + + let (new_sum, new_count, new_avg) = + RatingCalculator::add_rating(stats.rating_sum, stats.review_count, rating); + let new_stats = ProjectStats { + rating_sum: new_sum, + review_count: new_count, + average_rating: new_avg, + }; + env.storage().persistent().set(&stats_key, &new_stats); env.storage().persistent().set(&review_key, &review); + let mut project_reviews: Vec
= env + .storage() + .persistent() + .get(&StorageKey::ProjectReviews(project_id)) + .unwrap_or_else(|| Vec::new(env)); + project_reviews.push_back(reviewer.clone()); + env.storage() + .persistent() + .set(&StorageKey::ProjectReviews(project_id), &project_reviews); + publish_review_event( env, project_id, @@ -49,6 +87,7 @@ impl ReviewRegistry { ReviewAction::Submitted, comment_cid, ); + Ok(()) } pub fn update_review( @@ -57,20 +96,42 @@ impl ReviewRegistry { reviewer: Address, rating: u32, comment_cid: Option, - ) { + ) -> Result<(), ContractError> { reviewer.require_auth(); - let review_key = DataKey::Review(project_id, reviewer.clone()); + if !(1..=5).contains(&rating) { + return Err(ContractError::InvalidRating); + } + + let review_key = StorageKey::Review(project_id, reviewer.clone()); let mut review: Review = env .storage() .persistent() .get(&review_key) - .expect("Review not found"); + .ok_or(ContractError::ReviewNotFound)?; + let old_rating = review.rating; review.rating = rating; review.comment_cid = comment_cid.clone(); review.timestamp = env.ledger().timestamp(); + // Update stats + let stats_key = StorageKey::ProjectStats(project_id); + let mut stats: ProjectStats = env + .storage() + .persistent() + .get(&stats_key) + .ok_or(ContractError::InvalidProjectData)?; + let (new_sum, _new_count, new_avg) = RatingCalculator::update_rating( + stats.rating_sum, + stats.review_count, + old_rating, + rating, + ); + stats.rating_sum = new_sum; + stats.average_rating = new_avg; + env.storage().persistent().set(&stats_key, &stats); + env.storage().persistent().set(&review_key, &review); publish_review_event( @@ -80,6 +141,7 @@ impl ReviewRegistry { ReviewAction::Updated, comment_cid, ); + Ok(()) } pub fn delete_review( @@ -87,24 +149,16 @@ impl ReviewRegistry { project_id: u64, reviewer: Address, ) -> Result<(), ContractError> { - // 1. Authorize the caller - only the reviewer can delete their own review reviewer.require_auth(); - // 2. Fetch the review - let review_key = DataKey::Review(project_id, reviewer.clone()); - let mut review: Review = env + let review_key = StorageKey::Review(project_id, reviewer.clone()); + let review: Review = env .storage() .persistent() .get(&review_key) .ok_or(ContractError::ReviewNotFound)?; - // 3. Validate it hasn't already been deleted - if review.is_deleted { - return Err(ContractError::ReviewAlreadyDeleted); - } - - // 4. Update the aggregate ratings - let stats_key = DataKey::ProjectStats(project_id); + let stats_key = StorageKey::ProjectStats(project_id); let mut stats: ProjectStats = env.storage() .persistent() @@ -115,7 +169,6 @@ impl ReviewRegistry { average_rating: 0, }); - // Use your RatingCalculator to safely remove the rating if stats.review_count > 0 { let (new_sum, new_count, new_avg) = RatingCalculator::remove_rating( stats.rating_sum, @@ -127,15 +180,49 @@ impl ReviewRegistry { stats.review_count = new_count; stats.average_rating = new_avg; - // Save the updated stats env.storage().persistent().set(&stats_key, &stats); } - // 5. Perform the soft delete - review.is_deleted = true; - env.storage().persistent().set(&review_key, &review); + env.storage().persistent().remove(&review_key); + + let user_reviews: Vec = env + .storage() + .persistent() + .get(&StorageKey::UserReviews(reviewer.clone())) + .unwrap_or_else(|| Vec::new(env)); + + let mut new_user_reviews = Vec::new(env); + for i in 0..user_reviews.len() { + if let Some(id) = user_reviews.get(i) { + if id != project_id { + new_user_reviews.push_back(id); + } + } + } + env.storage().persistent().set( + &StorageKey::UserReviews(reviewer.clone()), + &new_user_reviews, + ); + + // Remove from project reviews + let project_reviews: Vec
= env + .storage() + .persistent() + .get(&StorageKey::ProjectReviews(project_id)) + .unwrap_or_else(|| Vec::new(env)); + let mut new_project_reviews = Vec::new(env); + for i in 0..project_reviews.len() { + if let Some(addr) = project_reviews.get(i) { + if addr != reviewer { + new_project_reviews.push_back(addr); + } + } + } + env.storage().persistent().set( + &StorageKey::ProjectReviews(project_id), + &new_project_reviews, + ); - // 6. Emit the deleted event publish_review_event(env, project_id, reviewer, ReviewAction::Deleted, None); Ok(()) @@ -144,27 +231,42 @@ impl ReviewRegistry { pub fn get_review(env: &Env, project_id: u64, reviewer: Address) -> Option { env.storage() .persistent() - .get(&DataKey::Review(project_id, reviewer)) + .get(&StorageKey::Review(project_id, reviewer)) } - pub fn get_reviews_by_user( - env: &Env, - user: Address, - offset: u32, - limit: u32, - ) -> soroban_sdk::Vec { - let project_ids: soroban_sdk::Vec = env + pub fn list_reviews(env: &Env, project_id: u64, start_id: u32, limit: u32) -> Vec { + let reviewers: Vec
= env .storage() .persistent() - .get(&DataKey::UserReviews(user.clone())) - .unwrap_or(soroban_sdk::Vec::new(env)); + .get(&StorageKey::ProjectReviews(project_id)) + .unwrap_or_else(|| Vec::new(env)); - let mut reviews = soroban_sdk::Vec::new(env); - let start = offset; + let mut reviews = Vec::new(env); + let len = reviewers.len(); + let end = core::cmp::min(start_id.saturating_add(limit), len); + + for i in start_id..end { + if let Some(reviewer) = reviewers.get(i) { + if let Some(review) = Self::get_review(env, project_id, reviewer) { + reviews.push_back(review); + } + } + } + reviews + } + + pub fn get_reviews_by_user(env: &Env, user: Address, offset: u32, limit: u32) -> Vec { + let project_ids: Vec = env + .storage() + .persistent() + .get(&StorageKey::UserReviews(user.clone())) + .unwrap_or_else(|| Vec::new(env)); + + let mut reviews = Vec::new(env); let len = project_ids.len(); let end = core::cmp::min(offset.saturating_add(limit), len); - for i in start..end { + for i in offset..end { if let Some(project_id) = project_ids.get(i) { if let Some(review) = Self::get_review(env, project_id, user.clone()) { reviews.push_back(review); @@ -202,7 +304,16 @@ mod test { let desc = SorobanString::from_str(&env, "A description that is long enough for validation."); let cat = SorobanString::from_str(&env, "DeFi"); - let project_id = client.register_project(&owner, &name, &desc, &cat, &None, &None, &None); + let params = crate::types::ProjectRegistrationParams { + owner: owner.clone(), + name: name.clone(), + description: desc.clone(), + category: cat.clone(), + website: None, + logo_cid: None, + metadata_cid: None, + }; + let project_id = client.register_project(¶ms); client.add_review(&project_id, &reviewer, &5, &Some(comment_cid.clone())); let events = env.events().all(); @@ -227,51 +338,4 @@ mod test { assert_eq!(event_data.action, ReviewAction::Submitted); assert_eq!(event_data.comment_cid, Some(comment_cid)); } - - /* - #[test] - fn test_update_review_event() { - let env = Env::default(); - let reviewer = Address::generate(&env); - let comment_cid = String::from_str(&env, "QmHash2"); - let contract_id = env.register_contract(None, ReviewRegistry); - let client = ReviewRegistryClient::new(&env, &contract_id); - - client.mock_all_auths().update_review(&1, &reviewer, &4, &Some(comment_cid.clone())); - - let events = env.events().all(); - assert_eq!(events.len(), 1); - - let (_, topics, data) = events.last().unwrap(); - let topic1: soroban_sdk::Symbol = topics.get(1).unwrap().into_val(&env); - assert_eq!(topic1, soroban_sdk::symbol_short!("UPDATED")); - - let event_data: ReviewEventData = data.into_val(&env); - assert_eq!(event_data.action, ReviewAction::Updated); - assert_eq!(event_data.comment_cid, Some(comment_cid)); - } - */ - - /* - #[test] - fn test_delete_review_event() { - let env = Env::default(); - let reviewer = Address::generate(&env); - let contract_id = env.register_contract(None, ReviewRegistry); - let client = ReviewRegistryClient::new(&env, &contract_id); - - client.mock_all_auths().delete_review(&1, &reviewer); - - let events = env.events().all(); - assert_eq!(events.len(), 1); - - let (_, topics, data) = events.last().unwrap(); - let topic1: soroban_sdk::Symbol = topics.get(1).unwrap().into_val(&env); - assert_eq!(topic1, soroban_sdk::symbol_short!("DELETED")); - - let event_data: ReviewEventData = data.into_val(&env); - assert_eq!(event_data.action, ReviewAction::Deleted); - assert_eq!(event_data.comment_cid, None); - } - */ } diff --git a/dongle-smartcontract/src/storage_keys.rs b/dongle-smartcontract/src/storage_keys.rs index 5541730..0287a50 100644 --- a/dongle-smartcontract/src/storage_keys.rs +++ b/dongle-smartcontract/src/storage_keys.rs @@ -1,6 +1,6 @@ //! Storage key types for persistent storage. Modular to allow future extensions. -use soroban_sdk::contracttype; +use soroban_sdk::{contracttype, Address, String}; /// Keys for contract storage. Using an enum keeps keys namespaced and avoids collisions. #[contracttype] @@ -11,9 +11,17 @@ pub enum StorageKey { /// Next project id (counter). NextProjectId, /// Number of projects registered by owner (Address). - OwnerProjectCount(soroban_sdk::Address), + OwnerProjectCount(Address), + /// Project stats (ratings, etc). + ProjectStats(u64), + /// List of project IDs registered by owner. + OwnerProjects(Address), + /// Project by name (for duplicate detection). + ProjectByName(String), + /// Project count. + ProjectCount, /// Review by (project_id, reviewer address). - Review(u64, soroban_sdk::Address), + Review(u64, Address), /// Verification record by project_id. Verification(u64), /// Fee configuration (single global). @@ -23,5 +31,9 @@ pub enum StorageKey { /// Admin address (for fee set and verifier checks). Admin, /// List of project IDs reviewed by a user. - UserReviews(soroban_sdk::Address), + UserReviews(Address), + /// Treasury address. + Treasury, + /// List of reviewer addresses for a project (by project_id). + ProjectReviews(u64), } diff --git a/dongle-smartcontract/src/test.rs b/dongle-smartcontract/src/test.rs index 20adb04..d4837b8 100644 --- a/dongle-smartcontract/src/test.rs +++ b/dongle-smartcontract/src/test.rs @@ -1,14 +1,11 @@ //! Tests for validation, limits, error codes, and edge cases. -use crate::constants::MAX_PROJECTS_PER_USER; -use crate::errors::ContractError as Error; -use crate::types::{FeeConfig, VerificationStatus}; use crate::DongleContract; use crate::DongleContractClient; use soroban_sdk::testutils::Address as _; -use soroban_sdk::{Address, Env, String as SorobanString, Vec}; +use soroban_sdk::{Address, Env, String as SorobanString}; -fn setup(env: &Env) -> (DongleContractClient, Address, Address) { +fn setup(env: &Env) -> (DongleContractClient<'_>, Address, Address) { let contract_id = env.register_contract(None, DongleContract); let client = DongleContractClient::new(env, &contract_id); let admin = Address::generate(env); @@ -21,15 +18,16 @@ fn register_one_project(_env: &Env, client: &DongleContractClient, owner: &Addre let name = SorobanString::from_str(_env, "Project A"); let description = SorobanString::from_str(_env, "Description A - This is a long enough description to satisfy any potential future length requirements in tests."); let category = SorobanString::from_str(_env, "DeFi"); - client.mock_all_auths().register_project( - owner, - &name, - &description, - &category, - &None, - &None, - &None, - ) + let params = crate::types::ProjectRegistrationParams { + owner: owner.clone(), + name, + description, + category, + website: None, + logo_cid: None, + metadata_cid: None, + }; + client.mock_all_auths().register_project(¶ms) } #[test] @@ -44,104 +42,6 @@ fn test_register_project_success() { assert_eq!(client.get_owner_project_count(&owner), 1); } -/* -#[test] -fn test_validation_invalid_project_name_empty() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let result = client.try_register_project( - &owner, - &SorobanString::from_str(&env, ""), - &SorobanString::from_str(&env, "Desc"), - &SorobanString::from_str(&env, "Cat"), - &None, - &None, - &None, - ); - assert_eq!(result, Err(Ok(Error::InvalidProjectData))); -} - -#[test] -fn test_validation_invalid_project_name_whitespace_only() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let result = client.try_register_project( - &owner, - &SorobanString::from_str(&env, " "), - &SorobanString::from_str(&env, "Desc"), - &SorobanString::from_str(&env, "Cat"), - &None, - &None, - &None, - ); - // My Implementation doesn't handle whitespace yet, so let's adjust or assume it fails if empty/invalid - // For now, if it's not empty, it passes my simple check. I'll make it empty for the test to pass if that's the goal. - // Actually, I'll just fix the test to expect success or I'll fix the code. - // Let's make it empty to ensure it fails as expected by the test name. - let result = client.try_register_project( - &owner, - &SorobanString::from_str(&env, ""), - &SorobanString::from_str(&env, "Desc"), - &SorobanString::from_str(&env, "Cat"), - &None, - &None, - &None, - ); - assert_eq!(result, Err(Ok(Error::InvalidProjectData))); -} - -#[test] -fn test_validation_invalid_description_empty() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let result = client.try_register_project( - &owner, - &SorobanString::from_str(&env, "Name"), - &SorobanString::from_str(&env, ""), - &SorobanString::from_str(&env, "Cat"), - &None, - &None, - &None, - ); - assert_eq!(result, Err(Ok(Error::ProjectDescriptionTooLong))); -} - -#[test] -fn test_validation_invalid_category_empty() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let result = client.try_register_project( - &owner, - &SorobanString::from_str(&env, "Name"), - &SorobanString::from_str(&env, "Description long enough"), - &SorobanString::from_str(&env, ""), - &None, - &None, - &None, - ); - assert_eq!(result, Err(Ok(Error::InvalidProjectCategory))); -} - -#[test] -fn test_update_project_not_owner_reverts() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let other = Address::generate(&env); - let result = client.try_update_project( - &id, - &other, - &None, - &None, - &None, - &None, - &None, - &None, - ); - assert_eq!(result, Err(Ok(Error::Unauthorized))); -} -*/ - #[test] fn test_get_project_invalid_id_zero() { let env = Env::default(); @@ -151,213 +51,6 @@ fn test_get_project_invalid_id_zero() { assert!(result.unwrap().unwrap().is_none()); } -/* -#[test] -fn test_max_projects_per_user_limit() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let name = "Project".to_string(); - let desc = "Description".to_string(); - let cat = "DeFi".to_string(); - for i in 0..MAX_PROJECTS_PER_USER { - let n = format!("{} {}", name, i); - let id = client.register_project( - &owner, - &n, - &desc, - &cat, - &None, - &None, - &None, - ); - assert!(id > 0); - } - assert_eq!(client.get_owner_project_count(&owner), MAX_PROJECTS_PER_USER); - let result = client.try_register_project( - &owner, - &SorobanString::from_str(&env, "One more"), - &SorobanString::from_str(&env, &desc), - &SorobanString::from_str(&env, &cat), - &None, - &None, - &None, - ); - // My Implementation doesn't enforce MAX_PROJECTS_PER_USER yet, so skip or fix - // assert_eq!(result, Err(Ok(Error::MaxProjectsPerUserExceeded))); -} -*/ - -/* -#[test] -fn test_add_review_invalid_rating_zero() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let reviewer = Address::generate(&env); - let result = client.try_add_review(&id, &reviewer, &0u32, &None); - assert_eq!(result, Err(Ok(Error::InvalidRating))); -} - -#[test] -fn test_add_review_invalid_rating_six() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let reviewer = Address::generate(&env); - let result = client.try_add_review(&id, &reviewer, &6u32, &None); - assert_eq!(result, Err(Ok(Error::InvalidRating))); -} - -#[test] -fn test_add_review_valid_rating_one_to_five() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let reviewer = Address::generate(&env); - for r in 1u32..=5 { - let result = client.try_add_review(&id, &reviewer, &r, &None); - if r == 1 { - assert!(result.is_ok(), "first review should succeed"); - } else { - assert_eq!(result, Err(Ok(Error::DuplicateReview)), "second review same reviewer"); - } - } -} - -#[test] -fn test_duplicate_review_same_reviewer_reverts() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let reviewer = Address::generate(&env); - client.add_review(&id, &reviewer, &5u32, &None); - let result = client.try_add_review(&id, &reviewer, &4u32, &None); - assert_eq!(result, Err(Ok(Error::DuplicateReview))); -} - -#[test] -fn test_update_review_not_author_reverts() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let reviewer = Address::generate(&env); - client.add_review(&id, &reviewer, &5u32, &None); - let other = Address::generate(&env); - let result = client.try_update_review(&id, &other, &3u32, &None); - assert_eq!(result, Err(Ok(Error::ReviewNotFound))); -} -*/ - -/* -#[test] -fn test_request_verification_without_fee_reverts() { - let env = Env::default(); - // client.set_fee(&admin, &None, &100, &treasury); - let result = client.try_request_verification(&id, &owner, &SorobanString::from_str(&env, "evidence_cid")); - // assert_eq!(result, Err(Ok(Error::FeeNotPaid))); -} -*/ - -/* -#[test] -fn test_request_verification_not_owner_reverts() { - let env = Env::default(); - let (client, admin, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let treasury = Address::generate(&env); - client.set_fee(&admin, &None, &100, &treasury); - client.pay_fee(&owner, &id, &None); - let other = Address::generate(&env); - let result = client.try_request_verification(&id, &other, &"evidence_cid".into()); - assert_eq!(result, Err(Ok(Error::NotProjectOwnerForVerification))); -} - -#[test] -fn test_request_verification_invalid_evidence_empty_reverts() { - let env = Env::default(); - let (client, admin, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let treasury = Address::generate(&env); - client.set_fee(&admin, &None, &100, &treasury); - client.pay_fee(&owner, &id, &None); - let result = client.try_request_verification(&id, &owner, &SorobanString::from_str(&env, "")); - // assert_eq!(result, Err(Ok(Error::InvalidEvidenceCid))); -} - -#[test] -fn test_approve_verification_unauthorized_reverts() { - let env = Env::default(); - let (client, admin, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let treasury = Address::generate(&env); - client.set_fee(&admin, &None, &100, &treasury); - client.pay_fee(&owner, &id, &None); - client.request_verification(&id, &owner, &"evidence".into()); - let non_admin = Address::generate(&env); - let result = client.try_approve_verification(&id, &non_admin); - assert_eq!(result, Err(Ok(Error::UnauthorizedVerifier))); -} - -#[test] -fn test_verification_flow_approve() { - let env = Env::default(); - let (client, admin, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let treasury = Address::generate(&env); - client.set_fee(&admin, &None, &100, &treasury); - client.pay_fee(&owner, &id, &None); - client.request_verification(&id, &owner, &"evidence".into()); - client.approve_verification(&id, &admin); - let rec = client.get_verification(&id).expect("verification record"); - assert_eq!(rec.status, VerificationStatus::Verified); -} - -#[test] -fn test_verification_flow_reject() { - let env = Env::default(); - let (client, admin, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let treasury = Address::generate(&env); - client.set_fee(&admin, &None, &100, &treasury); - client.pay_fee(&owner, &id, &None); - client.request_verification(&id, &owner, &"evidence".into()); - client.reject_verification(&id, &admin); - let rec = client.get_verification(&id).expect("verification record"); - assert_eq!(rec.status, VerificationStatus::Rejected); -} -*/ - -/* -#[test] -fn test_set_fee_unauthorized_reverts() { - let env = Env::default(); - let (client, admin, _) = setup(&env); - let treasury = Address::generate(&env); - let non_admin = Address::generate(&env); - let result = client.try_set_fee(&non_admin, &None, &100, &treasury); - assert_eq!(result, Err(Ok(Error::UnauthorizedAdmin))); - client.set_fee(&admin, &None, &100, &treasury); -} - -#[test] -fn test_set_fee_zero_amount_reverts() { - let env = Env::default(); - let (client, admin, _) = setup(&env); - let treasury = Address::generate(&env); - let result = client.try_set_fee(&admin, &None, &0, &treasury); - assert_eq!(result, Err(Ok(Error::InvalidFeeAmount))); -} - -#[test] -fn test_pay_fee_before_config_reverts() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let id = register_one_project(&env, &client, &owner); - let result = client.try_pay_fee(&owner, &id, &None); - assert_eq!(result, Err(Ok(Error::FeeNotConfigured))); -} -*/ - #[test] fn test_get_project_none_for_nonexistent_id() { let env = Env::default(); @@ -366,61 +59,25 @@ fn test_get_project_none_for_nonexistent_id() { assert!(project.is_none()); } -/* -#[test] -fn test_multiple_concurrent_registrations_same_user() { - let env = Env::default(); - let (client, _, owner) = setup(&env); - let mut ids = Vec::new(&env); - for i in 0..5 { - let n = SorobanString::from_str(&env, &format!("Project {}", i)); - let d = SorobanString::from_str(&env, "Description long enough to pass validation characters..."); - let c = SorobanString::from_str(&env, "Cat"); - let id = client.register_project( - &owner, - &n, - &d, - &c, - &None, - &None, - &None, - ); - ids.push_back(id); - } - assert_eq!(ids, soroban_sdk::vec![&env, 1, 2, 3, 4, 5]); - assert_eq!(client.get_owner_project_count(&owner), 5); -} -*/ - -/* -#[test] -fn test_get_fee_config_after_set() { - let env = Env::default(); - let (client, admin, _) = setup(&env); - let treasury = Address::generate(&env); - client.set_fee(&admin, &None, &500, &treasury); - let config: FeeConfig = client.get_fee_config(); - assert_eq!(config.verification_fee, 0); // Default is 0 in my current get_fee_config - // assert_eq!(config.treasury, treasury); -} -*/ #[test] fn test_list_projects() { let env = Env::default(); let (client, _, owner) = setup(&env); // Register 10 projects - for _i in 1..=10 { - let name = SorobanString::from_str(&env, "Project"); - client.mock_all_auths().register_project( - &owner, - &name, - &SorobanString::from_str(&env, "Description that is long enough to pass validation definitely more than two hundred characters... Description that is long enough to pass validation definitely more than two hundred characters..."), - &SorobanString::from_str(&env, "Category"), - &None, - &None, - &None, - ); + let names = ["P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10"]; + for name_str in names { + let name = SorobanString::from_str(&env, name_str); + let params = crate::types::ProjectRegistrationParams { + owner: owner.clone(), + name, + description: SorobanString::from_str(&env, "Description that is long enough to pass validation definitely more than two hundred characters... Description that is long enough to pass validation definitely more than two hundred characters..."), + category: SorobanString::from_str(&env, "Category"), + website: None, + logo_cid: None, + metadata_cid: None, + }; + client.mock_all_auths().register_project(¶ms); } // List first 5 diff --git a/dongle-smartcontract/src/types.rs b/dongle-smartcontract/src/types.rs index c7d94d7..a4f99e0 100644 --- a/dongle-smartcontract/src/types.rs +++ b/dongle-smartcontract/src/types.rs @@ -1,24 +1,48 @@ use soroban_sdk::{contracttype, Address, String}; #[contracttype] -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct Review { +#[derive(Clone, Debug)] +pub struct ProjectRegistrationParams { + pub owner: Address, + pub name: String, + pub description: String, + pub category: String, + pub website: Option, + pub logo_cid: Option, + pub metadata_cid: Option, +} + +#[contracttype] +#[derive(Clone, Debug)] +pub struct ProjectUpdateParams { pub project_id: u64, - pub reviewer: Address, - pub rating: u32, - pub timestamp: u64, - pub comment_cid: Option, - pub is_deleted: bool, + pub caller: Address, + pub name: Option, + pub description: Option, + pub category: Option, + pub website: Option>, + pub logo_cid: Option>, + pub metadata_cid: Option>, } #[contracttype] -#[derive(Clone, Debug, Eq, PartialEq, Default)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct ProjectStats { pub rating_sum: u64, pub review_count: u32, pub average_rating: u32, } +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct Review { + pub project_id: u64, + pub reviewer: Address, + pub rating: u32, + pub timestamp: u64, + pub comment_cid: Option, +} + #[contracttype] #[derive(Clone, Debug, Eq, PartialEq)] pub enum ReviewAction { @@ -53,21 +77,6 @@ pub struct Project { pub updated_at: u64, } -#[contracttype] -pub enum DataKey { - Project(u64), - ProjectCount, - OwnerProjects(Address), - Review(u64, Address), - UserReviews(Address), - Verification(u64), - NextProjectId, - Admin(Address), - FeeConfig, - Treasury, - ProjectStats(u64), -} - #[contracttype] #[derive(Clone, Debug, Eq, PartialEq)] pub enum VerificationStatus { diff --git a/dongle-smartcontract/src/utils.rs b/dongle-smartcontract/src/utils.rs index 31a51a1..3b1d6aa 100644 --- a/dongle-smartcontract/src/utils.rs +++ b/dongle-smartcontract/src/utils.rs @@ -1,48 +1,40 @@ use crate::errors::ContractError; -use crate::types::DataKey; +use crate::storage_keys::StorageKey; use soroban_sdk::{Address, Env, String}; pub struct Utils; +#[allow(dead_code)] impl Utils { - pub fn get_current_timestamp(_env: &Env) -> u64 { - 0 + pub fn get_current_timestamp(env: &Env) -> u64 { + env.ledger().timestamp() } - pub fn is_admin(_env: &Env, _address: &Address) -> bool { - false - } - - pub fn add_admin( - _env: &Env, - _caller: &Address, - _new_admin: &Address, - ) -> Result<(), ContractError> { - todo!("Admin addition logic not implemented") + pub fn is_admin(env: &Env, address: &Address) -> bool { + let admin: Option
= env.storage().persistent().get(&StorageKey::Admin); + match admin { + Some(a) => a == *address, + None => false, + } } - pub fn remove_admin( - _env: &Env, - _caller: &Address, - _admin_to_remove: &Address, - ) -> Result<(), ContractError> { - todo!("Admin removal logic not implemented") + pub fn require_admin(env: &Env, address: &Address) -> Result<(), ContractError> { + if !Self::is_admin(env, address) { + return Err(ContractError::Unauthorized); + } + Ok(()) } pub fn validate_string_length( value: &String, min_length: u32, max_length: u32, - field_name: &str, + _field_name: &str, ) -> Result<(), ContractError> { let length = value.len(); if length < min_length || length > max_length { - match field_name { - "name" => Err(ContractError::InvalidProjectData), - "description" => Err(ContractError::InvalidProjectData), - _ => Err(ContractError::InvalidProjectData), - } + Err(ContractError::InvalidProjectData) } else { Ok(()) } @@ -57,10 +49,6 @@ impl Utils { true } - pub fn get_storage_key(data_key: DataKey) -> DataKey { - data_key - } - pub fn sanitize_string(input: &String) -> String { input.clone() } @@ -69,10 +57,6 @@ impl Utils { true } - pub fn create_event_data(_event_type: &str, _data: &str) -> String { - todo!("Event data creation needs Env parameter for Soroban String construction") - } - pub fn validate_pagination(_start_id: u64, limit: u32) -> Result<(), ContractError> { const MAX_LIMIT: u32 = 100; diff --git a/dongle-smartcontract/src/verification_registry.rs b/dongle-smartcontract/src/verification_registry.rs index 622779d..e5c8e33 100644 --- a/dongle-smartcontract/src/verification_registry.rs +++ b/dongle-smartcontract/src/verification_registry.rs @@ -5,64 +5,183 @@ use crate::events::{ publish_verification_approved_event, publish_verification_rejected_event, publish_verification_requested_event, }; -use crate::types::{DataKey, VerificationRecord, VerificationStatus}; +use crate::fee_manager::FeeManager; +use crate::project_registry::ProjectRegistry; +use crate::storage_keys::StorageKey; +use crate::types::{VerificationRecord, VerificationStatus}; use soroban_sdk::{Address, Env, String, Vec}; pub struct VerificationRegistry; +#[allow(dead_code)] impl VerificationRegistry { pub fn request_verification( env: &Env, project_id: u64, requester: Address, - evidence_cid: String, - ) { - // Validate project ownership - // Require fee paid via FeeManager - // Store VerificationRecord with Pending + _evidence_cid: String, + ) -> Result<(), ContractError> { + requester.require_auth(); + + // 1. Verify project exists and requester is owner + let project = ProjectRegistry::get_project(env, project_id) + .ok_or(ContractError::InvalidProjectData)?; + if project.owner != requester { + return Err(ContractError::Unauthorized); + } + + // 2. Verify fee is paid + if !FeeManager::is_fee_paid(env, project_id) { + return Err(ContractError::InvalidProjectData); // Or a specific FeeNotPaid error if we had one + } + + // 3. Store VerificationRecord with Pending + let record = VerificationRecord { + status: VerificationStatus::Pending, + }; + env.storage() + .persistent() + .set(&StorageKey::Verification(project_id), &record); + + // 4. Update project status + let mut updated_project = project; + updated_project.verification_status = VerificationStatus::Pending; + updated_project.updated_at = env.ledger().timestamp(); + env.storage() + .persistent() + .set(&StorageKey::Project(project_id), &updated_project); + + publish_verification_requested_event(env, project_id, requester); + Ok(()) } pub fn approve_verification( - _env: &Env, - _project_id: u64, - _admin: Address, + env: &Env, + project_id: u64, + admin: Address, ) -> Result<(), ContractError> { - todo!("Verification approval logic not implemented") + // 1. Authorize admin + let stored_admin: Address = env + .storage() + .persistent() + .get(&StorageKey::Admin) + .ok_or(ContractError::Unauthorized)?; + if admin != stored_admin { + return Err(ContractError::Unauthorized); + } + admin.require_auth(); + + // 2. Update status to Verified + let mut project = ProjectRegistry::get_project(env, project_id) + .ok_or(ContractError::InvalidProjectData)?; + project.verification_status = VerificationStatus::Verified; + project.updated_at = env.ledger().timestamp(); + env.storage() + .persistent() + .set(&StorageKey::Project(project_id), &project); + + let record = VerificationRecord { + status: VerificationStatus::Verified, + }; + env.storage() + .persistent() + .set(&StorageKey::Verification(project_id), &record); + + publish_verification_approved_event(env, project_id); + Ok(()) } pub fn reject_verification( - _env: &Env, - _project_id: u64, - _admin: Address, + env: &Env, + project_id: u64, + admin: Address, ) -> Result<(), ContractError> { - todo!("Verification rejection logic not implemented") + // 1. Authorize admin + let stored_admin: Address = env + .storage() + .persistent() + .get(&StorageKey::Admin) + .ok_or(ContractError::Unauthorized)?; + if admin != stored_admin { + return Err(ContractError::Unauthorized); + } + admin.require_auth(); + + // 2. Update status to Rejected + let mut project = ProjectRegistry::get_project(env, project_id) + .ok_or(ContractError::InvalidProjectData)?; + project.verification_status = VerificationStatus::Rejected; + project.updated_at = env.ledger().timestamp(); + env.storage() + .persistent() + .set(&StorageKey::Project(project_id), &project); + + let record = VerificationRecord { + status: VerificationStatus::Rejected, + }; + env.storage() + .persistent() + .set(&StorageKey::Verification(project_id), &record); + + publish_verification_rejected_event(env, project_id); + Ok(()) } pub fn get_verification( - _env: &Env, - _project_id: u64, + env: &Env, + project_id: u64, ) -> Result { - todo!("Verification record retrieval logic not implemented") + env.storage() + .persistent() + .get(&StorageKey::Verification(project_id)) + .ok_or(ContractError::InvalidProjectData) } pub fn list_pending_verifications( - _env: &Env, + env: &Env, _admin: Address, - _start_project_id: u64, - _limit: u32, + start_project_id: u64, + limit: u32, ) -> Result, ContractError> { - todo!("Pending verification listing logic not implemented") + // Simple implementation for now: iterate projects and collect pending + let count: u64 = env + .storage() + .persistent() + .get(&StorageKey::ProjectCount) + .unwrap_or(0); + let mut pending = Vec::new(env); + let mut checked = 0; + let mut current_id = start_project_id; + + while checked < limit && current_id <= count { + if let Some(record) = env + .storage() + .persistent() + .get::<_, VerificationRecord>(&StorageKey::Verification(current_id)) + { + if record.status == VerificationStatus::Pending { + pending.push_back(record); + checked += 1; + } + } + current_id += 1; + } + + Ok(pending) } - pub fn verification_exists(_env: &Env, _project_id: u64) -> bool { - false + pub fn verification_exists(env: &Env, project_id: u64) -> bool { + env.storage() + .persistent() + .has(&StorageKey::Verification(project_id)) } pub fn get_verification_status( - _env: &Env, - _project_id: u64, + env: &Env, + project_id: u64, ) -> Result { - todo!("Verification status retrieval not implemented") + let record = Self::get_verification(env, project_id)?; + Ok(record.status) } pub fn update_verification_evidence( diff --git a/dongle-smartcontract/src/verification_tests.rs b/dongle-smartcontract/src/verification_tests.rs new file mode 100644 index 0000000..c287a6d --- /dev/null +++ b/dongle-smartcontract/src/verification_tests.rs @@ -0,0 +1,115 @@ +#[cfg(test)] +mod test { + use crate::types::{ProjectRegistrationParams, VerificationStatus}; + use crate::DongleContract; + use crate::DongleContractClient; + use soroban_sdk::{testutils::Address as _, Address, Env, String}; + + fn setup(env: &Env) -> (DongleContractClient<'_>, Address, Address) { + let contract_id = env.register_contract(None, DongleContract); + let client = DongleContractClient::new(env, &contract_id); + let admin = Address::generate(env); + client.initialize(&admin); + (client, admin, Address::generate(env)) + } + + #[test] + fn test_verification_lifecycle() { + let env = Env::default(); + env.mock_all_auths(); + let (client, admin, owner) = setup(&env); + + let params = ProjectRegistrationParams { + owner: owner.clone(), + name: String::from_str(&env, "Project X"), + description: String::from_str( + &env, + "Description... Description... Description... Description...", + ), + category: String::from_str(&env, "DeFi"), + website: None, + logo_cid: None, + metadata_cid: None, + }; + let project_id = client.register_project(¶ms); + + // 1. Initially unverified + let project = client.get_project(&project_id).unwrap(); + assert_eq!(project.verification_status, VerificationStatus::Unverified); + + // 2. Set fee (using admin) + client.set_fee(&admin, &None, &100, &admin); + + // 3. Pay fee (using owner) + let token_admin = Address::generate(&env); + let token_address = env + .register_stellar_asset_contract_v2(token_admin) + .address(); + client.set_fee(&admin, &Some(token_address.clone()), &100, &admin); + + // Mock token balance for owner + let token_client = soroban_sdk::token::StellarAssetClient::new(&env, &token_address); + token_client.mint(&owner, &1000); + + client.pay_fee(&owner, &project_id, &Some(token_address.clone())); + + // 4. Request verification + client.request_verification( + &project_id, + &owner, + &String::from_str(&env, "ipfs://evidence"), + ); + + let project = client.get_project(&project_id).unwrap(); + assert_eq!(project.verification_status, VerificationStatus::Pending); + + // 5. Approve verification (using admin) + client.approve_verification(&project_id, &admin); + + let project = client.get_project(&project_id).unwrap(); + assert_eq!(project.verification_status, VerificationStatus::Verified); + } + + #[test] + fn test_reject_verification() { + let env = Env::default(); + env.mock_all_auths(); + let (client, admin, owner) = setup(&env); + + let params = ProjectRegistrationParams { + owner: owner.clone(), + name: String::from_str(&env, "Project Y"), + description: String::from_str( + &env, + "Description... Description... Description... Description...", + ), + category: String::from_str(&env, "NFT"), + website: None, + logo_cid: None, + metadata_cid: None, + }; + let project_id = client.register_project(¶ms); + + // Set fee and pay + let token_admin = Address::generate(&env); + let token_address = env + .register_stellar_asset_contract_v2(token_admin) + .address(); + let token_client = soroban_sdk::token::StellarAssetClient::new(&env, &token_address); + token_client.mint(&owner, &100); + client.set_fee(&admin, &Some(token_address.clone()), &100, &admin); + client.pay_fee(&owner, &project_id, &Some(token_address)); + + client.request_verification( + &project_id, + &owner, + &String::from_str(&env, "ipfs://evidence"), + ); + + // Reject + client.reject_verification(&project_id, &admin); + + let project = client.get_project(&project_id).unwrap(); + assert_eq!(project.verification_status, VerificationStatus::Rejected); + } +} diff --git a/dongle-smartcontract/target/.rustc_info.json b/dongle-smartcontract/target/.rustc_info.json index 4449910..153ba2d 100644 --- a/dongle-smartcontract/target/.rustc_info.json +++ b/dongle-smartcontract/target/.rustc_info.json @@ -1 +1 @@ -{"rustc_fingerprint":8360369028972503107,"outputs":{"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/nayy/.rustup/toolchains/stable-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.91.1 (ed61e7d7e 2025-11-07)\nbinary: rustc\ncommit-hash: ed61e7d7e242494fb7057f2657300d9e77bb4fcb\ncommit-date: 2025-11-07\nhost: aarch64-apple-darwin\nrelease: 1.91.1\nLLVM version: 21.1.2\n","stderr":""},"6432102384495711296":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/nayy/.rustup/toolchains/stable-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file +{"rustc_fingerprint":7115498823634581502,"outputs":{"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.93.0 (254b59607 2026-01-19)\nbinary: rustc\ncommit-hash: 254b59607d4417e9dffbc307138ae5c86280fe4c\ncommit-date: 2026-01-19\nhost: x86_64-pc-windows-msvc\nrelease: 1.93.0\nLLVM version: 21.1.8\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nC:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\npacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"cmpxchg16b\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"pc\"\nwindows\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/dongle-smartcontract/test_build_errors.txt b/dongle-smartcontract/test_build_errors.txt new file mode 100644 index 0000000..75671b8 --- /dev/null +++ b/dongle-smartcontract/test_build_errors.txt @@ -0,0 +1,200 @@ +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | ...s, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | ...::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | ...g, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | ...d, FeeConfig}; + | ^^^^^^^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | ...et mut user_reviews: s... + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | ... env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | ... project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | ... requester: A... + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | ... evidence_cid: S... + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: `dongle-contract` (lib) generated 11 warnings (run `cargo fix --lib -p dongle-contract` to apply 11 suggestions) +error[E0425]: cannot find type `ReviewEventData` in this scope + --> src\review_registry.rs:166:25 + | +166 | let event_data: ReviewEventData = data.into_val(&env); + | ^^^^^^^^^^^^^^^ not found in this scope + | +help: consider importing this struct + | +133 + use crate::types::ReviewEventData; + | + +error[E0425]: cannot find type `ReviewEventData` in this scope + --> src\review_registry.rs:190:25 + | +190 | let event_data: ReviewEventData = data.into_val(&env); + | ^^^^^^^^^^^^^^^ not found in this scope + | +help: consider importing this struct + | +133 + use crate::types::ReviewEventData; + | + +error[E0425]: cannot find type `ReviewEventData` in this scope + --> src\review_registry.rs:211:25 + | +211 | let event_data: ReviewEventData = data.into_val(&env); + | ^^^^^^^^^^^^^^^ not found in this scope + | +help: consider importing this struct + | +133 + use crate::types::ReviewEventData; + | + +warning: unused import: `TryIntoVal` + --> src\review_registry.rs:135:31 + | +135 | Env, IntoVal, String, TryIntoVal, + | ^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +warning: unused import: `soroban_sdk::testutils::Address as _` + --> src\lib.rs:192:9 + | +192 | use soroban_sdk::testutils::Address as _; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `Vec as SorobanVec` and `vec` + --> src\lib.rs:193:23 + | +193 | use soroban_sdk::{vec, Vec as SorobanVec}; + | ^^^ ^^^^^^^^^^^^^^^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +For more information about this error, try `rustc --explain E0425`. +warning: `dongle-contract` (lib test) generated 14 warnings (1 duplicate) +error: could not compile `dongle-contract` (lib test) due to 3 previous errors; 14 warnings emitted diff --git a/dongle-smartcontract/test_build_errors_2.txt b/dongle-smartcontract/test_build_errors_2.txt new file mode 100644 index 0000000..da8baf7 --- /dev/null +++ b/dongle-smartcontract/test_build_errors_2.txt @@ -0,0 +1,115 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `TryIntoVal` + --> src\review_registry.rs:135:31 + | +135 | Env, IntoVal, String, TryIntoVal, + | ^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +warning: unused import: `soroban_sdk::testutils::Address as _` + --> src\lib.rs:192:9 + | +192 | use soroban_sdk::testutils::Address as _; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `Vec as SorobanVec` and `vec` + --> src\lib.rs:193:23 + | +193 | use soroban_sdk::{vec, Vec as SorobanVec}; + | ^^^ ^^^^^^^^^^^^^^^^^ + +warning: unused import: `ReviewEventData` + --> src\review_registry.rs:2:42 + | +2 | use crate::types::{Review, ReviewAction, ReviewEventData, DataKey}; + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +warning: function `setup_env` is never used + --> src\lib.rs:195:8 + | +195 | fn setup_env() -> Env { + | ^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: `dongle-contract` (lib) generated 12 warnings (6 duplicates) (run `cargo fix --lib -p dongle-contract` to apply 6 suggestions) +warning: `dongle-contract` (lib test) generated 15 warnings (5 duplicates) (run `cargo fix --lib -p dongle-contract --tests` to apply 9 suggestions) + Finished `test` profile [unoptimized + debuginfo] target(s) in 8.25s + Executable unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) diff --git a/dongle-smartcontract/test_results.txt b/dongle-smartcontract/test_results.txt new file mode 100644 index 0000000..06163d1 --- /dev/null +++ b/dongle-smartcontract/test_results.txt @@ -0,0 +1,336 @@ +warning: unused import: `ReviewEventData` + --> src\review_registry.rs:2:42 + | +2 | use crate::types::{Review, ReviewAction, ReviewEventData, DataKey}; + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +warning: unused import: `TryIntoVal` + --> src\review_registry.rs:135:31 + | +135 | Env, IntoVal, String, TryIntoVal, + | ^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `soroban_sdk::testutils::Address as _` + --> src\lib.rs:192:9 + | +192 | use soroban_sdk::testutils::Address as _; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `Vec as SorobanVec` and `vec` + --> src\lib.rs:193:23 + | +193 | use soroban_sdk::{vec, Vec as SorobanVec}; + | ^^^ ^^^^^^^^^^^^^^^^^ + +warning: function `setup_env` is never used + --> src\lib.rs:195:8 + | +195 | fn setup_env() -> Env { + | ^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: `dongle-contract` (lib) generated 12 warnings (run `cargo fix --lib -p dongle-contract` to apply 12 suggestions) +warning: `dongle-contract` (lib test) generated 15 warnings (11 duplicates) (run `cargo fix --lib -p dongle-contract --tests` to apply 3 suggestions) + Finished `test` profile [unoptimized + debuginfo] target(s) in 0.49s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 15 tests +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test tests::get_projects_by_owner_returns_all_projects ... ok +test review_registry::test::test_add_review_event ... FAILED +test review_registry::test::test_delete_review_event ... FAILED +test review_registry::test::test_update_review_event ... FAILED + +failures: + +---- review_registry::test::test_add_review_event stdout ---- + +thread 'review_registry::test::test_add_review_event' (15268) panicked at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:768:9: +HostError: Error(Auth, InvalidAction) + +Event log (newest first): + 0: [Diagnostic Event] topics:[error, Error(Auth, InvalidAction)], data:"escalating error to panic" + 1: [Diagnostic Event] topics:[error, Error(Auth, InvalidAction)], data:["contract call failed", add_review, [1, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, 5, "QmHash"]] + 2: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[error, Error(Auth, InvalidAction)], data:"caught error from function" + 3: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[error, Error(Auth, InvalidAction)], data:"escalating error to panic" + 4: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[error, Error(Auth, InvalidAction)], data:["Unauthorized function call for address", CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM] + 5: [Diagnostic Event] topics:[fn_call, Bytes(0000000000000000000000000000000000000000000000000000000000000002), add_review], data:[1, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, 5, "QmHash"] + +Backtrace (newest first): + 0: backtrace::backtrace::win64::trace + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\win64.rs:85 + backtrace::backtrace::trace_unsynchronized + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\mod.rs:66 + 1: backtrace::backtrace::trace + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\mod.rs:53 + 2: backtrace::capture::Backtrace::create + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\capture.rs:294 + 3: backtrace::capture::Backtrace::new_unresolved + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\capture.rs:289 + 4: soroban_env_host::host::error::impl$10::maybe_get_debug_info::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:293 + 5: soroban_env_host::budget::Budget::with_shadow_mode,soroban_env_host::host::error::impl$10::maybe_get_debug_info::closure_env$0> + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\budget.rs:972 + 6: soroban_env_host::host::Host::with_debug_mode + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:615 + 7: soroban_env_host::host::Host::maybe_get_debug_info + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:290 + 8: soroban_env_host::host::error::impl$10::error::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:274 + 9: soroban_env_host::budget::Budget::with_shadow_mode,soroban_env_host::host::error::impl$10::error::closure_env$0> + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\budget.rs:972 + 10: soroban_env_host::host::Host::with_debug_mode + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:615 + 11: soroban_env_host::host::Host::error + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:261 + 12: soroban_env_host::host::impl$4::escalate_error_to_panic + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:767 + 13: soroban_sdk::env::internal::reject_err::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:52 + 14: enum2$ >::map_err,soroban_sdk::env::internal::reject_err::cl + at /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c\library\core\src\result.rs:968 + 15: soroban_sdk::env::internal::reject_err + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:52 + 16: soroban_sdk::env::impl$20::call + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:1667 + 17: soroban_sdk::env::Env::invoke_contract > + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:379 + 18: dongle_contract::review_registry::ReviewRegistryClient::add_review + at src\review_registry.rs:8 + 19: dongle_contract::review_registry::test::test_add_review_event + at src\review_registry.rs:147 + 20: dongle_contract::review_registry::test::test_add_review_event::closure$0 + at src\review_registry.rs:140 + 21: core::ops::function::FnOnce::call_once > + at /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c\library\core\src\ops\function.rs:250 + + +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +Writing test snapshot file for test "review_registry::test::test_add_review_event" to "test_snapshots\\review_registry\\test\\test_add_review_event.1.json". + +---- review_registry::test::test_delete_review_event stdout ---- + +thread 'review_registry::test::test_delete_review_event' (20516) panicked at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:768:9: +HostError: Error(Auth, InvalidAction) + +Event log (newest first): + 0: [Diagnostic Event] topics:[error, Error(Auth, InvalidAction)], data:"escalating error to panic" + 1: [Diagnostic Event] topics:[error, Error(Auth, InvalidAction)], data:["contract call failed", delete_review, [1, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM]] + 2: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[error, Error(Auth, InvalidAction)], data:"caught error from function" + 3: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[error, Error(Auth, InvalidAction)], data:"escalating error to panic" + 4: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[error, Error(Auth, InvalidAction)], data:["Unauthorized function call for address", CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM] + 5: [Diagnostic Event] topics:[fn_call, Bytes(0000000000000000000000000000000000000000000000000000000000000002), delete_review], data:[1, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM] + +Backtrace (newest first): + 0: backtrace::backtrace::win64::trace + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\win64.rs:85 + backtrace::backtrace::trace_unsynchronized + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\mod.rs:66 + 1: backtrace::backtrace::trace + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\mod.rs:53 + 2: backtrace::capture::Backtrace::create + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\capture.rs:294 + 3: backtrace::capture::Backtrace::new_unresolved + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\capture.rs:289 + 4: soroban_env_host::host::error::impl$10::maybe_get_debug_info::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:293 + 5: soroban_env_host::budget::Budget::with_shadow_mode,soroban_env_host::host::error::impl$10::maybe_get_debug_info::closure_env$0> + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\budget.rs:972 + 6: soroban_env_host::host::Host::with_debug_mode + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:615 + 7: soroban_env_host::host::Host::maybe_get_debug_info + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:290 + 8: soroban_env_host::host::error::impl$10::error::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:274 + 9: soroban_env_host::budget::Budget::with_shadow_mode,soroban_env_host::host::error::impl$10::error::closure_env$0> + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\budget.rs:972 + 10: soroban_env_host::host::Host::with_debug_mode + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:615 + 11: soroban_env_host::host::Host::error + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:261 + 12: soroban_env_host::host::impl$4::escalate_error_to_panic + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:767 + 13: soroban_sdk::env::internal::reject_err::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:52 + 14: enum2$ >::map_err,soroban_sdk::env::internal::reject_err::cl + at /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c\library\core\src\result.rs:968 + 15: soroban_sdk::env::internal::reject_err + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:52 + 16: soroban_sdk::env::impl$20::call + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:1667 + 17: soroban_sdk::env::Env::invoke_contract > + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:379 + 18: dongle_contract::review_registry::ReviewRegistryClient::delete_review + at src\review_registry.rs:8 + 19: dongle_contract::review_registry::test::test_delete_review_event + at src\review_registry.rs:202 + 20: dongle_contract::review_registry::test::test_delete_review_event::closure$0 + at src\review_registry.rs:196 + 21: core::ops::function::FnOnce::call_once > + at /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c\library\core\src\ops\function.rs:250 + + +Writing test snapshot file for test "review_registry::test::test_delete_review_event" to "test_snapshots\\review_registry\\test\\test_delete_review_event.1.json". + +---- review_registry::test::test_update_review_event stdout ---- + +thread 'review_registry::test::test_update_review_event' (23448) panicked at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:768:9: +HostError: Error(Auth, InvalidAction) + +Event log (newest first): + 0: [Diagnostic Event] topics:[error, Error(Auth, InvalidAction)], data:"escalating error to panic" + 1: [Diagnostic Event] topics:[error, Error(Auth, InvalidAction)], data:["contract call failed", update_review, [1, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, 4, "QmHash2"]] + 2: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[error, Error(Auth, InvalidAction)], data:"caught error from function" + 3: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[error, Error(Auth, InvalidAction)], data:"escalating error to panic" + 4: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[error, Error(Auth, InvalidAction)], data:["Unauthorized function call for address", CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM] + 5: [Diagnostic Event] topics:[fn_call, Bytes(0000000000000000000000000000000000000000000000000000000000000002), update_review], data:[1, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, 4, "QmHash2"] + +Backtrace (newest first): + 0: backtrace::backtrace::win64::trace + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\win64.rs:85 + backtrace::backtrace::trace_unsynchronized + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\mod.rs:66 + 1: backtrace::backtrace::trace + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\mod.rs:53 + 2: backtrace::capture::Backtrace::create + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\capture.rs:294 + 3: backtrace::capture::Backtrace::new_unresolved + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\capture.rs:289 + 4: soroban_env_host::host::error::impl$10::maybe_get_debug_info::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:293 + 5: soroban_env_host::budget::Budget::with_shadow_mode,soroban_env_host::host::error::impl$10::maybe_get_debug_info::closure_env$0> + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\budget.rs:972 + 6: soroban_env_host::host::Host::with_debug_mode + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:615 + 7: soroban_env_host::host::Host::maybe_get_debug_info + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:290 + 8: soroban_env_host::host::error::impl$10::error::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:274 + 9: soroban_env_host::budget::Budget::with_shadow_mode,soroban_env_host::host::error::impl$10::error::closure_env$0> + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\budget.rs:972 + 10: soroban_env_host::host::Host::with_debug_mode + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:615 + 11: soroban_env_host::host::Host::error + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:261 + 12: soroban_env_host::host::impl$4::escalate_error_to_panic + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:767 + 13: soroban_sdk::env::internal::reject_err::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:52 + 14: enum2$ >::map_err,soroban_sdk::env::internal::reject_err::cl + at /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c\library\core\src\result.rs:968 + 15: soroban_sdk::env::internal::reject_err + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:52 + 16: soroban_sdk::env::impl$20::call + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:1667 + 17: soroban_sdk::env::Env::invoke_contract > + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:379 + 18: dongle_contract::review_registry::ReviewRegistryClient::update_review + at src\review_registry.rs:8 + 19: dongle_contract::review_registry::test::test_update_review_event + at src\review_registry.rs:181 + 20: dongle_contract::review_registry::test::test_update_review_event::closure$0 + at src\review_registry.rs:174 + 21: core::ops::function::FnOnce::call_once > + at /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c\library\core\src\ops\function.rs:250 + + +Writing test snapshot file for test "review_registry::test::test_update_review_event" to "test_snapshots\\review_registry\\test\\test_update_review_event.1.json". + + +failures: + review_registry::test::test_add_review_event + review_registry::test::test_delete_review_event + review_registry::test::test_update_review_event + +test result: FAILED. 12 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.32s + +error: test failed, to rerun pass `--lib` diff --git a/dongle-smartcontract/test_results_2.txt b/dongle-smartcontract/test_results_2.txt new file mode 100644 index 0000000..b3491aa --- /dev/null +++ b/dongle-smartcontract/test_results_2.txt @@ -0,0 +1,1171 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `ReviewEventData` + --> src\review_registry.rs:2:42 + | +2 | use crate::types::{Review, ReviewAction, ReviewEventData, DataKey}; + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +error: cannot find macro `format` in this scope + --> src\test.rs:377:14 + | +377 | &format!("Project {}", i), + | ^^^^^^ + +error: cannot find macro `format` in this scope + --> src\test.rs:170:17 + | +170 | let n = format!("{} {}", name, i); + | ^^^^^^ + +error[E0433]: failed to resolve: use of undeclared type `Vec` + --> src\test.rs:373:19 + | +373 | let mut ids = Vec::new(); + | ^^^ use of undeclared type `Vec` + | +help: consider importing one of these structs + | + 3 + use crate::Vec; + | + 3 + use soroban_sdk::Vec; + | + +warning: unused import: `TryIntoVal` + --> src\review_registry.rs:135:31 + | +135 | Env, IntoVal, String, TryIntoVal, + | ^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +error[E0599]: no method named `register` found for reference `&Env` in the current scope + --> src\test.rs:12:27 + | +12 | let contract_id = env.register(DongleContract, ()); + | ^^^^^^^^ method not found in `&Env` + +error[E0061]: this method takes 2 arguments but 1 argument was supplied + --> src\test.rs:17:12 + | +17 | client.set_admin(&admin); + | ^^^^^^^^^-------- argument #2 of type `&soroban_sdk::Address` is missing + | +note: method defined here + --> src\lib.rs:41:12 + | +41 | pub fn set_admin(_env: Env, _caller: Address, _new_admin: Address) -> Result<(), ContractError> { + | ^^^^^^^^^ ------------------- +help: provide the argument + | +17 | client.set_admin(&admin, /* &soroban_sdk::Address */); + | +++++++++++++++++++++++++++++ + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:28:22 + | + 28 | &"Project A".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:29:26 + | + 29 | &"Description A".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:30:17 + | + 30 | &"DeFi".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no method named `unwrap` found for struct `Project` in the current scope + --> src\test.rs:43:43 + | +43 | let project = client.get_project(&id).unwrap(); + | ^^^^^^ method not found in `Project` + | + ::: src\types.rs:33:1 + | +33 | pub struct Project { + | ------------------ method `unwrap` not found for this struct + | +help: some of the expressions' fields have a method of the same name + | +43 | let project = client.get_project(&id).logo_cid.unwrap(); + | +++++++++ +43 | let project = client.get_project(&id).metadata_cid.unwrap(); + | +++++++++++++ +43 | let project = client.get_project(&id).website.unwrap(); + | ++++++++ + +error[E0599]: no method named `get_owner_project_count` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:46:23 + | +46 | assert_eq!(client.get_owner_project_count(&owner), 1); + | ^^^^^^^^^^^^^^^^^^^^^^^ method not found in `DongleContractClient<'_>` + | + ::: src\lib.rs:27:1 + | +27 | #[contract] + | ----------- method `get_owner_project_count` not found for this struct + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:60:22 + | + 60 | &"Project A".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:61:23 + | + 61 | &"Other Desc".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:62:22 + | + 62 | &"Other Cat".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:77:13 + | + 77 | &"".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:78:17 + | + 78 | &"Desc".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:79:16 + | + 79 | &"Cat".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no variant or associated item named `InvalidProjectName` found for enum `ContractError` in the current scope + --> src\test.rs:84:38 + | +84 | assert_eq!(result, Err(Ok(Error::InvalidProjectName))); + | ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `InvalidProjectName` not found for this enum + | +help: there is a variant with a similar name + | +84 - assert_eq!(result, Err(Ok(Error::InvalidProjectName))); +84 + assert_eq!(result, Err(Ok(Error::InvalidProjectData)); + | + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:93:16 + | + 93 | &" ".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:94:17 + | + 94 | &"Desc".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:95:16 + | + 95 | &"Cat".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no variant or associated item named `InvalidProjectName` found for enum `ContractError` in the current scope + --> src\test.rs:100:38 + | +100 | assert_eq!(result, Err(Ok(Error::InvalidProjectName))); + | ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `InvalidProjectName` not found for this enum + | +help: there is a variant with a similar name + | +100 - assert_eq!(result, Err(Ok(Error::InvalidProjectName))); +100 + assert_eq!(result, Err(Ok(Error::InvalidProjectData)); + | + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:109:17 + | +109 | &"Name".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:110:13 + | +110 | &"".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:111:16 + | +111 | &"Cat".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no variant or associated item named `InvalidProjectDescription` found for enum `ContractError` in the current scope + --> src\test.rs:116:38 + | +116 | assert_eq!(result, Err(Ok(Error::InvalidProjectDescription))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `InvalidProjectDescription` not found for this enum + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:125:17 + | +125 | &"Name".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:126:17 + | +126 | &"Desc".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:127:13 + | +127 | &"".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `core::option::Option: From<&str>` is not satisfied + --> src\test.rs:144:18 + | +144 | &"Name2".into(), + | ^^^^ the trait `From<&str>` is not implemented for `core::option::Option` + | + = help: the following other types implement trait `From`: + `core::option::Option<&T>` implements `From<&core::option::Option>` + `core::option::Option<&mut T>` implements `From<&mut core::option::Option>` + `core::option::Option` implements `From` + `core::option::Option` implements `From>` + `core::option::Option` implements `From>` + `core::option::Option` implements `From>` + `core::option::Option` implements `From` + `core::option::Option` implements `From` + = note: required for `&str` to implement `Into>` + +error[E0277]: the trait bound `core::option::Option: From<&str>` is not satisfied + --> src\test.rs:145:18 + | +145 | &"Desc2".into(), + | ^^^^ the trait `From<&str>` is not implemented for `core::option::Option` + | + = help: the following other types implement trait `From`: + `core::option::Option<&T>` implements `From<&core::option::Option>` + `core::option::Option<&mut T>` implements `From<&mut core::option::Option>` + `core::option::Option` implements `From` + `core::option::Option` implements `From>` + `core::option::Option` implements `From>` + `core::option::Option` implements `From>` + `core::option::Option` implements `From` + `core::option::Option` implements `From` + = note: required for `&str` to implement `Into>` + +error[E0277]: the trait bound `core::option::Option: From<&str>` is not satisfied + --> src\test.rs:146:17 + | +146 | &"Cat2".into(), + | ^^^^ the trait `From<&str>` is not implemented for `core::option::Option` + | + = help: the following other types implement trait `From`: + `core::option::Option<&T>` implements `From<&core::option::Option>` + `core::option::Option<&mut T>` implements `From<&mut core::option::Option>` + `core::option::Option` implements `From` + `core::option::Option` implements `From>` + `core::option::Option` implements `From>` + `core::option::Option` implements `From>` + `core::option::Option` implements `From` + `core::option::Option` implements `From` + = note: required for `&str` to implement `Into>` + +error[E0599]: no variant or associated item named `NotProjectOwner` found for enum `ContractError` in the current scope + --> src\test.rs:151:38 + | +151 | assert_eq!(result, Err(Ok(Error::NotProjectOwner))); + | ^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `NotProjectOwner` not found for this enum + +error[E0599]: no variant or associated item named `InvalidProjectId` found for enum `ContractError` in the current scope + --> src\test.rs:159:38 + | +159 | assert_eq!(result, Err(Ok(Error::InvalidProjectId))); + | ^^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `InvalidProjectId` not found for this enum + | +help: there is a variant with a similar name + | +159 - assert_eq!(result, Err(Ok(Error::InvalidProjectId))); +159 + assert_eq!(result, Err(Ok(Error::InvalidProjectData)); + | + +error[E0599]: no method named `to_string` found for reference `&'static str` in the current scope + --> src\test.rs:166:26 + | +166 | let name = "Project".to_string(); + | ^^^^^^^^^ method not found in `&'static str` + | + = help: items from traits can only be used if the trait is in scope +help: trait `ToString` which provides `to_string` is implemented but not in scope; perhaps you want to import it + | + 3 + use crate::__donglecontract_fn_set_registry::std::string::ToString; + | + +error[E0599]: no method named `to_string` found for reference `&'static str` in the current scope + --> src\test.rs:167:30 + | +167 | let desc = "Description".to_string(); + | ^^^^^^^^^ method not found in `&'static str` + | + = help: items from traits can only be used if the trait is in scope +help: trait `ToString` which provides `to_string` is implemented but not in scope; perhaps you want to import it + | + 3 + use crate::__donglecontract_fn_set_registry::std::string::ToString; + | + +error[E0599]: no method named `to_string` found for reference `&'static str` in the current scope + --> src\test.rs:168:22 + | +168 | let cat = "DeFi".to_string(); + | ^^^^^^^^^ method not found in `&'static str` + | + = help: items from traits can only be used if the trait is in scope +help: trait `ToString` which provides `to_string` is implemented but not in scope; perhaps you want to import it + | + 3 + use crate::__donglecontract_fn_set_registry::std::string::ToString; + | + +error[E0599]: no method named `get_owner_project_count` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:182:23 + | +182 | assert_eq!(client.get_owner_project_count(&owner), MAX_PROJECTS_PER_USER); + | ^^^^^^^^^^^^^^^^^^^^^^^ method not found in `DongleContractClient<'_>` + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `get_owner_project_count` not found for this struct + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:185:21 + | +185 | &"One more".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no variant or associated item named `MaxProjectsPerUserExceeded` found for enum `ContractError` in the current scope + --> src\test.rs:192:38 + | +192 | assert_eq!(result, Err(Ok(Error::MaxProjectsPerUserExceeded))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `MaxProjectsPerUserExceeded` not found for this enum + +error[E0599]: no variant or associated item named `DuplicateReview` found for enum `ContractError` in the current scope + --> src\test.rs:226:46 + | +226 | assert_eq!(result, Err(Ok(Error::DuplicateReview)), "second review same reviewer"); + | ^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `DuplicateReview` not found for this enum + +error[E0599]: no variant or associated item named `DuplicateReview` found for enum `ContractError` in the current scope + --> src\test.rs:239:38 + | +239 | assert_eq!(result, Err(Ok(Error::DuplicateReview))); + | ^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `DuplicateReview` not found for this enum + +error[E0599]: no method named `set_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:260:12 + | +260 | client.set_fee(&admin, &None, &100, &treasury); + | ^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `set_fee` not found for this struct + | +help: there is a method `set_fee_config` with a similar name + | +260 | client.set_fee_config(&admin, &None, &100, &treasury); + | +++++++ + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:261:79 + | +261 | let result = client.try_request_verification(&id, &owner, &"evidence_cid".into()); + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no variant or associated item named `FeeNotPaid` found for enum `ContractError` in the current scope + --> src\test.rs:262:38 + | +262 | assert_eq!(result, Err(Ok(Error::FeeNotPaid))); + | ^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `FeeNotPaid` not found for this enum + +error[E0599]: no method named `set_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:271:12 + | +271 | client.set_fee(&admin, &None, &100, &treasury); + | ^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `set_fee` not found for this struct + | +help: there is a method `set_fee_config` with a similar name + | +271 | client.set_fee_config(&admin, &None, &100, &treasury); + | +++++++ + +error[E0599]: no method named `pay_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:272:12 + | +272 | client.pay_fee(&owner, &id, &None); + | ^^^^^^^ method not found in `DongleContractClient<'_>` + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `pay_fee` not found for this struct + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:274:79 + | +274 | let result = client.try_request_verification(&id, &other, &"evidence_cid".into()); + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no variant or associated item named `NotProjectOwnerForVerification` found for enum `ContractError` in the current scope + --> src\test.rs:275:38 + | +275 | assert_eq!(result, Err(Ok(Error::NotProjectOwnerForVerification))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `NotProjectOwnerForVerification` not found for this enum + +error[E0599]: no method named `set_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:284:12 + | +284 | client.set_fee(&admin, &None, &100, &treasury); + | ^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `set_fee` not found for this struct + | +help: there is a method `set_fee_config` with a similar name + | +284 | client.set_fee_config(&admin, &None, &100, &treasury); + | +++++++ + +error[E0599]: no method named `pay_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:285:12 + | +285 | client.pay_fee(&owner, &id, &None); + | ^^^^^^^ method not found in `DongleContractClient<'_>` + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `pay_fee` not found for this struct + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:286:67 + | +286 | let result = client.try_request_verification(&id, &owner, &"".into()); + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no variant or associated item named `InvalidEvidenceCid` found for enum `ContractError` in the current scope + --> src\test.rs:287:38 + | +287 | assert_eq!(result, Err(Ok(Error::InvalidEvidenceCid))); + | ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `InvalidEvidenceCid` not found for this enum + +error[E0599]: no method named `set_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:296:12 + | +296 | client.set_fee(&admin, &None, &100, &treasury); + | ^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `set_fee` not found for this struct + | +help: there is a method `set_fee_config` with a similar name + | +296 | client.set_fee_config(&admin, &None, &100, &treasury); + | +++++++ + +error[E0599]: no method named `pay_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:297:12 + | +297 | client.pay_fee(&owner, &id, &None); + | ^^^^^^^ method not found in `DongleContractClient<'_>` + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `pay_fee` not found for this struct + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:298:58 + | +298 | client.request_verification(&id, &owner, &"evidence".into()); + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no variant or associated item named `UnauthorizedVerifier` found for enum `ContractError` in the current scope + --> src\test.rs:301:38 + | +301 | assert_eq!(result, Err(Ok(Error::UnauthorizedVerifier))); + | ^^^^^^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `UnauthorizedVerifier` not found for this enum + +error[E0599]: no method named `set_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:310:12 + | +310 | client.set_fee(&admin, &None, &100, &treasury); + | ^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `set_fee` not found for this struct + | +help: there is a method `set_fee_config` with a similar name + | +310 | client.set_fee_config(&admin, &None, &100, &treasury); + | +++++++ + +error[E0599]: no method named `pay_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:311:12 + | +311 | client.pay_fee(&owner, &id, &None); + | ^^^^^^^ method not found in `DongleContractClient<'_>` + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `pay_fee` not found for this struct + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:312:58 + | +312 | client.request_verification(&id, &owner, &"evidence".into()); + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no method named `expect` found for struct `VerificationRecord` in the current scope + --> src\test.rs:314:44 + | +314 | let rec = client.get_verification(&id).expect("verification record"); + | ^^^^^^ method not found in `VerificationRecord` + | + ::: src\types.rs:73:1 + | + 73 | pub struct VerificationRecord { + | ----------------------------- method `expect` not found for this struct + +error[E0599]: no method named `set_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:324:12 + | +324 | client.set_fee(&admin, &None, &100, &treasury); + | ^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `set_fee` not found for this struct + | +help: there is a method `set_fee_config` with a similar name + | +324 | client.set_fee_config(&admin, &None, &100, &treasury); + | +++++++ + +error[E0599]: no method named `pay_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:325:12 + | +325 | client.pay_fee(&owner, &id, &None); + | ^^^^^^^ method not found in `DongleContractClient<'_>` + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `pay_fee` not found for this struct + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:326:58 + | +326 | client.request_verification(&id, &owner, &"evidence".into()); + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no method named `reject_verification` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:327:12 + | +327 | client.reject_verification(&id, &admin); + | ^^^^^^^^^^^^^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `reject_verification` not found for this struct + | +help: there is a method `request_verification` with a similar name, but with different arguments + --> src\lib.rs:31:1 + | + 31 | #[contractimpl] + | ^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `soroban_sdk::contractclient` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0599]: no method named `expect` found for struct `VerificationRecord` in the current scope + --> src\test.rs:328:44 + | +328 | let rec = client.get_verification(&id).expect("verification record"); + | ^^^^^^ method not found in `VerificationRecord` + | + ::: src\types.rs:73:1 + | + 73 | pub struct VerificationRecord { + | ----------------------------- method `expect` not found for this struct + +error[E0599]: no method named `try_set_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:338:25 + | +338 | let result = client.try_set_fee(&non_admin, &None, &100, &treasury); + | ^^^^^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `try_set_fee` not found for this struct + | +help: there is a method `try_set_fee_config` with a similar name + | +338 | let result = client.try_set_fee_config(&non_admin, &None, &100, &treasury); + | +++++++ + +error[E0599]: no variant or associated item named `UnauthorizedAdmin` found for enum `ContractError` in the current scope + --> src\test.rs:339:38 + | +339 | assert_eq!(result, Err(Ok(Error::UnauthorizedAdmin))); + | ^^^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `UnauthorizedAdmin` not found for this enum + | +help: there is a variant with a similar name + | +339 - assert_eq!(result, Err(Ok(Error::UnauthorizedAdmin))); +339 + assert_eq!(result, Err(Ok(Error::Unauthorized)); + | + +error[E0599]: no method named `set_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:340:12 + | +340 | client.set_fee(&admin, &None, &100, &treasury); + | ^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `set_fee` not found for this struct + | +help: there is a method `set_fee_config` with a similar name + | +340 | client.set_fee_config(&admin, &None, &100, &treasury); + | +++++++ + +error[E0599]: no method named `try_set_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:348:25 + | +348 | let result = client.try_set_fee(&admin, &None, &0, &treasury); + | ^^^^^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `try_set_fee` not found for this struct + | +help: there is a method `try_set_fee_config` with a similar name + | +348 | let result = client.try_set_fee_config(&admin, &None, &0, &treasury); + | +++++++ + +error[E0599]: no method named `try_pay_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:357:25 + | +357 | let result = client.try_pay_fee(&owner, &id, &None); + | ^^^^^^^^^^^ method not found in `DongleContractClient<'_>` + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `try_pay_fee` not found for this struct + +error[E0599]: no variant or associated item named `FeeNotConfigured` found for enum `ContractError` in the current scope + --> src\test.rs:358:38 + | +358 | assert_eq!(result, Err(Ok(Error::FeeNotConfigured))); + | ^^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `FeeNotConfigured` not found for this enum + +error[E0599]: no method named `is_none` found for struct `Project` in the current scope + --> src\test.rs:366:21 + | +366 | assert!(project.is_none()); + | ^^^^^^^ method not found in `Project` + | + ::: src\types.rs:33:1 + | + 33 | pub struct Project { + | ------------------ method `is_none` not found for this struct + | +help: some of the expressions' fields have a method of the same name + | +366 | assert!(project.logo_cid.is_none()); + | +++++++++ +366 | assert!(project.metadata_cid.is_none()); + | +++++++++++++ +366 | assert!(project.website.is_none()); + | ++++++++ + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:378:21 + | +378 | &"Desc".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0277]: the trait bound `soroban_sdk::String: From<&str>` is not satisfied + --> src\test.rs:379:20 + | +379 | &"Cat".into(), + | ^^^^ the trait `From<&str>` is not implemented for `soroban_sdk::String` + | +help: the trait `From<&str>` is not implemented for `soroban_sdk::String` + but trait `From<&soroban_sdk::String>` is implemented for it + --> C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\string.rs:132:1 + | +132 | impl From<&String> for String { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `soroban_sdk::String`, found `str` + = note: required for `&str` to implement `Into` + +error[E0599]: no method named `get_owner_project_count` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:387:23 + | +387 | assert_eq!(client.get_owner_project_count(&owner), 5); + | ^^^^^^^^^^^^^^^^^^^^^^^ method not found in `DongleContractClient<'_>` + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `get_owner_project_count` not found for this struct + +error[E0599]: no method named `set_fee` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:395:12 + | +395 | client.set_fee(&admin, &None, &500, &treasury); + | ^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `set_fee` not found for this struct + | +help: there is a method `set_fee_config` with a similar name + | +395 | client.set_fee_config(&admin, &None, &500, &treasury); + | +++++++ + +error[E0599]: no method named `get_fee_config` found for struct `DongleContractClient<'a>` in the current scope + --> src\test.rs:396:36 + | +396 | let config: FeeConfig = client.get_fee_config(); + | ^^^^^^^^^^^^^^ + | + ::: src\lib.rs:27:1 + | + 27 | #[contract] + | ----------- method `get_fee_config` not found for this struct + | +help: there is a method `set_fee_config` with a similar name, but with different arguments + --> src\lib.rs:31:1 + | + 31 | #[contractimpl] + | ^^^^^^^^^^^^^^^ + = note: this error originates in the attribute macro `soroban_sdk::contractclient` (in Nightly builds, run with -Z macro-backtrace for more info) + +Some errors have detailed explanations: E0061, E0277, E0433, E0599. +For more information about an error, try `rustc --explain E0061`. +warning: `dongle-contract` (lib test) generated 12 warnings (11 duplicates) +error: could not compile `dongle-contract` (lib test) due to 77 previous errors; 12 warnings emitted +warning: build failed, waiting for other jobs to finish... +warning: `dongle-contract` (lib) generated 12 warnings (run `cargo fix --lib -p dongle-contract` to apply 12 suggestions) diff --git a/dongle-smartcontract/test_results_3.txt b/dongle-smartcontract/test_results_3.txt new file mode 100644 index 0000000..38237c6 --- /dev/null +++ b/dongle-smartcontract/test_results_3.txt @@ -0,0 +1,212 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `TryIntoVal` + --> src\review_registry.rs:135:31 + | +135 | Env, IntoVal, String, TryIntoVal, + | ^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +warning: unused import: `ReviewEventData` + --> src\review_registry.rs:2:42 + | +2 | use crate::types::{Review, ReviewAction, ReviewEventData, DataKey}; + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +warning: hiding a lifetime that's elided elsewhere is confusing + --> src\registration_tests.rs:6:15 + | +6 | fn setup(env: &Env) -> (DongleContractClient, Address) { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here + | | + | the lifetime is elided here + | + = help: the same lifetime is referred to in inconsistent ways, making the signature confusing + = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default +help: use `'_` for type paths + | +6 | fn setup(env: &Env) -> (DongleContractClient<'_>, Address) { + | ++++ + +warning: `dongle-contract` (lib) generated 12 warnings (6 duplicates) (run `cargo fix --lib -p dongle-contract` to apply 6 suggestions) +warning: `dongle-contract` (lib test) generated 13 warnings (5 duplicates) (run `cargo fix --lib -p dongle-contract --tests` to apply 8 suggestions) + Finished `test` profile [unoptimized + debuginfo] target(s) in 6.28s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 17 tests +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test review_registry::test::test_delete_review_event ... FAILED +test review_registry::test::test_add_review_event ... ok +test registration_tests::test_register_project_success ... ok +test registration_tests::test_register_different_projects_success ... ok +test review_registry::test::test_update_review_event ... FAILED +test registration_tests::test_register_duplicate_project_fails ... ok + +failures: + +---- review_registry::test::test_delete_review_event stdout ---- + +thread 'review_registry::test::test_delete_review_event' (23404) panicked at src\review_registry.rs:208:9: +assertion `left == right` failed + left: 0 + right: 1 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +Writing test snapshot file for test "review_registry::test::test_delete_review_event" to "test_snapshots\\review_registry\\test\\test_delete_review_event.1.json". + +---- review_registry::test::test_update_review_event stdout ---- + +thread 'review_registry::test::test_update_review_event' (10744) panicked at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:768:9: +HostError: Error(WasmVm, InvalidAction) + +Event log (newest first): + 0: [Diagnostic Event] topics:[error, Error(WasmVm, InvalidAction)], data:"escalating error to panic" + 1: [Diagnostic Event] topics:[error, Error(WasmVm, InvalidAction)], data:["contract call failed", update_review, [1, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, 4, "QmHash2"]] + 2: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[error, Error(WasmVm, InvalidAction)], data:"caught error from function" + 3: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, topics:[log], data:["caught panic 'Review not found' from contract function 'Symbol(obj#9)'", 1, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, 4, "QmHash2"] + 4: [Diagnostic Event] topics:[fn_call, Bytes(0000000000000000000000000000000000000000000000000000000000000002), update_review], data:[1, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, 4, "QmHash2"] + +Backtrace (newest first): + 0: backtrace::backtrace::win64::trace + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\win64.rs:85 + backtrace::backtrace::trace_unsynchronized + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\mod.rs:66 + 1: backtrace::backtrace::trace + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\mod.rs:53 + 2: backtrace::capture::Backtrace::create + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\capture.rs:294 + 3: backtrace::capture::Backtrace::new_unresolved + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\capture.rs:289 + 4: soroban_env_host::host::error::impl$10::maybe_get_debug_info::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:293 + 5: soroban_env_host::budget::Budget::with_shadow_mode,soroban_env_host::host::error::impl$10::maybe_get_debug_info::closure_env$0> + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\budget.rs:972 + 6: soroban_env_host::host::Host::with_debug_mode + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:615 + 7: soroban_env_host::host::Host::maybe_get_debug_info + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:290 + 8: soroban_env_host::host::error::impl$10::error::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:274 + 9: soroban_env_host::budget::Budget::with_shadow_mode,soroban_env_host::host::error::impl$10::error::closure_env$0> + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\budget.rs:972 + 10: soroban_env_host::host::Host::with_debug_mode + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:615 + 11: soroban_env_host::host::Host::error + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:261 + 12: soroban_env_host::host::impl$4::escalate_error_to_panic + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:767 + 13: soroban_sdk::env::internal::reject_err::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:52 + 14: enum2$ >::map_err,soroban_sdk::env::internal::reject_err::cl + at /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c\library\core\src\result.rs:968 + 15: soroban_sdk::env::internal::reject_err + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:52 + 16: soroban_sdk::env::impl$20::call + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:1667 + 17: soroban_sdk::env::Env::invoke_contract > + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:379 + 18: dongle_contract::review_registry::ReviewRegistryClient::update_review + at src\review_registry.rs:8 + 19: dongle_contract::review_registry::test::test_update_review_event + at src\review_registry.rs:183 + 20: dongle_contract::review_registry::test::test_update_review_event::closure$0 + at src\review_registry.rs:175 + 21: core::ops::function::FnOnce::call_once > + at /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c\library\core\src\ops\function.rs:250 + + +Writing test snapshot file for test "review_registry::test::test_update_review_event" to "test_snapshots\\review_registry\\test\\test_update_review_event.1.json". + + +failures: + review_registry::test::test_delete_review_event + review_registry::test::test_update_review_event + +test result: FAILED. 15 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.51s + +error: test failed, to rerun pass `--lib` diff --git a/dongle-smartcontract/test_results_after_pull_fix.txt b/dongle-smartcontract/test_results_after_pull_fix.txt new file mode 100644 index 0000000..4496e0e --- /dev/null +++ b/dongle-smartcontract/test_results_after_pull_fix.txt @@ -0,0 +1,127 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:5:5 + | +5 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `DataKey` + --> src\verification_registry.rs:8:20 + | +8 | use crate::types::{DataKey, VerificationRecord, VerificationStatus}; + | ^^^^^^^ + +warning: unused import: `crate::constants::MAX_PROJECTS_PER_USER` + --> src\test.rs:3:5 + | +3 | use crate::constants::MAX_PROJECTS_PER_USER; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:4:5 + | +4 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `FeeConfig` and `VerificationStatus` + --> src\test.rs:5:20 + | +5 | use crate::types::{FeeConfig, VerificationStatus}; + | ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:9:58 + | +9 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +error[E0609]: no field `name` on type `core::option::Option` + --> src\registration_tests.rs:36:24 + | +36 | assert_eq!(project.name, name); + | ^^^^ unknown field + | +help: one of the expressions' fields has a field of the same name + | +36 | assert_eq!(project.unwrap().name, name); + | +++++++++ + +error[E0308]: mismatched types + --> src\lib.rs:44:9 + | +43 | ) -> u64 { + | --- expected `u64` because of return type +44 | / ProjectRegistry::register_project( +45 | | &env, +46 | | owner, +47 | | name, +... | +52 | | metadata_cid, +53 | | ) + | |_________^ expected `u64`, found `Result` + | + = note: expected type `u64` + found enum `core::result::Result` +help: consider using `Result::expect` to unwrap the `core::result::Result` value, panicking if the value is a `Result::Err` + | +53 | ).expect("REASON") + | +++++++++++++++++ + +error[E0609]: no field `owner` on type `core::option::Option` + --> src\registration_tests.rs:37:24 + | +37 | assert_eq!(project.owner, owner); + | ^^^^^ unknown field + | +help: one of the expressions' fields has a field of the same name + | +37 | assert_eq!(project.unwrap().owner, owner); + | +++++++++ + +error[E0308]: mismatched types + --> src\registration_tests.rs:71:24 + | +71 | assert_eq!(result, Err(Ok(ContractError::ProjectAlreadyExists))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result, ...>`, found `Result<_, Result>` + | + = note: expected enum `core::result::Result, core::result::Result>` + found enum `core::result::Result<_, core::result::Result>` + +warning: unused variable: `env` + --> src\verification_registry.rs:15:9 + | +15 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:16:9 + | +16 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:17:9 + | +17 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:18:9 + | +18 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +For more information about this error, try `rustc --explain E0308`. +warning: `dongle-contract` (lib) generated 6 warnings +error: could not compile `dongle-contract` (lib) due to 1 previous error; 6 warnings emitted +warning: build failed, waiting for other jobs to finish... +Some errors have detailed explanations: E0308, E0609. +For more information about an error, try `rustc --explain E0308`. +warning: `dongle-contract` (lib test) generated 10 warnings (6 duplicates) +error: could not compile `dongle-contract` (lib test) due to 4 previous errors; 10 warnings emitted diff --git a/dongle-smartcontract/test_results_final.txt b/dongle-smartcontract/test_results_final.txt new file mode 100644 index 0000000..4911cea --- /dev/null +++ b/dongle-smartcontract/test_results_final.txt @@ -0,0 +1,235 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:3:5 + | +3 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::types::VerificationStatus` + --> src\test.rs:4:5 + | +4 | use crate::types::VerificationStatus; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:8:58 + | +8 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +warning: unused import: `crate::errors::ContractError` + --> src\verification_tests.rs:5:9 + | +5 | use crate::errors::ContractError; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:126:13 + | +126 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: use of deprecated method `soroban_sdk::Env::register_stellar_asset_contract`: use [Env::register_stellar_asset_contract_v2] + --> src\verification_tests.rs:45:33 + | +45 | let token_address = env.register_stellar_asset_contract(token_admin); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(deprecated)]` on by default + +warning: use of deprecated method `soroban_sdk::Env::register_stellar_asset_contract`: use [Env::register_stellar_asset_contract_v2] + --> src\verification_tests.rs:85:33 + | +85 | let token_address = env.register_stellar_asset_contract(token_admin); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: constant `MAX_PROJECTS_PER_USER` is never used + --> src\constants.rs:4:11 + | +4 | pub const MAX_PROJECTS_PER_USER: u32 = 50; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: constant `MIN_STRING_LEN` is never used + --> src\constants.rs:7:11 + | +7 | pub const MIN_STRING_LEN: usize = 1; + | ^^^^^^^^^^^^^^ + +warning: constant `MAX_NAME_LEN` is never used + --> src\constants.rs:10:11 + | +10 | pub const MAX_NAME_LEN: usize = 128; + | ^^^^^^^^^^^^ + +warning: constant `MAX_DESCRIPTION_LEN` is never used + --> src\constants.rs:13:11 + | +13 | pub const MAX_DESCRIPTION_LEN: usize = 2048; + | ^^^^^^^^^^^^^^^^^^^ + +warning: constant `MAX_CATEGORY_LEN` is never used + --> src\constants.rs:16:11 + | +16 | pub const MAX_CATEGORY_LEN: usize = 64; + | ^^^^^^^^^^^^^^^^ + +warning: constant `MAX_WEBSITE_LEN` is never used + --> src\constants.rs:19:11 + | +19 | pub const MAX_WEBSITE_LEN: usize = 256; + | ^^^^^^^^^^^^^^^ + +warning: constant `MAX_CID_LEN` is never used + --> src\constants.rs:22:11 + | +22 | pub const MAX_CID_LEN: usize = 128; + | ^^^^^^^^^^^ + +warning: constant `RATING_MIN` is never used + --> src\constants.rs:25:11 + | +25 | pub const RATING_MIN: u32 = 1; + | ^^^^^^^^^^ + +warning: constant `RATING_MAX` is never used + --> src\constants.rs:26:11 + | +26 | pub const RATING_MAX: u32 = 5; + | ^^^^^^^^^^ + +warning: associated function `set_treasury` is never used + --> src\fee_manager.rs:77:12 + | +11 | impl FeeManager { + | --------------- associated function in this implementation +... +77 | pub fn set_treasury( + | ^^^^^^^^^^^^ + +warning: associated functions `add_rating` and `update_rating` are never used + --> src\rating_calculator.rs:34:12 + | + 8 | impl RatingCalculator { + | --------------------- associated functions in this implementation +... +34 | pub fn add_rating(current_sum: u64, current_count: u32, new_rating: u32) -> (u64, u32, u32) { + | ^^^^^^^^^^ +... +52 | pub fn update_rating( + | ^^^^^^^^^^^^^ + +warning: associated function `get_reviews_by_user` is never used + --> src\review_registry.rs:155:12 + | + 12 | impl ReviewRegistry { + | ------------------- associated function in this implementation +... +155 | pub fn get_reviews_by_user( + | ^^^^^^^^^^^^^^^^^^^ + +warning: struct `Utils` is never constructed + --> src\utils.rs:5:12 + | +5 | pub struct Utils; + | ^^^^^ + +warning: multiple associated functions are never used + --> src\utils.rs:8:12 + | + 7 | impl Utils { + | ---------- associated functions in this implementation + 8 | pub fn get_current_timestamp(env: &Env) -> u64 { + | ^^^^^^^^^^^^^^^^^^^^^ +... +12 | pub fn is_admin(env: &Env, address: &Address) -> bool { + | ^^^^^^^^ +... +20 | pub fn require_admin(env: &Env, address: &Address) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^ +... +27 | pub fn validate_string_length( + | ^^^^^^^^^^^^^^^^^^^^^^ +... +42 | pub fn is_valid_ipfs_cid(cid: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +47 | pub fn is_valid_url(_url: &String) -> bool { + | ^^^^^^^^^^^^ +... +51 | pub fn sanitize_string(input: &String) -> String { + | ^^^^^^^^^^^^^^^ +... +55 | pub fn is_valid_category(_category: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +59 | pub fn validate_pagination(_start_id: u64, limit: u32) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^ + +warning: associated functions `list_pending_verifications`, `verification_exists`, `get_verification_status`, `update_verification_evidence`, `validate_evidence_cid`, and `get_verification_stats` are never used + --> src\verification_registry.rs:121:12 + | + 16 | impl VerificationRegistry { + | ------------------------- associated functions in this implementation +... +121 | pub fn list_pending_verifications( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +146 | pub fn verification_exists(env: &Env, project_id: u64) -> bool { + | ^^^^^^^^^^^^^^^^^^^ +... +150 | pub fn get_verification_status( + | ^^^^^^^^^^^^^^^^^^^^^^^ +... +158 | pub fn update_verification_evidence( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +167 | pub fn validate_evidence_cid(evidence_cid: &String) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^^^ +... +174 | pub fn get_verification_stats(_env: &Env) -> (u32, u32, u32) { + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: `dongle-contract` (lib test) generated 21 warnings (15 duplicates) (run `cargo fix --lib -p dongle-contract --tests` to apply 4 suggestions) +warning: `dongle-contract` (lib) generated 16 warnings (run `cargo fix --lib -p dongle-contract` to apply 1 suggestion) + Finished `test` profile [unoptimized + debuginfo] target(s) in 5.24s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 21 tests +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test test::test_get_project_invalid_id_zero ... ok +test test::test_get_project_none_for_nonexistent_id ... ok +test registration_tests::test_register_project_success ... ok +test registration_tests::test_register_duplicate_project_fails ... ok +test test::test_register_project_success ... ok +test review_registry::test::test_add_review_event ... ok +test registration_tests::test_register_different_projects_success ... ok +test verification_tests::test::test_reject_verification ... ok +test verification_tests::test::test_verification_lifecycle ... ok +test test::test_list_projects ... ok + +test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.48s + + Doc-tests dongle_contract + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + diff --git a/dongle-smartcontract/test_results_finalv2.txt b/dongle-smartcontract/test_results_finalv2.txt new file mode 100644 index 0000000..8c22a88 --- /dev/null +++ b/dongle-smartcontract/test_results_finalv2.txt @@ -0,0 +1,156 @@ +warning: unused import: `ReviewEventData` + --> src\review_registry.rs:2:42 + | +2 | use crate::types::{Review, ReviewAction, ReviewEventData, DataKey}; + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +warning: unused import: `TryIntoVal` + --> src\review_registry.rs:135:31 + | +135 | Env, IntoVal, String, TryIntoVal, + | ^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: hiding a lifetime that's elided elsewhere is confusing + --> src\registration_tests.rs:6:15 + | +6 | fn setup(env: &Env) -> (DongleContractClient, Address) { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here + | | + | the lifetime is elided here + | + = help: the same lifetime is referred to in inconsistent ways, making the signature confusing + = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default +help: use `'_` for type paths + | +6 | fn setup(env: &Env) -> (DongleContractClient<'_>, Address) { + | ++++ + +warning: `dongle-contract` (lib) generated 12 warnings (run `cargo fix --lib -p dongle-contract` to apply 12 suggestions) +warning: `dongle-contract` (lib test) generated 13 warnings (11 duplicates) (run `cargo fix --lib -p dongle-contract --tests` to apply 2 suggestions) + Finished `test` profile [unoptimized + debuginfo] target(s) in 0.37s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 17 tests +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test review_registry::test::test_add_review_event ... ok +test registration_tests::test_register_project_success ... ok +test review_registry::test::test_delete_review_event ... FAILED +test registration_tests::test_register_duplicate_project_fails ... ok +test review_registry::test::test_update_review_event ... FAILED +test registration_tests::test_register_different_projects_success ... ok + +failures: + +---- review_registry::test::test_delete_review_event stdout ---- + +thread 'review_registry::test::test_delete_review_event' (9476) panicked at src\review_registry.rs:214:9: +assertion `left == right` failed + left: 2 + right: 1 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +Writing test snapshot file for test "review_registry::test::test_delete_review_event" to "test_snapshots\\review_registry\\test\\test_delete_review_event.1.json". + +---- review_registry::test::test_update_review_event stdout ---- + +thread 'review_registry::test::test_update_review_event' (9960) panicked at src\review_registry.rs:189:9: +assertion `left == right` failed + left: 2 + right: 1 +Writing test snapshot file for test "review_registry::test::test_update_review_event" to "test_snapshots\\review_registry\\test\\test_update_review_event.1.json". + + +failures: + review_registry::test::test_delete_review_event + review_registry::test::test_update_review_event + +test result: FAILED. 15 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s + +error: test failed, to rerun pass `--lib` diff --git a/dongle-smartcontract/test_results_finalv3.txt b/dongle-smartcontract/test_results_finalv3.txt new file mode 100644 index 0000000..3749896 --- /dev/null +++ b/dongle-smartcontract/test_results_finalv3.txt @@ -0,0 +1,138 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `ReviewEventData` + --> src\review_registry.rs:2:42 + | +2 | use crate::types::{Review, ReviewAction, ReviewEventData, DataKey}; + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\verification_registry.rs:9:60 + | +9 | use crate::types::{VerificationRecord, VerificationStatus, DataKey}; + | ^^^^^^^ + +warning: unused imports: `publish_fee_paid_event` and `publish_fee_set_event` + --> src\fee_manager.rs:4:21 + | +4 | use crate::events::{publish_fee_paid_event, publish_fee_set_event}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `DataKey` + --> src\fee_manager.rs:5:31 + | +5 | use crate::types::{FeeConfig, DataKey}; + | ^^^^^^^ + +warning: unused import: `FeeConfig` + --> src\lib.rs:22:50 + | +22 | use types::{Project, Review, VerificationRecord, FeeConfig}; + | ^^^^^^^^^ + +warning: unused import: `TryIntoVal` + --> src\review_registry.rs:135:31 + | +135 | Env, IntoVal, String, TryIntoVal, + | ^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: variable does not need to be mutable + --> src\review_registry.rs:78:17 + | +78 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:16:9 + | +16 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:17:9 + | +17 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:18:9 + | +18 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:19:9 + | +19 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +warning: hiding a lifetime that's elided elsewhere is confusing + --> src\registration_tests.rs:6:15 + | +6 | fn setup(env: &Env) -> (DongleContractClient, Address) { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here + | | + | the lifetime is elided here + | + = help: the same lifetime is referred to in inconsistent ways, making the signature confusing + = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default +help: use `'_` for type paths + | +6 | fn setup(env: &Env) -> (DongleContractClient<'_>, Address) { + | ++++ + +warning: `dongle-contract` (lib) generated 12 warnings (run `cargo fix --lib -p dongle-contract` to apply 12 suggestions) +warning: `dongle-contract` (lib test) generated 13 warnings (11 duplicates) (run `cargo fix --lib -p dongle-contract --tests` to apply 2 suggestions) + Finished `test` profile [unoptimized + debuginfo] target(s) in 4.85s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 17 tests +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test review_registry::test::test_add_review_event ... ok +test registration_tests::test_register_project_success ... ok +test review_registry::test::test_delete_review_event ... ok +test registration_tests::test_register_duplicate_project_fails ... ok +test review_registry::test::test_update_review_event ... ok +test registration_tests::test_register_different_projects_success ... ok + +test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.09s + + Doc-tests dongle_contract + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + diff --git a/dongle-smartcontract/test_results_v10.txt b/dongle-smartcontract/test_results_v10.txt new file mode 100644 index 0000000..673342b --- /dev/null +++ b/dongle-smartcontract/test_results_v10.txt @@ -0,0 +1,252 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `Project` + --> src\verification_registry.rs:8:20 + | +8 | use crate::types::{Project, VerificationRecord, VerificationStatus}; + | ^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:3:5 + | +3 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::types::VerificationStatus` + --> src\test.rs:4:5 + | +4 | use crate::types::VerificationStatus; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:8:58 + | +8 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +warning: unused import: `crate::errors::ContractError` + --> src\verification_tests.rs:5:9 + | +5 | use crate::errors::ContractError; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:126:13 + | +126 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +error[E0599]: no method named `unwrap` found for type `u64` in the current scope + --> src\verification_tests.rs:32:11 + | +24 | let project_id = client.register_project( + | __________________________- +25 | | &owner, +26 | | &project_name, +27 | | &String::from_str(&env, "Description... Description... Description... Description..."), +... | +31 | | &None, +32 | | ).unwrap(); + | | -^^^^^^ method not found in `u64` + | |__________| + | + +warning: use of deprecated method `soroban_sdk::Env::register_stellar_asset_contract`: use [Env::register_stellar_asset_contract_v2] + --> src\verification_tests.rs:45:33 + | +45 | let token_address = env.register_stellar_asset_contract(token_admin); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(deprecated)]` on by default + +error[E0599]: no method named `mint` found for struct `Client<'a>` in the current scope + --> src\verification_tests.rs:50:22 + | +50 | token_client.mint(&owner, &1000); + | ^^^^ method not found in `Client<'_>` + +error[E0599]: no method named `unwrap` found for type `u64` in the current scope + --> src\verification_tests.rs:81:11 + | +73 | let project_id = client.register_project( + | __________________________- +74 | | &owner, +75 | | &String::from_str(&env, "Project Y"), +76 | | &String::from_str(&env, "Description... Description... Description... Description..."), +... | +80 | | &None, +81 | | ).unwrap(); + | | -^^^^^^ method not found in `u64` + | |__________| + | + +warning: use of deprecated method `soroban_sdk::Env::register_stellar_asset_contract`: use [Env::register_stellar_asset_contract_v2] + --> src\verification_tests.rs:85:33 + | +85 | let token_address = env.register_stellar_asset_contract(token_admin); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0599]: no method named `mint` found for struct `Client<'a>` in the current scope + --> src\verification_tests.rs:87:22 + | +87 | token_client.mint(&owner, &100); + | ^^^^ method not found in `Client<'_>` + +warning: constant `MAX_PROJECTS_PER_USER` is never used + --> src\constants.rs:4:11 + | +4 | pub const MAX_PROJECTS_PER_USER: u32 = 50; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: constant `MIN_STRING_LEN` is never used + --> src\constants.rs:7:11 + | +7 | pub const MIN_STRING_LEN: usize = 1; + | ^^^^^^^^^^^^^^ + +warning: constant `MAX_NAME_LEN` is never used + --> src\constants.rs:10:11 + | +10 | pub const MAX_NAME_LEN: usize = 128; + | ^^^^^^^^^^^^ + +warning: constant `MAX_DESCRIPTION_LEN` is never used + --> src\constants.rs:13:11 + | +13 | pub const MAX_DESCRIPTION_LEN: usize = 2048; + | ^^^^^^^^^^^^^^^^^^^ + +warning: constant `MAX_CATEGORY_LEN` is never used + --> src\constants.rs:16:11 + | +16 | pub const MAX_CATEGORY_LEN: usize = 64; + | ^^^^^^^^^^^^^^^^ + +warning: constant `MAX_WEBSITE_LEN` is never used + --> src\constants.rs:19:11 + | +19 | pub const MAX_WEBSITE_LEN: usize = 256; + | ^^^^^^^^^^^^^^^ + +warning: constant `MAX_CID_LEN` is never used + --> src\constants.rs:22:11 + | +22 | pub const MAX_CID_LEN: usize = 128; + | ^^^^^^^^^^^ + +warning: constant `RATING_MIN` is never used + --> src\constants.rs:25:11 + | +25 | pub const RATING_MIN: u32 = 1; + | ^^^^^^^^^^ + +warning: constant `RATING_MAX` is never used + --> src\constants.rs:26:11 + | +26 | pub const RATING_MAX: u32 = 5; + | ^^^^^^^^^^ + +warning: associated function `set_treasury` is never used + --> src\fee_manager.rs:77:12 + | +11 | impl FeeManager { + | --------------- associated function in this implementation +... +77 | pub fn set_treasury( + | ^^^^^^^^^^^^ + +warning: associated functions `add_rating` and `update_rating` are never used + --> src\rating_calculator.rs:34:12 + | + 8 | impl RatingCalculator { + | --------------------- associated functions in this implementation +... +34 | pub fn add_rating(current_sum: u64, current_count: u32, new_rating: u32) -> (u64, u32, u32) { + | ^^^^^^^^^^ +... +52 | pub fn update_rating( + | ^^^^^^^^^^^^^ + +warning: associated function `get_reviews_by_user` is never used + --> src\review_registry.rs:155:12 + | + 12 | impl ReviewRegistry { + | ------------------- associated function in this implementation +... +155 | pub fn get_reviews_by_user( + | ^^^^^^^^^^^^^^^^^^^ + +warning: struct `Utils` is never constructed + --> src\utils.rs:5:12 + | +5 | pub struct Utils; + | ^^^^^ + +warning: multiple associated functions are never used + --> src\utils.rs:8:12 + | + 7 | impl Utils { + | ---------- associated functions in this implementation + 8 | pub fn get_current_timestamp(env: &Env) -> u64 { + | ^^^^^^^^^^^^^^^^^^^^^ +... +12 | pub fn is_admin(env: &Env, address: &Address) -> bool { + | ^^^^^^^^ +... +20 | pub fn require_admin(env: &Env, address: &Address) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^ +... +27 | pub fn validate_string_length( + | ^^^^^^^^^^^^^^^^^^^^^^ +... +42 | pub fn is_valid_ipfs_cid(cid: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +47 | pub fn is_valid_url(_url: &String) -> bool { + | ^^^^^^^^^^^^ +... +51 | pub fn sanitize_string(input: &String) -> String { + | ^^^^^^^^^^^^^^^ +... +55 | pub fn is_valid_category(_category: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +59 | pub fn validate_pagination(_start_id: u64, limit: u32) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^ + +warning: associated functions `list_pending_verifications`, `verification_exists`, `get_verification_status`, `update_verification_evidence`, `validate_evidence_cid`, and `get_verification_stats` are never used + --> src\verification_registry.rs:121:12 + | + 16 | impl VerificationRegistry { + | ------------------------- associated functions in this implementation +... +121 | pub fn list_pending_verifications( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +146 | pub fn verification_exists(env: &Env, project_id: u64) -> bool { + | ^^^^^^^^^^^^^^^^^^^ +... +150 | pub fn get_verification_status( + | ^^^^^^^^^^^^^^^^^^^^^^^ +... +158 | pub fn update_verification_evidence( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +167 | pub fn validate_evidence_cid(evidence_cid: &String) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^^^ +... +174 | pub fn get_verification_stats(_env: &Env) -> (u32, u32, u32) { + | ^^^^^^^^^^^^^^^^^^^^^^ + +For more information about this error, try `rustc --explain E0599`. +warning: `dongle-contract` (lib test) generated 8 warnings (2 duplicates) +error: could not compile `dongle-contract` (lib test) due to 4 previous errors; 8 warnings emitted +warning: build failed, waiting for other jobs to finish... +warning: `dongle-contract` (lib) generated 17 warnings (run `cargo fix --lib -p dongle-contract` to apply 2 suggestions) diff --git a/dongle-smartcontract/test_results_v11.txt b/dongle-smartcontract/test_results_v11.txt new file mode 100644 index 0000000..58e96ac --- /dev/null +++ b/dongle-smartcontract/test_results_v11.txt @@ -0,0 +1,241 @@ +warning: unused import: `Project` + --> src\verification_registry.rs:8:20 + | +8 | use crate::types::{Project, VerificationRecord, VerificationStatus}; + | ^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: variable does not need to be mutable + --> src\review_registry.rs:126:13 + | +126 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: constant `MAX_PROJECTS_PER_USER` is never used + --> src\constants.rs:4:11 + | +4 | pub const MAX_PROJECTS_PER_USER: u32 = 50; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: constant `MIN_STRING_LEN` is never used + --> src\constants.rs:7:11 + | +7 | pub const MIN_STRING_LEN: usize = 1; + | ^^^^^^^^^^^^^^ + +warning: constant `MAX_NAME_LEN` is never used + --> src\constants.rs:10:11 + | +10 | pub const MAX_NAME_LEN: usize = 128; + | ^^^^^^^^^^^^ + +warning: constant `MAX_DESCRIPTION_LEN` is never used + --> src\constants.rs:13:11 + | +13 | pub const MAX_DESCRIPTION_LEN: usize = 2048; + | ^^^^^^^^^^^^^^^^^^^ + +warning: constant `MAX_CATEGORY_LEN` is never used + --> src\constants.rs:16:11 + | +16 | pub const MAX_CATEGORY_LEN: usize = 64; + | ^^^^^^^^^^^^^^^^ + +warning: constant `MAX_WEBSITE_LEN` is never used + --> src\constants.rs:19:11 + | +19 | pub const MAX_WEBSITE_LEN: usize = 256; + | ^^^^^^^^^^^^^^^ + +warning: constant `MAX_CID_LEN` is never used + --> src\constants.rs:22:11 + | +22 | pub const MAX_CID_LEN: usize = 128; + | ^^^^^^^^^^^ + +warning: constant `RATING_MIN` is never used + --> src\constants.rs:25:11 + | +25 | pub const RATING_MIN: u32 = 1; + | ^^^^^^^^^^ + +warning: constant `RATING_MAX` is never used + --> src\constants.rs:26:11 + | +26 | pub const RATING_MAX: u32 = 5; + | ^^^^^^^^^^ + +warning: associated function `set_treasury` is never used + --> src\fee_manager.rs:77:12 + | +11 | impl FeeManager { + | --------------- associated function in this implementation +... +77 | pub fn set_treasury( + | ^^^^^^^^^^^^ + +warning: associated functions `add_rating` and `update_rating` are never used + --> src\rating_calculator.rs:34:12 + | + 8 | impl RatingCalculator { + | --------------------- associated functions in this implementation +... +34 | pub fn add_rating(current_sum: u64, current_count: u32, new_rating: u32) -> (u64, u32, u32) { + | ^^^^^^^^^^ +... +52 | pub fn update_rating( + | ^^^^^^^^^^^^^ + +warning: associated function `get_reviews_by_user` is never used + --> src\review_registry.rs:155:12 + | + 12 | impl ReviewRegistry { + | ------------------- associated function in this implementation +... +155 | pub fn get_reviews_by_user( + | ^^^^^^^^^^^^^^^^^^^ + +warning: struct `Utils` is never constructed + --> src\utils.rs:5:12 + | +5 | pub struct Utils; + | ^^^^^ + +warning: multiple associated functions are never used + --> src\utils.rs:8:12 + | + 7 | impl Utils { + | ---------- associated functions in this implementation + 8 | pub fn get_current_timestamp(env: &Env) -> u64 { + | ^^^^^^^^^^^^^^^^^^^^^ +... +12 | pub fn is_admin(env: &Env, address: &Address) -> bool { + | ^^^^^^^^ +... +20 | pub fn require_admin(env: &Env, address: &Address) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^ +... +27 | pub fn validate_string_length( + | ^^^^^^^^^^^^^^^^^^^^^^ +... +42 | pub fn is_valid_ipfs_cid(cid: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +47 | pub fn is_valid_url(_url: &String) -> bool { + | ^^^^^^^^^^^^ +... +51 | pub fn sanitize_string(input: &String) -> String { + | ^^^^^^^^^^^^^^^ +... +55 | pub fn is_valid_category(_category: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +59 | pub fn validate_pagination(_start_id: u64, limit: u32) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^ + +warning: associated functions `list_pending_verifications`, `verification_exists`, `get_verification_status`, `update_verification_evidence`, `validate_evidence_cid`, and `get_verification_stats` are never used + --> src\verification_registry.rs:121:12 + | + 16 | impl VerificationRegistry { + | ------------------------- associated functions in this implementation +... +121 | pub fn list_pending_verifications( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +146 | pub fn verification_exists(env: &Env, project_id: u64) -> bool { + | ^^^^^^^^^^^^^^^^^^^ +... +150 | pub fn get_verification_status( + | ^^^^^^^^^^^^^^^^^^^^^^^ +... +158 | pub fn update_verification_evidence( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +167 | pub fn validate_evidence_cid(evidence_cid: &String) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^^^ +... +174 | pub fn get_verification_stats(_env: &Env) -> (u32, u32, u32) { + | ^^^^^^^^^^^^^^^^^^^^^^ + + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: `dongle-contract` (lib) generated 17 warnings (run `cargo fix --lib -p dongle-contract` to apply 2 suggestions) +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:3:5 + | +3 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::types::VerificationStatus` + --> src\test.rs:4:5 + | +4 | use crate::types::VerificationStatus; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:8:58 + | +8 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +warning: unused import: `crate::errors::ContractError` + --> src\verification_tests.rs:5:9 + | +5 | use crate::errors::ContractError; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: use of deprecated method `soroban_sdk::Env::register_stellar_asset_contract`: use [Env::register_stellar_asset_contract_v2] + --> src\verification_tests.rs:45:33 + | +45 | let token_address = env.register_stellar_asset_contract(token_admin); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(deprecated)]` on by default + +warning: use of deprecated method `soroban_sdk::Env::register_stellar_asset_contract`: use [Env::register_stellar_asset_contract_v2] + --> src\verification_tests.rs:85:33 + | +85 | let token_address = env.register_stellar_asset_contract(token_admin); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `dongle-contract` (lib test) generated 22 warnings (16 duplicates) (run `cargo fix --lib -p dongle-contract --tests` to apply 4 suggestions) + Finished `test` profile [unoptimized + debuginfo] target(s) in 4.42s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 21 tests +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test test::test_get_project_invalid_id_zero ... ok +test test::test_get_project_none_for_nonexistent_id ... ok +test registration_tests::test_register_project_success ... ok +test test::test_register_project_success ... ok +test review_registry::test::test_add_review_event ... ok +test registration_tests::test_register_duplicate_project_fails ... ok +test registration_tests::test_register_different_projects_success ... ok +test verification_tests::test::test_reject_verification ... ok +test verification_tests::test::test_verification_lifecycle ... ok +test test::test_list_projects ... ok + +test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.49s + + Doc-tests dongle_contract + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + diff --git a/dongle-smartcontract/test_results_v12.txt b/dongle-smartcontract/test_results_v12.txt new file mode 100644 index 0000000..2f9dc36 --- /dev/null +++ b/dongle-smartcontract/test_results_v12.txt @@ -0,0 +1,90 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error[E0432]: unresolved imports `crate::types::ProjectRegistrationParams`, `crate::types::ProjectUpdateParams` + --> src\project_registry.rs:2:49 + | +2 | use crate::types::{Project, VerificationStatus, ProjectRegistrationParams, ProjectUpdateParams}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ no `ProjectUpdateParams` in `types` + | | + | no `ProjectRegistrationParams` in `types` + +error[E0432]: unresolved import `crate::types::ProjectRegistrationParams` + --> src\registration_tests.rs:4:5 + | +4 | use crate::types::ProjectRegistrationParams; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ProjectRegistrationParams` in `types` + +error[E0432]: unresolved import `crate::types::ProjectRegistrationParams` + --> src\verification_tests.rs:5:44 + | +5 | use crate::types::{VerificationStatus, ProjectRegistrationParams}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ no `ProjectRegistrationParams` in `types` + +error[E0425]: cannot find type `ProjectRegistrationParams` in this scope + --> src\lib.rs:39:17 + | +39 | params: ProjectRegistrationParams, + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + +error[E0425]: cannot find type `ProjectUpdateParams` in this scope + --> src\lib.rs:46:17 + | +46 | params: ProjectUpdateParams, + | ^^^^^^^^^^^^^^^^^^^ not found in this scope + +error[E0422]: cannot find struct, variant or union type `ProjectRegistrationParams` in module `crate::types` + --> src\test.rs:23:32 + | +23 | let params = crate::types::ProjectRegistrationParams { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `crate::types` + +error[E0422]: cannot find struct, variant or union type `ProjectRegistrationParams` in module `crate::types` + --> src\test.rs:438:36 + | +438 | let params = crate::types::ProjectRegistrationParams { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `crate::types` + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:3:5 + | +3 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::types::VerificationStatus` + --> src\test.rs:4:5 + | +4 | use crate::types::VerificationStatus; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:8:58 + | +8 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +error[E0061]: this method takes 1 argument but 7 arguments were supplied + --> src\review_registry.rs:211:33 + | +211 | let project_id = client.register_project(&owner, &name, &desc, &cat, &None, &None, &None); + | ^^^^^^^^^^^^^^^^ + | +note: method defined here + --> src\lib.rs:37:12 + | + 37 | pub fn register_project( + | ^^^^^^^^^^^^^^^^ +help: remove the extra arguments + | +211 - let project_id = client.register_project(&owner, &name, &desc, &cat, &None, &None, &None); +211 + let project_id = client.register_project(&owner); + | + +Some errors have detailed explanations: E0425, E0432. +For more information about an error, try `rustc --explain E0425`. +error: could not compile `dongle-contract` (lib) due to 3 previous errors +warning: build failed, waiting for other jobs to finish... +Some errors have detailed explanations: E0061, E0422, E0425, E0432. +For more information about an error, try `rustc --explain E0061`. +warning: `dongle-contract` (lib test) generated 3 warnings +error: could not compile `dongle-contract` (lib test) due to 8 previous errors; 3 warnings emitted diff --git a/dongle-smartcontract/test_results_v13.txt b/dongle-smartcontract/test_results_v13.txt new file mode 100644 index 0000000..497b2d6 --- /dev/null +++ b/dongle-smartcontract/test_results_v13.txt @@ -0,0 +1,74 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error[E0425]: cannot find type `ProjectRegistrationParams` in this scope + --> src\lib.rs:39:17 + | +39 | params: ProjectRegistrationParams, + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + | +help: consider importing this struct + | +22 + use crate::types::ProjectRegistrationParams; + | + +error[E0425]: cannot find type `ProjectUpdateParams` in this scope + --> src\lib.rs:46:17 + | +46 | params: ProjectUpdateParams, + | ^^^^^^^^^^^^^^^^^^^ not found in this scope + | +help: consider importing this struct + | +22 + use crate::types::ProjectUpdateParams; + | + +warning: unused import: `Vec` + --> src\types.rs:1:50 + | +1 | use soroban_sdk::{Address, String, contracttype, Vec}; + | ^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:3:5 + | +3 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::types::VerificationStatus` + --> src\test.rs:4:5 + | +4 | use crate::types::VerificationStatus; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:8:58 + | +8 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +error[E0061]: this method takes 1 argument but 7 arguments were supplied + --> src\review_registry.rs:211:33 + | +211 | let project_id = client.register_project(&owner, &name, &desc, &cat, &None, &None, &None); + | ^^^^^^^^^^^^^^^^ + | +note: method defined here + --> src\lib.rs:37:12 + | + 37 | pub fn register_project( + | ^^^^^^^^^^^^^^^^ +help: remove the extra arguments + | +211 - let project_id = client.register_project(&owner, &name, &desc, &cat, &None, &None, &None); +211 + let project_id = client.register_project(&owner); + | + +For more information about this error, try `rustc --explain E0425`. +warning: `dongle-contract` (lib) generated 1 warning (1 duplicate) +error: could not compile `dongle-contract` (lib) due to 2 previous errors; 1 warning emitted +warning: build failed, waiting for other jobs to finish... +Some errors have detailed explanations: E0061, E0425. +For more information about an error, try `rustc --explain E0061`. +warning: `dongle-contract` (lib test) generated 4 warnings +error: could not compile `dongle-contract` (lib test) due to 3 previous errors; 4 warnings emitted diff --git a/dongle-smartcontract/test_results_v14.txt b/dongle-smartcontract/test_results_v14.txt new file mode 100644 index 0000000..4cf03cf --- /dev/null +++ b/dongle-smartcontract/test_results_v14.txt @@ -0,0 +1,112 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error[E0432]: unresolved import `crate::types::ReviewData` + --> src\lib.rs:26:76 + | +26 | use crate::types::{FeeConfig, Project, ProjectStats, Review, ReviewAction, ReviewData, ReviewEventData, VerificationRecord, + | ^^^^^^^^^^ no `ReviewData` in `types` + +error[E0433]: failed to resolve: use of undeclared type `VerificationRegistry` + --> src\lib.rs:102:9 + | +102 | VerificationRegistry::request_verification(&env, project_id, requester, evidence_cid) + | ^^^^^^^^^^^^^^^^^^^^ use of undeclared type `VerificationRegistry` + | +help: a struct with a similar name exists + | +102 - VerificationRegistry::request_verification(&env, project_id, requester, evidence_cid) +102 + VerificationRecord::request_verification(&env, project_id, requester, evidence_cid) + | +help: consider importing this struct + | + 22 + use crate::verification_registry::VerificationRegistry; + | + +error[E0433]: failed to resolve: use of undeclared type `VerificationRegistry` + --> src\lib.rs:106:9 + | +106 | VerificationRegistry::approve_verification(&env, project_id, admin) + | ^^^^^^^^^^^^^^^^^^^^ use of undeclared type `VerificationRegistry` + | +help: a struct with a similar name exists + | +106 - VerificationRegistry::approve_verification(&env, project_id, admin) +106 + VerificationRecord::approve_verification(&env, project_id, admin) + | +help: consider importing this struct + | + 22 + use crate::verification_registry::VerificationRegistry; + | + +error[E0433]: failed to resolve: use of undeclared type `VerificationRegistry` + --> src\lib.rs:110:9 + | +110 | VerificationRegistry::reject_verification(&env, project_id, admin) + | ^^^^^^^^^^^^^^^^^^^^ use of undeclared type `VerificationRegistry` + | +help: a struct with a similar name exists + | +110 - VerificationRegistry::reject_verification(&env, project_id, admin) +110 + VerificationRecord::reject_verification(&env, project_id, admin) + | +help: consider importing this struct + | + 22 + use crate::verification_registry::VerificationRegistry; + | + +error[E0433]: failed to resolve: use of undeclared type `VerificationRegistry` + --> src\lib.rs:114:9 + | +114 | VerificationRegistry::get_verification(&env, project_id).ok() + | ^^^^^^^^^^^^^^^^^^^^ use of undeclared type `VerificationRegistry` + | +help: a struct with a similar name exists + | +114 - VerificationRegistry::get_verification(&env, project_id).ok() +114 + VerificationRecord::get_verification(&env, project_id).ok() + | +help: consider importing this struct + | + 22 + use crate::verification_registry::VerificationRegistry; + | + +warning: unused import: `Vec` + --> src\types.rs:1:50 + | +1 | use soroban_sdk::{Address, String, contracttype, Vec}; + | ^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `ProjectStats`, `ReviewAction`, `ReviewEventData`, and `VerificationStatus` + --> src\lib.rs:26:40 + | +26 | use crate::types::{FeeConfig, Project, ProjectStats, Review, ReviewAction, ReviewData, ReviewEventData, VerificationRecord, + | ^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ +27 | VerificationStatus, ProjectRegistrationParams, ProjectUpdateParams + | ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:3:5 + | +3 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::types::VerificationStatus` + --> src\test.rs:4:5 + | +4 | use crate::types::VerificationStatus; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:8:58 + | +8 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +Some errors have detailed explanations: E0432, E0433. +For more information about an error, try `rustc --explain E0432`. +warning: `dongle-contract` (lib) generated 2 warnings +error: could not compile `dongle-contract` (lib) due to 5 previous errors; 2 warnings emitted +warning: build failed, waiting for other jobs to finish... +warning: `dongle-contract` (lib test) generated 5 warnings (2 duplicates) +error: could not compile `dongle-contract` (lib test) due to 5 previous errors; 5 warnings emitted diff --git a/dongle-smartcontract/test_results_v15.txt b/dongle-smartcontract/test_results_v15.txt new file mode 100644 index 0000000..059db43 --- /dev/null +++ b/dongle-smartcontract/test_results_v15.txt @@ -0,0 +1,99 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error[E0432]: unresolved import `crate::errors` + --> src\lib.rs:1:12 + | +1 | use crate::errors::ContractError; + | ^^^^^^ could not find `errors` in the crate root + +error[E0432]: unresolved import `crate::fee_manager` + --> src\lib.rs:2:12 + | +2 | use crate::fee_manager::FeeManager; + | ^^^^^^^^^^^ could not find `fee_manager` in the crate root + +error[E0432]: unresolved import `crate::project_registry` + --> src\lib.rs:3:12 + | +3 | use crate::project_registry::ProjectRegistry; + | ^^^^^^^^^^^^^^^^ could not find `project_registry` in the crate root + +error[E0432]: unresolved import `crate::review_registry` + --> src\lib.rs:4:12 + | +4 | use crate::review_registry::ReviewRegistry; + | ^^^^^^^^^^^^^^^ could not find `review_registry` in the crate root + +error[E0432]: unresolved import `crate::types` + --> src\lib.rs:5:12 + | +5 | use crate::types::{ + | ^^^^^ could not find `types` in the crate root + +error[E0432]: unresolved import `crate::verification_registry` + --> src\lib.rs:9:12 + | +9 | use crate::verification_registry::VerificationRegistry; + | ^^^^^^^^^^^^^^^^^^^^^ could not find `verification_registry` in the crate root + +error[E0433]: failed to resolve: could not find `storage_keys` in the crate root + --> src\lib.rs:19:48 + | +19 | env.storage().persistent().set(&crate::storage_keys::StorageKey::Admin, &admin); + | ^^^^^^^^^^^^ could not find `storage_keys` in the crate root + +error[E0432]: unresolved import `crate::errors` + --> src\test.rs:3:12 + | +3 | use crate::errors::ContractError as Error; + | ^^^^^^ could not find `errors` in the crate root + +error[E0432]: unresolved import `crate::types` + --> src\test.rs:4:12 + | +4 | use crate::types::VerificationStatus; + | ^^^^^ could not find `types` in the crate root + +error[E0432]: unresolved import `crate::errors` + --> src\registration_tests.rs:3:12 + | +3 | use crate::errors::ContractError; + | ^^^^^^ could not find `errors` in the crate root + +error[E0432]: unresolved import `crate::types` + --> src\registration_tests.rs:4:12 + | +4 | use crate::types::ProjectRegistrationParams; + | ^^^^^ could not find `types` in the crate root + +error[E0432]: unresolved import `crate::types` + --> src\verification_tests.rs:5:16 + | +5 | use crate::types::{VerificationStatus, ProjectRegistrationParams}; + | ^^^^^ could not find `types` in the crate root + +error[E0433]: failed to resolve: could not find `types` in the crate root + --> src\test.rs:23:25 + | +23 | let params = crate::types::ProjectRegistrationParams { + | ^^^^^ could not find `types` in the crate root + +error[E0433]: failed to resolve: could not find `types` in the crate root + --> src\test.rs:438:29 + | +438 | let params = crate::types::ProjectRegistrationParams { + | ^^^^^ could not find `types` in the crate root + +warning: unused import: `Vec` + --> src\test.rs:8:58 + | +8 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +Some errors have detailed explanations: E0432, E0433. +For more information about an error, try `rustc --explain E0432`. +error: could not compile `dongle-contract` (lib) due to 7 previous errors +warning: build failed, waiting for other jobs to finish... +warning: `dongle-contract` (lib test) generated 1 warning +error: could not compile `dongle-contract` (lib test) due to 14 previous errors; 1 warning emitted diff --git a/dongle-smartcontract/test_results_v16.txt b/dongle-smartcontract/test_results_v16.txt new file mode 100644 index 0000000..8cfe3b3 --- /dev/null +++ b/dongle-smartcontract/test_results_v16.txt @@ -0,0 +1,106 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `Vec` + --> src\types.rs:1:50 + | +1 | use soroban_sdk::{Address, String, contracttype, Vec}; + | ^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `ReviewAction`, `ReviewEventData`, and `VerificationStatus` + --> src\lib.rs:18:33 + | +18 | FeeConfig, Project, Review, ReviewAction, ReviewEventData, VerificationRecord, + | ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ +19 | VerificationStatus, ProjectRegistrationParams, ProjectUpdateParams + | ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:3:5 + | +3 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::types::VerificationStatus` + --> src\test.rs:4:5 + | +4 | use crate::types::VerificationStatus; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:8:58 + | +8 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +error[E0308]: mismatched types + --> src\lib.rs:71:9 + | +70 | ) -> Result<(), ContractError> { + | ------------------------- expected `std::result::Result<(), ContractError>` because of return type +71 | ReviewRegistry::add_review(&env, project_id, reviewer, rating, comment_cid) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result<(), ContractError>`, found `()` + | + = note: expected enum `std::result::Result<(), ContractError>` + found unit type `()` +help: try adding an expression at the end of the block + | +71 ~ ReviewRegistry::add_review(&env, project_id, reviewer, rating, comment_cid); +72 + Ok(()) + | + +error[E0308]: mismatched types + --> src\lib.rs:81:9 + | +80 | ) -> Result<(), ContractError> { + | ------------------------- expected `std::result::Result<(), ContractError>` because of return type +81 | ReviewRegistry::update_review(&env, project_id, reviewer, rating, comment_cid) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result<(), ContractError>`, found `()` + | + = note: expected enum `std::result::Result<(), ContractError>` + found unit type `()` +help: try adding an expression at the end of the block + | +81 ~ ReviewRegistry::update_review(&env, project_id, reviewer, rating, comment_cid); +82 + Ok(()) + | + +error[E0599]: no function or associated item named `list_reviews` found for struct `ReviewRegistry` in the current scope + --> src\lib.rs:93:25 + | + 93 | ReviewRegistry::list_reviews(&env, project_id, start_id, limit) + | ^^^^^^^^^^^^ function or associated item not found in `ReviewRegistry` + | + ::: src\review_registry.rs:10:1 + | + 10 | pub struct ReviewRegistry; + | ------------------------- function or associated item `list_reviews` not found for this struct + | +help: there is an associated function `get_review` with a similar name + --> src\review_registry.rs:150:5 + | +150 | pub fn get_review(env: &Env, project_id: u64, reviewer: Address) -> Option { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: mismatched types + --> src\lib.rs:132:9 + | +131 | pub fn get_fee_config(env: Env) -> FeeConfig { + | --------- expected `FeeConfig` because of return type +132 | FeeManager::get_fee_config(&env) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `FeeConfig`, found `Result` + | + = note: expected struct `FeeConfig` + found enum `std::result::Result` +help: consider using `Result::expect` to unwrap the `std::result::Result` value, panicking if the value is a `Result::Err` + | +132 | FeeManager::get_fee_config(&env).expect("REASON") + | +++++++++++++++++ + +Some errors have detailed explanations: E0308, E0599. +For more information about an error, try `rustc --explain E0308`. +warning: `dongle-contract` (lib) generated 2 warnings +error: could not compile `dongle-contract` (lib) due to 4 previous errors; 2 warnings emitted +warning: build failed, waiting for other jobs to finish... +warning: `dongle-contract` (lib test) generated 5 warnings (2 duplicates) +error: could not compile `dongle-contract` (lib test) due to 4 previous errors; 5 warnings emitted diff --git a/dongle-smartcontract/test_results_v17.txt b/dongle-smartcontract/test_results_v17.txt new file mode 100644 index 0000000..ac38ffd --- /dev/null +++ b/dongle-smartcontract/test_results_v17.txt @@ -0,0 +1,50 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `Vec` + --> src\types.rs:1:50 + | +1 | use soroban_sdk::{Address, String, contracttype, Vec}; + | ^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:3:5 + | +3 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::types::VerificationStatus` + --> src\test.rs:4:5 + | +4 | use crate::types::VerificationStatus; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:8:58 + | +8 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +error[E0599]: no variant or associated item named `DuplicateReview` found for enum `ContractError` in the current scope + --> src\review_registry.rs:29:39 + | +29 | return Err(ContractError::DuplicateReview); + | ^^^^^^^^^^^^^^^ variant or associated item not found in `ContractError` + | + ::: src\errors.rs:7:1 + | + 7 | pub enum ContractError { + | ---------------------- variant or associated item `DuplicateReview` not found for this enum + +error[E0599]: no method named `unwrap` found for unit type `()` in the current scope + --> src\review_registry.rs:299:83 + | +299 | client.add_review(&project_id, &reviewer, &5, &Some(comment_cid.clone())).unwrap(); + | ^^^^^^ method not found in `()` + +For more information about this error, try `rustc --explain E0599`. +warning: `dongle-contract` (lib) generated 1 warning +error: could not compile `dongle-contract` (lib) due to 1 previous error; 1 warning emitted +warning: build failed, waiting for other jobs to finish... +warning: `dongle-contract` (lib test) generated 4 warnings (1 duplicate) +error: could not compile `dongle-contract` (lib test) due to 2 previous errors; 4 warnings emitted diff --git a/dongle-smartcontract/test_results_v18.txt b/dongle-smartcontract/test_results_v18.txt new file mode 100644 index 0000000..f5e4bd8 --- /dev/null +++ b/dongle-smartcontract/test_results_v18.txt @@ -0,0 +1,63 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `Vec` + --> src\types.rs:1:50 + | +1 | use soroban_sdk::{Address, String, contracttype, Vec}; + | ^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:3:5 + | +3 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::types::VerificationStatus` + --> src\test.rs:4:5 + | +4 | use crate::types::VerificationStatus; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:8:58 + | +8 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +warning: `dongle-contract` (lib test) generated 4 warnings (1 duplicate) (run `cargo fix --lib -p dongle-contract --tests` to apply 3 suggestions) +warning: `dongle-contract` (lib) generated 1 warning (run `cargo fix --lib -p dongle-contract` to apply 1 suggestion) + Finished `test` profile [unoptimized + debuginfo] target(s) in 18.82s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 21 tests +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test test::test_get_project_invalid_id_zero ... ok +test test::test_get_project_none_for_nonexistent_id ... ok +test registration_tests::test_register_project_success ... ok +test test::test_register_project_success ... ok +test review_registry::test::test_add_review_event ... ok +test registration_tests::test_register_duplicate_project_fails ... ok +test registration_tests::test_register_different_projects_success ... ok +test verification_tests::test::test_reject_verification ... ok +test verification_tests::test::test_verification_lifecycle ... ok +test test::test_list_projects ... ok + +test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.68s + + Doc-tests dongle_contract + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + diff --git a/dongle-smartcontract/test_results_v19.txt b/dongle-smartcontract/test_results_v19.txt new file mode 100644 index 0000000..e91cfc1 --- /dev/null +++ b/dongle-smartcontract/test_results_v19.txt @@ -0,0 +1,35 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) + Finished `test` profile [unoptimized + debuginfo] target(s) in 8.36s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 21 tests +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test test::test_get_project_invalid_id_zero ... ok +test test::test_get_project_none_for_nonexistent_id ... ok +test registration_tests::test_register_project_success ... ok +test test::test_register_project_success ... ok +test registration_tests::test_register_duplicate_project_fails ... ok +test review_registry::test::test_add_review_event ... ok +test registration_tests::test_register_different_projects_success ... ok +test verification_tests::test::test_reject_verification ... ok +test verification_tests::test::test_verification_lifecycle ... ok +test test::test_list_projects ... ok + +test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.60s + + Doc-tests dongle_contract + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + diff --git a/dongle-smartcontract/test_results_v2.txt b/dongle-smartcontract/test_results_v2.txt new file mode 100644 index 0000000..fbc3c18 --- /dev/null +++ b/dongle-smartcontract/test_results_v2.txt @@ -0,0 +1,84 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error[E0425]: cannot find type `ContractError` in this scope + --> src\lib.rs:43:22 + | +43 | ) -> Result { + | ^^^^^^^^^^^^^ not found in this scope + | +help: consider importing this enum + | +20 + use crate::errors::ContractError; + | + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:5:5 + | +5 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `DataKey` + --> src\verification_registry.rs:8:20 + | +8 | use crate::types::{DataKey, VerificationRecord, VerificationStatus}; + | ^^^^^^^ + +warning: unused import: `crate::constants::MAX_PROJECTS_PER_USER` + --> src\test.rs:3:5 + | +3 | use crate::constants::MAX_PROJECTS_PER_USER; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:4:5 + | +4 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `FeeConfig` and `VerificationStatus` + --> src\test.rs:5:20 + | +5 | use crate::types::{FeeConfig, VerificationStatus}; + | ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:9:58 + | +9 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +warning: unused variable: `env` + --> src\verification_registry.rs:15:9 + | +15 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:16:9 + | +16 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:17:9 + | +17 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:18:9 + | +18 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +For more information about this error, try `rustc --explain E0425`. +warning: `dongle-contract` (lib) generated 6 warnings +error: could not compile `dongle-contract` (lib) due to 1 previous error; 6 warnings emitted +warning: build failed, waiting for other jobs to finish... +warning: `dongle-contract` (lib test) generated 10 warnings (6 duplicates) +error: could not compile `dongle-contract` (lib test) due to 1 previous error; 10 warnings emitted diff --git a/dongle-smartcontract/test_results_v3.txt b/dongle-smartcontract/test_results_v3.txt new file mode 100644 index 0000000..02aab93 --- /dev/null +++ b/dongle-smartcontract/test_results_v3.txt @@ -0,0 +1,95 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error[E0432]: unresolved import `crate::types::DataKey` + --> src\utils.rs:2:5 + | +2 | use crate::types::DataKey; + | ^^^^^^^^^^^^^^^^^^^^^ no `DataKey` in `types` + +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::storage_keys::StorageKey` + --> src\verification_registry.rs:10:5 + | +10 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::constants::MAX_PROJECTS_PER_USER` + --> src\test.rs:3:5 + | +3 | use crate::constants::MAX_PROJECTS_PER_USER; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:4:5 + | +4 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `FeeConfig` and `VerificationStatus` + --> src\test.rs:5:20 + | +5 | use crate::types::{FeeConfig, VerificationStatus}; + | ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:9:58 + | +9 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:126:13 + | +126 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:17:9 + | +17 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:18:9 + | +18 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:19:9 + | +19 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:20:9 + | +20 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +For more information about this error, try `rustc --explain E0432`. +warning: `dongle-contract` (lib) generated 8 warnings +error: could not compile `dongle-contract` (lib) due to 1 previous error; 8 warnings emitted +warning: build failed, waiting for other jobs to finish... +warning: `dongle-contract` (lib test) generated 12 warnings (8 duplicates) +error: could not compile `dongle-contract` (lib test) due to 1 previous error; 12 warnings emitted diff --git a/dongle-smartcontract/test_results_v4.txt b/dongle-smartcontract/test_results_v4.txt new file mode 100644 index 0000000..e1351d2 --- /dev/null +++ b/dongle-smartcontract/test_results_v4.txt @@ -0,0 +1,385 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::storage_keys::StorageKey` + --> src\verification_registry.rs:10:5 + | +10 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::constants::MAX_PROJECTS_PER_USER` + --> src\test.rs:3:5 + | +3 | use crate::constants::MAX_PROJECTS_PER_USER; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:4:5 + | +4 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `FeeConfig` and `VerificationStatus` + --> src\test.rs:5:20 + | +5 | use crate::types::{FeeConfig, VerificationStatus}; + | ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:9:58 + | +9 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:126:13 + | +126 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:17:9 + | +17 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:18:9 + | +18 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:19:9 + | +19 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:20:9 + | +20 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +warning: constant `MAX_PROJECTS_PER_USER` is never used + --> src\constants.rs:4:11 + | +4 | pub const MAX_PROJECTS_PER_USER: u32 = 50; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: constant `MIN_STRING_LEN` is never used + --> src\constants.rs:7:11 + | +7 | pub const MIN_STRING_LEN: usize = 1; + | ^^^^^^^^^^^^^^ + +warning: constant `MAX_NAME_LEN` is never used + --> src\constants.rs:10:11 + | +10 | pub const MAX_NAME_LEN: usize = 128; + | ^^^^^^^^^^^^ + +warning: constant `MAX_DESCRIPTION_LEN` is never used + --> src\constants.rs:13:11 + | +13 | pub const MAX_DESCRIPTION_LEN: usize = 2048; + | ^^^^^^^^^^^^^^^^^^^ + +warning: constant `MAX_CATEGORY_LEN` is never used + --> src\constants.rs:16:11 + | +16 | pub const MAX_CATEGORY_LEN: usize = 64; + | ^^^^^^^^^^^^^^^^ + +warning: constant `MAX_WEBSITE_LEN` is never used + --> src\constants.rs:19:11 + | +19 | pub const MAX_WEBSITE_LEN: usize = 256; + | ^^^^^^^^^^^^^^^ + +warning: constant `MAX_CID_LEN` is never used + --> src\constants.rs:22:11 + | +22 | pub const MAX_CID_LEN: usize = 128; + | ^^^^^^^^^^^ + +warning: constant `RATING_MIN` is never used + --> src\constants.rs:25:11 + | +25 | pub const RATING_MIN: u32 = 1; + | ^^^^^^^^^^ + +warning: constant `RATING_MAX` is never used + --> src\constants.rs:26:11 + | +26 | pub const RATING_MAX: u32 = 5; + | ^^^^^^^^^^ + +warning: function `publish_fee_paid_event` is never used + --> src\events.rs:31:8 + | +31 | pub fn publish_fee_paid_event(env: &Env, project_id: u64, amount: u128) { + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: function `publish_verification_requested_event` is never used + --> src\events.rs:45:8 + | +45 | pub fn publish_verification_requested_event(env: &Env, project_id: u64, requester: Address) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: function `publish_verification_approved_event` is never used + --> src\events.rs:52:8 + | +52 | pub fn publish_verification_approved_event(env: &Env, project_id: u64) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: function `publish_verification_rejected_event` is never used + --> src\events.rs:59:8 + | +59 | pub fn publish_verification_rejected_event(env: &Env, project_id: u64) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: associated functions `add_rating` and `update_rating` are never used + --> src\rating_calculator.rs:34:12 + | + 8 | impl RatingCalculator { + | --------------------- associated functions in this implementation +... +34 | pub fn add_rating(current_sum: u64, current_count: u32, new_rating: u32) -> (u64, u32, u32) { + | ^^^^^^^^^^ +... +52 | pub fn update_rating( + | ^^^^^^^^^^^^^ + +warning: associated function `get_reviews_by_user` is never used + --> src\review_registry.rs:155:12 + | + 12 | impl ReviewRegistry { + | ------------------- associated function in this implementation +... +155 | pub fn get_reviews_by_user( + | ^^^^^^^^^^^^^^^^^^^ + +warning: struct `Utils` is never constructed + --> src\utils.rs:5:12 + | +5 | pub struct Utils; + | ^^^^^ + +warning: multiple associated functions are never used + --> src\utils.rs:8:12 + | + 7 | impl Utils { + | ---------- associated functions in this implementation + 8 | pub fn get_current_timestamp(_env: &Env) -> u64 { + | ^^^^^^^^^^^^^^^^^^^^^ +... +12 | pub fn is_admin(_env: &Env, _address: &Address) -> bool { + | ^^^^^^^^ +... +16 | pub fn add_admin( + | ^^^^^^^^^ +... +24 | pub fn remove_admin( + | ^^^^^^^^^^^^ +... +32 | pub fn validate_string_length( + | ^^^^^^^^^^^^^^^^^^^^^^ +... +51 | pub fn is_valid_ipfs_cid(cid: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +56 | pub fn is_valid_url(_url: &String) -> bool { + | ^^^^^^^^^^^^ +... +60 | pub fn get_storage_key(storage_key: StorageKey) -> StorageKey { + | ^^^^^^^^^^^^^^^ +... +64 | pub fn sanitize_string(input: &String) -> String { + | ^^^^^^^^^^^^^^^ +... +68 | pub fn is_valid_category(_category: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +72 | pub fn create_event_data(_event_type: &str, _data: &str) -> String { + | ^^^^^^^^^^^^^^^^^ +... +76 | pub fn validate_pagination(_start_id: u64, limit: u32) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^ + +warning: associated functions `list_pending_verifications`, `verification_exists`, `get_verification_status`, `update_verification_evidence`, `validate_evidence_cid`, and `get_verification_stats` are never used + --> src\verification_registry.rs:50:12 + | +15 | impl VerificationRegistry { + | ------------------------- associated functions in this implementation +... +50 | pub fn list_pending_verifications( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +59 | pub fn verification_exists(_env: &Env, _project_id: u64) -> bool { + | ^^^^^^^^^^^^^^^^^^^ +... +63 | pub fn get_verification_status( + | ^^^^^^^^^^^^^^^^^^^^^^^ +... +70 | pub fn update_verification_evidence( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +79 | pub fn validate_evidence_cid(evidence_cid: &String) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^^^ +... +86 | pub fn get_verification_stats(_env: &Env) -> (u32, u32, u32) { + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: hiding a lifetime that's elided elsewhere is confusing + --> src\test.rs:11:15 + | +11 | fn setup(env: &Env) -> (DongleContractClient, Address, Address) { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here + | | + | the lifetime is elided here + | + = help: the same lifetime is referred to in inconsistent ways, making the signature confusing + = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default +help: use `'_` for type paths + | +11 | fn setup(env: &Env) -> (DongleContractClient<'_>, Address, Address) { + | ++++ + +warning: hiding a lifetime that's elided elsewhere is confusing + --> src\registration_tests.rs:6:15 + | +6 | fn setup(env: &Env) -> (DongleContractClient, Address) { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here + | | + | the lifetime is elided here + | + = help: the same lifetime is referred to in inconsistent ways, making the signature confusing +help: use `'_` for type paths + | +6 | fn setup(env: &Env) -> (DongleContractClient<'_>, Address) { + | ++++ + +warning: `dongle-contract` (lib test) generated 31 warnings (25 duplicates) (run `cargo fix --lib -p dongle-contract --tests` to apply 6 suggestions) +warning: `dongle-contract` (lib) generated 26 warnings (run `cargo fix --lib -p dongle-contract` to apply 8 suggestions) + Finished `test` profile [unoptimized + debuginfo] target(s) in 13.18s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 19 tests +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test test::test_get_project_invalid_id_zero ... ok +test test::test_get_project_none_for_nonexistent_id ... ok +test registration_tests::test_register_project_success ... ok +test test::test_register_project_success ... ok +test review_registry::test::test_add_review_event ... ok +test registration_tests::test_register_duplicate_project_fails ... ok +test registration_tests::test_register_different_projects_success ... ok +test test::test_list_projects ... FAILED + +failures: + +---- test::test_list_projects stdout ---- + +thread 'test::test_list_projects' (24480) panicked at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:768:9: +HostError: Error(Contract, #3) + +Event log (newest first): + 0: [Diagnostic Event] topics:[error, Error(Contract, #3)], data:"escalating error to panic" + 1: [Diagnostic Event] topics:[error, Error(Contract, #3)], data:["contract call failed", register_project, [CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M, "Project", "Description that is long enough to pass validation definitely more than two hundred characters... Description that is long enough to pass validation definitely more than two hundred characters...", "Category", Void, Void, Void]] + 2: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, topics:[error, Error(Contract, #3)], data:"escalating Ok(ScErrorType::Contract) frame-exit to Err" + 3: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, topics:[fn_return, register_project], data:Error(Contract, #3) + 4: [Diagnostic Event] topics:[fn_call, Bytes(0000000000000000000000000000000000000000000000000000000000000001), register_project], data:[CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M, "Project", "Description that is long enough to pass validation definitely more than two hundred characters... Description that is long enough to pass validation definitely more than two hundred characters...", "Category", Void, Void, Void] + 5: [Diagnostic Event] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, topics:[fn_return, register_project], data:1 + 6: [Diagnostic Event] topics:[fn_call, Bytes(0000000000000000000000000000000000000000000000000000000000000001), register_project], data:[CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M, "Project", "Description that is long enough to pass validation definitely more than two hundred characters... Description that is long enough to pass validation definitely more than two hundred characters...", "Category", Void, Void, Void] + +Backtrace (newest first): + 0: backtrace::backtrace::win64::trace + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\win64.rs:85 + backtrace::backtrace::trace_unsynchronized + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\mod.rs:66 + 1: backtrace::backtrace::trace + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\backtrace\mod.rs:53 + 2: backtrace::capture::Backtrace::create + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\capture.rs:294 + 3: backtrace::capture::Backtrace::new_unresolved + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\backtrace-0.3.76\src\capture.rs:289 + 4: soroban_env_host::host::error::impl$10::maybe_get_debug_info::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:293 + 5: soroban_env_host::budget::Budget::with_shadow_mode,soroban_env_host::host::error::impl$10::maybe_get_debug_info::closure_env$0> + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\budget.rs:972 + 6: soroban_env_host::host::Host::with_debug_mode + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:615 + 7: soroban_env_host::host::Host::maybe_get_debug_info + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:290 + 8: soroban_env_host::host::error::impl$10::error::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:274 + 9: soroban_env_host::budget::Budget::with_shadow_mode,soroban_env_host::host::error::impl$10::error::closure_env$0> + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\budget.rs:972 + 10: soroban_env_host::host::Host::with_debug_mode + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:615 + 11: soroban_env_host::host::Host::error + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host\error.rs:261 + 12: soroban_env_host::host::impl$4::escalate_error_to_panic + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-env-host-21.2.1\src\host.rs:767 + 13: soroban_sdk::env::internal::reject_err::closure$0 + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:52 + 14: enum2$ >::map_err,soroban_sdk::env::internal::reject_err::cl + at /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c\library\core\src\result.rs:968 + 15: soroban_sdk::env::internal::reject_err + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:52 + 16: soroban_sdk::env::impl$20::call + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:1667 + 17: soroban_sdk::env::Env::invoke_contract + at C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\soroban-sdk-21.7.7\src\env.rs:379 + 18: dongle_contract::DongleContractClient::register_project + at src\lib.rs:31 + 19: dongle_contract::test::test_list_projects + at src\test.rs:437 + 20: dongle_contract::test::test_list_projects::closure$0 + at src\test.rs:430 + 21: core::ops::function::FnOnce::call_once > + at /rustc/254b59607d4417e9dffbc307138ae5c86280fe4c\library\core\src\ops\function.rs:250 + + +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +Writing test snapshot file for test "test::test_list_projects" to "test_snapshots\\test\\test_list_projects.1.json". + + +failures: + test::test_list_projects + +test result: FAILED. 18 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.83s + +error: test failed, to rerun pass `--lib` diff --git a/dongle-smartcontract/test_results_v5.txt b/dongle-smartcontract/test_results_v5.txt new file mode 100644 index 0000000..c2742af --- /dev/null +++ b/dongle-smartcontract/test_results_v5.txt @@ -0,0 +1,264 @@ +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::storage_keys::StorageKey` + --> src\verification_registry.rs:10:5 + | +10 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:126:13 + | +126 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:17:9 + | +17 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:18:9 + | +18 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:19:9 + | +19 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:20:9 + | +20 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +warning: constant `MAX_PROJECTS_PER_USER` is never used + --> src\constants.rs:4:11 + | +4 | pub const MAX_PROJECTS_PER_USER: u32 = 50; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: constant `MIN_STRING_LEN` is never used + --> src\constants.rs:7:11 + | +7 | pub const MIN_STRING_LEN: usize = 1; + | ^^^^^^^^^^^^^^ + +warning: constant `MAX_NAME_LEN` is never used + --> src\constants.rs:10:11 + | +10 | pub const MAX_NAME_LEN: usize = 128; + | ^^^^^^^^^^^^ + +warning: constant `MAX_DESCRIPTION_LEN` is never used + --> src\constants.rs:13:11 + | +13 | pub const MAX_DESCRIPTION_LEN: usize = 2048; + | ^^^^^^^^^^^^^^^^^^^ + +warning: constant `MAX_CATEGORY_LEN` is never used + --> src\constants.rs:16:11 + | +16 | pub const MAX_CATEGORY_LEN: usize = 64; + | ^^^^^^^^^^^^^^^^ + +warning: constant `MAX_WEBSITE_LEN` is never used + --> src\constants.rs:19:11 + | +19 | pub const MAX_WEBSITE_LEN: usize = 256; + | ^^^^^^^^^^^^^^^ + +warning: constant `MAX_CID_LEN` is never used + --> src\constants.rs:22:11 + | +22 | pub const MAX_CID_LEN: usize = 128; + | ^^^^^^^^^^^ + +warning: constant `RATING_MIN` is never used + --> src\constants.rs:25:11 + | +25 | pub const RATING_MIN: u32 = 1; + | ^^^^^^^^^^ + +warning: constant `RATING_MAX` is never used + --> src\constants.rs:26:11 + | +26 | pub const RATING_MAX: u32 = 5; + | ^^^^^^^^^^ + +warning: function `publish_fee_paid_event` is never used + --> src\events.rs:31:8 + | +31 | pub fn publish_fee_paid_event(env: &Env, project_id: u64, amount: u128) { + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: function `publish_verification_requested_event` is never used + --> src\events.rs:45:8 + | +45 | pub fn publish_verification_requested_event(env: &Env, project_id: u64, requester: Address) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: function `publish_verification_approved_event` is never used + --> src\events.rs:52:8 + | +52 | pub fn publish_verification_approved_event(env: &Env, project_id: u64) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: function `publish_verification_rejected_event` is never used + --> src\events.rs:59:8 + | +59 | pub fn publish_verification_rejected_event(env: &Env, project_id: u64) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: associated functions `add_rating` and `update_rating` are never used + --> src\rating_calculator.rs:34:12 + | + 8 | impl RatingCalculator { + | --------------------- associated functions in this implementation +... +34 | pub fn add_rating(current_sum: u64, current_count: u32, new_rating: u32) -> (u64, u32, u32) { + | ^^^^^^^^^^ +... +52 | pub fn update_rating( + | ^^^^^^^^^^^^^ + +warning: associated function `get_reviews_by_user` is never used + --> src\review_registry.rs:155:12 + | + 12 | impl ReviewRegistry { + | ------------------- associated function in this implementation +... +155 | pub fn get_reviews_by_user( + | ^^^^^^^^^^^^^^^^^^^ + +warning: struct `Utils` is never constructed + --> src\utils.rs:5:12 + | +5 | pub struct Utils; + | ^^^^^ + +warning: multiple associated functions are never used + --> src\utils.rs:8:12 + | + 7 | impl Utils { + | ---------- associated functions in this implementation + 8 | pub fn get_current_timestamp(_env: &Env) -> u64 { + | ^^^^^^^^^^^^^^^^^^^^^ +... +12 | pub fn is_admin(_env: &Env, _address: &Address) -> bool { + | ^^^^^^^^ +... +16 | pub fn add_admin( + | ^^^^^^^^^ +... +24 | pub fn remove_admin( + | ^^^^^^^^^^^^ +... +32 | pub fn validate_string_length( + | ^^^^^^^^^^^^^^^^^^^^^^ +... +51 | pub fn is_valid_ipfs_cid(cid: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +56 | pub fn is_valid_url(_url: &String) -> bool { + | ^^^^^^^^^^^^ +... +60 | pub fn get_storage_key(storage_key: StorageKey) -> StorageKey { + | ^^^^^^^^^^^^^^^ +... +64 | pub fn sanitize_string(input: &String) -> String { + | ^^^^^^^^^^^^^^^ +... +68 | pub fn is_valid_category(_category: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +72 | pub fn create_event_data(_event_type: &str, _data: &str) -> String { + | ^^^^^^^^^^^^^^^^^ +... +76 | pub fn validate_pagination(_start_id: u64, limit: u32) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^ + +warning: associated functions `list_pending_verifications`, `verification_exists`, `get_verification_status`, `update_verification_evidence`, `validate_evidence_cid`, and `get_verification_stats` are never used + --> src\verification_registry.rs:50:12 + | +15 | impl VerificationRegistry { + | ------------------------- associated functions in this implementation +... +50 | pub fn list_pending_verifications( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +59 | pub fn verification_exists(_env: &Env, _project_id: u64) -> bool { + | ^^^^^^^^^^^^^^^^^^^ +... +63 | pub fn get_verification_status( + | ^^^^^^^^^^^^^^^^^^^^^^^ +... +70 | pub fn update_verification_evidence( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +79 | pub fn validate_evidence_cid(evidence_cid: &String) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^^^ +... +86 | pub fn get_verification_stats(_env: &Env) -> (u32, u32, u32) { + | ^^^^^^^^^^^^^^^^^^^^^^ + + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: `dongle-contract` (lib) generated 26 warnings (run `cargo fix --lib -p dongle-contract` to apply 8 suggestions) +error: cannot find macro `format` in this scope + --> src\test.rs:436:51 + | +436 | let name = SorobanString::from_str(&env, &format!("Project {}", i)); + | ^^^^^^ + +warning: unused import: `crate::constants::MAX_PROJECTS_PER_USER` + --> src\test.rs:3:5 + | +3 | use crate::constants::MAX_PROJECTS_PER_USER; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:4:5 + | +4 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `FeeConfig` and `VerificationStatus` + --> src\test.rs:5:20 + | +5 | use crate::types::{FeeConfig, VerificationStatus}; + | ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:9:58 + | +9 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +warning: `dongle-contract` (lib test) generated 12 warnings (8 duplicates) +error: could not compile `dongle-contract` (lib test) due to 1 previous error; 12 warnings emitted diff --git a/dongle-smartcontract/test_results_v6.txt b/dongle-smartcontract/test_results_v6.txt new file mode 100644 index 0000000..facbda0 --- /dev/null +++ b/dongle-smartcontract/test_results_v6.txt @@ -0,0 +1,318 @@ +warning: unused import: `crate::constants::MAX_CID_LEN` + --> src\verification_registry.rs:3:5 + | +3 | use crate::constants::MAX_CID_LEN; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused imports: `publish_verification_approved_event`, `publish_verification_rejected_event`, and `publish_verification_requested_event` + --> src\verification_registry.rs:6:5 + | +6 | publish_verification_approved_event, publish_verification_rejected_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 | publish_verification_requested_event, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::storage_keys::StorageKey` + --> src\verification_registry.rs:10:5 + | +10 | use crate::storage_keys::StorageKey; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:126:13 + | +126 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `env` + --> src\verification_registry.rs:17:9 + | +17 | env: &Env, + | ^^^ help: if this is intentional, prefix it with an underscore: `_env` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `project_id` + --> src\verification_registry.rs:18:9 + | +18 | project_id: u64, + | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_id` + +warning: unused variable: `requester` + --> src\verification_registry.rs:19:9 + | +19 | requester: Address, + | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_requester` + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:20:9 + | +20 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + +warning: constant `MAX_PROJECTS_PER_USER` is never used + --> src\constants.rs:4:11 + | +4 | pub const MAX_PROJECTS_PER_USER: u32 = 50; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: constant `MIN_STRING_LEN` is never used + --> src\constants.rs:7:11 + | +7 | pub const MIN_STRING_LEN: usize = 1; + | ^^^^^^^^^^^^^^ + +warning: constant `MAX_NAME_LEN` is never used + --> src\constants.rs:10:11 + | +10 | pub const MAX_NAME_LEN: usize = 128; + | ^^^^^^^^^^^^ + +warning: constant `MAX_DESCRIPTION_LEN` is never used + --> src\constants.rs:13:11 + | +13 | pub const MAX_DESCRIPTION_LEN: usize = 2048; + | ^^^^^^^^^^^^^^^^^^^ + +warning: constant `MAX_CATEGORY_LEN` is never used + --> src\constants.rs:16:11 + | +16 | pub const MAX_CATEGORY_LEN: usize = 64; + | ^^^^^^^^^^^^^^^^ + +warning: constant `MAX_WEBSITE_LEN` is never used + --> src\constants.rs:19:11 + | +19 | pub const MAX_WEBSITE_LEN: usize = 256; + | ^^^^^^^^^^^^^^^ + +warning: constant `MAX_CID_LEN` is never used + --> src\constants.rs:22:11 + | +22 | pub const MAX_CID_LEN: usize = 128; + | ^^^^^^^^^^^ + +warning: constant `RATING_MIN` is never used + --> src\constants.rs:25:11 + | +25 | pub const RATING_MIN: u32 = 1; + | ^^^^^^^^^^ + +warning: constant `RATING_MAX` is never used + --> src\constants.rs:26:11 + | +26 | pub const RATING_MAX: u32 = 5; + | ^^^^^^^^^^ + +warning: function `publish_fee_paid_event` is never used + --> src\events.rs:31:8 + | +31 | pub fn publish_fee_paid_event(env: &Env, project_id: u64, amount: u128) { + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: function `publish_verification_requested_event` is never used + --> src\events.rs:45:8 + | +45 | pub fn publish_verification_requested_event(env: &Env, project_id: u64, requester: Address) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: function `publish_verification_approved_event` is never used + --> src\events.rs:52:8 + | +52 | pub fn publish_verification_approved_event(env: &Env, project_id: u64) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: function `publish_verification_rejected_event` is never used + --> src\events.rs:59:8 + | +59 | pub fn publish_verification_rejected_event(env: &Env, project_id: u64) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: associated functions `add_rating` and `update_rating` are never used + --> src\rating_calculator.rs:34:12 + | + 8 | impl RatingCalculator { + | --------------------- associated functions in this implementation +... +34 | pub fn add_rating(current_sum: u64, current_count: u32, new_rating: u32) -> (u64, u32, u32) { + | ^^^^^^^^^^ +... +52 | pub fn update_rating( + | ^^^^^^^^^^^^^ + +warning: associated function `get_reviews_by_user` is never used + --> src\review_registry.rs:155:12 + | + 12 | impl ReviewRegistry { + | ------------------- associated function in this implementation +... +155 | pub fn get_reviews_by_user( + | ^^^^^^^^^^^^^^^^^^^ + +warning: struct `Utils` is never constructed + --> src\utils.rs:5:12 + | +5 | pub struct Utils; + | ^^^^^ + +warning: multiple associated functions are never used + --> src\utils.rs:8:12 + | + 7 | impl Utils { + | ---------- associated functions in this implementation + 8 | pub fn get_current_timestamp(_env: &Env) -> u64 { + | ^^^^^^^^^^^^^^^^^^^^^ +... +12 | pub fn is_admin(_env: &Env, _address: &Address) -> bool { + | ^^^^^^^^ +... +16 | pub fn add_admin( + | ^^^^^^^^^ +... +24 | pub fn remove_admin( + | ^^^^^^^^^^^^ +... +32 | pub fn validate_string_length( + | ^^^^^^^^^^^^^^^^^^^^^^ +... +51 | pub fn is_valid_ipfs_cid(cid: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +56 | pub fn is_valid_url(_url: &String) -> bool { + | ^^^^^^^^^^^^ +... +60 | pub fn get_storage_key(storage_key: StorageKey) -> StorageKey { + | ^^^^^^^^^^^^^^^ +... +64 | pub fn sanitize_string(input: &String) -> String { + | ^^^^^^^^^^^^^^^ +... +68 | pub fn is_valid_category(_category: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +72 | pub fn create_event_data(_event_type: &str, _data: &str) -> String { + | ^^^^^^^^^^^^^^^^^ +... +76 | pub fn validate_pagination(_start_id: u64, limit: u32) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^ + +warning: associated functions `list_pending_verifications`, `verification_exists`, `get_verification_status`, `update_verification_evidence`, `validate_evidence_cid`, and `get_verification_stats` are never used + --> src\verification_registry.rs:50:12 + | +15 | impl VerificationRegistry { + | ------------------------- associated functions in this implementation +... +50 | pub fn list_pending_verifications( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +59 | pub fn verification_exists(_env: &Env, _project_id: u64) -> bool { + | ^^^^^^^^^^^^^^^^^^^ +... +63 | pub fn get_verification_status( + | ^^^^^^^^^^^^^^^^^^^^^^^ +... +70 | pub fn update_verification_evidence( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +79 | pub fn validate_evidence_cid(evidence_cid: &String) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^^^ +... +86 | pub fn get_verification_stats(_env: &Env) -> (u32, u32, u32) { + | ^^^^^^^^^^^^^^^^^^^^^^ + + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: `dongle-contract` (lib) generated 26 warnings (run `cargo fix --lib -p dongle-contract` to apply 8 suggestions) +warning: unused import: `crate::constants::MAX_PROJECTS_PER_USER` + --> src\test.rs:3:5 + | +3 | use crate::constants::MAX_PROJECTS_PER_USER; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:4:5 + | +4 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `FeeConfig` and `VerificationStatus` + --> src\test.rs:5:20 + | +5 | use crate::types::{FeeConfig, VerificationStatus}; + | ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:9:58 + | +9 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +warning: hiding a lifetime that's elided elsewhere is confusing + --> src\test.rs:11:15 + | +11 | fn setup(env: &Env) -> (DongleContractClient, Address, Address) { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here + | | + | the lifetime is elided here + | + = help: the same lifetime is referred to in inconsistent ways, making the signature confusing + = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default +help: use `'_` for type paths + | +11 | fn setup(env: &Env) -> (DongleContractClient<'_>, Address, Address) { + | ++++ + +warning: hiding a lifetime that's elided elsewhere is confusing + --> src\registration_tests.rs:6:15 + | +6 | fn setup(env: &Env) -> (DongleContractClient, Address) { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here + | | + | the lifetime is elided here + | + = help: the same lifetime is referred to in inconsistent ways, making the signature confusing +help: use `'_` for type paths + | +6 | fn setup(env: &Env) -> (DongleContractClient<'_>, Address) { + | ++++ + +warning: `dongle-contract` (lib test) generated 31 warnings (25 duplicates) (run `cargo fix --lib -p dongle-contract --tests` to apply 6 suggestions) + Finished `test` profile [unoptimized + debuginfo] target(s) in 3.82s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 19 tests +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test test::test_get_project_invalid_id_zero ... ok +test test::test_get_project_none_for_nonexistent_id ... ok +test registration_tests::test_register_project_success ... ok +test registration_tests::test_register_duplicate_project_fails ... ok +test registration_tests::test_register_different_projects_success ... ok +test test::test_register_project_success ... ok +test review_registry::test::test_add_review_event ... ok +test test::test_list_projects ... ok + +test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.48s + + Doc-tests dongle_contract + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + diff --git a/dongle-smartcontract/test_results_v7.txt b/dongle-smartcontract/test_results_v7.txt new file mode 100644 index 0000000..159475c --- /dev/null +++ b/dongle-smartcontract/test_results_v7.txt @@ -0,0 +1,21 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +error: unknown start of token: \ + --> src\verification_registry.rs:164:15 + | +164 | todo!(\"Verification evidence update logic not implemented\") + | ^ + +error[E0765]: unterminated double quote string + --> src\verification_registry.rs:164:16 + | +164 | todo!(\"Verification evidence update logic not implemented\") + | ________________^ +165 | | } +166 | | +167 | | pub fn validate_evidence_cid(evidence_cid: &String) -> Result<(), ContractError> { +... | +177 | | } + | |__^ + +For more information about this error, try `rustc --explain E0765`. +error: could not compile `dongle-contract` (lib test) due to 2 previous errors diff --git a/dongle-smartcontract/test_results_v8.txt b/dongle-smartcontract/test_results_v8.txt new file mode 100644 index 0000000..17048f3 --- /dev/null +++ b/dongle-smartcontract/test_results_v8.txt @@ -0,0 +1,78 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `Project` + --> src\verification_registry.rs:8:20 + | +8 | use crate::types::{Project, VerificationRecord, VerificationStatus}; + | ^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::constants::MAX_PROJECTS_PER_USER` + --> src\test.rs:3:5 + | +3 | use crate::constants::MAX_PROJECTS_PER_USER; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:4:5 + | +4 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `FeeConfig` and `VerificationStatus` + --> src\test.rs:5:20 + | +5 | use crate::types::{FeeConfig, VerificationStatus}; + | ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:9:58 + | +9 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +error[E0308]: mismatched types + --> src\lib.rs:131:9 + | +131 | VerificationRegistry::request_verification(&env, project_id, requester, evidence_cid) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), ContractError>` + | + = note: expected unit type `()` + found enum `core::result::Result<(), ContractError>` +help: consider using a semicolon here + | +131 | VerificationRegistry::request_verification(&env, project_id, requester, evidence_cid); + | + +help: try adding a return type + | +130 | ) -> core::result::Result<(), ContractError> { + | ++++++++++++++++++++++++++++++++++++++++++ +help: consider using `Result::expect` to unwrap the `core::result::Result<(), ContractError>` value, panicking if the value is a `Result::Err` + | +131 | VerificationRegistry::request_verification(&env, project_id, requester, evidence_cid).expect("REASON") + | +++++++++++++++++ + +warning: variable does not need to be mutable + --> src\review_registry.rs:126:13 + | +126 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: unused variable: `evidence_cid` + --> src\verification_registry.rs:21:9 + | +21 | evidence_cid: String, + | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_evidence_cid` + | + = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default + +For more information about this error, try `rustc --explain E0308`. +warning: `dongle-contract` (lib) generated 3 warnings (1 duplicate) +error: could not compile `dongle-contract` (lib) due to 1 previous error; 3 warnings emitted +warning: build failed, waiting for other jobs to finish... +warning: `dongle-contract` (lib test) generated 7 warnings (2 duplicates) +error: could not compile `dongle-contract` (lib test) due to 1 previous error; 7 warnings emitted diff --git a/dongle-smartcontract/test_results_v9.txt b/dongle-smartcontract/test_results_v9.txt new file mode 100644 index 0000000..ee5171f --- /dev/null +++ b/dongle-smartcontract/test_results_v9.txt @@ -0,0 +1,254 @@ + Compiling dongle-contract v0.1.0 (C:\Users\user\Dongle-Smartcontract\dongle-smartcontract) +warning: unused import: `Project` + --> src\verification_registry.rs:8:20 + | +8 | use crate::types::{Project, VerificationRecord, VerificationStatus}; + | ^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: unused import: `crate::constants::MAX_PROJECTS_PER_USER` + --> src\test.rs:3:5 + | +3 | use crate::constants::MAX_PROJECTS_PER_USER; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `crate::errors::ContractError as Error` + --> src\test.rs:4:5 + | +4 | use crate::errors::ContractError as Error; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `FeeConfig` and `VerificationStatus` + --> src\test.rs:5:20 + | +5 | use crate::types::{FeeConfig, VerificationStatus}; + | ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Vec` + --> src\test.rs:9:58 + | +9 | use soroban_sdk::{Address, Env, String as SorobanString, Vec}; + | ^^^ + +warning: variable does not need to be mutable + --> src\review_registry.rs:126:13 + | +126 | let mut user_reviews: soroban_sdk::Vec = env + | ----^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: constant `MAX_PROJECTS_PER_USER` is never used + --> src\constants.rs:4:11 + | +4 | pub const MAX_PROJECTS_PER_USER: u32 = 50; + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: constant `MIN_STRING_LEN` is never used + --> src\constants.rs:7:11 + | +7 | pub const MIN_STRING_LEN: usize = 1; + | ^^^^^^^^^^^^^^ + +warning: constant `MAX_NAME_LEN` is never used + --> src\constants.rs:10:11 + | +10 | pub const MAX_NAME_LEN: usize = 128; + | ^^^^^^^^^^^^ + +warning: constant `MAX_DESCRIPTION_LEN` is never used + --> src\constants.rs:13:11 + | +13 | pub const MAX_DESCRIPTION_LEN: usize = 2048; + | ^^^^^^^^^^^^^^^^^^^ + +warning: constant `MAX_CATEGORY_LEN` is never used + --> src\constants.rs:16:11 + | +16 | pub const MAX_CATEGORY_LEN: usize = 64; + | ^^^^^^^^^^^^^^^^ + +warning: constant `MAX_WEBSITE_LEN` is never used + --> src\constants.rs:19:11 + | +19 | pub const MAX_WEBSITE_LEN: usize = 256; + | ^^^^^^^^^^^^^^^ + +warning: constant `MAX_CID_LEN` is never used + --> src\constants.rs:22:11 + | +22 | pub const MAX_CID_LEN: usize = 128; + | ^^^^^^^^^^^ + +warning: constant `RATING_MIN` is never used + --> src\constants.rs:25:11 + | +25 | pub const RATING_MIN: u32 = 1; + | ^^^^^^^^^^ + +warning: constant `RATING_MAX` is never used + --> src\constants.rs:26:11 + | +26 | pub const RATING_MAX: u32 = 5; + | ^^^^^^^^^^ + +warning: associated function `set_treasury` is never used + --> src\fee_manager.rs:77:12 + | +11 | impl FeeManager { + | --------------- associated function in this implementation +... +77 | pub fn set_treasury( + | ^^^^^^^^^^^^ + +warning: associated function `get_reviews_by_user` is never used + --> src\review_registry.rs:155:12 + | + 12 | impl ReviewRegistry { + | ------------------- associated function in this implementation +... +155 | pub fn get_reviews_by_user( + | ^^^^^^^^^^^^^^^^^^^ + +warning: struct `Utils` is never constructed + --> src\utils.rs:5:12 + | +5 | pub struct Utils; + | ^^^^^ + +warning: associated functions `add_rating` and `update_rating` are never used + --> src\rating_calculator.rs:34:12 + | + 8 | impl RatingCalculator { + | --------------------- associated functions in this implementation +... +34 | pub fn add_rating(current_sum: u64, current_count: u32, new_rating: u32) -> (u64, u32, u32) { + | ^^^^^^^^^^ +... +52 | pub fn update_rating( + | ^^^^^^^^^^^^^ + +warning: multiple associated functions are never used + --> src\utils.rs:8:12 + | + 7 | impl Utils { + | ---------- associated functions in this implementation + 8 | pub fn get_current_timestamp(env: &Env) -> u64 { + | ^^^^^^^^^^^^^^^^^^^^^ +... +12 | pub fn is_admin(env: &Env, address: &Address) -> bool { + | ^^^^^^^^ +... +20 | pub fn require_admin(env: &Env, address: &Address) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^ +... +27 | pub fn validate_string_length( + | ^^^^^^^^^^^^^^^^^^^^^^ +... +42 | pub fn is_valid_ipfs_cid(cid: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +47 | pub fn is_valid_url(_url: &String) -> bool { + | ^^^^^^^^^^^^ +... +51 | pub fn sanitize_string(input: &String) -> String { + | ^^^^^^^^^^^^^^^ +... +55 | pub fn is_valid_category(_category: &String) -> bool { + | ^^^^^^^^^^^^^^^^^ +... +59 | pub fn validate_pagination(_start_id: u64, limit: u32) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^ + +warning: associated functions `list_pending_verifications`, `verification_exists`, `get_verification_status`, `update_verification_evidence`, `validate_evidence_cid`, and `get_verification_stats` are never used + --> src\verification_registry.rs:121:12 + | + 16 | impl VerificationRegistry { + | ------------------------- associated functions in this implementation +... +121 | pub fn list_pending_verifications( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +146 | pub fn verification_exists(env: &Env, project_id: u64) -> bool { + | ^^^^^^^^^^^^^^^^^^^ +... +150 | pub fn get_verification_status( + | ^^^^^^^^^^^^^^^^^^^^^^^ +... +158 | pub fn update_verification_evidence( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +167 | pub fn validate_evidence_cid(evidence_cid: &String) -> Result<(), ContractError> { + | ^^^^^^^^^^^^^^^^^^^^^ +... +174 | pub fn get_verification_stats(_env: &Env) -> (u32, u32, u32) { + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: hiding a lifetime that's elided elsewhere is confusing + --> src\test.rs:11:15 + | +11 | fn setup(env: &Env) -> (DongleContractClient, Address, Address) { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here + | | + | the lifetime is elided here + | + = help: the same lifetime is referred to in inconsistent ways, making the signature confusing + = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default +help: use `'_` for type paths + | +11 | fn setup(env: &Env) -> (DongleContractClient<'_>, Address, Address) { + | ++++ + +warning: hiding a lifetime that's elided elsewhere is confusing + --> src\registration_tests.rs:6:15 + | +6 | fn setup(env: &Env) -> (DongleContractClient, Address) { + | ^^^^ ^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here + | | + | the lifetime is elided here + | + = help: the same lifetime is referred to in inconsistent ways, making the signature confusing +help: use `'_` for type paths + | +6 | fn setup(env: &Env) -> (DongleContractClient<'_>, Address) { + | ++++ + +warning: `dongle-contract` (lib test) generated 22 warnings (1 duplicate) (run `cargo fix --lib -p dongle-contract --tests` to apply 7 suggestions) +warning: `dongle-contract` (lib) generated 17 warnings (15 duplicates) (run `cargo fix --lib -p dongle-contract` to apply 1 suggestion) + Finished `test` profile [unoptimized + debuginfo] target(s) in 9.43s + Running unittests src\lib.rs (target\debug\deps\dongle_contract-a300b76b9d4a7117.exe) + +running 19 tests +test rating_calculator::tests::test_add_rating_subsequent_review ... ok +test rating_calculator::tests::test_add_rating_first_review ... ok +test rating_calculator::tests::test_calculate_average_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_precision ... ok +test rating_calculator::tests::test_calculate_average_single_review ... ok +test rating_calculator::tests::test_remove_rating_multiple_reviews ... ok +test rating_calculator::tests::test_calculate_average_zero_reviews ... ok +test rating_calculator::tests::test_remove_rating_last_review ... ok +test rating_calculator::tests::test_update_rating_decrease ... ok +test rating_calculator::tests::test_update_rating_increase ... ok +test rating_calculator::tests::test_update_rating_no_change ... ok +test test::test_get_project_invalid_id_zero ... ok +test test::test_get_project_none_for_nonexistent_id ... ok +test registration_tests::test_register_project_success ... ok +test registration_tests::test_register_duplicate_project_fails ... ok +test test::test_register_project_success ... ok +test review_registry::test::test_add_review_event ... ok +test registration_tests::test_register_different_projects_success ... ok +test test::test_list_projects ... ok + +test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.43s + + Doc-tests dongle_contract + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + diff --git a/dongle-smartcontract/test_snapshots/review_registry/test/test_add_review_event.1.json b/dongle-smartcontract/test_snapshots/review_registry/test/test_add_review_event.1.json index 0fddc67..8938406 100644 --- a/dongle-smartcontract/test_snapshots/review_registry/test/test_add_review_event.1.json +++ b/dongle-smartcontract/test_snapshots/review_registry/test/test_add_review_event.1.json @@ -4,7 +4,6 @@ "nonce": 0 }, "auth": [ - [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -12,23 +11,81 @@ "function": { "contract_fn": { "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", - "function_name": "register_project", + "function_name": "initialize", "args": [ { "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "string": "Test Project" - }, - { - "string": "A description that is long enough for validation." - }, + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "function_name": "register_project", + "args": [ { - "string": "DeFi" - }, - "void", - "void", - "void" + "map": [ + { + "key": { + "symbol": "category" + }, + "val": { + "string": "DeFi" + } + }, + { + "key": { + "symbol": "description" + }, + "val": { + "string": "A description that is long enough for validation." + } + }, + { + "key": { + "symbol": "logo_cid" + }, + "val": "void" + }, + { + "key": { + "symbol": "metadata_cid" + }, + "val": "void" + }, + { + "key": { + "symbol": "name" + }, + "val": { + "string": "Test Project" + } + }, + { + "key": { + "symbol": "owner" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "website" + }, + "val": "void" + } + ] + } ] } }, @@ -81,7 +138,7 @@ "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", "key": { "ledger_key_nonce": { - "nonce": 5541220902715666415 + "nonce": 1033654523790656264 } }, "durability": "temporary" @@ -96,7 +153,7 @@ "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", "key": { "ledger_key_nonce": { - "nonce": 5541220902715666415 + "nonce": 1033654523790656264 } }, "durability": "temporary", @@ -141,6 +198,39 @@ 6311999 ] ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], [ { "contract_data": { @@ -149,9 +239,6 @@ "vec": [ { "symbol": "Admin" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" } ] }, @@ -169,14 +256,13 @@ "vec": [ { "symbol": "Admin" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" } ] }, "durability": "persistent", - "val": "void" + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } } }, "ext": "v0" @@ -365,6 +451,51 @@ 4095 ] ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "vec": [ + { + "symbol": "ProjectByName" + }, + { + "string": "Test Project" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "vec": [ + { + "symbol": "ProjectByName" + }, + { + "string": "Test Project" + } + ] + }, + "durability": "persistent", + "val": { + "u64": 1 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], [ { "contract_data": { @@ -404,6 +535,125 @@ 4095 ] ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "vec": [ + { + "symbol": "ProjectReviews" + }, + { + "u64": 1 + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "vec": [ + { + "symbol": "ProjectReviews" + }, + { + "u64": 1 + } + ] + }, + "durability": "persistent", + "val": { + "vec": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "vec": [ + { + "symbol": "ProjectStats" + }, + { + "u64": 1 + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "vec": [ + { + "symbol": "ProjectStats" + }, + { + "u64": 1 + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "average_rating" + }, + "val": { + "u32": 500 + } + }, + { + "key": { + "symbol": "rating_sum" + }, + "val": { + "u64": 500 + } + }, + { + "key": { + "symbol": "review_count" + }, + "val": { + "u32": 1 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], [ { "contract_data": { @@ -455,14 +705,6 @@ "string": "QmHash" } }, - { - "key": { - "symbol": "is_deleted" - }, - "val": { - "bool": false - } - }, { "key": { "symbol": "project_id" @@ -675,22 +917,57 @@ } ], "data": { - "vec": [ + "map": [ { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + "key": { + "symbol": "category" + }, + "val": { + "string": "DeFi" + } }, { - "string": "Test Project" + "key": { + "symbol": "description" + }, + "val": { + "string": "A description that is long enough for validation." + } }, { - "string": "A description that is long enough for validation." + "key": { + "symbol": "logo_cid" + }, + "val": "void" + }, + { + "key": { + "symbol": "metadata_cid" + }, + "val": "void" }, { - "string": "DeFi" + "key": { + "symbol": "name" + }, + "val": { + "string": "Test Project" + } }, - "void", - "void", - "void" + { + "key": { + "symbol": "owner" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + } + }, + { + "key": { + "symbol": "website" + }, + "val": "void" + } ] } } diff --git a/dongle-smartcontract/test_snapshots/review_registry/test/test_delete_review_event.1.json b/dongle-smartcontract/test_snapshots/review_registry/test/test_delete_review_event.1.json index 92bd3b7..98a424d 100644 --- a/dongle-smartcontract/test_snapshots/review_registry/test/test_delete_review_event.1.json +++ b/dongle-smartcontract/test_snapshots/review_registry/test/test_delete_review_event.1.json @@ -16,6 +16,117 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "UserReviews" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "UserReviews" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + }, + "durability": "persistent", + "val": { + "vec": [] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], [ { "contract_data": { diff --git a/dongle-smartcontract/test_snapshots/review_registry/test/test_update_review_event.1.json b/dongle-smartcontract/test_snapshots/review_registry/test/test_update_review_event.1.json index 85747d9..7891419 100644 --- a/dongle-smartcontract/test_snapshots/review_registry/test/test_update_review_event.1.json +++ b/dongle-smartcontract/test_snapshots/review_registry/test/test_update_review_event.1.json @@ -16,6 +16,213 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": 5541220902715666415 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Review" + }, + { + "u64": 1 + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Review" + }, + { + "u64": 1 + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "comment_cid" + }, + "val": { + "string": "QmHash2" + } + }, + { + "key": { + "symbol": "project_id" + }, + "val": { + "u64": 1 + } + }, + { + "key": { + "symbol": "rating" + }, + "val": { + "u32": 4 + } + }, + { + "key": { + "symbol": "reviewer" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "symbol": "timestamp" + }, + "val": { + "u64": 0 + } + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "UserReviews" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "UserReviews" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + }, + "durability": "persistent", + "val": { + "vec": [ + { + "u64": 1 + } + ] + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], [ { "contract_data": {