Skip to content

Fix: deployment block input - #21

Open
marthendalnunes wants to merge 1 commit into
withtally:mainfrom
marthendalnunes:fix/deployment-block-input
Open

Fix: deployment block input#21
marthendalnunes wants to merge 1 commit into
withtally:mainfrom
marthendalnunes:fix/deployment-block-input

Conversation

@marthendalnunes

Copy link
Copy Markdown

Fixes #13

@vercel

vercel Bot commented Jun 13, 2024

Copy link
Copy Markdown
Contributor

@marthendalnunes is attempting to deploy a commit to the withtally Team on Vercel.

A member of the Team first needs to authorize it.

@crazyrabbitLTC crazyrabbitLTC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR!

@vercel

vercel Bot commented Dec 11, 2024

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tally-zero ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 10:15pm

gzeoneth referenced this pull request in OffchainLabs/tally-zero Mar 18, 2026
* feat: add election ABI definitions and vote schema

Add inline ABI arrays for NomineeElectionGovernor and
MemberElectionGovernor contracts, plus ERC20Votes getPastVotes.
Add electionVoteSchema for vote form validation.

* feat: add election write action forms

ContenderSignupForm: EIP-712 signing + addContender for registration.
ContenderVoteForm: vote for contenders during nominee selection.
NomineeVoteForm: vote for nominees during member election with
full-weight deadline display.

* feat: wire ElectionActionCard into election page

Phase-aware orchestrator renders the correct form based on
election phase: contender signup, contender voting, or nominee
voting. Integrated into ElectionContainer below the timeline grid.

* feat: add election phase override for nerd mode testing

Adds a nerd-mode-only toggle in Settings → Governance Tools to
force the election page into CONTENDER_SUBMISSION, NOMINEE_SELECTION,
or MEMBER_ELECTION phase. Shows a yellow banner when active.
Enables testing write action forms without a live election.

* feat: enable nerd mode via #nerd URL hash param

* fix: show wallet widget and settings on all app pages

Previously only /explore showed the wallet connect button and settings
toggle. Now all non-landing pages get the full header nav.

* feat: use previous election data for nerd mode phase override

When the phase override is active but the selected election has no
nominee/member data, search backwards through completed elections to
find one with cached data for testing the voting forms.

* refactor: deduplicate election vote components

- Extract shared ElectionVoteRow from ContenderVoteRow/NomineeVoteRow
  (identical vote flow, differs only by governor address and info slot)
- Extract shared VotingPowerSummary (was duplicated inline)
- Consolidate ERC20_VOTES_ABI to single export from config/election-abi
- Remove unused electionVoteSchema and proposalDeadline prop

* feat: bypass simulation gate in nerd mode phase override

When phase override is active, the on-chain simulation rejects with
"vote not currently active" since the proposal is completed. Skip the
simulation requirement and suppress the error so the Vote button is
clickable for testing the full UI flow.

* refactor: use gov-tracker SDK for election write encoding

- Update gov-tracker to 0.4.0-alpha.feat-election-write-actions.4226113
- Replace viem encodeAbiParameters with SDK's encodeElectionVoteParams
  in ElectionVoteRow
- Replace inline EIP-712 typed data construction with SDK's
  getAddContenderTypedData in ContenderSignupForm
- Keep local JSON ABIs in config/election-abi.ts (wagmi needs them
  for typed contract reads, SDK exports human-readable string ABIs)

* refactor: use VOTE_SUPPORT constants from gov-tracker SDK

- Update gov-tracker to 0.4.0-alpha.feat-election-write-actions.f8fdb7c
  (adds governance proposal vote preparation module)
- Replace magic numbers 0/1/2 in VoteForm RadioGroup with VOTE_SUPPORT
  constants (FOR, AGAINST, ABSTAIN)
- Use VoteSupport type for simulation args type safety
- Derive valid vote values in voteSchema from VOTE_SUPPORT

* refactor: use SDK PreparedTransaction for vote submission

