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

Sancho-v1.0.12 #1660

Merged
merged 22 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c38f2aa
fix(#1132): change link to propose a governance action docs
MSzalowski Jul 30, 2024
a730427
Merge pull request #1634 from IntersectMBO/fix/1132-propose-a-governa…
MSzalowski Jul 30, 2024
46b47c7
fix(#1130): change DRep docs links
MSzalowski Jul 30, 2024
fe865b5
Merge pull request #1635 from IntersectMBO/fix/1130-amend-copy-on-dre…
MSzalowski Jul 30, 2024
ba1d127
fix(#1131): change link to view governance action docs
MSzalowski Jul 30, 2024
6d3b148
Merge pull request #1636 from IntersectMBO/fix/1131-write-page-on-gas…
MSzalowski Jul 30, 2024
bbb3ef9
feat(#1644): provide network name to network metrics endpoint
MSzalowski Jul 31, 2024
ef37cd1
Merge pull request #1645 from IntersectMBO/feat/1644-provide-network-…
MSzalowski Jul 31, 2024
7bccd0a
chore: make all the frontend build arguments mandatory
MSzalowski Jul 31, 2024
a6c38ba
Merge pull request #1647 from IntersectMBO/chore/make-frontend-build-…
MSzalowski Jul 31, 2024
bc73ac2
fix!: remove usage of metadata validation service in Haskell Backend
MSzalowski Jul 31, 2024
cf57b40
chore: remove metadata validation config options for Haskell backend
MSzalowski Jul 31, 2024
8210586
chore: remove references from proposals
MSzalowski Jul 31, 2024
2373433
chore: remove tls manager causing timeout errors
MSzalowski Jul 31, 2024
227e4ec
chore: make validate api adjustments
MSzalowski Jul 31, 2024
8acaa8e
fix: move validation requests to frontend service fixing metadatas
MSzalowski Aug 1, 2024
95f2167
chore: infrastructure adjustments of metadata-validation service usage
MSzalowski Aug 1, 2024
e56f7ef
fix: fix ts erorrs
MSzalowski Aug 1, 2024
7e01cad
fix: fix argument name in dockerfile
MSzalowski Aug 1, 2024
a7101aa
Merge pull request #1649 from IntersectMBO/fix/1623-call-to-metadata-…
MSzalowski Aug 1, 2024
e43c4a9
chore: bump GovTool version to v1.0.12
MSzalowski Aug 1, 2024
24e1ec2
Merge pull request #1659 from IntersectMBO/chore/bump-govtool-to-v1.0.12
MSzalowski Aug 1, 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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ changes.

-

## [sancho-v1.0.12](https://github.com/IntersectMBO/govtool/releases/tag/sancho-v1.0.12) 2024-08-01

### Added

- Add network name to GET /network/metrics [Issue 1644](https://github.com/IntersectMBO/govtool/issues/1644)

### Fixed

- Fix displaying Governance Action & DRep metadatas

### Changed

- Change link to propose a governace action docs [Issue 1132](https://github.com/IntersectMBO/govtool/issues/1132)
- Change link to docs regarding DReps [Issue 1130](https://github.com/IntersectMBO/govtool/issues/1130)
- Change link to view governance actions docs [Issue 1131](https://github.com/IntersectMBO/govtool/issues/1131)
- Make all the frontend build arguments mandatory [Issue 1642](https://github.com/IntersectMBO/govtool/issues/1642), [Issue 1643](https://github.com/IntersectMBO/govtool/issues/1643)
- Breaking! Remove usage of metadata validation service in Haskell Backend

## [sancho-v1.0.11](https://github.com/IntersectMBO/govtool/releases/tag/sancho-v1.0.11) 2024-07-30

### Added
Expand Down
2 changes: 1 addition & 1 deletion govtool/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG
WORKDIR /src
COPY . .
RUN cabal build
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.11/x/vva-be/build/vva-be/vva-be /usr/local/bin
RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.12/x/vva-be/build/vva-be/vva-be /usr/local/bin
12 changes: 2 additions & 10 deletions govtool/backend/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

module Main where

import Control.Concurrent.QSem (newQSem)
import Control.Exception (Exception, SomeException, fromException, throw)
import Control.Lens.Operators ((.~))
import Control.Monad
Expand Down Expand Up @@ -38,8 +37,6 @@ import qualified Data.Text.Lazy.Encoding as LazyText

import Database.PostgreSQL.Simple (close, connectPostgreSQL)

import Network.HTTP.Client hiding (Proxy, Request)
import Network.HTTP.Client.TLS
import Network.Wai
import Network.Wai.Handler.Warp
import Network.Wai.Middleware.Cors
Expand Down Expand Up @@ -85,6 +82,7 @@ startApp vvaConfig = do
settings =
setPort vvaPort
$ setHost vvaHost
$ setTimeout 60 -- 60 seconds timeout
$ setBeforeMainLoop
( Text.hPutStrLn stderr $
Text.pack
Expand All @@ -107,8 +105,6 @@ startApp vvaConfig = do
dRepVotingPowerCache <- newCache
dRepListCache <- newCache
networkMetricsCache <- newCache
proposalMetadataValidationCache <- newCache
dRepMetadataValidationCache <- newCache
return $ CacheEnv
{ proposalListCache
, getProposalCache
Expand All @@ -120,13 +116,9 @@ startApp vvaConfig = do
, dRepVotingPowerCache
, dRepListCache
, networkMetricsCache
, proposalMetadataValidationCache
, dRepMetadataValidationCache
}
connectionPool <- createPool (connectPostgreSQL (encodeUtf8 (dbSyncConnectionString $ getter vvaConfig))) close 1 1 60
vvaTlsManager <- newManager tlsManagerSettings
qsem <- newQSem (metadataValidationMaxConcurrentRequests vvaConfig)
let appEnv = AppEnv {vvaConfig=vvaConfig, vvaCache=cacheEnv, vvaConnectionPool=connectionPool, vvaTlsManager, vvaMetadataQSem=qsem}
let appEnv = AppEnv {vvaConfig=vvaConfig, vvaCache=cacheEnv, vvaConnectionPool=connectionPool }
server' <- mkVVAServer appEnv
runSettings settings server'

Expand Down
8 changes: 2 additions & 6 deletions govtool/backend/example-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
"host" : "localhost",
"dbname" : "cexplorer",
"user" : "postgres",
"password" : "v8hlDV0yMAHHlIurYupj",
"password" : "postgres",
"port" : 5432
},
"port" : 9999,
"host" : "localhost",
"cachedurationseconds": 20,
"sentrydsn": "https://username:[email protected]/id",
"sentryenv": "dev",
"metadatavalidationenabled": true,
"metadatavalidationhost": "localhost",
"metadatavalidationport": 3001,
"metadatavalidationmaxconcurrentrequests": 10
"sentryenv": "dev"
}
4 changes: 3 additions & 1 deletion govtool/backend/sql/get-network-metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ SELECT
total_drep_votes.count,
total_registered_dreps.count,
always_abstain_voting_power.amount,
always_no_confidence_voting_power.amount
always_no_confidence_voting_power.amount,
network_name
FROM
current_epoch
CROSS JOIN current_block
Expand All @@ -82,3 +83,4 @@ FROM
CROSS JOIN total_registered_dreps
CROSS JOIN always_abstain_voting_power
CROSS JOIN always_no_confidence_voting_power
CROSS JOIN meta;
113 changes: 113 additions & 0 deletions govtool/backend/sql/list-proposals-my.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
WITH LatestDrepDistr AS (
SELECT
*,
ROW_NUMBER() OVER (PARTITION BY hash_id ORDER BY epoch_no DESC) AS rn
FROM
drep_distr
),
EpochUtils AS (
SELECT
(Max(end_time) - Min(end_time)) / (Max(NO) - Min(NO)) AS epoch_duration,
Max(NO) AS last_epoch_no,
Max(end_time) AS last_epoch_end_time
FROM
epoch
),
always_no_confidence_voting_power AS (
SELECT
coalesce((
SELECT
amount
FROM drep_hash
LEFT JOIN drep_distr ON drep_hash.id = drep_distr.hash_id
WHERE
drep_hash.view = 'drep_always_no_confidence' ORDER BY epoch_no DESC LIMIT 1), 0) AS amount
),
always_abstain_voting_power AS (
SELECT
coalesce((
SELECT
amount
FROM drep_hash
LEFT JOIN drep_distr ON drep_hash.id = drep_distr.hash_id
WHERE
drep_hash.view = 'drep_always_abstain' ORDER BY epoch_no DESC LIMIT 1), 0) AS amount
)
SELECT
gov_action_proposal.id AS proposal_id,
encode(creator_tx.hash, 'hex') AS tx_hash,
gov_action_proposal.index,
gov_action_proposal.type::text,
CASE
WHEN gov_action_proposal.type = 'TreasuryWithdrawals' THEN
json_build_object('Reward Address', stake_address.view, 'Amount', treasury_withdrawal.amount)
WHEN gov_action_proposal.type::text = 'InfoAction' THEN
json_build_object()
ELSE
NULL
END AS description,
epoch_utils.last_epoch_end_time + epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no) AS expiry_date,
gov_action_proposal.expiration AS expiry_epoch_no,
creator_block.time AS created_date,
creator_block.epoch_no AS created_epoch_no,
voting_anchor.url,
encode(voting_anchor.data_hash, 'hex') AS metadata_hash,
off_chain_vote_gov_action_data.title,
off_chain_vote_gov_action_data.abstract,
off_chain_vote_gov_action_data.motivation,
off_chain_vote_gov_action_data.rationale,
coalesce(Sum(ldd.amount) FILTER (WHERE voting_procedure.vote::text = 'Yes'), 0) +
CASE
WHEN gov_action_proposal.type = 'NoConfidence' THEN always_no_confidence_voting_power.amount
ELSE 0
END AS yes_votes,
coalesce(Sum(ldd.amount) FILTER (WHERE voting_procedure.vote::text = 'No'), 0) +
CASE
WHEN gov_action_proposal.type = 'NoConfidence' THEN 0
ELSE always_no_confidence_voting_power.amount
END AS no_votes,
coalesce(Sum(ldd.amount) FILTER (WHERE voting_procedure.vote::text = 'Abstain'), 0) + always_abstain_voting_power.amount AS abstain_votes
FROM
gov_action_proposal
LEFT JOIN treasury_withdrawal ON gov_action_proposal.id = treasury_withdrawal.gov_action_proposal_id
LEFT JOIN stake_address ON stake_address.id = treasury_withdrawal.stake_address_id
CROSS JOIN EpochUtils AS epoch_utils
CROSS JOIN always_no_confidence_voting_power
CROSS JOIN always_abstain_voting_power
CROSS JOIN off_chain_vote_gov_action_data ON off_chain_vote_gov_action_data.off_chain_vote_data_id = off_chain_vote_data.id
JOIN tx AS creator_tx ON creator_tx.id = gov_action_proposal.tx_id
JOIN block AS creator_block ON creator_block.id = creator_tx.block_id
LEFT JOIN voting_anchor ON voting_anchor.id = gov_action_proposal.voting_anchor_id
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = voting_anchor.id
LEFT JOIN voting_procedure ON voting_procedure.gov_action_proposal_id = gov_action_proposal.id
LEFT JOIN LatestDrepDistr ldd ON ldd.hash_id = voting_procedure.drep_voter AND ldd.rn = 1
WHERE (NOT ?
OR (concat(encode(creator_tx.hash, 'hex'), '#', gov_action_proposal.index) IN ?))
AND gov_action_proposal.expiration > (
SELECT
Max(NO)
FROM
epoch)
AND gov_action_proposal.ratified_epoch IS NULL
AND gov_action_proposal.enacted_epoch IS NULL
AND gov_action_proposal.expired_epoch IS NULL
AND gov_action_proposal.dropped_epoch IS NULL
GROUP BY
(gov_action_proposal.id,
stake_address.view,
treasury_withdrawal.amount,
creator_block.epoch_no,
off_chain_vote_gov_action_data.title,
off_chain_vote_gov_action_data.abstract,
off_chain_vote_gov_action_data.motivation,
off_chain_vote_gov_action_data.rationale,
gov_action_proposal.index,
creator_tx.hash,
creator_block.time,
epoch_utils.epoch_duration,
epoch_utils.last_epoch_no,
epoch_utils.last_epoch_end_time,
voting_anchor.url,
voting_anchor.data_hash,
always_no_confidence_voting_power.amount,
always_abstain_voting_power.amount)
9 changes: 2 additions & 7 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,16 @@ SELECT
null
end
) as description,
epoch_utils.last_epoch_end_time + epoch_utils.epoch_duration *(gov_action_proposal.expiration - epoch_utils.last_epoch_no),
epoch_utils.last_epoch_end_time + epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no),
gov_action_proposal.expiration,
creator_block.time,
creator_block.epoch_no,
/* created date */
voting_anchor.url,
encode(voting_anchor.data_hash, 'hex'),
off_chain_vote_gov_action_data.title,
off_chain_vote_gov_action_data.abstract,
off_chain_vote_gov_action_data.motivation,
off_chain_vote_gov_action_data.rationale,
off_chain_vote_data.json,
off_chain_vote_data.json#>'{body, references}' as references,
coalesce(Sum(ldd.amount) FILTER (WHERE voting_procedure.vote::text = 'Yes'), 0) +(
CASE WHEN gov_action_proposal.type = 'NoConfidence' THEN
always_no_confidence_voting_power.amount
Expand All @@ -80,7 +77,6 @@ FROM
on gov_action_proposal.id = treasury_withdrawal.gov_action_proposal_id
LEFT JOIN stake_address
on stake_address.id = treasury_withdrawal.stake_address_id

CROSS JOIN EpochUtils AS epoch_utils
CROSS JOIN always_no_confidence_voting_power
CROSS JOIN always_abstain_voting_power
Expand Down Expand Up @@ -112,7 +108,6 @@ GROUP BY
off_chain_vote_gov_action_data.abstract,
off_chain_vote_gov_action_data.motivation,
off_chain_vote_gov_action_data.rationale,
off_chain_vote_data.json,
gov_action_proposal.index,
creator_tx.hash,
creator_block.time,
Expand All @@ -122,4 +117,4 @@ GROUP BY
voting_anchor.url,
voting_anchor.data_hash,
always_no_confidence_voting_power.amount,
always_abstain_voting_power.amount)
always_abstain_voting_power.amount)
Loading
Loading