Cardano-wallet: Implement network/clock endpoint

Created on 27 Feb 2020  路  6Comments  路  Source: input-output-hk/cardano-wallet

Context

NTP is a protocol to allow time synchronization between remote machines. This is particularly essential for Ouroboros is a time-based protocol. In case a local clock is drifting too much compared to the global clock, one would want to re-sync his clock.

Decision

We are adding network/clock endpoint which returns NtpStatus type (Drift, Pending, Unavailable).

Acceptance Criteria

  • network/clock endpoint along with corresponding types has to be added
  • swagger.yaml has to be updated
  • in the implementation of the endpoint https://github.com/input-output-hk/ouroboros-network/tree/master/ntp-client is used
  • illustrative tests of endpoint usage are added

  • Development

    QA

    Most helpful comment

    @piotr-iohk Those look like bona fide errors to me. Your system has IPv6 enabled but lacks connectivity.

    All 6 comments

    @paweljakubas I'm seeing this error in the log when invoking network/clock:

    [cardano-wallet.ntp-client:Info:30] [2020-03-04 12:30:46.31 UTC] query to ntp client invoked
    [cardano-wallet.ntp-client:Alert:10310] [2020-03-04 12:30:46.32 UTC] ntp client experienced error Network.Socket.ByteString.sendManyTo: does not exist (Network is unreachable) when sending packet using IPv6
    [cardano-wallet.ntp-client:Alert:10304] [2020-03-04 12:30:46.32 UTC] ntp client experienced error Network.Socket.ByteString.sendManyTo: does not exist (Network is unreachable) when using IPv6 protocol
    

    Also, if I'm not mistaken there is only a single integration test added for this requirement (https://github.com/input-output-hk/cardano-wallet/blob/master/lib/core-integration/src/Test/Integration/Scenario/API/Network.hs#L202-L210).

    I'm wondering if there could be some more unit tests (or properties) added for https://github.com/input-output-hk/cardano-wallet/blob/master/lib/core/src/Network/Ntp.hs#L132-L143 that would excercise all patterns?
    Not sure how it works underneath, but is it possible maybe to get NtpSyncUnavailable by tweaking https://github.com/input-output-hk/cardano-wallet/blob/master/lib/core/src/Network/Ntp.hs#L44 ?

    After discussing with @paweljakubas -> #1410.

    The base library ouroboros-network/ntp-client might need more unit tests added. It is missing error path tests such as NtpSyncUnavailable mentioned by @piotr-iohk.

    @piotr-iohk Those look like bona fide errors to me. Your system has IPv6 enabled but lacks connectivity.

    @piotr-iohk Those look like bona fide errors to me.

    Could be... In any case, thanks for new word. ;)

    Closing.

    • The errors logged on my machine were indeed a configuration issue (https://github.com/input-output-hk/cardano-wallet/pull/1410#discussion_r388821612).
    • Also adjusted log levels to show Notice instead of Warning or Alert (https://github.com/input-output-hk/cardano-wallet/pull/1410#discussion_r388840049)
    • since the underlying lib does not support Windows I have also added this info to the API doc and disabled integration test on Windows for the time being (in #1410)
    Was this page helpful?
    0 / 5 - 0 ratings