Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c0c35ba
add polkadot build script
coriolinus Feb 6, 2020
32d9303
Add scripting to bring up a simple alice-bob example net
coriolinus Feb 6, 2020
35cd700
enable external rpc access to the nodes
coriolinus Feb 7, 2020
cd19677
Ensure external RPC access works
coriolinus Feb 12, 2020
1ff63a5
Add multi-stage dockerfile for building the cumulus-test-parachain-co…
coriolinus Feb 12, 2020
55d5e8d
Add services which generate genesis state, run the collator
coriolinus Feb 12, 2020
78a4e60
Merge remote-tracking branch 'origin/master' into prgn-collator-script
coriolinus Feb 13, 2020
e2ce4c8
Launch the collator node
coriolinus Feb 13, 2020
d244115
enable external websocket access to indexer nodes
coriolinus Feb 13, 2020
4a32d81
Reorganize for improved caching, again
coriolinus Feb 14, 2020
e698987
Get the collator talking to the indexer nodes
coriolinus Feb 14, 2020
8968c5a
Add runtime stage to collect runtime wasm blob into volume
coriolinus Feb 17, 2020
30bf185
WIP: add registrar service and partial work to actually register the …
coriolinus Feb 17, 2020
1c5ba4a
Add a parachain registrar which should properly register the parachain
coriolinus Feb 18, 2020
c683f80
BROKEN attempt to demo registrar communication with the blockchain
coriolinus Feb 20, 2020
54e98d4
Fix broken parachain registrar
coriolinus Feb 20, 2020
d2b0905
Merge remote-tracking branch 'origin/master' into prgn-collator-script
coriolinus Feb 21, 2020
ba59157
fixes which cause the collator to correctly produce new parachain blocks
coriolinus Feb 21, 2020
d53f004
add documentation for running the parachain automatically
coriolinus Feb 21, 2020
f260c00
Add health check to collator
coriolinus Feb 21, 2020
0ff7fb5
minor scripting improvements
coriolinus Feb 21, 2020
55d9701
Apply suggestions from code review
coriolinus Feb 21, 2020
e202ffc
Docker: copy the whole workspace in one go
coriolinus Feb 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
BROKEN attempt to demo registrar communication with the blockchain
This is a really weird bug. After running `scripts/run_collector.sh`,
which brings everything up, it's perfectly possible to get into
a state very much like what the registrar is in, and communicate
with the blockchain without issue:

```sh
$ docker run --rm --net cumulus_testing_net para-reg:latest polkadot-js-api --ws ws://172.28.1.1:9944 query.sudo.key
Thu 20 Feb 2020 12:19:20 PM CET
{
  "key": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
```

However, the registrar itself, doing the same thing from within
`register_para.sh`, is failing to find the right place in the network:

```
/runtime/cumulus_test_parachain_runtime.compact.wasm found after 0 seconds
/genesis/genesis-state found after 0 seconds
2020-02-20 10:43:22          API-WS: disconnected from ws://172.28.1.1:9944 code: '1006' reason: 'connection failed'
_Event {
  type: 'error',
  isTrusted: false,
  _yaeti: true,
  target: W3CWebSocket {
    _listeners: {},
    addEventListener: [Function: _addEventListener],
    removeEventListener: [Function: _removeEventListener],
    dispatchEvent: [Function: _dispatchEvent],
    _url: 'ws://172.28.1.1:9944',
    _readyState: 3,
    _protocol: undefined,
    _extensions: '',
    _bufferedAmount: 0,
    _binaryType: 'arraybuffer',
    _connection: undefined,
    _client: WebSocketClient {
      _events: [Object: null prototype] {},
      _eventsCount: 0,
      _maxListeners: undefined,
      config: [Object],
      _req: null,
      protocols: [],
      origin: undefined,
      url: [Url],
      secure: false,
      base64nonce: 'aJ6J3pYDz8l5owVWHGbzHg==',
      [Symbol(kCapture)]: false
    },
    onclose: [Function (anonymous)],
    onerror: [Function (anonymous)],
    onmessage: [Function (anonymous)],
    onopen: [Function (anonymous)]
  },
  cancelable: true,
  stopImmediatePropagation: [Function (anonymous)]
}
```

They should be connected to the same network, running the same
image, doing the same call. The only difference is the file
existence checks, which really shouldn't be affecting the network
state at all.

Pushing this commit to ask for outside opinions on it, because
this is very weird and I clearly don't understand some part of
what's happening.
  • Loading branch information
coriolinus committed Feb 20, 2020
commit c683f80473c907a90a62672f88a0c7d22c954ac4
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ services:
- "genesis-state:/genesis"
- "parachain-runtime:/runtime"
depends_on:
- node_alice
- runtime
- genesis_state
networks:
Expand Down
8 changes: 3 additions & 5 deletions docker/parachain-registrar.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM node:latest AS pjs

RUN yarn global add @polkadot/api-cli
# It would be great to depend on a more stable tag, but we need some
# as-yet-unreleased features.
RUN yarn global add @polkadot/[email protected]

ENTRYPOINT [ "polkadot-js-api" ]
CMD [ "--version" ]
Expand All @@ -15,10 +17,6 @@ CMD [ "--version" ]
# pjs query.sudo.key

FROM pjs

# install tools required to run the registration script
RUN apt-get update && apt-get install -y xxd

# the only thing left to do is to actually run the transaction.
COPY ./scripts/register_para.sh /usr/bin
# unset the previous stage's entrypoint
Expand Down
56 changes: 48 additions & 8 deletions scripts/register_para.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,54 @@

set -e -o pipefail

# this is straightforward: just send the sudo'd tx to the alice node
sizeof () {
stat --printf="%s" "$1"
}

wait_for_file () {
# Wait for a file to have a stable, non-zero size.
# Takes at least 0.2 seconds per run, but there's no upper bound if the
# file grows continuously. If the file doesn't exist, or stably has 0 size,
# this will take up to 10 seconds by default; this limit can be adjusted by
# the second input parameter.
path="$1"
limit="$2"
if [ -z "$limit" ]; then
limit=10
fi
count=0
while [ "$count" -lt "$limit" ]; do
if [ -s "$path" ]; then
echo "$path found after $count seconds"
# now ensure that the file size is stable: it's not still being written
oldsize=0
size="$(sizeof "$path")"
while [ "$oldsize" -ne "$size" ]; do
sleep 0.2
oldsize="$size"
size="$(sizeof "$path")"
done
return
fi
count=$((count+1))
sleep 1
done
echo "$path not found after $count seconds"
exit 1
}

wait_for_file /runtime/cumulus_test_parachain_runtime.compact.wasm
wait_for_file /genesis/genesis-state

# this is now straightforward: just send the sudo'd tx to the alice node

polkadot-js-api \
--ws ws://172.28.1.1:9944 \
--sudo \
--seed "//Alice" \
tx.registrar.registerPara \
100 \
'{"scheduling":"Always"}' \
@/runtime/cumulus_test_parachain_runtime.compact.wasm \
@/genesis/genesis-state
query.sudo.key
# --sudo \
# --seed "//Alice" \
# tx.registrar.registerPara \
# 100 \
# '{"scheduling":"Always"}' \
# @/runtime/cumulus_test_parachain_runtime.compact.wasm \
# @/genesis/genesis-state