From 0a129c587fd9a1d5957f282c7e3352f5f751b26b Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 15 Nov 2023 14:50:21 +0100 Subject: [PATCH 01/13] feat(dataverse): add triple store config to instantiate msg --- Cargo.lock | 4 +--- Cargo.toml | 1 + contracts/okp4-dataverse/Cargo.toml | 4 +--- contracts/okp4-dataverse/src/msg.rs | 18 +++++++++++++++++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9936f1e1..571cafaa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -760,9 +760,7 @@ dependencies = [ "cw-utils 1.0.2", "cw2 1.1.1", "itertools 0.12.0", - "okp4-logic-bindings", - "okp4-objectarium", - "okp4-objectarium-client", + "okp4-cognitarium", "schemars", "serde", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 0af3bd30..694c577f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ cw-utils = "1.0.2" cw2 = "1.1.1" okp4-logic-bindings = { path = "packages/okp4-logic-bindings" } okp4-objectarium = { path = "contracts/okp4-objectarium" } +okp4-cognitarium = { path = "contracts/okp4-cognitarium" } okp4-objectarium-client = { path = "packages/okp4-objectarium-client" } schemars = "0.8.16" serde = { version = "1.0.192", default-features = false, features = ["derive"] } diff --git a/contracts/okp4-dataverse/Cargo.toml b/contracts/okp4-dataverse/Cargo.toml index 9abdf1a1..89a752c2 100644 --- a/contracts/okp4-dataverse/Cargo.toml +++ b/contracts/okp4-dataverse/Cargo.toml @@ -35,9 +35,7 @@ cw-storage-plus.workspace = true cw-utils.workspace = true cw2.workspace = true itertools = "0.12.0" -okp4-logic-bindings.workspace = true -okp4-objectarium-client.workspace = true -okp4-objectarium.workspace = true +okp4-cognitarium.workspace = true schemars.workspace = true serde.workspace = true thiserror.workspace = true diff --git a/contracts/okp4-dataverse/src/msg.rs b/contracts/okp4-dataverse/src/msg.rs index bbdc6314..227b9c29 100644 --- a/contracts/okp4-dataverse/src/msg.rs +++ b/contracts/okp4-dataverse/src/msg.rs @@ -1,11 +1,14 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; -use cosmwasm_std::Binary; +use cosmwasm_std::{Binary, Uint64}; /// `InstantiateMsg` is used to initialize a new instance of the dataverse. #[cw_serde] pub struct InstantiateMsg { /// A unique name to identify the dataverse instance. pub name: String, + + /// The configuration used to instantiate the triple store. + pub triplestore_config: TripleStoreConfig, } /// `ExecuteMsg` defines the set of possible actions that can be performed on the dataverse. @@ -120,6 +123,19 @@ pub enum ExecuteMsg { }, } +/// # TripleStoreConfig +/// `TripleStoreConfig` represents the configuration related to the management of the triple store. +#[cw_serde] +pub struct TripleStoreConfig { + /// The code id that will be used to instantiate the triple store contract in which + /// to store dataverse semantic data. It must implement the cognitarium interface. + pub code_id: Uint64, + + /// Limitations regarding triple store usage. + #[serde(default = "okp4_cognitarium::msg::StoreLimitsInput::default")] + pub limits: okp4_cognitarium::msg::StoreLimitsInput, +} + /// # RdfFormat /// `RdfFormat` represents the various serialization formats for RDF (Resource Description Framework) data. #[cw_serde] From b3de77902d665823c0ed6d0ff7e29d20d52bd810 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 15 Nov 2023 15:07:31 +0100 Subject: [PATCH 02/13] build: enable cosmwasm_1_2 features --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 694c577f..7b4496fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["contracts/*", "packages/*"] [workspace.dependencies] cosmwasm-schema = "1.5.0" -cosmwasm-std = "1.5.0" +cosmwasm-std = { version = "1.5.0", features = ["cosmwasm_1_2"] } cosmwasm-storage = "1.4.1" cw-multi-test = "0.15.1" cw-storage-plus = "1.2.0" From 490e0e49bec7ff3f531ef118194272f5d3a2086f Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:37:39 +0100 Subject: [PATCH 03/13] build: specify library feature to imported contracts when linking a contract to another we may encounter C symbol duplication caused by the export of contract's entrypoints, we avoid that this way. --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7b4496fa..1f149fb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,8 @@ cw-storage-plus = "1.2.0" cw-utils = "1.0.2" cw2 = "1.1.1" okp4-logic-bindings = { path = "packages/okp4-logic-bindings" } -okp4-objectarium = { path = "contracts/okp4-objectarium" } -okp4-cognitarium = { path = "contracts/okp4-cognitarium" } +okp4-objectarium = { path = "contracts/okp4-objectarium", features = ["library"] } +okp4-cognitarium = { path = "contracts/okp4-cognitarium", features = ["library"] } okp4-objectarium-client = { path = "packages/okp4-objectarium-client" } schemars = "0.8.16" serde = { version = "1.0.192", default-features = false, features = ["derive"] } From 1c05850dd8c1f87b8680ce19c7e8c24b1a497999 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:40:07 +0100 Subject: [PATCH 04/13] feat(dataverse): add basic internal state --- contracts/okp4-dataverse/src/state.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contracts/okp4-dataverse/src/state.rs b/contracts/okp4-dataverse/src/state.rs index 8b137891..b27549b1 100644 --- a/contracts/okp4-dataverse/src/state.rs +++ b/contracts/okp4-dataverse/src/state.rs @@ -1 +1,10 @@ +use cw_storage_plus::Item; +use serde::{Deserialize, Serialize}; +pub const DATAVERSE: Item<'_, Dataverse> = Item::new("dataverse"); + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] +pub struct Dataverse { + pub name: String, + pub triplestore_address: String, +} From f5fade26c110a71c82831207f5e38a618f76b457 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:40:30 +0100 Subject: [PATCH 05/13] feat(dataverse): implement instantiate msg --- contracts/okp4-dataverse/src/contract.rs | 41 +++++++++++++++++++++--- contracts/okp4-dataverse/src/error.rs | 5 ++- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/contracts/okp4-dataverse/src/contract.rs b/contracts/okp4-dataverse/src/contract.rs index f4dc328a..6289e123 100644 --- a/contracts/okp4-dataverse/src/contract.rs +++ b/contracts/okp4-dataverse/src/contract.rs @@ -1,10 +1,14 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; -use cosmwasm_std::{Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult}; +use cosmwasm_std::{ + instantiate2_address, to_binary, Binary, CodeInfoResponse, Deps, DepsMut, Env, MessageInfo, + Response, StdError, StdResult, WasmMsg, +}; use cw2::set_contract_version; use crate::error::ContractError; use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; +use crate::state::{Dataverse, DATAVERSE}; // version info for migration info const CONTRACT_NAME: &str = concat!("crates.io:", env!("CARGO_PKG_NAME")); @@ -13,13 +17,42 @@ const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( deps: DepsMut<'_>, - _env: Env, + env: Env, _info: MessageInfo, - _msg: InstantiateMsg, + msg: InstantiateMsg, ) -> Result { set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - Err(StdError::generic_err("Not implemented").into()) + let creator = deps.api.addr_canonicalize(env.contract.address.as_str())?; + let CodeInfoResponse { checksum, .. } = deps + .querier + .query_wasm_code_info(msg.triplestore_config.code_id.u64())?; + let salt = Binary::from(msg.name.as_bytes()); + + let triplestore_address = deps + .api + .addr_humanize(&instantiate2_address(&checksum, &creator, &salt)?)?; + + DATAVERSE.save( + deps.storage, + &Dataverse { + name: msg.name.clone(), + triplestore_address: triplestore_address.to_string(), + }, + )?; + + Ok(Response::new() + .add_attribute("triplestore_address", triplestore_address) + .add_message(WasmMsg::Instantiate2 { + admin: Some(env.contract.address.to_string()), + code_id: msg.triplestore_config.code_id.u64(), + label: format!("{}_triplestore", msg.name), + msg: to_binary(&okp4_cognitarium::msg::InstantiateMsg { + limits: msg.triplestore_config.limits, + })?, + funds: vec![], + salt, + })) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/okp4-dataverse/src/error.rs b/contracts/okp4-dataverse/src/error.rs index 7155f592..21651b09 100644 --- a/contracts/okp4-dataverse/src/error.rs +++ b/contracts/okp4-dataverse/src/error.rs @@ -1,8 +1,11 @@ -use cosmwasm_std::StdError; +use cosmwasm_std::{Instantiate2AddressError, StdError}; use thiserror::Error; #[derive(Error, Debug, PartialEq)] pub enum ContractError { #[error("{0}")] Std(#[from] StdError), + + #[error("{0}")] + Instantiate2Address(#[from] Instantiate2AddressError), } From 3d9d514905607d160849688606f86f7983dc6ad3 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 15 Nov 2023 20:56:47 +0100 Subject: [PATCH 06/13] test(dataverse): add instantiate tests --- contracts/okp4-dataverse/src/contract.rs | 85 ++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 4 deletions(-) diff --git a/contracts/okp4-dataverse/src/contract.rs b/contracts/okp4-dataverse/src/contract.rs index 6289e123..82e17894 100644 --- a/contracts/okp4-dataverse/src/contract.rs +++ b/contracts/okp4-dataverse/src/contract.rs @@ -29,9 +29,17 @@ pub fn instantiate( .query_wasm_code_info(msg.triplestore_config.code_id.u64())?; let salt = Binary::from(msg.name.as_bytes()); - let triplestore_address = deps - .api - .addr_humanize(&instantiate2_address(&checksum, &creator, &salt)?)?; + /// Necessary stuff for testing purposes, see: https://github.com/CosmWasm/cosmwasm/issues/1648 + #[allow(unused)] + let triplestore_address = instantiate2_address(&checksum, &creator, &salt)?; + let triplestore_address = { + #[cfg(not(test))] + { + deps.api.addr_humanize(&triplestore_address)? + } + #[cfg(test)] + cosmwasm_std::Addr::unchecked("predicted address") + }; DATAVERSE.save( deps.storage, @@ -75,4 +83,73 @@ pub fn query(_deps: Deps<'_>, _env: Env, _msg: QueryMsg) -> StdResult { pub mod query {} #[cfg(test)] -mod tests {} +mod tests { + use super::*; + use crate::msg::TripleStoreConfig; + use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info}; + use cosmwasm_std::{ + Attribute, ContractResult, HexBinary, SubMsg, SystemError, SystemResult, Uint128, Uint64, + WasmQuery, + }; + use okp4_cognitarium::msg::StoreLimitsInputBuilder; + + #[test] + fn proper_instantiate() { + let mut deps = mock_dependencies(); + deps.querier.update_wasm(|query| match query { + WasmQuery::CodeInfo { code_id, .. } => { + let resp = CodeInfoResponse::new( + code_id.clone(), + "creator".to_string(), + HexBinary::from_hex( + "3B94AAF0B7D804B5B458DED0D20CACF95D2A1C8DF78ED3C89B61291760454AEC", + ) + .unwrap(), + ); + SystemResult::Ok(ContractResult::Ok(to_binary(&resp).unwrap())) + } + _ => SystemResult::Err(SystemError::Unknown {}), + }); + + let store_limits = StoreLimitsInputBuilder::default() + .max_byte_size(Uint128::from(50000u128)) + .build() + .unwrap(); + + let msg = InstantiateMsg { + name: "my-dataverse".to_string(), + triplestore_config: TripleStoreConfig { + code_id: Uint64::from(17u64), + limits: store_limits.clone(), + }, + }; + + let res = instantiate(deps.as_mut(), mock_env(), mock_info("creator", &[]), msg).unwrap(); + + assert_eq!( + res.attributes, + vec![Attribute::new("triplestore_address", "predicted address")] + ); + assert_eq!( + res.messages, + vec![SubMsg::new(WasmMsg::Instantiate2 { + admin: Some("cosmos2contract".to_string()), + code_id: 17, + label: "my-dataverse_triplestore".to_string(), + msg: to_binary(&okp4_cognitarium::msg::InstantiateMsg { + limits: store_limits, + }) + .unwrap(), + funds: vec![], + salt: Binary::from("my-dataverse".as_bytes()), + })] + ); + assert_eq!( + DATAVERSE.load(&deps.storage).unwrap(), + Dataverse { + name: "my-dataverse".to_string(), + triplestore_address: "predicted address".to_string(), + } + ) + } +} From 561c673e8929b7a4f34d53c600f83fb751b01cf5 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:00:35 +0100 Subject: [PATCH 07/13] docs(dataverse): update generated documentation --- contracts/okp4-dataverse/src/msg.rs | 6 +-- docs/okp4-dataverse.md | 65 +++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/contracts/okp4-dataverse/src/msg.rs b/contracts/okp4-dataverse/src/msg.rs index 227b9c29..66cef449 100644 --- a/contracts/okp4-dataverse/src/msg.rs +++ b/contracts/okp4-dataverse/src/msg.rs @@ -58,19 +58,19 @@ pub enum ExecuteMsg { /// Preconditions: /// - The identity must be unique within the dataverse. identity: Did, - /// The URI that identifies the dataset. + /// The URI that identifies the resource. /// This URI makes sense only in the context of the service that provides the resource. /// /// Preconditions: /// - The URI must be unique within the dataverse. identifier: Uri, - /// The URI of the service, already registered in the dataverse, that provides the dataset. + /// The URI of the service, already registered in the dataverse, that provides the resource. /// /// Preconditions: /// - The Service must be registered in the dataverse before the resource can be registered. provided_by: Uri, /// The URI of the entity responsible for registering and managing the resource in the dataverse (i.e. on the blockchain). - /// It's an optional field, if not provided the dataset is registered by the entity that invokes the transaction. + /// It's an optional field, if not provided the resource is registered by the entity that invokes the transaction. registrar: Option, }, diff --git a/docs/okp4-dataverse.md b/docs/okp4-dataverse.md index 373382e5..40cad173 100644 --- a/docs/okp4-dataverse.md +++ b/docs/okp4-dataverse.md @@ -50,6 +50,9 @@ Given its role and status, this smart contract serves as the primary access poin |parameter|description| |----------|-----------| |`name`|*(Required.) * **string**. A unique name to identify the dataverse instance.| +|`triplestore_config`|*(Required.) * **[TripleStoreConfig](#triplestoreconfig)**. The configuration used to instantiate the triple store.| +|`triplestore_config.code_id`|**[Uint64](#uint64)**. The code id that will be used to instantiate the triple store contract in which to store dataverse semantic data. It must implement the cognitarium interface.| +|`triplestore_config.limits`|**[StoreLimitsInput](#storelimitsinput)**. Limitations regarding triple store usage.
**Default:** `{"max_byte_size":"340282366920938463463374607431768211455","max_insert_data_byte_size":"340282366920938463463374607431768211455","max_insert_data_triple_count":"340282366920938463463374607431768211455","max_query_limit":30,"max_query_variable_count":30,"max_triple_byte_size":"340282366920938463463374607431768211455","max_triple_count":"340282366920938463463374607431768211455"}`| ## ExecuteMsg @@ -83,10 +86,10 @@ The unique identification of each Digital Resource is achieved through a combina |parameter|description| |----------|-----------| |`register_digital_resource`|*(Required.) * **object**. | -|`register_digital_resource.identifier`|*(Required.) * **string**. The URI that identifies the dataset. This URI makes sense only in the context of the service that provides the resource.

Preconditions: - The URI must be unique within the dataverse.| +|`register_digital_resource.identifier`|*(Required.) * **string**. The URI that identifies the resource. This URI makes sense only in the context of the service that provides the resource.

Preconditions: - The URI must be unique within the dataverse.| |`register_digital_resource.identity`|*(Required.) * **string**. The decentralized identity (DID) of the Digital Resource.

Preconditions: - The identity must be unique within the dataverse.| -|`register_digital_resource.provided_by`|*(Required.) * **string**. The URI of the service, already registered in the dataverse, that provides the dataset.

Preconditions: - The Service must be registered in the dataverse before the resource can be registered.| -|`register_digital_resource.registrar`|**string\|null**. The URI of the entity responsible for registering and managing the resource in the dataverse (i.e. on the blockchain). It's an optional field, if not provided the dataset is registered by the entity that invokes the transaction.| +|`register_digital_resource.provided_by`|*(Required.) * **string**. The URI of the service, already registered in the dataverse, that provides the resource.

Preconditions: - The Service must be registered in the dataverse before the resource can be registered.| +|`register_digital_resource.registrar`|**string\|null**. The URI of the entity responsible for registering and managing the resource in the dataverse (i.e. on the blockchain). It's an optional field, if not provided the resource is registered by the entity that invokes the transaction.| ### ExecuteMsg::FoundZone @@ -202,6 +205,36 @@ RDF/XML is a syntax to express RDF information in XML. See the [official RDF/XML |-------| |`"rdf_xml"`| +### StoreLimitsInput + +Contains requested limitations regarding store usages. + +|property|description| +|----------|-----------| +|`max_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes the store can contain. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`max_insert_data_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes an insert data query can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`max_insert_data_triple_count`|**[Uint128](#uint128)**. The maximum number of triples an insert data query can contain (after parsing). Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`max_query_limit`|**integer**. The maximum limit of a query, i.e. the maximum number of triples returned by a select query. Default to 30 if not set.| +|`max_query_variable_count`|**integer**. The maximum number of variables a query can select. Default to 30 if not set.| +|`max_triple_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes the store can contain for a single triple. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. The limit is used to prevent storing very large triples, especially literals. Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`max_triple_count`|**[Uint128](#uint128)**. The maximum number of triples the store can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.| + +### TripleStoreConfig + +`TripleStoreConfig` represents the configuration related to the management of the triple store. + +|property|description| +|----------|-----------| +|`code_id`|*(Required.) * **[Uint64](#uint64)**. The code id that will be used to instantiate the triple store contract in which to store dataverse semantic data. It must implement the cognitarium interface.| +|`limits`|**[StoreLimitsInput](#storelimitsinput)**. Limitations regarding triple store usage.| +|`limits.max_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes the store can contain. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. Default to [Uint128::MAX] if not set, which can be considered as no limit.
**Default:** `"340282366920938463463374607431768211455"`| +|`limits.max_insert_data_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes an insert data query can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.
**Default:** `"340282366920938463463374607431768211455"`| +|`limits.max_insert_data_triple_count`|**[Uint128](#uint128)**. The maximum number of triples an insert data query can contain (after parsing). Default to [Uint128::MAX] if not set, which can be considered as no limit.
**Default:** `"340282366920938463463374607431768211455"`| +|`limits.max_query_limit`|**integer**. The maximum limit of a query, i.e. the maximum number of triples returned by a select query. Default to 30 if not set.
**Default:** `30`| +|`limits.max_query_variable_count`|**integer**. The maximum number of variables a query can select. Default to 30 if not set.
**Default:** `30`| +|`limits.max_triple_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes the store can contain for a single triple. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. The limit is used to prevent storing very large triples, especially literals. Default to [Uint128::MAX] if not set, which can be considered as no limit.
**Default:** `"340282366920938463463374607431768211455"`| +|`limits.max_triple_count`|**[Uint128](#uint128)**. The maximum number of triples the store can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.
**Default:** `"340282366920938463463374607431768211455"`| + ### Turtle Turtle (Terse RDF Triple Language) Format @@ -212,6 +245,30 @@ Turtle is a textual format for representing RDF triples in a more compact and hu |-------| |`"turtle"`| +### Uint128 + +A string containing a 128-bit integer in decimal representation. + +|type| +|----| +|**string**.| + +### Uint64 + +A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq. + +# Examples + +Use `from` to create instances of this and `u64` to get the value out: + +``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42); + +let b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ``` + +|type| +|----| +|**string**.| + --- -*Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-dataverse.json` (`7dba583f9d24fda1`)* \ No newline at end of file +*Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-dataverse.json` (`bee536f5330fd1e5`)* \ No newline at end of file From 2e4560ca54ac8997113b3b41ebd0d239f75506d2 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:12:35 +0100 Subject: [PATCH 08/13] style: little coup de polish --- Cargo.toml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1f149fb4..008c96a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,9 +9,13 @@ cw-multi-test = "0.15.1" cw-storage-plus = "1.2.0" cw-utils = "1.0.2" cw2 = "1.1.1" +okp4-cognitarium = { path = "contracts/okp4-cognitarium", features = [ + "library", +] } okp4-logic-bindings = { path = "packages/okp4-logic-bindings" } -okp4-objectarium = { path = "contracts/okp4-objectarium", features = ["library"] } -okp4-cognitarium = { path = "contracts/okp4-cognitarium", features = ["library"] } +okp4-objectarium = { path = "contracts/okp4-objectarium", features = [ + "library", +] } okp4-objectarium-client = { path = "packages/okp4-objectarium-client" } schemars = "0.8.16" serde = { version = "1.0.192", default-features = false, features = ["derive"] } From 0b0c6354fae8d1a0bc675fec1fbc62cf1b10173e Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:46:49 +0100 Subject: [PATCH 09/13] build: avoid a single wasm compilation for all contracts --- Makefile.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.toml b/Makefile.toml index 100ac589..4a8fcd38 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -59,6 +59,7 @@ rustup target add wasm32-unknown-unknown [tasks.wasm] args = [ + "hack", "build", "--release", "--lib", @@ -67,7 +68,7 @@ args = [ "--locked", ] command = "cargo" -dependencies = ["install-wasm"] +dependencies = ["install-wasm", "install-cargo-hack"] env = { RUSTFLAGS = "-C link-arg=-s" } [tasks.schema] @@ -537,6 +538,9 @@ if ! [ -x "$(command -v ffizer)" ]; then fi ''' +[tasks.install-cargo-hack] +install_crate = { crate_name = "cargo-hack" } + [config] default_to_workspace = false min_version = "0.36.3" From 0498747ba0dfcd91e5781b07db8fcf17068bdc31 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:59:58 +0100 Subject: [PATCH 10/13] ci(lint): add dataverse contract under size limit --- .size-limit.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.size-limit.json b/.size-limit.json index 1908e3eb..432302a5 100644 --- a/.size-limit.json +++ b/.size-limit.json @@ -16,5 +16,11 @@ "running": false, "brotli": false, "gzip": false + }, + { + "path": "target/wasm32-unknown-unknown/release/okp4_dataverse.wasm", + "running": false, + "brotli": false, + "gzip": false } ] From c142976a035348f1bc32758c316d1b3848a835d7 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Thu, 16 Nov 2023 10:00:50 +0100 Subject: [PATCH 11/13] feat(dataverse): dissociate triple store msg limits struct --- contracts/okp4-dataverse/src/contract.rs | 15 +++--- contracts/okp4-dataverse/src/msg.rs | 67 ++++++++++++++++++++++-- docs/okp4-dataverse.md | 44 ++++++++-------- 3 files changed, 93 insertions(+), 33 deletions(-) diff --git a/contracts/okp4-dataverse/src/contract.rs b/contracts/okp4-dataverse/src/contract.rs index 82e17894..923eb7a7 100644 --- a/contracts/okp4-dataverse/src/contract.rs +++ b/contracts/okp4-dataverse/src/contract.rs @@ -56,7 +56,7 @@ pub fn instantiate( code_id: msg.triplestore_config.code_id.u64(), label: format!("{}_triplestore", msg.name), msg: to_binary(&okp4_cognitarium::msg::InstantiateMsg { - limits: msg.triplestore_config.limits, + limits: msg.triplestore_config.limits.into(), })?, funds: vec![], salt, @@ -85,13 +85,12 @@ pub mod query {} #[cfg(test)] mod tests { use super::*; - use crate::msg::TripleStoreConfig; + use crate::msg::{TripleStoreConfig, TripleStoreLimitsInput}; use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info}; use cosmwasm_std::{ Attribute, ContractResult, HexBinary, SubMsg, SystemError, SystemResult, Uint128, Uint64, WasmQuery, }; - use okp4_cognitarium::msg::StoreLimitsInputBuilder; #[test] fn proper_instantiate() { @@ -111,10 +110,10 @@ mod tests { _ => SystemResult::Err(SystemError::Unknown {}), }); - let store_limits = StoreLimitsInputBuilder::default() - .max_byte_size(Uint128::from(50000u128)) - .build() - .unwrap(); + let store_limits = TripleStoreLimitsInput { + max_byte_size: Some(Uint128::from(50000u128)), + ..Default::default() + }; let msg = InstantiateMsg { name: "my-dataverse".to_string(), @@ -137,7 +136,7 @@ mod tests { code_id: 17, label: "my-dataverse_triplestore".to_string(), msg: to_binary(&okp4_cognitarium::msg::InstantiateMsg { - limits: store_limits, + limits: store_limits.into(), }) .unwrap(), funds: vec![], diff --git a/contracts/okp4-dataverse/src/msg.rs b/contracts/okp4-dataverse/src/msg.rs index 66cef449..a69eade5 100644 --- a/contracts/okp4-dataverse/src/msg.rs +++ b/contracts/okp4-dataverse/src/msg.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; -use cosmwasm_std::{Binary, Uint64}; +use cosmwasm_std::{Binary, Uint128, Uint64}; /// `InstantiateMsg` is used to initialize a new instance of the dataverse. #[cw_serde] @@ -132,8 +132,69 @@ pub struct TripleStoreConfig { pub code_id: Uint64, /// Limitations regarding triple store usage. - #[serde(default = "okp4_cognitarium::msg::StoreLimitsInput::default")] - pub limits: okp4_cognitarium::msg::StoreLimitsInput, + pub limits: TripleStoreLimitsInput, +} + +/// # TripleStoreLimitsInput +/// Contains requested limitations regarding store usages. +#[cw_serde] +#[derive(Default)] +pub struct TripleStoreLimitsInput { + /// The maximum number of triples the store can contain. + /// Default to [Uint128::MAX] if not set, which can be considered as no limit. + pub max_triple_count: Option, + /// The maximum number of bytes the store can contain. + /// The size of a triple is counted as the sum of the size of its subject, predicate and object, + /// including the size of data types and language tags if any. + /// Default to [Uint128::MAX] if not set, which can be considered as no limit. + pub max_byte_size: Option, + /// The maximum number of bytes the store can contain for a single triple. + /// The size of a triple is counted as the sum of the size of its subject, predicate and object, + /// including the size of data types and language tags if any. The limit is used to prevent + /// storing very large triples, especially literals. + /// Default to [Uint128::MAX] if not set, which can be considered as no limit. + pub max_triple_byte_size: Option, + /// The maximum limit of a query, i.e. the maximum number of triples returned by a select query. + /// Default to 30 if not set. + pub max_query_limit: Option, + /// The maximum number of variables a query can select. + /// Default to 30 if not set. + pub max_query_variable_count: Option, + /// The maximum number of bytes an insert data query can contain. + /// Default to [Uint128::MAX] if not set, which can be considered as no limit. + pub max_insert_data_byte_size: Option, + /// The maximum number of triples an insert data query can contain (after parsing). + /// Default to [Uint128::MAX] if not set, which can be considered as no limit. + pub max_insert_data_triple_count: Option, +} + +impl From for okp4_cognitarium::msg::StoreLimitsInput { + fn from(value: TripleStoreLimitsInput) -> Self { + let mut limits = okp4_cognitarium::msg::StoreLimitsInput::default(); + if let Some(max_triple_count) = value.max_triple_count { + limits.max_triple_count = max_triple_count; + } + if let Some(max_byte_size) = value.max_byte_size { + limits.max_byte_size = max_byte_size; + } + if let Some(max_triple_byte_size) = value.max_triple_byte_size { + limits.max_triple_byte_size = max_triple_byte_size; + } + if let Some(max_query_limit) = value.max_query_limit { + limits.max_query_limit = max_query_limit; + } + if let Some(max_query_variable_count) = value.max_query_variable_count { + limits.max_query_variable_count = max_query_variable_count; + } + if let Some(max_insert_data_byte_size) = value.max_insert_data_byte_size { + limits.max_insert_data_byte_size = max_insert_data_byte_size; + } + if let Some(max_insert_data_triple_count) = value.max_insert_data_triple_count { + limits.max_insert_data_triple_count = max_insert_data_triple_count; + } + + limits + } } /// # RdfFormat diff --git a/docs/okp4-dataverse.md b/docs/okp4-dataverse.md index 40cad173..bd3f9da5 100644 --- a/docs/okp4-dataverse.md +++ b/docs/okp4-dataverse.md @@ -52,7 +52,7 @@ Given its role and status, this smart contract serves as the primary access poin |`name`|*(Required.) * **string**. A unique name to identify the dataverse instance.| |`triplestore_config`|*(Required.) * **[TripleStoreConfig](#triplestoreconfig)**. The configuration used to instantiate the triple store.| |`triplestore_config.code_id`|**[Uint64](#uint64)**. The code id that will be used to instantiate the triple store contract in which to store dataverse semantic data. It must implement the cognitarium interface.| -|`triplestore_config.limits`|**[StoreLimitsInput](#storelimitsinput)**. Limitations regarding triple store usage.
**Default:** `{"max_byte_size":"340282366920938463463374607431768211455","max_insert_data_byte_size":"340282366920938463463374607431768211455","max_insert_data_triple_count":"340282366920938463463374607431768211455","max_query_limit":30,"max_query_variable_count":30,"max_triple_byte_size":"340282366920938463463374607431768211455","max_triple_count":"340282366920938463463374607431768211455"}`| +|`triplestore_config.limits`|**[TripleStoreLimitsInput](#triplestorelimitsinput)**. Limitations regarding triple store usage.| ## ExecuteMsg @@ -205,35 +205,35 @@ RDF/XML is a syntax to express RDF information in XML. See the [official RDF/XML |-------| |`"rdf_xml"`| -### StoreLimitsInput +### TripleStoreConfig -Contains requested limitations regarding store usages. +`TripleStoreConfig` represents the configuration related to the management of the triple store. |property|description| |----------|-----------| -|`max_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes the store can contain. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. Default to [Uint128::MAX] if not set, which can be considered as no limit.| -|`max_insert_data_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes an insert data query can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.| -|`max_insert_data_triple_count`|**[Uint128](#uint128)**. The maximum number of triples an insert data query can contain (after parsing). Default to [Uint128::MAX] if not set, which can be considered as no limit.| -|`max_query_limit`|**integer**. The maximum limit of a query, i.e. the maximum number of triples returned by a select query. Default to 30 if not set.| -|`max_query_variable_count`|**integer**. The maximum number of variables a query can select. Default to 30 if not set.| -|`max_triple_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes the store can contain for a single triple. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. The limit is used to prevent storing very large triples, especially literals. Default to [Uint128::MAX] if not set, which can be considered as no limit.| -|`max_triple_count`|**[Uint128](#uint128)**. The maximum number of triples the store can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`code_id`|*(Required.) * **[Uint64](#uint64)**. The code id that will be used to instantiate the triple store contract in which to store dataverse semantic data. It must implement the cognitarium interface.| +|`limits`|*(Required.) * **[TripleStoreLimitsInput](#triplestorelimitsinput)**. Limitations regarding triple store usage.| +|`limits.max_byte_size`|**[Uint128](#uint128)\|null**. The maximum number of bytes the store can contain. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`limits.max_insert_data_byte_size`|**[Uint128](#uint128)\|null**. The maximum number of bytes an insert data query can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`limits.max_insert_data_triple_count`|**[Uint128](#uint128)\|null**. The maximum number of triples an insert data query can contain (after parsing). Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`limits.max_query_limit`|**integer\|null**. The maximum limit of a query, i.e. the maximum number of triples returned by a select query. Default to 30 if not set.| +|`limits.max_query_variable_count`|**integer\|null**. The maximum number of variables a query can select. Default to 30 if not set.| +|`limits.max_triple_byte_size`|**[Uint128](#uint128)\|null**. The maximum number of bytes the store can contain for a single triple. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. The limit is used to prevent storing very large triples, especially literals. Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`limits.max_triple_count`|**[Uint128](#uint128)\|null**. The maximum number of triples the store can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.| -### TripleStoreConfig +### TripleStoreLimitsInput -`TripleStoreConfig` represents the configuration related to the management of the triple store. +Contains requested limitations regarding store usages. |property|description| |----------|-----------| -|`code_id`|*(Required.) * **[Uint64](#uint64)**. The code id that will be used to instantiate the triple store contract in which to store dataverse semantic data. It must implement the cognitarium interface.| -|`limits`|**[StoreLimitsInput](#storelimitsinput)**. Limitations regarding triple store usage.| -|`limits.max_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes the store can contain. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. Default to [Uint128::MAX] if not set, which can be considered as no limit.
**Default:** `"340282366920938463463374607431768211455"`| -|`limits.max_insert_data_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes an insert data query can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.
**Default:** `"340282366920938463463374607431768211455"`| -|`limits.max_insert_data_triple_count`|**[Uint128](#uint128)**. The maximum number of triples an insert data query can contain (after parsing). Default to [Uint128::MAX] if not set, which can be considered as no limit.
**Default:** `"340282366920938463463374607431768211455"`| -|`limits.max_query_limit`|**integer**. The maximum limit of a query, i.e. the maximum number of triples returned by a select query. Default to 30 if not set.
**Default:** `30`| -|`limits.max_query_variable_count`|**integer**. The maximum number of variables a query can select. Default to 30 if not set.
**Default:** `30`| -|`limits.max_triple_byte_size`|**[Uint128](#uint128)**. The maximum number of bytes the store can contain for a single triple. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. The limit is used to prevent storing very large triples, especially literals. Default to [Uint128::MAX] if not set, which can be considered as no limit.
**Default:** `"340282366920938463463374607431768211455"`| -|`limits.max_triple_count`|**[Uint128](#uint128)**. The maximum number of triples the store can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.
**Default:** `"340282366920938463463374607431768211455"`| +|`max_byte_size`|**[Uint128](#uint128)\|null**. The maximum number of bytes the store can contain. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`max_insert_data_byte_size`|**[Uint128](#uint128)\|null**. The maximum number of bytes an insert data query can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`max_insert_data_triple_count`|**[Uint128](#uint128)\|null**. The maximum number of triples an insert data query can contain (after parsing). Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`max_query_limit`|**integer\|null**. The maximum limit of a query, i.e. the maximum number of triples returned by a select query. Default to 30 if not set.| +|`max_query_variable_count`|**integer\|null**. The maximum number of variables a query can select. Default to 30 if not set.| +|`max_triple_byte_size`|**[Uint128](#uint128)\|null**. The maximum number of bytes the store can contain for a single triple. The size of a triple is counted as the sum of the size of its subject, predicate and object, including the size of data types and language tags if any. The limit is used to prevent storing very large triples, especially literals. Default to [Uint128::MAX] if not set, which can be considered as no limit.| +|`max_triple_count`|**[Uint128](#uint128)\|null**. The maximum number of triples the store can contain. Default to [Uint128::MAX] if not set, which can be considered as no limit.| ### Turtle @@ -271,4 +271,4 @@ let b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ``` --- -*Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-dataverse.json` (`bee536f5330fd1e5`)* \ No newline at end of file +*Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-dataverse.json` (`569cd8a4d521dc5f`)* \ No newline at end of file From 31340f21c77d8a2b7ea8d7b9b9099e64ac5d6c31 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Thu, 16 Nov 2023 10:11:26 +0100 Subject: [PATCH 12/13] refactor(dataverse): make compilation happy --- contracts/okp4-dataverse/src/contract.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/contracts/okp4-dataverse/src/contract.rs b/contracts/okp4-dataverse/src/contract.rs index 923eb7a7..bbb1ea1c 100644 --- a/contracts/okp4-dataverse/src/contract.rs +++ b/contracts/okp4-dataverse/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - instantiate2_address, to_binary, Binary, CodeInfoResponse, Deps, DepsMut, Env, MessageInfo, - Response, StdError, StdResult, WasmMsg, + instantiate2_address, to_json_binary, Binary, CodeInfoResponse, Deps, DepsMut, Env, + MessageInfo, Response, StdError, StdResult, WasmMsg, }; use cw2::set_contract_version; @@ -29,9 +29,9 @@ pub fn instantiate( .query_wasm_code_info(msg.triplestore_config.code_id.u64())?; let salt = Binary::from(msg.name.as_bytes()); - /// Necessary stuff for testing purposes, see: https://github.com/CosmWasm/cosmwasm/issues/1648 - #[allow(unused)] let triplestore_address = instantiate2_address(&checksum, &creator, &salt)?; + + // Necessary stuff for testing purposes, see: https://github.com/CosmWasm/cosmwasm/issues/1648 let triplestore_address = { #[cfg(not(test))] { @@ -55,7 +55,7 @@ pub fn instantiate( admin: Some(env.contract.address.to_string()), code_id: msg.triplestore_config.code_id.u64(), label: format!("{}_triplestore", msg.name), - msg: to_binary(&okp4_cognitarium::msg::InstantiateMsg { + msg: to_json_binary(&okp4_cognitarium::msg::InstantiateMsg { limits: msg.triplestore_config.limits.into(), })?, funds: vec![], @@ -105,7 +105,7 @@ mod tests { ) .unwrap(), ); - SystemResult::Ok(ContractResult::Ok(to_binary(&resp).unwrap())) + SystemResult::Ok(ContractResult::Ok(to_json_binary(&resp).unwrap())) } _ => SystemResult::Err(SystemError::Unknown {}), }); @@ -123,7 +123,8 @@ mod tests { }, }; - let res = instantiate(deps.as_mut(), mock_env(), mock_info("creator", &[]), msg).unwrap(); + let env = mock_env(); + let res = instantiate(deps.as_mut(), env.clone(), mock_info("creator", &[]), msg).unwrap(); assert_eq!( res.attributes, @@ -132,10 +133,10 @@ mod tests { assert_eq!( res.messages, vec![SubMsg::new(WasmMsg::Instantiate2 { - admin: Some("cosmos2contract".to_string()), + admin: Some(env.contract.address.to_string()), code_id: 17, label: "my-dataverse_triplestore".to_string(), - msg: to_binary(&okp4_cognitarium::msg::InstantiateMsg { + msg: to_json_binary(&okp4_cognitarium::msg::InstantiateMsg { limits: store_limits.into(), }) .unwrap(), From 89a55eeb39af3a1581d33f27fbff2c6716819ca7 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Thu, 16 Nov 2023 10:17:26 +0100 Subject: [PATCH 13/13] feat(dataverse): use Addr type for triple store state address --- contracts/okp4-dataverse/src/contract.rs | 14 +++++++------- contracts/okp4-dataverse/src/state.rs | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/contracts/okp4-dataverse/src/contract.rs b/contracts/okp4-dataverse/src/contract.rs index bbb1ea1c..d1494d45 100644 --- a/contracts/okp4-dataverse/src/contract.rs +++ b/contracts/okp4-dataverse/src/contract.rs @@ -29,13 +29,13 @@ pub fn instantiate( .query_wasm_code_info(msg.triplestore_config.code_id.u64())?; let salt = Binary::from(msg.name.as_bytes()); - let triplestore_address = instantiate2_address(&checksum, &creator, &salt)?; + let _triplestore_address = instantiate2_address(&checksum, &creator, &salt)?; // Necessary stuff for testing purposes, see: https://github.com/CosmWasm/cosmwasm/issues/1648 let triplestore_address = { #[cfg(not(test))] { - deps.api.addr_humanize(&triplestore_address)? + deps.api.addr_humanize(&_triplestore_address)? } #[cfg(test)] cosmwasm_std::Addr::unchecked("predicted address") @@ -45,12 +45,12 @@ pub fn instantiate( deps.storage, &Dataverse { name: msg.name.clone(), - triplestore_address: triplestore_address.to_string(), + triplestore_address: triplestore_address.clone(), }, )?; Ok(Response::new() - .add_attribute("triplestore_address", triplestore_address) + .add_attribute("triplestore_address", triplestore_address.to_string()) .add_message(WasmMsg::Instantiate2 { admin: Some(env.contract.address.to_string()), code_id: msg.triplestore_config.code_id.u64(), @@ -88,8 +88,8 @@ mod tests { use crate::msg::{TripleStoreConfig, TripleStoreLimitsInput}; use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info}; use cosmwasm_std::{ - Attribute, ContractResult, HexBinary, SubMsg, SystemError, SystemResult, Uint128, Uint64, - WasmQuery, + Addr, Attribute, ContractResult, HexBinary, SubMsg, SystemError, SystemResult, Uint128, + Uint64, WasmQuery, }; #[test] @@ -148,7 +148,7 @@ mod tests { DATAVERSE.load(&deps.storage).unwrap(), Dataverse { name: "my-dataverse".to_string(), - triplestore_address: "predicted address".to_string(), + triplestore_address: Addr::unchecked("predicted address"), } ) } diff --git a/contracts/okp4-dataverse/src/state.rs b/contracts/okp4-dataverse/src/state.rs index b27549b1..7774dfb8 100644 --- a/contracts/okp4-dataverse/src/state.rs +++ b/contracts/okp4-dataverse/src/state.rs @@ -1,3 +1,4 @@ +use cosmwasm_std::Addr; use cw_storage_plus::Item; use serde::{Deserialize, Serialize}; @@ -6,5 +7,5 @@ pub const DATAVERSE: Item<'_, Dataverse> = Item::new("dataverse"); #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] pub struct Dataverse { pub name: String, - pub triplestore_address: String, + pub triplestore_address: Addr, }