ethresearch / sharding-p2p-poc

Proof of Concept of Ethereum Serenity Peer-to-Peer Layer on libp2p PubSub System
40 stars 19 forks source link

JSON-ize the CLI output #97

Closed mhchia closed 5 years ago

mhchia commented 5 years ago

What was wrong?

Fix https://github.com/ethresearch/sharding-p2p-poc/issues/94

How was it fixed?

If a command succeeds, output the result directly. e.g.

$ sharding-p2p-poc -client getsubshard
[1,2,3,4,5]

If a command fails, output the error message, and set the return code as non-zero. e.g.

$ sharding-p2p-poc -client broadcastcollation 1 1 1 100 0
Failed to broadcast 1 collations of size 100 in period 0 in shard 1, err: rpc error: code = Unknown desc = Failed to broadcast collation, err: broadcasting to a not subscribed shard
$ echo $?
1

TODOs

Cute Animal Picture

put a cute animal picture link inside the parentheses

mhchia commented 5 years ago

TODO

mhchia commented 5 years ago

cc @NIC619 @ChihChengLiang

araskachoi commented 5 years ago

@mhchia For the status code, could you return any non-0 value for any errors.

mhchia commented 5 years ago

@araskachoi Yes, we have done it. Any error leads to a non-zero return value of the program

araskachoi commented 5 years ago

@mhchia awesome, thanks for the clarification!

mhchia commented 5 years ago

No problem, you're welcome:) I think the RPCs and output should be ready. Please give us any feedback if there is still any issue.

araskachoi commented 5 years ago

Awesome, I will pull and test it out and see if it is good! Also, I think it would be a valuable metric to add into the json, the timestamp for when any action has been successfully completed. This way we can measure the time it takes for something to happen (especially when we start testing with network conditions and large scale tests). Please let me know your thoughts!