Skip to content

Commit 4d1d28d

Browse files
authored
Merge pull request #2496 from IntersectMBO/develop
GovTool - v1.0.30
2 parents f3ecac2 + 60c5196 commit 4d1d28d

File tree

64 files changed

+6419
-34298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+6419
-34298
lines changed

.github/workflows/code_check_frontend.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ jobs:
3434
NODE_AUTH_TOKEN: ${{ secrets.NPMRC_TOKEN }}
3535

3636
- name: 🧪 Test
37-
env:
38-
NODE_OPTIONS: "--max_old_space_size=8192"
3937
run: |
4038
npm run test
4139

.github/workflows/frontend_sonar_scan.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ jobs:
3131
- name: 🧪 Test
3232
working-directory: govtool/frontend
3333
env:
34-
NODE_OPTIONS: "--max_old_space_size=6144"
3534
NODE_AUTH_TOKEN: ${{ secrets.NPMRC_TOKEN }}
3635
run: |
3736
npm ci

.github/workflows/test_storybook.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19-
- uses: actions/setup-node@v3
19+
- uses: actions/setup-node@v4
2020
with:
21-
node-version: 16
21+
node-version-file: "govtool/frontend/.nvmrc"
2222
- name: Install dependencies
2323
run: |
2424
npm config set @intersect.mbo:registry "https://registry.npmjs.org/" --location=global
@@ -27,7 +27,7 @@ jobs:
2727
- name: Install Playwright
2828
run: npx playwright install --with-deps
2929
- name: Build Storybook
30-
run: NODE_OPTIONS="--max-old-space-size=8046" npm run build:storybook --quiet
30+
run: npm run build:storybook --quiet
3131
- name: Serve Storybook and run tests
3232
run: |
3333
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,26 @@ changes.
2626

2727
-
2828

