Comments (3)
WIP on this branch: https://github.com/encointer/encointer-js/tree/cl/incognitee-support
On a local setup, I try to create the breakthrough by trying to run worker.getShieldingKey
with the following unit test:
Setup:
- Worker in docker inside wsl
- encointer-js in windows
- Tested that the rust-cli is able to communicate with the worker from the wsl host (outside docker) so the setup to talk to the docker is correct 👍
I can open a connection from an encointer-js unit test, but the connection immediately closes where the rustls-server complains about receiving a corrupt package. So we don't enter our custom protocol level yet, and it has to do with the websocket setup itself if I get this correctly.
On the js-side I get:
Error: WebSocket closed with reason: connection failed (1006).
at EncointerWorker._handleClose (\\wsl$\Ubuntu\home\clang\code\encointer-js\node_modules\websocket-as-promised\src\index.js:407:19)
at W3CWebSocket.listener (\\wsl$\Ubuntu\home\clang\code\encointer-js\node_modules\websocket-as-promised\src\index.js:340:64)
at W3CWebSocket._dispatchEvent [as dispatchEvent] (\\wsl$\Ubuntu\home\clang\code\encointer-js\node_modules\yaeti\lib\EventTarget.js:115:12)
at W3CWebSocket.onConnectFailed (\\wsl$\Ubuntu\home\clang\code\encointer-js\node_modules\websocket\lib\W3CWebSocket.js:219:14)
at WebSocketClient.<anonymous> (\\wsl$\Ubuntu\home\clang\code\encointer-js\node_modules\websocket\lib\W3CWebSocket.js:59:25)
at WebSocketClient.emit (node:events:513:28)
at ClientRequest.handleRequestError (\\wsl$\Ubuntu\home\clang\code\encointer-js\node_modules\websocket\lib\WebSocketClient.js:227:14)
at ClientRequest.emit (node:events:513:28)
at Socket.socketOnEnd (node:_http_client:526:9)
at Socket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
On the worker side:
[2024-03-29T18:22:34.906870Z DEBUG itc_tls_websocket_server::ws_server] Number of readiness events: 1
[2024-03-29T18:22:34.906977Z TRACE itc_tls_websocket_server::ws_server] Received new connection event
[2024-03-29T18:22:34.907023Z DEBUG itc_tls_websocket_server::ws_server] Accepting new connection from 172.17.0.1:36528
[2024-03-29T18:22:34.907091Z TRACE itc_tls_websocket_server::ws_server] New connection has token Token(1016)
[2024-03-29T18:22:34.907110Z TRACE itc_tls_websocket_server::ws_server] Web-socket connection created
[2024-03-29T18:22:34.907169Z DEBUG itc_tls_websocket_server::ws_server] Accepted connection, 1 active connections
[2024-03-29T18:22:34.909213Z DEBUG itc_tls_websocket_server::ws_server] Number of readiness events: 1
[2024-03-29T18:22:34.909294Z TRACE itc_tls_websocket_server::ws_server] Connection (token Token(1016)) activity event
[2024-03-29T18:22:34.909334Z TRACE itc_tls_websocket_server::connection] Connection (Token(1016)) is readable
[2024-03-29T18:22:34.909433Z ERROR itc_tls_websocket_server::connection] cannot process TLS packet(s), closing connection: CorruptMessage
[2024-03-29T18:22:34.909464Z DEBUG itc_tls_websocket_server::connection] Connection (Token(1016)) is closed
[2024-03-29T18:22:34.909476Z TRACE itc_tls_websocket_server::ws_server] Connection Token(1016) is closed, removing
[2024-03-29T18:22:34.909528Z TRACE itc_tls_websocket_server::ws_server] Closed Token(1016), 0 active connections remaining
The worker throws the error here: https://github.com/integritee-network/worker/blob/b0c86e2995e90fdc508396c97900ffd2e99c68a9/core/tls-websocket-server/src/connection.rs#L99.
A corrupted message error is thrown due to a frame desync (protocol mismatch), I don't understand yet, why our websocket isn't talking TLS supposedly.
from encointer-js.
This is how the stream looks for a successful trusted getter rpc from our rust client:
[2024-03-29T21:55:11.410707Z TRACE itc_tls_websocket_server::ws_server] Connection (token Token(406)) activity event
[2024-03-29T21:55:11.410720Z TRACE itc_tls_websocket_server::connection] Connection (Token(406)) is readable
[2024-03-29T21:55:11.410737Z TRACE itc_tls_websocket_server::connection] Initialize connection 406
[2024-03-29T21:55:11.410830Z DEBUG itc_tls_websocket_server::connection] Initialized connection 406 successfully
[2024-03-29T21:55:11.411416Z DEBUG itc_tls_websocket_server::ws_server] Number of readiness events: 1
[2024-03-29T21:55:11.411468Z TRACE itc_tls_websocket_server::ws_server] Connection (token Token(406)) activity event
[2024-03-29T21:55:11.411481Z TRACE itc_tls_websocket_server::connection] Connection (Token(406)) is readable
[2024-03-29T21:55:11.411526Z TRACE itc_tls_websocket_server::connection] Read is possible for connection 406: true
[2024-03-29T21:55:11.411562Z TRACE itc_tls_websocket_server::connection] Got Message::Text on web-socket (connection 406), calling handler..
[2024-03-29T21:55:11.411594Z DEBUG enclave_runtime::rpc::worker_api_direct] worker_api_direct rpc was called: state_executeGetter
[2024-03-29T21:55:11.411774Z DEBUG ita_stf::getter] TrustedGetter free_balance
[2024-03-29T21:55:11.411809Z DEBUG ita_stf::getter] AccountInfo for 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d is <wasm:stripped>
⣿STF⣿ 🔍 TrustedGetter query: free balance for ⣿⣿⣿ is ⣿⣿⣿
[2024-03-29T21:55:11.411865Z DEBUG itc_direct_rpc_server::rpc_ws_handler] RPC response string: Some("{\"jsonrpc\":\"2.0\",\"result\":\"0x4801400000c16ff286230000000000000000000000\",\"id\":1}")
from encointer-js.
Ok, the errors were only thrown initially, when I still used the ws
in the url instead of wss
. Now it seems that the websocket connection is opened, but it is stale afterward. I believe that the JS-websocket is still expecting some final handshake, which is missing.
from encointer-js.
Related Issues (20)
- extend `computeMeetupIndex` tests with constellations including `reputables`
- update rpc prefixes
- Negative Fixed-point numbers are probably not working
- Can't extract error after newest gesell upgrade
- Test if the `WorkerApi` is compatible with TLS into the enclave HOT 1
- [typegen] can't recreate local types due to loader error.
- Note: polkadot type generation is incompatible with `ts-node>9` and `typescript>4.5`.
- Add typeOverrideBundles
- upgrade dependencies to newest NPM versions for polkadot-0.9.42 HOT 1
- upgrade CommunityMetadata type and add new fields
- Bug: meetup index 1 is returned for bad meetup assignment params
- Fix `EncointerWorker` for react project HOT 1
- adapt reputation enum of pallets >= 6.1.0
- Use jsonrpc 2.0 library instead of homegrown low-level implementation
- Node-RSA seems to create output violating the standards HOT 3
- Fix `Worker` implementation for encointer
- Fix inconsistent use of CommunityIdentifier vs. ShardVault
- can't run tests when package build folder exists due to `DuplicateHasteCandidatesError`
- Handle check metadata signed extension
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from encointer-js.