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

Switch networking to @polkadot/rpc-provider and support for author_submitAndWatchExtrinsic for trusted calls #116

Merged
merged 50 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
93ac67d
add rpc-provider
clangenb Oct 24, 2024
557f20e
remove unnecessary modules from rpc-provider
clangenb Oct 24, 2024
6d79e12
yarn lock
clangenb Oct 24, 2024
1815e0c
remove rpc provider again
clangenb Oct 24, 2024
b87764c
Functional WIP of working RPC provider
clangenb Oct 24, 2024
4cfceec
simplify the websocket worker some more
clangenb Oct 24, 2024
4753f34
Revert "remove rpc provider again"
clangenb Oct 24, 2024
c91ee62
submitAndWatch WIP
clangenb Oct 24, 2024
31a2565
[websocketIntegriteeWorker] close ws after tests
clangenb Oct 25, 2024
2531f29
[websocketIntegriteeWorker] extract resultToRpcReturnValue
clangenb Oct 25, 2024
7fc408b
[websocketIntegriteeWorker] trustedCall fire&forget works
clangenb Oct 25, 2024
fff816a
[websocketIntegriteeWorker] submitAndCallback architecture seems to w…
clangenb Oct 25, 2024
da24cab
[websocketIntegriteeWorker] improve logging
clangenb Oct 25, 2024
1c801e5
implement getters with the new api
clangenb Oct 25, 2024
03fa309
fix tests by resolving shard vs mrenclave ambiguity
clangenb Oct 25, 2024
8d9f02b
properly reject upon priority error
clangenb Oct 25, 2024
8e064c4
fix tests in old integriteeWorker
clangenb Oct 25, 2024
9416f1a
update localDocker network with shard
clangenb Oct 25, 2024
ed48e7a
move rpc-provider to worker
clangenb Oct 25, 2024
5329bfc
integrate local rpc-provider
clangenb Oct 25, 2024
641b64f
close websockets after test in old worker implementation
clangenb Oct 25, 2024
154d0ca
able to run test with local rpc-provider
clangenb Oct 25, 2024
6215133
[rpc-provider] add debug logs
clangenb Oct 25, 2024
af73e1d
successfully implement `author_submitAndWatchExtrinsic`
clangenb Oct 25, 2024
034167a
merge the websocketWorker back into the worker
clangenb Oct 25, 2024
ca5c092
fix tests by resolving shard vs mrenclave ambiguity
clangenb Oct 25, 2024
a2c661c
merge the integritee websocket worker back into the original one
clangenb Oct 25, 2024
6da2a66
remove obsolete sendTrustedCall method
clangenb Oct 25, 2024
cdf69f0
remove legacy code and encointer code
clangenb Oct 25, 2024
e5b6d53
delete tests in rpc-provider that don't run
clangenb Oct 25, 2024
a22bfe2
allow passing the websocket implementation into the rpc-provider.
clangenb Oct 25, 2024
9231c93
remove old IWorker interface
clangenb Oct 25, 2024
aa0d200
remove unnecessary stuff from rpc-provider
clangenb Oct 25, 2024
6714142
make websocket a dev-dep
clangenb Oct 25, 2024
6012548
remove unnecessary promised map dependency
clangenb Oct 25, 2024
7c19e64
extract generic top to worker base implementation
clangenb Oct 25, 2024
ea83f50
simplify callback code
clangenb Oct 25, 2024
4a87aad
aggregate callback result in TrustedCallResult
clangenb Oct 25, 2024
d2acd0e
improve callback code
clangenb Oct 25, 2024
7b09016
fix code peculiarities
clangenb Oct 25, 2024
2164072
add comment about tests and skip them again for the ci
clangenb Oct 25, 2024
df0ba52
remove unnecessary dependency
clangenb Oct 25, 2024
c668eb6
add comment about websocket in rpc-provider
clangenb Oct 25, 2024
41ff9a8
better comment
clangenb Oct 25, 2024
af1075c
better type for submitAndWatch
clangenb Oct 25, 2024
54c70af
v0.15.3-alpha.0
clangenb Oct 25, 2024
9d26933
v0.16.0-alpha.0
clangenb Oct 25, 2024
578726b
resolve promise if status is invalid
clangenb Oct 26, 2024
25e7cc6
Revert "[rpc-provider] add debug logs"
clangenb Oct 26, 2024
11b2147
downgrade a log
clangenb Oct 26, 2024
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
Binary file removed .yarn/cache/chnl-npm-1.2.0-0147cf365c-78044132c0.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ The worker uses the webcrypto api if it is run in the browser. This library is o
defined if you access the webpage with `localhost` in firefox. It is not available
on `127.0.0.1` or `0.0.0.0` due to browser security policies.