Replace useSimulateContract + useWriteContract with SDK's
prepareCastVote / prepareCastVoteWithReasonAndParams + wagmi's
useEstimateGas + useSendTransaction.

VoteForm:
- prepareCastVote builds calldata, useEstimateGas validates pre-send
- Drops 515-line OzGovernor_ABI.json import

ElectionVoteRow:
- prepareCastVoteWithReasonAndParams replaces inline ABI encoding
- Drops governorAbi prop (callers updated)
- Uses VOTE_SUPPORT.FOR instead of magic number 1
- Nerd mode override still bypasses simulation gate

* refactor: use gov-tracker SDK for contender registration

Replace useSimulateContract + useWriteContract with SDK's
prepareContenderRegistration + useEstimateGas + useSendTransaction.
The SDK now handles EIP-712 typed data construction and addContender
calldata encoding, removing the last write-path dependency on local ABI.

* refactor: source governance addresses from gov-tracker SDK

Replace hardcoded contract addresses in config/arbitrum-governance.ts,
config/governors.ts, and config/security-council.ts with ADDRESSES
export from @gzeoneth/gov-tracker. Single source of truth for all
governance contract addresses.

* refactor: use SDK hashOperation for pure salt validation

Replace two useReadContract(hashOperation) RPC calls with SDK's pure
hashOperation + validateSalt functions. Salt computation is now
synchronous (keccak256 hash), eliminating loading states and the
30-line useEffect validation flow.

* chore: bump gov-tracker to 4b39fe2

New exports (PROPOSAL_STATE, compareBigNumbers, queryWithRetry,
getErrorMessage) overlap with existing local utilities that have
different signatures. No actionable changes for tally-zero in this
release.

* refactor: use SDK JSON ABIs for wagmi read operations

Replace local ERC20_VOTES_ABI with SDK's erc20VotesAbi (JSON format
with as const) for wagmi useReadContract calls. Election governor ABIs
stay local — the SDK's full ABIs (26+ entries) exceed viem's type
inference recursion limit. Also source ARB_TOKEN address from SDK.

* refactor: use SDK prepareTimelockExecuteCalldata for timelock execution

Replace useSimulateContract + useWriteContract with SDK's pure
prepareTimelockExecuteCalldata + useEstimateGas + useSendTransaction.
The SDK encodes execute() calldata without a provider, completing
the migration of all write actions to the SDK pattern. Delete
ArbitrumTimelock_ABI.json — no longer imported anywhere.

* refactor: replace local election ABIs with SDK read ABI subsets

SDK now exports curated read/write ABI splits that stay within viem's
type inference limits. Replace NOMINEE_ELECTION_GOVERNOR_ABI and
MEMBER_ELECTION_GOVERNOR_ABI with nomineeElectionGovernorReadAbi and
memberElectionGovernorReadAbi. Delete config/election-abi.ts — all
contract ABIs now sourced from gov-tracker SDK.

* feat: election contract overrides + fix member election data loading (#21)

Add per-chain election contract address resolution with localStorage
overrides (nerd mode) for testing against Sepolia deployments.

Fix: override path in useElectionStatus now fetches memberProposalId
from the member governor when the nominee election is executed. Without
this, the member election form ("Vote for Nominees") and weight
indicator never appeared after nominee election completion.

Custom TestWalletProvider connector for Playwright E2E testing — the
wagmi mock connector can't sign or send transactions (forwards wallet
methods to RPC), so a custom connector intercepts eth_signTypedData_v4
and eth_sendTransaction, signs locally, sends via eth_sendRawTransaction.

* refactor: cleanup election write actions code quality

- Fix auto-send race condition in ContenderSignupForm: split into
  explicit sign + submit steps instead of useEffect auto-fire
- Fix floating-point precision loss in vote amount conversion:
  use ethers parseEther instead of Math.floor(n * 1e18)
- Extract useElectionVotingPower hook to deduplicate identical
  voting power logic from ContenderVoteForm and NomineeVoteForm
