This test guide is related to the features in Milestone 2 of the grant from W3F, including the following parts:
- Setup and Unit-Test
- Environment Preparing
- SQoS Item: challenge
- SQoS Item: hidden & reveal
- SOoS Item: error rollback
- SQoS Item: verification threshold
-
Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -
Node
NVM: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
Node:nvm install v18
-
Git
sudo apt install git
We're building this version with the dev environment of ink! 4.0.0-alpha.3
. Use the following command to install the environment.
$ rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu
$ cargo install cargo-contract --version 2.0.0-alpha.3 --locked --force
$ cargo contract --version
cargo-contract 2.0.0-alpha.3-unknown-x86_64-unknown-linux-gnu
Note: If compilation fails, try executing the following first
- Install pkg-config
sudo apt install pkg-config
sudo apt install libssl-dev
- Install dylint
cargo install cargo-dylint
cargo install dylint-link
- Install binaryen
- Download binaryen
- Uncompress
tar -xf binaryen-version_111-x86_64-linux.tar.gz
- Add ./bin to ENV path
Clone the feature-sqos
branch of protocol-stack-for-ink
.
$ git clone -b feature-sqos https://github.com/dantenetwork/protocol-stack-for-ink.git
$ cd protocol-stack-for-ink/contracts/cross-chain
$ cargo contract build
$ cargo test
Clone the feature-sqos
branch of ink-sdk
repository. Compile the Greeting
contract.
$ git clone -b feature-sqos https://github.com/dantenetwork/ink-sdk.git
$ cd ink-sdk/examples/greeting
$ cargo contract build
$ cargo test
We have launched a Testnet to specifically target the features in this Milestone.
As we have not found an existing test or dev chain that supports the matched version of ink!
, we started a test Parachain of Polkadot. The related endpoint is at: ws://3.74.157.177:9944
We make the test by sending message from NEAR testnet to local POLKADOT testnet. All the features need to tested are on the Polkadot side, so there's no need for us to send message or invocations from Polkadot to Near, which makes the verification more convenient.
-
Test application contract(GREETING contract):
5HmRxPJZxKN5ZkD1FqzjkiPzmD9b1M4xkdJLLK4UQxoSL5uo
-
Dante Protocol contract(CROSS CHAIN contract):
5HVL6rC2GPxsDgt53DjNAqzoZRk6eJ7k1NfBLE1GzqXwWZ4A
-
Steps:
- Connect to
ws://3.74.157.177:9944
withhttps://polkadot.js.org/apps/#/explorer
. If you met the errorFailed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
, just addpolkadot.js.org
to theallowed unsafe content
of your browser. - Add
GREETING
andCROSS CHAIN
contract, use compiled metadata.json. ClickAdd an existing contract
as the following picture:
Add contract
- The following picture show the test application smart contract
GREETING
. Everything has already been prepared by us.
The greeting contract used to do the tests
- Connect to
Note that MAIN(EXTENSION): 5GufhjY66EiUUCKPWQP7qYVRqt291Eu48agQfHCnMprc7pMj
is the owner of greeting and cross chain contract, which is in order to prevent others from maliciously modifying the contract.
-
Test application contract(GREETING contract):
d8ae7a513eeaa36a4c6a42127587dbf0f2adbbda06523c0fba4a16bd275089f9
-
Dante Protocol contract(CROSS CHAIN contract):
170165c66e33a744726f7f8cd36885cc43aa1e55f88273df5c6aed72e45711e6
We have registered enough test routers
The information of the off-chain test routers for this testing is as follows:
1 malicious router: 5D5NSmbCPZ39jzkGqez7rg548LLr6Q7h4Fp4wUcQutnUs22u
3 honest routers:
-
5FnmygZEu2KhQoQGYdMd7ELYKDmBhn6mGk3BoXsHRSsvXPYW
-
5FHQ7XiyuUAJp1dBgzyoGFEJkFL4um7Ge7VLgqtCkzuEsT9C
-
5EkdEVGERnp5MabyAz92WuKYGjGa6vboarS4qQSMrCBuykB5
We provide a tutorial of launching a test router, everyone can launch a test router to join.
Currently, the economic mechanism is not ready, so there's no limitation for anyone to join.
Note that this is a temporaty mechanism and is just for the testing.
In the official version, staking is needed when registering, so as to improve the cost of some malicious behaviours.
-
For test, we provide a
selectRouters
function inCROSS CHAIN
contract to re-select working routers immediately. This is just for test.
-
The
isSelected
function inCROSS CHAIN
contract shows whether a router is selected currently.
Note thatPolkadot.js.app
is not very friendly forgetter
methods, so we cannot include the interface name in the screenshots.
The details of SQoS Items are as follows: