Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kusama shell parathread preparation. #4

Closed
7 tasks done
clangenb opened this issue Jun 13, 2021 · 17 comments
Closed
7 tasks done

kusama shell parathread preparation. #4

clangenb opened this issue Jun 13, 2021 · 17 comments

Comments

@clangenb
Copy link
Contributor

clangenb commented Jun 13, 2021

Manual test procedure

  1. launch rococo-local relay-chain (polkadot v0.9.3-local-testing with polkadot-launch cbb4373 without any parachains)
  2. download DUT shell.wasm and shell.state from CI artifacts
  3. register parathread with id 2015 (shell.wasm and state)
  4. verify
    a. sudo key
    b. sudo has 10MTEER
    c. total supply is 10MTEER
    d. paraid is 2015
  5. perform token transaction (must pay fees)
  6. download integritee.wasm and integritee.state from CI artifacts
  7. sudo->system->setCode(integritee)
  8. verify same as above
  9. verify: produces blocks
  10. post permalink to tested artifacts in this thread
@brenzi brenzi changed the title kusama parachain auction preparation. kusama parathread preparation. Jun 16, 2021
@clangenb
Copy link
Contributor Author

Tested everything according to this protocol: https://github.com/scs/integritee-parachain/blob/edca34334246b9f7595eb170332f1d7e7e965f96/parathread_registration_test_protocol.md

The tested artifacts are mentioned there. But if you want, I can recite them here.

@brenzi
Copy link
Collaborator

brenzi commented Jun 19, 2021

I was able to test with integritee keys, starting an extra collator with

/target/release/integritee-collator --collator -d /tmp/teerk1/integritee_test --parachain-id 2015 --chain shell-rococo-local.json --port 40335 --ws-port 9946 --rpc-port 9936 -- --execution wasm --chain rococo-local-raw.json --port 30337 --ws-port 9981

and then injecting the Aura key with author_insertKey

With a single collator, the block time is 60s (5 x target 12) as all others are skipped. But liveness is there even with 1 collator

@brenzi
Copy link
Collaborator

brenzi commented Jun 19, 2021

Will now test
srtool shell.wasm and .state from same commit as @clangenb tested above: 0c69983
artifacts:

register shell

launch rococo solo:

node ../polkadot-launch/dist/index.js launch-rococo-local.json
  • In js-apps (ws port 9999): Network-> Parachain->Parathreads->(+) Paraid as Alice until 2015 is registered
  • (+) Parathread with id 2015 with above linked shell wasm and state
  • "onboarding"
  • Developer->Sudo->paraSudoWrapper->scheduleParathreadUpgrade(2015)
  • "UpgradingToParachain"
  • generate all chain specs locally: scripts/dump-wasm-and-state-for-all-chains.sh. We actually only need shell-rococo-local.json
  • launch collator ./target/release/integritee-collator --collator -d /tmp/teerk1/integritee_test --parachain-id 2015 --chain shell-rococo-local.json --port 40335 --ws-port 9946 --rpc-port 9936 -- --execution wasm --chain rococo-local-raw.json --port 30337 --ws-port 9981
  • inject aura key for first collator: curl http://localhost:9936 -H "Content-Type:application/json;charset=utf-8" -d '{ "jsonrpc":"2.0", "id":1, "method":"author_insertKey", "params": [ "aura", "<MNEMONIC>", "0xc6c1370a5b6656f3816b2a6c32444ec18d5ac6d33103c4e5c3f359623a19dc47" ] }'
  • FAILS collator wont produce blocks

@clangenb
Copy link
Contributor Author

clangenb commented Jun 20, 2021

I could successfully produce blocks with:

However, I could not produce blocks with the integritee keys according to the above procedure - neither for the srtool wasm, nor the artifacts of 0c69983.

I agree though that the procedure should be correct according to: https://substrate.dev/docs/en/tutorials/start-a-private-network/customchain

@brenzi
Copy link
Collaborator

brenzi commented Jun 20, 2021

tried again, with locally built binary and srtool wasm. It worked with commit d9a647d8fdbaa4a8166ec1785509c86e570cfb94 where I have only one custom authority which is endowed. But because shell-rococo-local.json sets chainType to Local, js/apps won't behave as expected. should be Live, because only "-dev" is Local in our case

edit funding authorities do not need to be funded! see below where it works without

@brenzi
Copy link
Collaborator

brenzi commented Jun 20, 2021

setup

  • integritee-collator 0.6.0-970cc1c-x86_64-linux-gnu (based on polkadot 0.9.4 release)
  • polkadot-launch @a017b95ca153519c086bc6fdc5c063b0dde8495f
  • polkadot 0.9.3-8a3d93591-x86_64-linux-gnu
    (v0.9.3-local-testing)

test

run

scripts/dump_wasm_and_state_for_all_chains.sh

and manually get srtool wasm artifact

sha256sum 
e1604dc539a298900cef498216c8e87e641e4e71051f3c3107995d03ab31a59f  shell-srtool-0c69983.wasm

launch relaychain

node ../polkadot-launch/dist/index.js launch-rococo-local.json

register paraid until 2015

register parathread with id 2015

  • shell-srtool-0c69983.wasm
  • shell-kusama.state

launch collator

./target/release/integritee-collator --collator -d /tmp/teerk1/integritee_test --parachain-id 2015 --chain shell-rococo-local.json --port 40335 --ws-port 9946 --rpc-port 9936 -- --execution wasm --chain rococo-local-raw.json --port 30337 --ws-port 9981