- Add toHex() helper to replace 16 scattered `as \`0x\${string}\``
  casts on PreparedTransaction fields across 4 files
- Extract inline ABI fragments from fetchWithOverrides to
  module-level constants
- Fix isActionablePhase type guard: narrow to ActionablePhase
  union instead of all ElectionPhase values
- Guard fetchWithOverrides against undefined nomineeGovernorAddress
  when only memberGovernor is overridden

* refactor: remove coupling and dead code in election components

- Remove leftover delay(500) from VoteForm submit handler
- Replace ElectionVoteRow's internal localStorage read for override
  state with a bypassSimulation prop threaded from ElectionContainer
  through ElectionActionCard and vote forms, eliminating implicit
  coupling between the leaf component and settings storage

* refactor: migrate to gov-tracker v0.4.0 ElectionConfig + getElectionStatus

- Bump gov-tracker to 0.4.0-alpha.feat-election-config-overrides
- Replace 150-line fetchWithOverrides with SDK getElectionStatus()
  which handles phase determination, proposal ID discovery, and
  state mapping internally via ElectionConfig
- Delete config/election-networks.ts, replace custom ElectionContracts
  interface with SDK's ElectionConfig + MAINNET_ELECTION_CONFIG
- Rewrite useElectionContracts to produce ElectionConfig from SDK
  defaults + localStorage overrides per chain
- Replace low-level encodeElectionVoteParams + prepareCastVoteWithReasonAndParams
  with SDK's prepareNomineeElectionVote helper
- Remove ethers import and inline ABI fragments from use-election-status
- Remove securityCouncilManager from contract override settings
  (unused field that was never consumed)
- Update field names: nomineeGovernor→nomineeGovernorAddress,
  memberGovernor→memberGovernorAddress (SDK convention)

* refactor: adopt gov-tracker 6650934 typed PreparedTransaction + batch API

- Bump gov-tracker to 0.4.0-alpha.feat-election-config-overrides.6650934
- Delete toHex() helper and all 16 call sites: PreparedTransaction.to
  and .data are now `0x${string}` natively, no casts needed
- Use ElectionConfig.tokenAddress to replace custom arbToken field:
  delete ARB_TOKENS map, ElectionContractsResult wrapper type, and
  arbToken in overrides settings
- Replace sequential getElectionStatus loop with getAllElectionStatuses
  batch function (parallel fetches, shared checkElectionStatus call)
- Simplify useElectionContracts to return Required<ElectionConfig>

* chore: bump gov-tracker to d887994

Fixes getElectionStatus crash for elections in early phases
(CONTENDER_SUBMISSION) where member proposal doesn't exist yet.
Election #5 now correctly displays as active.

* fix: fetch live status for elections without cached checkpoints

