Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 8 additions & 8 deletions docs/pages/ciphernode-operators/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ The Interfold protocol uses several contracts that work together:

| Contract | Address | Deploy block |
| -------------------- | -------------------------------------------- | ------------ |
| Enclave | `0xB47B267876B60a06138Bc9dfCee7aa3E26907CCB` | 10697349 |
| CiphernodeRegistry | `0x497Feea9abB72229aab1584c22b5416ff128926B` | 10697344 |
| BondingRegistry | `0x788046999530304DDe121e19eD456180Aca6B7c1` | 10697345 |
| SlashingManager | `0xd984728053ed3a17921fb3E27615cdcC796A8d9e` | 10697343 |
| E3RefundManager | `0x91eebD89bb00CBE9E5Eabf2a01a22704f88AD098` | 10697351 |
| EnclaveTicketToken | `0xD4BF670ABbf0849858dE08A3956B266D75aC52D5` | 10697342 |
| EnclaveToken (ENCL) | `0x62440E4b344D2A8aAf14c72b845F978eE615B7be` | 10697341 |
| MockUSDC (fee token) | `0x9B1820D75bb09433D17C674A289fc6dD53e9c389` | 10697340 |
| Enclave | `0x670eFE043d1D340148037b4b76c4F9dfED294309` | 10939874 |
| CiphernodeRegistry | `0x4D707127F72a216EA116AF0B4262dD7382F84259` | 10939869 |
| BondingRegistry | `0xb9b64c5e0a30f38ed33760f299613087aAe87283` | 10939870 |
| SlashingManager | `0x0553387EE0992Fe339579728B6c777164fD1de40` | 10939868 |
| E3RefundManager | `0xD327ec50C7a8909f90DE15fe53872e88B4948Ee0` | 10939876 |
| EnclaveTicketToken | `0x2446f2AC9632f17af96053e48dEDff44b50711Ea` | 10939867 |
| EnclaveToken (ENCL) | `0xbAb3220FD04a193a192F07879673597Cd695Cb03` | 10939866 |
| MockUSDC (fee token) | `0x2721Cdf281d40744aD567cBf3e7100F60bcbAE79` | 10939865 |

