From ee32536f1d861b6d3aba3d444a5961f6f4def17c Mon Sep 17 00:00:00 2001 From: Kumar Anirudha Date: Tue, 1 Feb 2022 23:21:08 +0530 Subject: [PATCH 1/2] renamed all contracts/rust to new dir contracts/wasm --- contracts/wasm/README.md | 4 ++-- .../docs/guide/example_projects/fair_roulette.md | 10 +++++----- documentation/docs/guide/solo/what-is-solo.md | 2 +- documentation/temp/misc/install.md | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/contracts/wasm/README.md b/contracts/wasm/README.md index 962066d3b0..b054cb71c2 100644 --- a/contracts/wasm/README.md +++ b/contracts/wasm/README.md @@ -72,14 +72,14 @@ Prerequisites: [downloaded here](https://rustwasm.github.io/wasm-pack/). Building a Rust smart contract is very simple when using the Rust plugin in any -IntelliJ based development environment. Open the _contracts/rust_ sub folder in +IntelliJ based development environment. Open the _contracts/wasm_ sub folder in your IntelliJ, which then provides you with the Rust workspace. The easiest way to create a new contract is to copy the _helloworld_ folder to a properly named new folder within the _rust_ sub folder. Next, change the fields in the first section of the new folder's _cargo.toml_ file to match your preferences. Make sure the package name equals the folder name. Finally, add the -new folder to the workspace in the _cargo.toml_ in the _contracts/rust_ folder. +new folder to the workspace in the _cargo.toml_ in the _contracts/wasm_ folder. To build the new smart contract select _Run->Edit Configurations_. Add a new configuration based on the _wasmpack_ template, type the _name_ of the new diff --git a/documentation/docs/guide/example_projects/fair_roulette.md b/documentation/docs/guide/example_projects/fair_roulette.md index a475b6e17f..4713eae723 100644 --- a/documentation/docs/guide/example_projects/fair_roulette.md +++ b/documentation/docs/guide/example_projects/fair_roulette.md @@ -65,7 +65,7 @@ Off-ledger requests are directly sent to Wasp nodes and do not require validatio :::note This example uses On-ledger requests to initiate a betting request. A method to invoke Off-ledger requests is implemented inside the frontend. -See: [placeBetOffLedger](https://github.com/iotaledger/wasp/blob/7b3ddc54891ccf021c7aaa32db35d88361fade16/contracts/rust/fairroulette/frontend/src/lib/fairroulette_client/fair_roulette_service.ts#L133) +See: [placeBetOffLedger](https://github.com/iotaledger/wasp/blob/7b3ddc54891ccf021c7aaa32db35d88361fade16/contracts/wasm/fairroulette/frontend/src/lib/fairroulette_client/fair_roulette_service.ts#L133) ::: #### Funds @@ -217,7 +217,7 @@ This service comprises two parts: ##### PlaceBetOnLedger -The [placeBetOnLedger](https://github.com/iotaledger/wasp/blob/7b3ddc54891ccf021c7aaa32db35d88361fade16/contracts/rust/fairroulette/frontend/src/lib/fairroulette_client/fair_roulette_service.ts#L149) function is responsible for sending On-Ledger bet requests. It constructs a simple OnLedger object containing: +The [placeBetOnLedger](https://github.com/iotaledger/wasp/blob/7b3ddc54891ccf021c7aaa32db35d88361fade16/contracts/wasm/fairroulette/frontend/src/lib/fairroulette_client/fair_roulette_service.ts#L149) function is responsible for sending On-Ledger bet requests. It constructs a simple OnLedger object containing: * The smart contract ID: `fairroulette` * The function to invoke: `placeBet` @@ -235,7 +235,7 @@ See: [CoreTypes](https://wiki.iota.org/wasp/misc/coretypes) and [Invoking](https ##### CallView -The [callView](https://github.com/iotaledger/wasp/blob/7b3ddc54891ccf021c7aaa32db35d88361fade16/contracts/rust/fairroulette/frontend/src/lib/fairroulette_client/fair_roulette_service.ts#L165) function is responsible for calling smart contract view functions. +The [callView](https://github.com/iotaledger/wasp/blob/7b3ddc54891ccf021c7aaa32db35d88361fade16/contracts/wasm/fairroulette/frontend/src/lib/fairroulette_client/fair_roulette_service.ts#L165) function is responsible for calling smart contract view functions. See: [Calling a view](https://wiki.iota.org/wasp/guide/solo/view-sc) @@ -246,9 +246,9 @@ State changes that happen afterwards are published through the websocket event s You can find examples to guide you in building similar functions in: -* Frontend: [getRoundStatus](https://github.com/iotaledger/wasp/blob/7b3ddc54891ccf021c7aaa32db35d88361fade16/contracts/rust/fairroulette/frontend/src/lib/fairroulette_client/fair_roulette_service.ts#L181) +* Frontend: [getRoundStatus](https://github.com/iotaledger/wasp/blob/7b3ddc54891ccf021c7aaa32db35d88361fade16/contracts/wasm/fairroulette/frontend/src/lib/fairroulette_client/fair_roulette_service.ts#L181) -* Smart Contract: [view_round_status](https://github.com/iotaledger/wasp/blob/7b3ddc54891ccf021c7aaa32db35d88361fade16/contracts/rust/fairroulette/src/fairroulette.rs#L312) +* Smart Contract: [view_round_status](https://github.com/iotaledger/wasp/blob/7b3ddc54891ccf021c7aaa32db35d88361fade16/contracts/wasm/fairroulette/src/fairroulette.rs#L312) Since data returned by the views is encoded in Base64, the frontend needs to decode this by using simple `Buffer` methods. The `view_round_status` view returns an `UInt16` which has a state of either `0` or `1`. diff --git a/documentation/docs/guide/solo/what-is-solo.md b/documentation/docs/guide/solo/what-is-solo.md index e3661fe9a9..28fbe2c076 100644 --- a/documentation/docs/guide/solo/what-is-solo.md +++ b/documentation/docs/guide/solo/what-is-solo.md @@ -45,7 +45,7 @@ The GoLang environment with the Rust plugin is a good combination. You can find example implementations of smart contracts (including source code and tests) in the Wasp repository, in the -[contracts/rust folder](https://github.com/iotaledger/wasp/tree/master/contracts/rust). +[contracts/wasm folder](https://github.com/iotaledger/wasp/tree/master/contracts/wasm). :::tip You can find the documentation for all the functionalities available in solo in [go-docs](https://pkg.go.dev/github.com/iotaledger/wasp/packages/solo). diff --git a/documentation/temp/misc/install.md b/documentation/temp/misc/install.md index 33b8045c20..93a8c94370 100644 --- a/documentation/temp/misc/install.md +++ b/documentation/temp/misc/install.md @@ -26,4 +26,4 @@ environment with the Rust plugin is a good combination. You can find example implementations of smart contracts (including source code and tests) in the Wasp repository, in the -[contracts/rust folder](https://github.com/iotaledger/wasp/tree/master/contracts/rust). +[contracts/wasm folder](https://github.com/iotaledger/wasp/tree/master/contracts/wasm). From f1ffe01d8910ca02285d82124fa080b4faee80cc Mon Sep 17 00:00:00 2001 From: Kumar Anirudha Date: Wed, 2 Feb 2022 18:51:29 +0530 Subject: [PATCH 2/2] fixed typo --- documentation/docs/guide/core_concepts/consensus.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/guide/core_concepts/consensus.md b/documentation/docs/guide/core_concepts/consensus.md index 9caeab9032..d173018a48 100644 --- a/documentation/docs/guide/core_concepts/consensus.md +++ b/documentation/docs/guide/core_concepts/consensus.md @@ -35,7 +35,7 @@ The anchor transaction contains chain state transition, the AliasOutput and toke **It is only possible to produce valid signatures of inputs of the anchor transaction by the quorum** of nodes. In this case, a confirmed anchor transaction becomes a cryptographical **proof of consensus** in the committee. -To archive this, IOTA Smart Contracts uses **BLS threshold signatures in combination with polynomial (Shamir) secret sharing** to identify the address controlling the chain state. In order for the secret keys to be distributed across the chain validators, a DKG (Distributed Key Generation) procedure is executed when starting a chain (using the Rabin-Gennaro algorithm). +To achieve this, IOTA Smart Contracts uses **BLS threshold signatures in combination with polynomial (Shamir) secret sharing** to identify the address controlling the chain state. In order for the secret keys to be distributed across the chain validators, a DKG (Distributed Key Generation) procedure is executed when starting a chain (using the Rabin-Gennaro algorithm). ## The Consensus Algorithm