Skip to content

[Human app] Add proposals endpoint and update frontend - #3509

Merged
flopez7 merged 9 commits into
developfrom
feat/human-app-server/governance
Aug 22, 2025
Merged

[Human app] Add proposals endpoint and update frontend#3509
flopez7 merged 9 commits into
developfrom
feat/human-app-server/governance

Conversation

@flopez7

@flopez7 flopez7 commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

Issue tracking

#3444

Context behind the change

  • Add governance module with new endpoint for getting active and pending proposals and cache them.
  • Update frontend to query new endpoint instead of querying RPC.
  • Show pending proposals in banner too.

How has this been tested?

Deployed locally on testnet

Release plan

  • Add new GOVERNANCE_RPC_URL and GOVERNOR_ADDRESS to Server
  • Remove GOVERNOR_ADDRESS from Frontend

Potential risks; What to monitor; Rollback plan

None

@flopez7
flopez7 requested a review from dnechay August 14, 2025 14:18
@flopez7 flopez7 self-assigned this Aug 14, 2025
@vercel

vercel Bot commented Aug 14, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
human-app Ready Ready Preview Comment Aug 20, 2025 2:35pm
4 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
faucet-frontend Ignored Ignored Preview Aug 20, 2025 2:35pm
faucet-server Ignored Ignored Preview Aug 20, 2025 2:35pm
human-dashboard-frontend Skipped Skipped Aug 20, 2025 2:35pm
staking-dashboard Skipped Skipped Aug 20, 2025 2:35pm

@vercel
vercel Bot temporarily deployed to Preview – human-app August 14, 2025 14:21 Inactive
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard August 14, 2025 14:21 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend August 14, 2025 14:21 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend August 14, 2025 14:22 Inactive
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard August 14, 2025 14:22 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-app August 14, 2025 14:22 Inactive
@flopez7 flopez7 changed the title [Human app][Server] Add governance module [Human app][Server][render preview] Add governance module Aug 15, 2025
@portuu3
portuu3 temporarily deployed to feat/human-app-server/governance - stg-human-app-server PR #3509 August 15, 2025 08:15 — with Render Destroyed
@flopez7 flopez7 changed the title [Human app][Server][render preview] Add governance module [Human app][Server] Add governance module Aug 15, 2025
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard August 15, 2025 11:32 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend August 15, 2025 11:32 Inactive
@flopez7 flopez7 changed the title [Human app][Server] Add governance module [Human app] Add proposals endpoint and update frontend Aug 15, 2025
Comment thread packages/apps/human-app/server/src/common/config/environment-config.service.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.module.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.module.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/model/governance.model.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend August 19, 2025 09:22 Inactive
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard August 19, 2025 09:22 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-app August 19, 2025 09:30 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend August 19, 2025 09:30 Inactive
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard August 19, 2025 09:30 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend August 19, 2025 09:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-app August 19, 2025 09:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard August 19, 2025 09:31 Inactive
@flopez7
flopez7 requested a review from dnechay August 19, 2025 09:33

@dnechay dnechay left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better now!

  1. please check logger usage examples
  2. there is still a case w/ 2+ concurrent requests where you access cache from them and can get invalid state
  3. one comment from prev review

Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard August 19, 2025 16:10 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend August 19, 2025 16:10 Inactive
@flopez7
flopez7 requested a review from dnechay August 19, 2025 16:30

@dnechay dnechay left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks way better and easier to understand now!

Some minor comments left.

Please also implement some safety-belt for getProposals to run only once in case of concurrent requests. Ideally - it should be a cron job to scan logs for new proposals and actualize data in cache and getProposals just to retrieve data from cache to return to the client

Comment thread packages/apps/human-app/frontend/src/shared/utils/time.ts Outdated
Comment thread packages/apps/human-app/frontend/src/shared/utils/time.ts Outdated
Comment thread packages/apps/human-app/server/src/common/utils/cache.ts Outdated
Comment thread packages/apps/human-app/frontend/src/shared/utils/time.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
Comment thread packages/apps/human-app/server/src/modules/governance/governance.service.ts Outdated
@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard August 20, 2025 14:32 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend August 20, 2025 14:32 Inactive
@flopez7
flopez7 requested a review from dnechay August 20, 2025 14:33

@dnechay dnechay left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code lgtm

@flopez7 what about concurrent requests that will call getProposals?

@flopez7

flopez7 commented Aug 21, 2025

Copy link
Copy Markdown
Contributor Author

Concurrent requests are fine. It’s read-only and cached; worst case we duplicate work and last write wins. No correctness risk (merge by proposalId, only PENDING/ACTIVE). We only advance lastScannedBlock after successful event fetch. Anyway, this is just an optimization, previously we did per-user requests on frontend and now it’s cached on server-side.

@dnechay

dnechay commented Aug 21, 2025

Copy link
Copy Markdown
Collaborator

Sounds legit, concurrency shouldn't be an issue for now.

I suppose that we are not going to have many active/pending proposals, so won't have to actualize their state as well by going to RPC.
If the above is correct and we won't be hitting RPC too much - it's good to go

@flopez7
flopez7 merged commit ac22e7e into develop Aug 22, 2025
13 checks passed
@flopez7
flopez7 deleted the feat/human-app-server/governance branch August 22, 2025 07:50
@flopez7 flopez7 mentioned this pull request Aug 22, 2025
10 tasks
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 this pull request may close these issues.

3 participants