stellar / soroban-example-dapp

End-to-End Example Soroban Dapp
Apache License 2.0
1.03k stars 835 forks source link

error: jsonrpc error: Networking or low-level protocol error: Invalid Url: Invalid URL: invalid format #91

Closed esteblock closed 1 year ago

esteblock commented 1 year ago

What version are you using?

soroban-cli 0.6.0

What did you do?

./quickstart.sh standalone
./initialize.sh standalone

What did you expect to see?

Success

What did you see instead?

Problem is while wrapping the token

Wrap the Stellar asset
error: jsonrpc error: Networking or low-level protocol error: Invalid Url: Invalid URL: invalid format

If I run all this manually:

soroban lab token wrap --network standalone --identity token-admin --asset "EXT:GDT2NORMZF6S2T4PT4OBJJ43OPD3GPRNTJG3WVVFB356TUHWZQMU6C3U

I get the exact error:

error: jsonrpc error: Networking or low-level protocol error: Invalid Url: Invalid URL: invalid format
esteblock commented 1 year ago

This happens when exploring with different network settings. The initialize.sh script checks if "soroban config network" has a network configuration for "standalone". However, it does not checks if the configuration has the same settings as the network we are going to use.

I propose that in order to avoid this problem: Either:

sreuland commented 1 year ago

I think this issue may have become obsolete after everything was updated per latest soroban Preview8 release, I tried replicating issue with latest commit on main(e885f0eb6f7b0fea61be4f95a4b2c43a2b2a6990):

in one terminal:

soroban-example-dapp$ make build-docker
soroban-example-dapp$ ./quickstart.sh standalone

in second terminal:

soroban-example-dapp$ soroban version
soroban 0.7.0 (75f45cf7d844184514d8662586670a7ae0911ea1)
soroban-env 0.0.15 (cf83838ae8a07a00224f0a5a3500eb7969bac7cf)
soroban-env interface version 32
stellar-xdr 0.0.15 (4655b635c698bb3bbc628bdba456df627c42ee3a)
xdr next (7356dc237ee0db5626561c129fb3fa4beaabbac6)
soroban-example-dapp$ mkdir .soroban
soroban-example-dapp$ ./initialize.sh standalone

Using standalone network
Add the standalone network to cli client
Create the token-admin identity
Fund token-admin account from friendbot
Wrap the Stellar asset
SUCCESS
Token wrapped succesfully with TOKEN_ID: d777567161812381f6150bd3b15839dbd2ebee40cfeefea889074431337c50f1
Build the crowdfund contract
cargo fmt --all
cargo build --target wasm32-unknown-unknown --release
  Downloaded soroban-env-guest v0.0.15
  Downloaded 1 crate (4.9 KB) in 0.40s
   Compiling proc-macro2 v1.0.47
   Compiling unicode-ident v1.0.5
   Compiling quote v1.0.21
   Compiling syn v1.0.105
   Compiling serde_derive v1.0.149
   Compiling serde v1.0.149
   Compiling serde_json v1.0.89
   Compiling ryu v1.0.11
   Compiling itoa v1.0.4
   Compiling autocfg v1.1.0
   Compiling ident_case v1.0.1
   Compiling fnv v1.0.7
   Compiling strsim v0.10.0
   Compiling typenum v1.16.0
   Compiling version_check v0.9.4
   Compiling thiserror v1.0.37
   Compiling either v1.8.0
   Compiling generic-array v0.14.6
   Compiling itertools v0.10.5
   Compiling libc v0.2.138
   Compiling num-traits v0.2.15
   Compiling indexmap v1.9.2
   Compiling num-integer v0.1.45
   Compiling hashbrown v0.12.3
   Compiling prettyplease v0.1.21
   Compiling num-bigint v0.4.3
   Compiling cfg-if v1.0.0
   Compiling static_assertions v1.1.0
   Compiling ethnum v1.3.2
   Compiling base64 v0.13.1
   Compiling cpufeatures v0.2.5
   Compiling wasmparser v0.88.0
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.3
   Compiling digest v0.10.6
   Compiling sha2 v0.10.6
   Compiling darling_core v0.14.2
   Compiling thiserror-impl v1.0.37
   Compiling bytes-lit v0.0.4
   Compiling darling_macro v0.14.2
   Compiling darling v0.14.2
   Compiling serde_with_macros v2.1.0
   Compiling serde_with v2.1.0
   Compiling hex v0.4.3
   Compiling crate-git-revision v0.0.4
   Compiling stellar-xdr v0.0.15
   Compiling soroban-env-common v0.0.15
   Compiling soroban-spec v0.7.0
   Compiling soroban-env-macros v0.0.15
   Compiling soroban-env-guest v0.0.15
   Compiling soroban-sdk-macros v0.7.0
   Compiling soroban-sdk v0.7.0
   Compiling soroban-crowdfund-contract v0.0.0 (/Users/sreuland/dev/soroban-example-dapp/contracts/crowdfund)
    Finished release [optimized] target(s) in 19.68s
cd target/wasm32-unknown-unknown/release/ && \
        for i in *.wasm ; do \
            ls -l "$i"; \
        done
-rwxr-xr-x  1 sreuland  staff  5116 Apr 13 12:56 soroban_crowdfund_contract.wasm
Deploy the crowdfund contract
SUCCESS
SUCCESS
Contract deployed succesfully with ID: 090aa2b0013bec3b4c8979e351a7228667a70566864ea367fc5512b3e244448d
Initialize the crowdfund contract
SUCCESS

Done

I tried using the cli as built in the soroban-preview docker also:

soroban-example-dapp$  docker exec soroban-preview ./initialize.sh standalone

had same success/done result.

esteblock commented 1 year ago

Hello @sreuland I should have close this issue. This was fixed in https://github.com/stellar/soroban-example-dapp/commit/ce021f7646e5e76439eb915bf7c9bfe953d54032#diff-e6bd26c7c0a9d375dc1979dcdc185178b4e3bbb6c3fe2deed9aab6825a7b959f

The problem here was if 1) Use ./initialize.sh with standalone in URL_1 2) Use ./initialize.sh with standalone in URL_2

I fixed this commenting the lines that were checking if soroban-cli had or not a network configuration

#if !(soroban config network ls | grep "$NETWORK" 2>&1 >/dev/null); then
# Always set a net configuration 
  echo Add the $NETWORK network to cli client
  soroban config network add "$NETWORK" \
    --rpc-url "$SOROBAN_RPC_URL" \
    --network-passphrase "$SOROBAN_NETWORK_PASSPHRASE"
#fi

Now the network is being configured every time. So always has the correct URL configuration