## Testing
Use the below command to only execute a particular test suite.

**Note:** The worker tests are skipped by default, as they need a running setup.

```bash
// execute worker tests
yarn test --runTestsByPath packages/worker-api/src/integriteeWorker.spec.ts
```

```bash
yarn add @encointer/node-api @encointer/worker-api
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"publishConfig": {
"directory": "build"
},
"version": "0.15.2"
"version": "0.16.0-alpha.0"
}
4 changes: 2 additions & 2 deletions packages/node-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
},
"sideEffects": false,
"type": "module",
"version": "0.15.2",
"version": "0.16.0-alpha.0",
"main": "index.js",
"dependencies": {
"@encointer/types": "^0.15.2",
"@encointer/types": "^0.16.0-alpha.0",
"@polkadot/api": "^11.2.1",
"tslib": "^2.6.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"sideEffects": false,
"type": "module",
"version": "0.15.2",
"version": "0.16.0-alpha.0",
"main": "index.js",
"scripts": {
"generate:defs": "node --experimental-specifier-resolution=node --loader ts-node/esm ../../node_modules/.bin/polkadot-types-from-defs --package @encointer/types/interfaces --input ./src/interfaces",
Expand Down
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"sideEffects": false,
"type": "module",
"types": "./index.d.ts",
"version": "0.15.2",
"version": "0.16.0-alpha.0",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.9",
Expand Down
18 changes: 10 additions & 8 deletions packages/worker-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,28 @@
"sideEffects": false,
"type": "module",
"types": "./index.d.ts",
"version": "0.15.2",
"version": "0.16.0-alpha.0",
"main": "index.js",
"dependencies": {
"@encointer/node-api": "^0.15.2",
"@encointer/types": "^0.15.2",
"@encointer/util": "^0.15.2",
"@encointer/node-api": "^0.16.0-alpha.0",
"@encointer/types": "^0.16.0-alpha.0",
"@encointer/util": "^0.16.0-alpha.0",
"@peculiar/webcrypto": "^1.4.6",
"@polkadot/api": "^11.2.1",
"@polkadot/keyring": "^12.6.2",
"@polkadot/types": "^11.2.1",
"@polkadot/util": "^12.6.2",
"@polkadot/util-crypto": "^12.6.2",
"@polkadot/wasm-crypto": "^7.3.2",
"@polkadot/x-global": "^12.6.2",
"@polkadot/x-ws": "^12.6.2",
"bs58": "^4.0.1",
"promised-map": "^1.0.0",
"websocket": "^1.0.34",
"websocket-as-promised": "^2.0.1"
"eventemitter3": "^5.0.1",
"tslib": "^2.6.2"
},
"devDependencies": {
"@types/bs58": "^4.0.4"
"@types/bs58": "^4.0.4",
"websocket": "^1.0.34"
},
"peerDependencies": {
"@polkadot/x-randomvalues": "^12.3.2"
Expand Down
132 changes: 0 additions & 132 deletions packages/worker-api/src/encointerWorker.spec.ts

This file was deleted.

107 changes: 0 additions & 107 deletions packages/worker-api/src/encointerWorker.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/worker-api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export { Worker } from './worker.js';
export { EncointerWorker } from './encointerWorker.js';
export { IntegriteeWorker } from './integriteeWorker.js';

export * from './interface.js';
Loading
Loading