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

chore: bump @intersect.mbo/pdf-ui to v0.5.2 #2462

Merged
merged 25 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
069c930
chore: add function to encode CIP 129 identifier
kneerose Nov 25, 2024
3e12546
test: assert CIP129 and govActionId on details page
kneerose Nov 25, 2024
c424da1
chore: remove governance-action-setup dependencies form playwright pr…
kneerose Nov 26, 2024
565c2c0
chore: add proposal submission static wallet
kneerose Nov 26, 2024
1edd82b
chore: use proposal static wallet to submit governance action
kneerose Nov 26, 2024
ad1e5b2
fix: wrong dRep hash on dRep register
kneerose Nov 26, 2024
dd92daa
Merge pull request #2402 from IntersectMBO/tests/assert-govActionId
kneerose Nov 27, 2024
692f13d
clenup: remove unused governance action setup
kneerose Nov 27, 2024
2ba10f3
fix(#2407): fix fetching voting power for newly registered DRep
MSzalowski Nov 27, 2024
e460c30
chore: remove proposalSubmission faucet wallet json file
kneerose Nov 28, 2024
29f653c
chore: retrieve proposal faucet wallet keys from environment variables
kneerose Nov 28, 2024
435664d
Merge pull request #2432 from IntersectMBO/feat/proposal-faucet-setup
kneerose Nov 28, 2024
fe972a9
chore: remove unneded unregistered stake key addresses warning
MSzalowski Nov 28, 2024
605ca12
Merge pull request #2439 from IntersectMBO/chore/dummy-commit
MSzalowski Nov 28, 2024
539b3cf
chore: reorder exports of pages
MSzalowski Nov 28, 2024
4c80fa9
Merge pull request #2440 from IntersectMBO/chore/dummy-commit
mpavlovicbb Nov 28, 2024
2dc965a
remove default value
mpavlovicbb Nov 28, 2024
012c791
Merge pull request #2441 from IntersectMBO/default-value-off
mpavlovicbb Nov 28, 2024
437cd48
Merge pull request #2434 from IntersectMBO/fix/2407-something-went-wr…
MSzalowski Nov 29, 2024
e68c943
fix(#1713): fix inconsistent voting status
MSzalowski Nov 27, 2024
5d433b7
Merge pull request #2433 from IntersectMBO/fix/1713-bug-inconsistent-…
MSzalowski Nov 29, 2024
a12a4f4
chore: bump @intersect.mbo/pdf-ui to v0.5.2
MSzalowski Dec 3, 2024
3b2b867
Merge pull request #2452 from IntersectMBO/chore/bump-pdf-ui-to-v0.5.2
MSzalowski Dec 3, 2024
b29a86c
Merge pull request #2454 from IntersectMBO/develop
MSzalowski Dec 3, 2024
b0af65a
Merge pull request #2455 from IntersectMBO/test
MSzalowski Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test_integration_playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ jobs:
NETWORK: ${{vars.NETWORK}}
FAUCET_ADDRESS: ${{vars.FAUCET_ADDRESS}}
CARDANOAPI_METADATA_URL: ${{vars.CARDANOAPI_METADATA_URL}}
PROPOSAL_FAUCET_PAYMENT_PRIVATE: ${{secrets.PROPOSAL_FAUCET_PAYMENT_PRIVATE}}
PROPOSAL_FAUCET_STAKE_PRIVATE: ${{secrets.PROPOSAL_FAUCET_STAKE_PRIVATE}}

publish-report:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ changes.

### Fixed

-
- Fix fetching voting power of newly registerd DRep [Issue 2407](https://github.com/IntersectMBO/govtool/issues/2407)
- Fix inconsistent voting status [Issue 1713](https://github.com/IntersectMBO/govtool/issues/1713)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion govtool/backend/sql/get-network-metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ SELECT
total_gov_action_proposals.count as total_gov_action_proposals,
total_drep_votes.count as total_drep_votes,
total_registered_dreps.unique_registrations as total_registered_dreps,
total_stake_controlled_by_dreps.total as total_stake_controlled_by_dreps,
COALESCE(total_stake_controlled_by_dreps.total, 0) as total_stake_controlled_by_dreps,
total_active_dreps.unique_active_drep_registrations as total_active_dreps,
total_inactive_dreps.total_inactive_dreps as total_inactive_dreps,
total_active_cip119_compliant_dreps.unique_active_cip119_compliant_drep_registrations as total_active_cip119_compliant_dreps,
Expand Down
10 changes: 9 additions & 1 deletion govtool/backend/sql/get-transaction-status.sql
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
select exists (select * from tx where tx.hash = decode(?, 'hex'))
SELECT
EXISTS (SELECT 1 FROM tx WHERE tx.hash = decode(?, 'hex')) AS tx_exists,
COALESCE(
(SELECT json_agg(voting_procedure.*)
FROM voting_procedure
JOIN tx ON voting_procedure.tx_id = tx.id
WHERE tx.hash = decode(?, 'hex')
), '[]'::json
) AS voting_procedures;
2 changes: 1 addition & 1 deletion govtool/backend/sql/get-voting-power.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
select sum(uv.value) as amount
select coalesce(sum(uv.value), 0) as amount
from utxo_view uv
join delegation_vote dv on uv.stake_address_id = dv.addr_id
join drep_hash dh on dv.drep_hash_id = dh.id
Expand Down
12 changes: 6 additions & 6 deletions govtool/backend/src/VVA/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Control.Exception (throw, throwIO)
import Control.Monad.Except (runExceptT, throwError)
import Control.Monad.Reader

import Data.Aeson (Value(..), Array, decode, encode, FromJSON, ToJSON)
import Data.Aeson (Value(..), Array, decode, encode, FromJSON, ToJSON, toJSON)
import Data.Bool (Bool)
import Data.List (sortOn)
import qualified Data.Map as Map
Expand Down Expand Up @@ -416,11 +416,11 @@ getCurrentEpochParams = do

getTransactionStatus :: App m => HexText -> m GetTransactionStatusResponse
getTransactionStatus (unHexText -> transactionId) = do
x <- Transaction.getTransactionStatus transactionId
case x of
Types.TransactionConfirmed -> return $ GetTransactionStatusResponse True
Types.TransactionUnconfirmed -> return $ GetTransactionStatusResponse False

status <- Transaction.getTransactionStatus transactionId
return $ GetTransactionStatusResponse $ case status of
Just value -> Just $ toJSON value
Nothing -> Nothing
throw500 :: App m => m ()
throw500 = throwError $ CriticalError "intentional system break for testing purposes"

Expand Down
32 changes: 14 additions & 18 deletions govtool/backend/src/VVA/API/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -651,29 +651,26 @@ instance ToSchema GetProposalResponse where
?~ toJSON exampleGetProposalResponse

newtype GetTransactionStatusResponse
= GetTransactionStatusResponse { getTransactionstatusResponseTransactionConfirmed :: Bool }
deriving (Generic, Show)
= GetTransactionStatusResponse { getTransactionStatusResponse :: Maybe Value }
deriving newtype (Show)

instance FromJSON GetTransactionStatusResponse where
parseJSON = pure . GetTransactionStatusResponse . Just

deriveJSON (jsonOptions "getTransactionstatusResponse") ''GetTransactionStatusResponse
instance ToJSON GetTransactionStatusResponse where
toJSON (GetTransactionStatusResponse Nothing) = Null
toJSON (GetTransactionStatusResponse (Just status)) = toJSON status

exampleGetTransactionStatusResponse :: Text
exampleGetTransactionStatusResponse = "{ \"transactionConfirmed\": True }"
exampleGetTransactionStatusResponse =
"{ \"transactionConfirmed\": True, \"votingProcedure\": {\"vote\": \"yes\"}}"

instance ToSchema GetTransactionStatusResponse where
declareNamedSchema proxy = do
NamedSchema name_ schema_ <-
genericDeclareNamedSchema
( fromAesonOptions $
jsonOptions "getTransactionstatusResponse"
)
proxy
return $
NamedSchema name_ $
schema_
& description ?~ "GetTransactionStatus Response"
& example
?~ toJSON exampleGetTransactionStatusResponse
declareNamedSchema _ = pure $ NamedSchema (Just "GetTransactionStatusResponse") $ mempty
& type_ ?~ OpenApiObject
& description ?~ "Transaction status encoded as JSON"
& example
?~ toJSON exampleGetTransactionStatusResponse

newtype DRepHash
= DRepHash Text
Expand Down Expand Up @@ -923,4 +920,3 @@ instance ToSchema GetNetworkMetricsResponse where
& description ?~ "GetNetworkMetricsResponse"
& example
?~ toJSON exampleGetNetworkMetricsResponse

12 changes: 7 additions & 5 deletions govtool/backend/src/VVA/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import Data.Has (Has)
import Data.String (fromString)
import Data.Text (Text, pack, unpack)
import qualified Data.Text.Encoding as Text
import qualified Data.Text.IO as Text
import Data.Maybe (fromMaybe)

import qualified Database.PostgreSQL.Simple as SQL

Expand All @@ -31,10 +33,10 @@ getTransactionStatusSql = sqlFrom $(embedFile "sql/get-transaction-status.sql")
getTransactionStatus ::
(Has ConnectionPool r, Has VVAConfig r, MonadReader r m, MonadIO m, MonadError AppError m)
=> Text
-> m TransactionStatus
-> m (Maybe TransactionStatus)
getTransactionStatus transactionId = withPool $ \conn -> do
result <- liftIO $ SQL.query conn getTransactionStatusSql (SQL.Only transactionId)
result <- liftIO $ SQL.query conn getTransactionStatusSql (transactionId, transactionId)
case result of
[SQL.Only True] -> return TransactionConfirmed
[SQL.Only False] -> return TransactionUnconfirmed
x -> throwError $ CriticalError ("Expected exactly one result from get-transaction-status.sql but got " <> pack (show (length x)) <> " of them. This should never happen")
[(transactionConfirmed, votingProcedure)] -> do
return $ Just $ TransactionStatus transactionConfirmed votingProcedure
_ -> return Nothing
18 changes: 16 additions & 2 deletions govtool/backend/src/VVA/Types.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
Expand All @@ -14,7 +15,7 @@ import Control.Monad.Fail (MonadFail)
import Control.Monad.IO.Class (MonadIO)
import Control.Monad.Reader (MonadReader)

import Data.Aeson (Value)
import Data.Aeson (Value, ToJSON (..), object, (.=))
import qualified Data.Cache as Cache
import Data.Has
import Data.Pool (Pool)
Expand Down Expand Up @@ -184,7 +185,20 @@ instance FromRow Proposal where
<*> field
<*> field

data TransactionStatus = TransactionConfirmed | TransactionUnconfirmed
data TransactionStatus = TransactionStatus
{ transactionConfirmed :: Bool
, votingProcedure :: Maybe Value
}

instance FromRow TransactionStatus where
fromRow = TransactionStatus <$> field <*> field

instance ToJSON TransactionStatus where
toJSON TransactionStatus {transactionConfirmed, votingProcedure} =
object
[ "transactionConfirmed" .= transactionConfirmed
, "votingProcedure" .= votingProcedure
]

data CacheEnv
= CacheEnv
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/Dockerfile.qovery
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG VITE_NETWORK_FLAG=0
ARG VITE_SENTRY_DSN
ARG NPMRC_TOKEN
ARG VITE_USERSNAP_SPACE_API_KEY
ARG VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED='true'
ARG VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED
ARG VITE_PDF_API_URL

ENV NODE_OPTIONS=--max_old_space_size=8192
Expand Down
Loading
Loading