The fetchDefault path only loaded elections from tracker cache
checkpoints. New elections (like #5 in CONTENDER_SUBMISSION) have
no checkpoint, so they were silently omitted from the election
list — showing "Not Started" instead of the actual active phase.

Fall back to getElectionStatus() for elections without checkpoints
so newly created elections appear immediately.

* fix: make checkElectionStatus non-fatal in default fetch path

checkElectionStatus (global election readiness check) crashes in
some browser environments where the SDK multicall returns undefined
(toNumber on undefined). Since it runs after elections are loaded,
wrap it in try-catch so the election list renders regardless.

Also use getAllElectionStatuses for fetching live election data
(replaces manual getElectionCount + per-index loop), and only set
error state when no elections have loaded yet — partial failures
during refresh shouldn't wipe the existing election display.

* feat: show registered contenders during contender submission phase

- Add ContenderList component in NomineeList to display registered
  contenders with numbered list, delegate labels, Tally profile
  links, Arbiscan links, and registration tx links
- Fetch nominee details for live (uncached) elections, with fallback
  to getContenders when getNomineeElectionDetails fails during early
  phases (quorum not available before voting snapshot)
- NomineeList now shows "Registered Contenders" title and count
  during CONTENDER_SUBMISSION phase

* refactor: adopt gov-tracker 132b852 read helpers + write dispatch

- VoteForm/useElectionVotingPower: use SDK readVotingPower() instead of
  manual useReadContract param construction
- ElectionVoteRow: accept prepareVote prop; NomineeVoteForm now correctly
  uses prepareMemberElectionVote instead of routing through nominee helper
- Replace local ProposalState enum with SDK PROPOSAL_STATE_MAP everywhere
  (state-utils, bundled-cache-loader, initial-state tests)
- Bump @gzeoneth/gov-tracker to 0.4.0-alpha.feat-election-write-actions.132b852

* refactor: adopt gov-tracker 540c44d read helpers for election reads

Bump gov-tracker to 0.4.0-beta.540c44d which adds readGovernorName,
readIsContender, readVotesUsed, readCurrentVotingPower, readDelegate,
readHasVoted read helpers. Replace manual useReadContract calls in
ContenderSignupForm with readGovernorName and readIsContender.

* chore: bump gov-tracker to 0.4.0-beta.225fa70

* refactor: migrate delegate indexing to gov-tracker SDK

Adopt gov-tracker 0.4.0-alpha.feat-delegate-indexing.9121604 which
upstreams the delegate cache indexer, query helpers, and live queries.

Deleted:
- scripts/build-delegate-cache.ts (480 lines) — replaced by SDK CLI
- Local multicall usage in delegate hooks — replaced by SDK's
  queryDelegatesNotVoted and queryDelegateVotingPowers
- Local DelegateInfo/DelegateCache types — re-exported from SDK
- Inline ERC20Votes ABI in use-delegate-lookup — uses SDK's ERC20_VOTES_ABI

Migrated:
- lib/delegate-cache.ts → thin wrapper over SDK's getDelegateRankInfo,
  getTopDelegates, getDelegateCacheStats, validateDelegateCache
- hooks/use-top-delegates-not-voted.ts → SDK's queryDelegatesNotVoted
- hooks/use-delegate-search.ts → SDK's filterDelegatesByMinPower,
  filterDelegatesByAddress, queryDelegateVotingPowers
- hooks/use-delegate-lookup.ts → SDK's ADDRESSES.ARB_TOKEN + ERC20_VOTES_ABI

Kept locally:
- getDelegateLabel (editorial data from delegate-labels.json)
- DelegateCacheStats with age field (UI-specific formatting)
- data/delegate-cache.json (browser-compatible cache loading via require)

Net: -745 lines

* chore: remove local delegate cache, use SDK bundled cache

Switch delegate cache loading from local data/delegate-cache.json
(5.9MB) to SDK's bundled cache at @gzeoneth/gov-tracker/delegate-cache.json.
Verified via Playwright: delegates page loads 230 delegates with labels.

* refactor: adopt gov-tracker a78c35a delegate cache + document strategy

Bump gov-tracker to 0.4.0-alpha.feat-delegate-indexing.a78c35a which
ships a comprehensive delegate cache (23,600 delegates vs 230 prior).

Add disclosure in SnapshotBlockNotice that only addresses with >=10 ARB
delegated are included and counts reflect this subset.

Document cache storage strategy in CLAUDE.md: proposal cache uses
localStorage (needs persistence for incremental tracking), delegate
cache loads from JS bundle only (read-only snapshot, no localStorage)
to avoid exceeding browser storage limits (~6MB combined).

* perf: reduce election page RPC calls from ~120 to ~30

- Add fetch-in-flight ref guard to prevent duplicate concurrent fetches
  caused by unstable useCallback/useEffect dependency chain
- Wait for localStorage hydration before first fetch by gating on
  isHydrated from useRpcSettings and useLocalStorage
- Parallelize cached election checkpoint lookups with Promise.all
- Run checkElectionStatus concurrently with live election data fetches
- Fall back to default fetch path when override contracts fail, with
  state cleanup to prevent stale override data from leaking
- Add effect cleanup to reset in-flight guard when dependencies change
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.

Invalid start block

2 participants