wemixarchive / go-wemix

Go implementation of the Wemix project.
https://www.wemix.com/
GNU Lesser General Public License v3.0
28 stars 25 forks source link

`eth_genesis` does not work as intended #101

Closed jed-wemade closed 1 month ago

jed-wemade commented 5 months ago

eth_genesis used in gwemix download-genesis is feature for downloading genesis config from gwemix node. Currently, the API returns content of genesis.json specified on startup. The API does not reflect default chain config which is set on runtime so actual config is hidden to outside unless attaching IPC. It may be reasonable as aspect of downloading genesis "file" which node used but most expects downloading "current" genesis.

Moreover, the API does not work when genesis.json is removed from node.

For testnet:

$ curl -H "Content-Type: application/json" \
  -d '{"id":0,"jsonrpc":"2.0","method":"eth_genesis","params":[]  
}' https://api.test.wemix.com
{"jsonrpc":"2.0","id":0,"error":{"code":-32000,"message":"open /opt/nxt/genesis.json: no such file or directory"}}

For mainnet EN:

$ curl -H "Content-Type: application/json" \
  -d '{"id":0,"jsonrpc":"2.0","method":"eth_genesis","params":[]
}' https://api.wemix.com 
{"jsonrpc":"2.0","id":0,"error":{"code":-32000,"message":"open /opt/wemix/genesis.json: no such file or directory"}}
jed-wemade commented 1 month ago

This feature will be removed for next fork.