quorum icon indicating copy to clipboard operation
quorum copied to clipboard

raft: block timestamp as nanoseconds?

Open drandreaskrueger opened this issue 8 years ago • 2 comments

the RPC API output of

web3.eth.getBlock( blockNumber ).timestamp

is usually denominated in seconds, but with RAFT it isn't.

I suppose, raft is reporting the timestamps as nanoseconds? Is that correct?

I had to come up with this special treatment

    # quorum raft consensus ... returns not seconds but nanoseconds?  
    timeunits = 1000000000.0 if CONSENSUS=="raft" else 1.0
    blocktimeSeconds = (ts_newBlockNumber - ts_blockNumber) / timeunits

https://gitlab.com/electronDLT/chainhammer/blob/86b5b3cfe59529df97cf7abe165224e3cc32892d/tps.py#L83-91

I have solved it for myself now, but it is a bit non-standard, no?

System information

Geth version: Geth/v1.7.2-stable-ee498061/linux-amd64/go1.9.3
OS & Version: Linux

suggestion:

return seconds, as a float.

drandreaskrueger avatar Jun 18 '18 13:06 drandreaskrueger

Looks like it is generated in nanos. Need to check if this is on purpose, since the block creation time is minimized in raft implementation.

Ref https://github.com/jpmorganchase/quorum/blob/master/raft/minter.go#L232

fixanoid avatar Jun 19 '18 14:06 fixanoid

This is correct for raft given that it has a configurable blocktime in ms.

jpmsam avatar Jul 05 '18 18:07 jpmsam