cronos-labs / play-unreal-plugin

Unreal Engine plugin repo for GameFi
Other
14 stars 13 forks source link

Problem: initialize error in metaverse demo #298

Open leejw51crypto opened 1 year ago

leejw51crypto commented 1 year ago

PlayCppSdk InitializeWalletConnect Error: socket error: TLS error: webpki error: UnsupportedCriticalExtension Getting from EnsureSession error: invalid client

leejw51crypto commented 1 year ago

don't call ConnectWalletConnect first.(don't have session info, so empty client, ensure_session fails)

call InitializeWalletConnect first, then check true is displayed. then connection is ok

because ConnectWalletConnect restores Client, it's different one

elai950 commented 1 year ago

I did all the tests on both Init and Connect just to be sure.

I think that first, we need to solve the session problem. Because it won't connect if the session didn't create and the client is invalid (there's an if condition in the code if the client is invalid then throw that error).

leejw51crypto commented 1 year ago

yes, so it's like this

ConnectWalletConnect is for restoring session,(after first pairing, saved to disk?) , maybe you can use later for ref: https://github.com/cronos-labs/play-cpp-sdk/blob/main/wallet-connect/examples/web3.rs

elai950 commented 1 year ago

Yes, I first call the InitializeWalletConnect. But see this:

2023-04-17 21_26_24-Window

The last line, assert. if the client is invalid the whole process fails with that Invalid Client error which resulting UnsupportedCriticalExtension.

I might be wrong I'm not pretending to understand how the whole code works but from my understanding first, the client bug should be resolved.

BTW, Where's the sessioninfo.json file should be saved? because I can't find he's location to verify that that file was even created.

leejw51crypto commented 1 year ago

yes, it should work. strange

i'll do the same today to reproduce

unreal has special place to save, it's saved by calling SaveClient or called OnNewSession, then addtional pairing not necessary.

leejw51crypto commented 1 year ago

could you try not to call ConnectWalletConnect, and like this? image

ensure session should be called after websocket is made and active, if not invalid client initializewalletconnect takes about 2 or 3 seconds in my pc

leejw51crypto commented 1 year ago

i'm checking ConnectWalletConnect now ref: https://github.com/cronos-labs/play-unreal-plugin/issues/301

elai950 commented 1 year ago

I'm failing in the callback of InitializeWalletConnect with success == false. With the error we mentioned.

leejw51crypto commented 1 year ago

@elai950 could you check one more test?

if above works, very strange, some issues in plugin code if not working, like tls issue , replace to use native tls

leejw51crypto commented 1 year ago

found similar issue: https://github.com/snapview/tokio-tungstenite/issues/231

leejw51crypto commented 1 year ago

changed root certificate type ref: https://github.com/cronos-labs/play-cpp-sdk/pull/433

elai950 commented 1 year ago

@elai950 could you check one more test?

if above works, very strange, some issues in plugin code if not working, like tls issue , replace to use native tls

Tried this, and got the same error:

Error: SocketError(TLS error: webpki error: UnsupportedCriticalExtension

Caused by:
   0: webpki error: UnsupportedCriticalExtension
   1: UnsupportedCriticalExtension

Location:
    C:\CodingNote\test-walletconnect\src\client\socket.rs:337:35)
error: process didn't exit successfully: `target\debug\examples\web3.exe` (exit code: 1)
leejw51crypto commented 1 year ago

thanks, for testing i assume it's by tokio-tungstenite certificate handling https://github.com/cronos-labs/play-cpp-sdk/pull/433

currently, we're using native , which is dependent to user's system setting, change to webpki (root certificates curated by Mozilla)

after this pr, merged, we will ship to our next plugin release

elai950 commented 1 year ago

Hey guys, Just updating don't know if it helps or if you managed to find and solve the problem. I got a new PC today brand new, with a fresh Windows 11 64-bit. This problem is still reproduced.

damoncro commented 1 year ago

I noticed @leejw51crypto posted a new commit on play-cpp-sdk which is the library that used in play-unreal-plugin. I guess, it possibly fixed the issue. But we haven't brought it to play-unreal-unreal, likely be released at next version (v0.0.20-alpha).

Would you @elai950 like to try it out? Kindly follow the step in https://github.com/cronos-labs/play-cpp-sdk#windows-1

It builds alongs wallet_connect.exe example which initialises the wallet_connect and print the QR code. Check the CI action here: https://github.com/cronos-labs/play-cpp-sdk/actions/runs/4783717180/jobs/8504308181#step:9:229

Kindly know that please install python and msvc, you can check how we build in CI: https://github.com/cronos-labs/play-cpp-sdk/blob/main/.github/workflows/win-build.yml

Once QR is shown, the problem should be fixed.

elai950 commented 1 year ago

Hey guys, Any news about this issue? still getting the error btw.

damoncro commented 1 year ago

Walletconnect 1.0 is about to sunset, @leejw51crypto is working on walletconnect 2.0. You can try once it is ready.