The DKG and decryption aggregator circuits are deployed as the sole on-chain verifiers for BFV
public-key publication and plaintext decryption respectively (each aggregator internally verifies
Expand Down
30 changes: 15 additions & 15 deletions docs/pages/ciphernode-operators/running.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ chains:
rpc_url: 'wss://ethereum-sepolia-rpc.publicnode.com'
contracts:
enclave:
address: '0xB47B267876B60a06138Bc9dfCee7aa3E26907CCB'
deploy_block: 10697349
address: '0x670eFE043d1D340148037b4b76c4F9dfED294309'
deploy_block: 10939874
ciphernode_registry:
address: '0x497Feea9abB72229aab1584c22b5416ff128926B'
deploy_block: 10697344
address: '0x4D707127F72a216EA116AF0B4262dD7382F84259'
deploy_block: 10939869
bonding_registry:
address: '0x788046999530304DDe121e19eD456180Aca6B7c1'
deploy_block: 10697345
address: '0xb9b64c5e0a30f38ed33760f299613087aAe87283'
deploy_block: 10939870
```

### Start Your Node
Expand Down Expand Up @@ -177,14 +177,14 @@ chains:
rpc_url: 'wss://ethereum-sepolia-rpc.publicnode.com'
contracts:
enclave:
address: '0xB47B267876B60a06138Bc9dfCee7aa3E26907CCB'
deploy_block: 10697349
address: '0x670eFE043d1D340148037b4b76c4F9dfED294309'
deploy_block: 10939874
ciphernode_registry:
address: '0x497Feea9abB72229aab1584c22b5416ff128926B'
deploy_block: 10697344
address: '0x4D707127F72a216EA116AF0B4262dD7382F84259'
deploy_block: 10939869
bonding_registry:
address: '0x788046999530304DDe121e19eD456180Aca6B7c1'
deploy_block: 10697345
address: '0xb9b64c5e0a30f38ed33760f299613087aAe87283'
deploy_block: 10939870
```

### Run the Container
Expand Down Expand Up @@ -270,9 +270,9 @@ Each contract can be specified as a simple address string or with a deploy block
```yaml
contracts:
enclave:
address: '0xB47B267876B60a06138Bc9dfCee7aa3E26907CCB'
deploy_block: 10697349
ciphernode_registry: '0x497Feea9abB72229aab1584c22b5416ff128926B'
address: '0x670eFE043d1D340148037b4b76c4F9dfED294309'
deploy_block: 10939874
ciphernode_registry: '0x4D707127F72a216EA116AF0B4262dD7382F84259'
```

---
Expand Down
3 changes: 2 additions & 1 deletion examples/CRISP/client/.npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Vercel / standalone installs: resolve @crisp-e3/sdk from npm (0.9.0), not the monorepo workspace.
# Vercel / standalone installs: resolve @crisp-e3/sdk from npm, not the monorepo workspace.
ignore-workspace=true
shared-workspace-lockfile=false
2 changes: 1 addition & 1 deletion examples/CRISP/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"deploy": "gh-pages -d dist"
},
"dependencies": {
"@crisp-e3/sdk": "0.9.0",
"@crisp-e3/sdk": "0.10.0",
"@emotion/babel-plugin": "^11.11.0",
"@emotion/react": "^11.11.4",
"@phosphor-icons/react": "^2.1.4",
Expand Down
39 changes: 22 additions & 17 deletions examples/CRISP/client/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions examples/CRISP/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useSwitchChain } from 'wagmi'
//Pages
import Landing from '@/pages/Landing/Landing'
import DailyPoll from '@/pages/DailyPoll/DailyPoll'
import HistoricPoll from '@/pages/HistoricPoll/HistoricPoll'
import AllPolls from '@/pages/AllPolls/AllPolls'
import About from '@/pages/About/About'
import PollResult from '@/pages/PollResult/PollResult'
import RoundPoll from '@/pages/RoundPoll'
Expand Down Expand Up @@ -58,7 +58,8 @@ const App: React.FC = () => {
<Route path='/about' element={<About />} />
<Route path='/current' element={<DailyPoll />} />
<Route path='/round/:roundId' element={<RoundPoll />} />
<Route path='/historic' element={<HistoricPoll />} />
<Route path='/all' element={<AllPolls />} />
<Route path='/historic' element={<Navigate to='/all' replace />} />
<Route path='/result/:roundId/:type?' element={<PollResult />} />
<Route path='*' element={<Navigate to='/' replace />} />
</Routes>
Expand Down
4 changes: 2 additions & 2 deletions examples/CRISP/client/src/components/NavMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const NAV_MENU_OPTIONS = [
path: '/current',
},
{
name: 'Historic Polls',
name: 'All Polls',
icon: <CheckFat />,
path: '/historic',
path: '/all',
},
{
name: 'About',
Expand Down
4 changes: 2 additions & 2 deletions examples/CRISP/client/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const PAGES = [
path: '/about',
},
{
label: 'Historic Polls',
path: '/historic',
label: 'All Polls',
path: '/all',
},
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const VoteManagementProvider = ({ children }: VoteManagementProviderProps) => {
const [txUrl, setTxUrl] = useState<string | undefined>(undefined)
const [pollResult, setPollResult] = useState<PollResult | null>(null)
const [currentRoundId, setCurrentRoundId] = useState<number | null>(null)
const [displayedRoundIsFallback, setDisplayedRoundIsFallback] = useState<boolean>(false)
const [hasVotedInCurrentRound, setHasVotedInCurrentRound] = useState<boolean>(false)
const [voteStatusLoading, setVoteStatusLoading] = useState<boolean>(false)
const voteStatusCache = useRef<Map<string, VoteStatus>>(new Map())
Expand Down Expand Up @@ -125,10 +126,35 @@ const VoteManagementProvider = ({ children }: VoteManagementProviderProps) => {

const initialLoad = async () => {
const currentRound = await getCurrentRound()
if (currentRound) {
setCurrentRoundId(currentRound.id)
await getRoundStateLite(currentRound.id)
if (!currentRound) return
setCurrentRoundId(currentRound.id)

// If the current round has ended without a published tally, the page would
// otherwise sit forever in "Over · Tallying…". Fall back to the latest past
// round that does have a tally so the user sees something useful.
const fetched = await getRoundStateLiteRequest(currentRound.id)
if (!fetched) return

const nowSec = Math.floor(Date.now() / 1000)
const ended = Number(fetched.end_time) <= nowSec
let fallbackRoundId: number | null = null

if (ended) {
const currentResult = await getWebResultByRound(currentRound.id)
const currentHasTally = !!(currentResult && Array.isArray(currentResult.tally) && currentResult.tally.length > 0)
if (!currentHasTally) {
const all = await getWebResult()
const latestWithTally = (all ?? [])
.filter((r) => Array.isArray(r.tally) && r.tally.length > 0)
.sort((a, b) => b.round_id - a.round_id)[0]
if (latestWithTally && latestWithTally.round_id !== currentRound.id) {
fallbackRoundId = latestWithTally.round_id
}
}
}

setDisplayedRoundIsFallback(fallbackRoundId !== null)
await getRoundStateLite(fallbackRoundId ?? currentRound.id)
}

const getRoundStateLite = async (roundCount: number) => {
Expand Down Expand Up @@ -212,6 +238,7 @@ const VoteManagementProvider = ({ children }: VoteManagementProviderProps) => {
txUrl,
pollResult,
currentRoundId,
displayedRoundIsFallback,
hasVotedInCurrentRound,
voteStatusLoading,
sessionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type VoteManagementContextType = {
txUrl: string | undefined
pollResult: PollResult | null
currentRoundId: number | null
displayedRoundIsFallback: boolean
hasVotedInCurrentRound: boolean
voteStatusLoading: boolean
sessionId: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useVoteManagementContext } from '@/context/voteManagement'
import { EditorialShell } from '@/design/Editorial'
import { debounce } from '@/utils/methods'

const HistoricPoll: React.FC = () => {
const AllPolls: React.FC = () => {
const { votingRound, pastPolls, getPastPolls, isLoading } = useVoteManagementContext()
const [visiblePolls, setVisiblePolls] = useState<PollResult[]>([])
const [page, setPage] = useState<number>(0)
Expand Down Expand Up @@ -71,14 +71,14 @@ const HistoricPoll: React.FC = () => {
<section className='pad-section col' style={{ flex: 1, gap: 28 }}>
<div className='col' style={{ gap: 12 }}>
<div className='mono muted'>Archive</div>
<h1 className='h1'>Past polls</h1>
<h1 className='h1'>All polls</h1>
</div>
{isLoading && (
<div className='flex justify-center'>
<LoadingAnimation isLoading={isLoading} />
</div>
)}
{!pastPolls.length && !isLoading && <p className='lede'>There are no historic polls.</p>}
{!pastPolls.length && !isLoading && <p className='lede'>There are no polls yet.</p>}
{visiblePolls.length > 0 && (
<div className='grid w-full grid-cols-1 gap-8 sm:grid-cols-2 md:grid-cols-3'>
{visiblePolls.map((pollResult: PollResult, index: number) => {
Expand All @@ -104,4 +104,4 @@ const HistoricPoll: React.FC = () => {
)
}

export default HistoricPoll
export default AllPolls
Loading
Loading