sudo > paraSudoWrapper > upgradeParachain

inject collator aura key

curl http://localhost:9936 -H "Content-Type:application/json;charset=utf-8" -d '{ "jsonrpc":"2.0", "id":1, "method":"author_insertKey", "params": [ "aura", "<MNEMONIC>", "0xc6c1370a5b6656f3816b2a6c32444ec18d5ac6d33103c4e5c3f359623a19dc47" ] }'

js-apps on 9946 now identifies as:

IntegriTEE Shell (Local)
integritee-parachain/0
#6

block time target is 12s, really is 12s

transfer of funds works

vesting > vestingTransfer

  • target : Bob
  • locked: 100
  • perBlock= 1
  • staring=50

success:

  • Bob's account shows 100, transferrable 0, locked 100
  • at block 51, transferrable 0, vested 1, locked 100
  • vested counting up

chain upgrade:
extrinsics: sudo > sudoUncheckdWeight > system > setCode(<integritee-kusama.wasm>)

js/apps after reload now identifies as
IntegriTEE Shell (Local)
integritee-parachain/9
#73

we need to restart the collator to fix the name:

./target/release/integritee-collator --collator -d /tmp/teerk1/integritee_test --parachain-id 2015 --chain integritee-rococo-local.json --port 40335 --ws-port 9946 --rpc-port 9936 -- --execution wasm --chain rococo-local-raw.json --port 30337 --ws-port 9981

then it looks like this:

IntegriTEE Network (Local)
integritee-parachain/9
#88

(this is actually indicating we're doing it wrong I think)

SUCCESS!!

@brenzi
Copy link
Collaborator

brenzi commented Jun 21, 2021

shell-tested-setup.zip
edit: use the one pasted below

@clangenb
Copy link
Contributor Author

I am getting the error:

[Parachain] Could not find the header of the genesis block in the database! block_hash=0x296c4e2af69f78d5cd97a3da21554b05cbd7358004c0ad820787caec6cf0cab2

Which is due to a different genesis head from the one registered on the chain: paritytech/cumulus#385

Indeed, I found the genesis state generated by my integritee-collator@970cc1c to be slightly different from the one of shell-tested-setup.zip. This is most likely due to the nondeterministic rust build process.

So as your zip does not include the collator nor the shell-rococo-local.spec I can't confirm that it works.

@clangenb
Copy link
Contributor Author

clangenb commented Jun 22, 2021

However, I can confirm successful registration and block production with:

sha256sum shell-runtime-srtool-67bcb13f98c298e98335802efbef244a2e162826
e1604dc539a298900cef498216c8e87e641e4e71051f3c3107995d03ab31a59f  shell-runtime-srtool-67bcb13f98c298e98335802efbef244a2e162826
sha256sum integritee-collator
d7d19135a43e7ee4438538492ff5cf7bab10e0be62290df793e6aef9cc5a6956  integritee-collator

The artifacts are contained in these runs:

https://github.com/scs/integritee-parachain/actions/runs/958445544
https://github.com/scs/integritee-parachain/actions/runs/958445539

@brenzi
Copy link
Collaborator

brenzi commented Jun 23, 2021

I am getting the error:

[Parachain] Could not find the header of the genesis block in the database! block_hash=0x296c4e2af69f78d5cd97a3da21554b05cbd7358004c0ad820787caec6cf0cab2

Which is due to a different genesis head from the one registered on the chain: paritytech#385

Indeed, I found the genesis state generated by my integritee-collator@970cc1c to be slightly different from the one of shell-tested-setup.zip. This is most likely due to the nondeterministic rust build process.

So as your zip does not include the collator nor the shell-rococo-local.spec I can't confirm that it works.

There must be a misunderstanding. The zip contains all you need. When registering the parathread, use

  • shell-srtool-0c69983.wasm
  • shell-kusama-970cc1c.state

You can use shell-kusama as shell-rococo-local will be byte-equivalent if generated by the same binary

@clangenb
Copy link
Contributor Author

Yes, but there is no binary.

@brenzi
Copy link
Collaborator

brenzi commented Jun 23, 2021

No, but that's the point: It must work with a different binary because people may compile it themselves. But I guess the problem is that shell-rococo-local-raw.json wasn't included. I updated the zip...
shell-tested-setup.zip

@clangenb
Copy link
Contributor Author

I agree that it must work with a different binary.

But as you correctly concluded, I also need the shell-rococo-local-raw.json from your binary because I can't recreate it byte-equivalently with a different binary - which leads to the above error.

@brenzi
Copy link
Collaborator

brenzi commented Jun 23, 2021

that's why the above attached zip now includes that file ;-)

@clangenb
Copy link
Contributor Author

I can confirm that it works for the 2nd version of the zip:

verified:

  • block production equals 12s after injecting authority keys.
  • total issuance == 10MTeer
  • integritee-root account has 10MTeer

I think this is everything I can confirm without having the root key.

@brenzi
Copy link
Collaborator

brenzi commented Jul 1, 2021

We need to redo these tests after #14
and the runtime upgrade should be done using the compact wasm!

@brenzi brenzi changed the title kusama parathread preparation. kusama shell parathread preparation. Jul 1, 2021
@brenzi
Copy link
Collaborator

brenzi commented Jul 7, 2021

successful launch and upgrade on westend-local. 🚀
test protocol: https://gist.github.com/brenzi/9e45a60067342d8604899b241f789091

@brenzi brenzi closed this as completed Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants