Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET http://localhost:8090/v2/network/information returns 500 on mainnet while wallet is syncing through Byron era. #1960

Closed
piotr-iohk opened this issue Jul 27, 2020 · 2 comments · Fixed by #1943
Assignees

Comments

@piotr-iohk
Copy link
Contributor

piotr-iohk commented Jul 27, 2020

Context

Information -
Version 2020.7.6 (git revision: 93c177b179fc4fc500858ebfbbf4ed7ecfc2c6bc)
Platform Linux
Installation From source

Steps to Reproduce

  1. Start cardano-wallet-shelley on mainnet. (https://hydra.iohk.io/build/3627080/download/1/index.html)
  2. While it is syncing (and also after it is synced, but still before HF) query
GET http://localhost:8090/v2/network/information 

Expected behavior

Information is available.

Actual behavior

The response was:
Code = 500,
Message = Something went wrong

in the log there is:

[cardano-wallet.network:Critical:206] [2020-07-27 13:54:16.34 UTC] Time interpreter queried past the horizon. This should not have happened.
Query is:
sqBind qBind QBind QBind QBind QAbsToRelEpoch EpochNo {unEpochNo = 208}
tHorizon [("runQuery",SrcLocEras are:
EraSummary {eraStart = Bound {boundTime = RelativeTime {getRelativeTime = 0s}, boundSlot = SlotNo {unSlotNo = 0}, boundEpoch = EpochNo {unEpochNo = 0}}, eraEnd = EraEnd (Bound {boundTime = RelativeTime {getRelativeTime = 89856000s}, boundSlot = SlotNo {unSlotNo = 4492800}, boundEpoch = EpochNo {unEpochNo = 208}}), eraParams = EraParams {eraEpochSize = EpochSize {unEpochSize = 21600}, eraSlotLength = SlotLength {getSlotLength = 20s}, eraSafeZone = StandardSafeZone 4320 NoLowerBound}}
CallStack (from HasCallStack):
  runQuery, called at src/Ouroboros/Consensus/HardFork/History/Qry.hs:302:44 in ouroboros-consensus-0.1.0.0-GJeJBwzkEl7AcixwXFgXER:Ouroboros.Consensus.HardFork.History.Qry
  interpretQuery, called at src/Cardano/Wallet/Primitive/Slotting.hs:309:26 in cardano-wallet-core-2020.7.6-AamOEQSEhy42ld6T94mTEW:Cardano.Wallet.Primitive.Slotting
  runQuery, called at src/Cardano/Wallet/Primitive/Slotting.hs:275:27 in cardano-wallet-core-2020.7.6-AamOEQSEhy42ld6T94mTEW:Cardano.Wallet.Primitive.Slotting
  mkTimeInterpreter, called at src/Cardano/Wallet/Shelley/Network.hs:456:60 in cardano-wallet-shelley-2020.7.6-2hcgUDLMQFX1xdHvgaYBva:Cardano.Wallet.Shelley.Network
  _timeInterpreterQuery, called at src/Cardano/Wallet/Shelley/Network.hs:307:33 in cardano-wallet-shelley-2020.7.6-2hcgUDLMQFX1xdHvgaYBva:Cardano.Wallet.Shelley.Network
  timeInterpreter, called at src/Cardano/Wallet/Network.hs:153:7 in cardano-wallet-core-2020.7.6-AamOEQSEhy42ld6T94mTEW:Cardano.Wallet.Network

Resolution

Two separate problems:

  1. Even when synced, in Byron, it returns 500
  2. When un-synced it returns 500

Explanation:

  1. We use startTime =<< firstSlotInEpoch (e + 1) to get the time of the next epoch. This is just outside the horizon.
  2. We throw if we can't get the network_tip or next_epoch.

Solution:

  1. Get the end time of the current epoch, instead of the start time of the next one
  2. Don't throw. Make network_tip and next_epoch optional

QA

Tested manually on mainnet.

When not in sync:

$ cardano-wallet-shelley network information
Ok.
{
    "node_tip": {
        "height": {
            "quantity": 2298589,
            "unit": "block"
        },
        "epoch_number": 106,
        "slot_number": 10480
    },
    "sync_progress": {
        "status": "syncing",
        "progress": {
            "quantity": 51.26,
            "unit": "percent"
        }
    }
}

When in sync:

{
    "network_tip": {
        "epoch_number": 207,
        "slot_number": 15728
    },
    "node_tip": {
        "height": {
            "quantity": 4484639,
            "unit": "block"
        },
        "epoch_number": 207,
        "slot_number": 15728
    },
    "sync_progress": {
        "status": "ready"
    },
    "next_epoch": {
        "epoch_start_time": "2020-07-29T21:44:51Z",
        "epoch_number": 208
    }
@Anviking Anviking self-assigned this Jul 27, 2020
@Anviking
Copy link
Collaborator

Should be solved by #1943

@piotr-iohk
Copy link
Contributor Author

lgtm

iohk-bors bot added a commit that referenced this issue Jul 30, 2020
1977: Test getNetworkInformation handling of PastHorizonException r=Anviking a=Anviking

# Issue Number

#1869 /  #1960


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] Added a mock interpreter & network layer to produce a single unit test
- [x] I think we can make this a monadic property test easily


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
iohk-bors bot added a commit that referenced this issue Jul 30, 2020
1977: Test getNetworkInformation handling of PastHorizonException r=Anviking a=Anviking

# Issue Number

#1869 /  #1960


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] Added a mock interpreter & network layer to produce a single unit test
- [x] I think we can make this a monadic property test easily


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
iohk-bors bot added a commit that referenced this issue Jul 30, 2020
1977: Test getNetworkInformation handling of PastHorizonException r=Anviking a=Anviking

# Issue Number

#1869 /  #1960


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] Added a mock interpreter & network layer to produce a single unit test
- [x] I think we can make this a monadic property test easily


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
iohk-bors bot added a commit that referenced this issue Jul 30, 2020
1977: Test getNetworkInformation handling of PastHorizonException r=Anviking a=Anviking

# Issue Number

#1869 /  #1960


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] Added a mock interpreter & network layer to produce a single unit test
- [x] I think we can make this a monadic property test easily


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
iohk-bors bot added a commit that referenced this issue Jul 30, 2020
1977: Test getNetworkInformation handling of PastHorizonException r=Anviking a=Anviking

# Issue Number

#1869 /  #1960


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] Added a mock interpreter & network layer to produce a single unit test
- [x] I think we can make this a monadic property test easily


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
iohk-bors bot added a commit that referenced this issue Jul 31, 2020
1977: Test getNetworkInformation handling of PastHorizonException r=Anviking a=Anviking

# Issue Number

#1869 /  #1960


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [x] Added a mock interpreter & network layer to produce a single unit test
- [x] I think we can make this a monadic property test easily


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants