Closed martyall closed 5 years ago
For the time being (before we do #41) you can start tindermint core if you have a tendermint binary in your path (v0.32.2)
> tendermint init
> tendermint node
then you can start the example app with
> make run-simple-storage
Seems the extra logs come from empty requests:
I changed ToObject instance to the following.
instance ToObject (Loggable (Request (t :: MessageType))) where
toObject (Loggable v) = case A.toJSON v of
A.Object o -> addMessageType v o
-- unreachable case
a -> at "showing_request" ?~ A.String (pack $ show a) $ mempty
where -- everything else the same
.
.
Then running the both tendermint and the server I got the following:
[2019-08-08 04:31:10][ABCI.Server][Info][Charless-MacBook-Pro.local][42308][ThreadId 6][showing_request:Array []] Request Received
[2019-08-08 04:31:10][ABCI.Server][Info][Charless-MacBook-Pro.local][42308][ThreadId 6][message_type:end_block][height:33] Request Received
[2019-08-08 04:31:10][ABCI.Server][Info][Charless-MacBook-Pro.local][42308][ThreadId 6][showing_request:Array []] Request Received
[2019-08-08 04:31:10][ABCI.Server][Info][Charless-MacBook-Pro.local][42308][ThreadId 5][showing_request:Array []] Request Received
[2019-08-08 04:31:10][ABCI.Server][Info][Charless-MacBook-Pro.local][42308][ThreadId 6][showing_request:Array []] Request Received
[2019-08-08 04:31:10][ABCI.Server][Info][Charless-MacBook-Pro.local][42308][ThreadId 6][showing_request:Array []] Request Received
Strange that empty requests are passed in since they don't seem to be of the MessageType
.
We could have the logger do [message_type: empty]
in this case as a possible solution.
After seeing Charle's comment, I looked into it as it seamed too strange and here is "fix" https://github.com/f-o-a-m/hs-abci/pull/55
it's "fix" and not fix because after that pr is merged we would see nice logs but, underling issue is different.
and
Looks like generic deriving of in ToJSON instances for these result in empty json array and as Request GADT defferes to ToJSON instance of underlying type as a result you wouldn't be able distinguish toJSON $ RequestCommit Commit
and toJSON $ RequestFlush Flush
from each other.
i.e. issue is that ToJSON/FromJSON instances of Request and Responce are incorrect. instead they should have repesentation like this:
{ type: "flush", message: []}
{ type: "begin_block", message: {...}}
I've created issue for it https://github.com/f-o-a-m/hs-abci/issues/56
Besides this, I would recommend to use something like unsafeCrashWith "error message here"
from PureScript, for cases where we can't guaranty something by type system and we think is unreachable/impossible and explaine why it's like that as the error message, so if in future some of the assumptions change and impossible becomes possible, we get error message instead of incorrect behavior/silence.
Ahh got it, that's my bad didn't realize types without any records were treated that way.
If you run a tendermint server and turn on the example app, you might see logs such as this:
It seems like there is some dulplicates / missing context?
for example: