vechain / web3-gear

Proxy Thor's RESTful API to Eth JSON-RPC, to support Remix, Truffle and more.
MIT License
30 stars 17 forks source link

Server error "got an unexpected keyword argument 'basic_logging'" #38

Open camdenorrb opened 2 years ago

camdenorrb commented 2 years ago

Server process:

camdenorrb@new-host Desktop/SmartContract/web3 ❯ web3-gear --host 127.0.0.1 --port 8545 --endpoint https://sync-testnet.vechain.org --keystore ./Keystore.json --passcode 'dweuodhweodewo' --debug
true --log 1

Web3-Gear/2.0.2/linux/python3.9.7
Listening on 127.0.0.1:8545
======== Running on http://127.0.0.1:8545 ========
(Press CTRL+C to quit)
Error handling request
Traceback (most recent call last):
  File "/home/camdenorrb/.local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/home/camdenorrb/.local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/home/camdenorrb/.local/lib/python3.9/site-packages/aiohttp/web_urldispatcher.py", line 195, in handler_wrapper
    return await result
  File "/home/camdenorrb/.local/lib/python3.9/site-packages/gear/cli.py", line 22, in handle
    response = await async_dispatch(request, basic_logging=logging, debug=debug)
  File "/home/camdenorrb/.local/lib/python3.9/site-packages/jsonrpcserver/async_main.py", line 49, in dispatch_to_json
    response = await dispatch_to_serializable(*args, **kwargs)
  File "/home/camdenorrb/.local/lib/python3.9/site-packages/jsonrpcserver/async_main.py", line 38, in dispatch_to_serializable
    await dispatch_to_response(*args, post_process=to_serializable, **kwargs),
TypeError: dispatch_to_response() got an unexpected keyword argument 'basic_logging'

Truffle logs

camdenorrb@new-host ~/Desktop/SmartContract ❯ npx truffle migrate --network testnet

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

> Something went wrong while attempting to connect to the network at http://127.0.0.1:8545. Check your network configuration.
Invalid JSON RPC response: "500 Internal Server Error\n\nServer got itself in trouble"
Truffle v5.4.15 (core: 5.4.15)
Node v16.11.1
nftpaper commented 2 years ago

The jsonrpcserver dependency was updated in August and the upgrade removed logging. You can roll back to jsonrpcserver 4.2 and web3-gear will work.

camdenorrb commented 2 years ago

Thank you @nftpaper that did fix it!

I'm gonna leave the issue open until a fix for this change has been implemented. This is a nice workaround for now tho

nbodtorf commented 2 years ago

Was having the same issue; swapping to jsonrpcserver 4.2 also fixed the 'basic_logging error' on my end. However, I'm still having an issue trying to run a contract migration through truffle on the testnet. It seems to start the migration, but then it fails at a certain point; during a request for 'eth_gasPrice' with the error 'Method not found'.

<-- {"jsonrpc": "2.0", "result": "0x9fa30f", "id": 13} <-- {"jsonrpc": "2.0", "result": "0x9fa30f", "id": 13} <-- {"jsonrpc": "2.0", "result": "0x3c616", "id": 15} --> {"jsonrpc":"2.0","id":16,"method":"eth_getBlockByNumber","params":["latest",false]} --> {"jsonrpc":"2.0","id":17,"method":"eth_gasPrice","params":[]} --> {"jsonrpc":"2.0","id":17,"method":"eth_gasPrice","params":[]} <-- {"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found", "data": "eth_gasPrice"}, "id": 17} <-- {"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found", "data": "eth_gasPrice"}, "id": 17} <-- {"jsonrpc": "2.0", "result": {"number": "0x9fa30f", "hash": "0x009fa30fe622c45ab01f53856becb7fdf64c953d88fa84107175c115885f4d0a", "size": "0x43b", "parentHash": "0x009fa30e485a0942a9208f7223f8e6b309588a74f7257fc559eff8ffd79fa3c2", "timestamp": "0x616ecb28", "gasLimit": "0x1406f40", "beneficiary": "0xb4094c25f86d628fdd571afc4077f0d0196afb48", "gasUsed": "0x5be12", "totalDifficulty": "0x3113401", "transactionsRoot": "0x03a85ecd09c953a3a27bfd7c2f1274e8daf952ec580fa6ce852388ff57425217", "txsFeatures": 1, "stateRoot": "0xdda487f60135e3017917c43afb12da965d844811ffdfc77d780254232a8c3b06", "receiptsRoot": "0x2c08b3a6052650f3aa01ced84850e232a87aa5628541ab57c49b790b68b6d32c", "miner": "0x28f24a070201d7efa49534ae8187c5f5cb19cb75", "isTrunk": true, "transactions": ["0x2eefa745ffbba7c1bbb57b734f905f006032e104b60b44f22d809209a9121b1d", "0xa84b1bc3d451a2fb9e36f83a68d1a7bded48dca06fadc3ad7e3e57702e21129c"]}, "id": 16} --> {"jsonrpc":"2.0","id":18,"method":"eth_blockNumber","params":[]} <-- {"jsonrpc": "2.0", "result": "0x9fa310", "id": 18} --> {"jsonrpc":"2.0","id":19,"method":"eth_blockNumber","params":[]} <-- {"jsonrpc": "2.0", "result": "0x9fa310", "id": 19} --> {"jsonrpc":"2.0","id":20,"method":"eth_blockNumber","params":[]} <-- {"jsonrpc": "2.0", "result": "0x9fa311", "id": 20} --> {"jsonrpc":"2.0","id":21,"method":"eth_blockNumber","params":[]} <-- {"jsonrpc": "2.0", "result": "0x9fa311", "id": 21}

nftpaper commented 2 years ago

@nbodtorf you need to add a gasPrice coefficient to your truffle-config.js file.

example:

module.exports = {
  networks: {
    development: {
    host: "127.0.0.1",
    port: 8545,
    network_id: "*",
    skipDryRun: true,
    production: true,
    gasPrice: 128
  }
 },
 compilers: {
   solc: {
    version: "^0.8.0"
  }
 }
};
nbodtorf commented 2 years ago

@nftpaper That fixed it. Thanks so much.

Git-on-my-level commented 2 years ago

Hey @nbodtorf can you share what version of Truffle you were using? I'm also getting "Method not found" but for eth_chainId instead

--> {"id":1,"jsonrpc":"2.0","params":[],"method":"eth_blockNumber"}
--> {"id":1637206540779,"jsonrpc":"2.0","params":[],"method":"eth_chainId"}