29+
## [v1.0.30](https://github.com/IntersectMBO/govtool/releases/tag/v1.0.30) 2024-12-10
30+
31+
### Added
32+
33+
- Add stake key registration certificate to voting and gov action proposal if not registered [Issue 2490](https://github.com/IntersectMBO/govtool/issues/2490)
34+
35+
### Fixed
36+
37+
- Fix vulnerabilities in dependencies [Issue 2192](https://github.com/IntersectMBO/govtool/issues/2192)
38+
- Optimize resources usage in frontend service build [Issue 2192](https://github.com/IntersectMBO/govtool/issues/2192)
39+
- Fix sentry reports on multiple reloads of Governance Actions [Issue 2446](https://github.com/IntersectMBO/govtool/issues/2446)
40+
41+
### Changed
42+
43+
-
44+
45+
### Removed
46+
47+
-
48+
2949
## [v1.0.29](https://github.com/IntersectMBO/govtool/releases/tag/v1.0.29) 2024-12-05
3050

3151
### Added

govtool/backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG
44
WORKDIR /src
55
COPY . .
66
RUN cabal build
7-
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.29/x/vva-be/build/vva-be/vva-be /usr/local/bin
7+
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.30/x/vva-be/build/vva-be/vva-be /usr/local/bin

govtool/backend/Dockerfile.qovery

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG
44
WORKDIR /src
55
COPY . .
66
RUN cabal build
7-
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.29/x/vva-be/build/vva-be/vva-be /usr/local/bin
7+
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.30/x/vva-be/build/vva-be/vva-be /usr/local/bin
88

99
# Expose the necessary port
1010
EXPOSE 9876

govtool/backend/app/Main.hs

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
module Main where
1010

11-
import Control.Exception (Exception, SomeException, fromException, throw)
11+
import Control.Exception (IOException, Exception, SomeException, fromException, throw)
1212
import Control.Lens.Operators ((.~))
1313
import Control.Monad
1414
import Control.Monad.IO.Class
@@ -21,6 +21,7 @@ import Data.ByteString.Char8 (unpack)
2121
import qualified Data.Cache as Cache
2222
import Data.Function ((&))
2323
import Data.Has (getter)
24+
import Data.List (isInfixOf)
2425
import Data.Monoid (mempty)
2526
import Data.OpenApi (OpenApi, Server (Server), _openApiServers,
2627
_serverDescription, _serverUrl, _serverVariables,
@@ -88,7 +89,8 @@ startApp vvaConfig sentryService = do
8889
settings =
8990
setPort vvaPort
9091
$ setHost vvaHost
91-
$ setTimeout 120 -- 120 seconds timeout
92+
$ setTimeout 300-- 300 seconds timeout
93+
$ setGracefulShutdownTimeout (Just 60) -- Allow 60 seconds for cleanup
9294
$ setBeforeMainLoop
9395
( Text.hPutStrLn stderr $
9496
Text.pack
@@ -130,25 +132,39 @@ startApp vvaConfig sentryService = do
130132

131133
exceptionHandler :: VVAConfig -> SentryService -> Maybe Request -> SomeException -> IO ()
132134
exceptionHandler vvaConfig sentryService mRequest exception = do
133-
print mRequest
134135
print exception
136+
-- These are not considered application errors
137+
-- They represent the client closing the connection prematurely
138+
-- or the timeout thread being killed by WARP
135139
let isNotTimeoutThread x = case fromException x of
136140
Just TimeoutThread -> False
137141
_ -> True
138142
isNotConnectionClosedByPeer x = case fromException x of
139143
Just ConnectionClosedByPeer -> False
140144
_ -> True
141-
guard . isNotTimeoutThread $ exception
142-
guard . isNotConnectionClosedByPeer $ exception
143-
let env = sentryEnv vvaConfig
144-
register
145-
sentryService
146-
"vva.be"
147-
Error
148-
(formatMessage mRequest exception)
149-
(recordUpdate env mRequest exception)
145+
isNotClientClosedConnection x =
146+
case fromException x of
147+
Just ioe -> not ("Warp: Client closed connection prematurely" `isInfixOf` show (ioe :: IOException))
148+
Nothing -> True
149+
isNotThreadKilledByTimeoutManager x =
150+
"Thread killed by timeout manager" `notElem` lines (show x)
151+
shouldSkipError =
152+
isNotTimeoutThread exception &&
153+
isNotConnectionClosedByPeer exception &&
154+
isNotClientClosedConnection exception &&
155+
isNotThreadKilledByTimeoutManager exception
150156

157+
guard shouldSkipError
151158

159+
let env = sentryEnv vvaConfig
160+
case mRequest of
161+
Nothing -> return ()
162+
Just _ -> register
163+
sentryService
164+
"vva.be"
165+
Error
166+
(formatMessage mRequest exception)
167+
(recordUpdate env mRequest exception)
152168

153169
formatMessage :: Maybe Request -> SomeException -> String
154170
formatMessage Nothing exception = "Exception before request could be parsed: " ++ show exception

govtool/backend/sql/list-proposals.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ SELECT
105105
encode(creator_tx.hash, 'hex'),
106106
gov_action_proposal.index,
107107
gov_action_proposal.type::text,
108-
(
108+
COALESCE(
109109
case when gov_action_proposal.type = 'TreasuryWithdrawals' then
110110
(
111111
select json_agg(
@@ -159,7 +159,7 @@ SELECT
159159
else
160160
null
161161
end
162-
) as description,
162+
, '{}'::json) as description,
163163
CASE
164164
WHEN meta.network_name::text = 'mainnet' OR meta.network_name::text = 'preprod' THEN
165165
latest_epoch.start_time + (gov_action_proposal.expiration - latest_epoch.no)::bigint * INTERVAL '5 days'

govtool/backend/src/VVA/API.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Control.Exception (throw, throwIO)
1313
import Control.Monad.Except (runExceptT, throwError)
1414
import Control.Monad.Reader
1515

16-
import Data.Aeson (Value(..), Array, decode, encode, FromJSON, ToJSON, toJSON)
16+
import Data.Aeson (Value(..), Array, decode, encode, ToJSON, toJSON)
1717
import Data.Bool (Bool)
1818
import Data.List (sortOn)
1919
import qualified Data.Map as Map

govtool/backend/src/VVA/Proposal.hs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
{-# LANGUAGE FlexibleContexts #-}
2-
{-# LANGUAGE LambdaCase #-}
3-
{-# LANGUAGE OverloadedStrings #-}
4-
{-# LANGUAGE RecordWildCards #-}
5-
{-# LANGUAGE TemplateHaskell #-}
6-
{-# LANGUAGE TypeApplications #-}
1+
{-# LANGUAGE FlexibleContexts #-}
2+
{-# LANGUAGE LambdaCase #-}
3+
{-# LANGUAGE OverloadedStrings #-}
4+
{-# LANGUAGE RecordWildCards #-}
5+
{-# LANGUAGE TemplateHaskell #-}
6+
{-# LANGUAGE TypeApplications #-}
7+
{-# LANGUAGE ScopedTypeVariables #-}
78

89
module VVA.Proposal where
910

10-
import Control.Exception (throw)
11+
import Control.Exception (throw, SomeException, try)
1112
import Control.Monad.Except (MonadError, throwError)
1213
import Control.Monad.Reader
1314

@@ -70,11 +71,17 @@ getProposals ::
7071
Maybe [Text] -> m [Proposal]
7172
getProposals mSearchTerms = withPool $ \conn -> do
7273
let searchParam = maybe "" head mSearchTerms
73-
liftIO $ SQL.query conn listProposalsSql
74-
( searchParam
75-
, "%" <> searchParam <> "%"
76-
, "%" <> searchParam <> "%"
77-
, "%" <> searchParam <> "%"
78-
, "%" <> searchParam <> "%"
79-
, "%" <> searchParam <> "%"
80-
)
74+
liftIO $ do
75+
result <- try $ SQL.query conn listProposalsSql
76+
( searchParam
77+
, "%" <> searchParam <> "%"
78+
, "%" <> searchParam <> "%"
79+
, "%" <> searchParam <> "%"
80+
, "%" <> searchParam <> "%"
81+
, "%" <> searchParam <> "%"
82+
)
83+
case result of
84+
Left (e :: SomeException) -> do
85+
return []
86+
Right rows -> do
87+
return rows

0 commit comments

Comments
 (0)