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

Exception multiple voting power entries for stake key: e12dc5c13fc0d978cc770a34cf170428a7ca3234f8... #2777

Open
sentry-io bot opened this issue Jan 28, 2025 · 1 comment
Assignees
Labels
🐛 Bug Something isn't working

Comments

@sentry-io
Copy link

sentry-io bot commented Jan 28, 2025

Sentry Issue: GOVTOOL-BACKEND-1D5

Exception multiple voting power entries for stake key: e12dc5c13fc0d978cc770a34cf170428a7ca3234f883a56e647e61d03b
CallStack (from HasCallStack):
  error, called at src/VVA/AdaHolder.hs:63:12 in vva-be-2.0.9-inplace:VVA.AdaHolder while handling request Request {requestMethod = "GET", httpVersion = HTTP/1.1, rawPathInfo = "/ada-holder/get-voting-power/e12dc5c13fc0d978cc770a34cf170428a7ca3234f883a56e647e61d03b", rawQueryString = "", requestHeaders = [("Host","be.gov.tools"),("X-Request-ID","68957a911f7fbcc13eaa42f34968f079"),("X-Real-IP","109.245.207.253"),("X-Forwarded-For","109.245.207.253"),("X-Forwarded-Host","be.gov.tools"),("X-Forwarded-Port","443"),("X-Forwarded-Proto","https"),("X-Forwarded-Scheme","https"),("X-Scheme","https"),("sec-ch-ua-platform","\"macOS\""),("user-agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"),("accept","application/json, text/plain, */*"),("sec-ch-ua","\"Google Chrome\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\""),("sec-ch-ua-mobile","?0"),("origin","https://gov.tools"),("sec-fetch-site","same-site"),("sec-fetch-mode","cors"),("sec-fetch-dest","empty"),("referer","https://gov.tools/"),("accept-encoding","gzip, deflate, br, zstd"),("accept-language","en-GB,en-US;q=0.9,en;q=0.8"),("priority","u=1, i")], isSecure = False, remoteHost = 10.0.43.78:41162, pathInfo = ["ada-holder","get-voting-power","e12dc5c13fc0d978cc770a34cf170428a7ca3234f883a56e647e61d03b"], queryString = [], requestBody = <IO ByteString>, vault = <Vault>, requestBodyLength = KnownLength 0, requestHeaderHost = Just "be.gov.tools", requestHeaderRange = Nothing}
@sentry-io sentry-io bot added the 🐛 Bug Something isn't working label Jan 28, 2025
@mesudip
Copy link
Contributor

mesudip commented Jan 28, 2025

getStakeKeyVotingPower stakeKey = withPool $ \conn -> do
  liftIO $ do
    result <- try $ SQL.query @_ @(Scientific, ByteString) conn getVotingPowerSql (SQL.Only stakeKey)
    case result of
      Left (e :: SomeException) -> do
        Text.putStrLn ("couldn't fetch voting power for stake key: " <> stakeKey)
        return 0
      Right [(votingPower,_)] -> return $ floor votingPower
      _ -> error ("multiple voting power entries for stake key: " <> unpack stakeKey)

When stake key is missing error message is multiple voting power entries for stake key.

Expected

  • voting power should be 0 when stake key is not present in database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
Status: No status
Status: No status
Development

No branches or pull requests

2 participants