The E2E tests run against local deployments of the parachain, relayer and ganache.
- Development environment for Rust and Substrate. See parachain requirements.
- Make sure you use a recent node version, e. g. with nvm:
nvm install 14.16.1
nvm use 14.16.1
- Development environment for Ethereum smart contracts.
yarn global add truffle
(cd ../ethereum && yarn install)
cp env.template .env
- Development environment for Relayer. See relayer requirements.
timeout
- native package on Ubuntu, on macOS trybrew install coreutils
jq
- https://stedolan.github.io/jq/download/- Build the
@snowfork/snowbridge-types
package using these steps.
Make sure to install/build all the requirements above.
Download dependencies:
yarn install
Install polkadot-launch
:
git clone -n https://github.com/paritytech/polkadot-launch.git /tmp/polkadot-launch
cd /tmp/polkadot-launch
git checkout 89e970
yarn install
yarn build
yarn global add file:$(pwd)
cd -
Build polkadot:
git clone -n https://github.com/snowfork/polkadot.git /tmp/polkadot
cd /tmp/polkadot
git checkout enable_beefy_on_rococo
./scripts/init.sh
cargo build --release
cd -
Optional: If you cloned the polkadot repo in another location, Create an .env
file to specify the directory where you installed the polkadot binary.
cp ./.env-example .env
Start all services (parachain, relayer, ganache, etc). We recommend adding the duplicate
flag to create a duplicate parachain so that we have 2 different running and registered parachains for testing XCM and for testing the polkadot light client with multiple parachain headers being tracked.
scripts/start-services.sh duplicate
Wait until the "System has been initialized" message
Go to polkadot-js and wait until the parachain has started producing blocks: https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A11144#/explorer
You can see the relay chain by connecting to https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9955#/explorer
Confirm the block number is > 2
You should now be good to go!
yarn test
Make sure to setup the E2E stack as described above.
For interacting with Substrate, open https://polkadot.js.org/apps/ in your browser (Make sure to use this link specifically).
Send 10 Ether to //Alice
on Substrate:
cd ../ethereum
truffle exec scripts/sendEth.js 10 \
0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d \
--network e2e_test
It should take around 10-20 seconds for Substrate to receive and process the message.
In the substrate webapp (linked above), you should see an Eth.Minted
event in the Network > Explorer view.
To see the PolkaETH balance for //Alice
:
- Navigate to Developer > Chain state > Storage
- Select the
assets
module in the drop-down. - Select
ETH
as the AssetId - Select
Alice
as the AccountId - Click the
+
button
To burn PolkaETH and unlock ETH on Ethereum:
- Navigate to Developer > Extrinsics
- Select
Alice
as the AccountId - Select
eth
as the module, andburn
as the extrinsic - Select
Basic
for the ChannelId - Input
0xBe68fC2d8249eb60bfCf0e71D5A0d2F2e292c4eD
for the recipient - Input
10000000000000000000
for the amount
It should take around 20 seconds for Ethereum to receive and process the message.
To verify that 0xBe68fC2d8249eb60bfCf0e71D5A0d2F2e292c4eD
received 10 Ether:
cd ../ethereum
truffle exec scripts/getEthBalance.js 0xBe68fC2d8249eb60bfCf0e71D5A0d2F2e292c4eD --network e2e_test
The start-services.sh
script writes the following logs:
- parachain.log
- relayer.log
- ganache.log