Skip to content

Commit

Permalink
dashboard: filter out governor enqueued vaas
Browse files Browse the repository at this point in the history
Signed-off-by: bingyuyap <[email protected]>
  • Loading branch information
bingyuyap committed Feb 13, 2024
1 parent 77b0536 commit 72241b8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dashboard/src/components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Home({
<Divider />
<MonitorSettingsProvider>
<CollapsibleSection header="Monitor">
<Monitor />
<Monitor governorInfo={governorInfo} />
</CollapsibleSection>
</MonitorSettingsProvider>
</>
Expand Down
19 changes: 15 additions & 4 deletions dashboard/src/components/Monitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
explorerVaa,
} from '@wormhole-foundation/wormhole-monitor-common';
import { Environment, useCurrentEnvironment, useNetworkContext } from '../contexts/NetworkContext';
import { CloudGovernorInfo } from '../hooks/useCloudGovernorInfo';

type LastBlockByChain = { [chainId: string]: string };
type CountsByChain = {
Expand Down Expand Up @@ -291,7 +292,7 @@ function ReobserveCode({ misses }: { misses: MissesByChain | null }) {
) : null;
}

function Misses() {
function Misses({ governorInfo }: { governorInfo?: CloudGovernorInfo | null }) {
const { currentNetwork } = useNetworkContext();
const { showAllMisses } = useSettings();
const [missesWrapper, setMissesWrapper] = useState<DataWrapper<MissesByChain>>(
Expand Down Expand Up @@ -329,7 +330,17 @@ function Misses() {
.map(([chain, info]) => {
const filteredMisses = showAllMisses
? info.messages
: info.messages.filter((message) => message.timestamp < twoHoursAgo);
: info.messages
.filter((message) => message.timestamp < twoHoursAgo)
.filter(
(message) =>
!governorInfo?.enqueuedVAAs.some(
(enqueuedVAA) =>
enqueuedVAA.emitterChain === message.chain &&
enqueuedVAA.emitterAddress === message.emitter &&
enqueuedVAA.sequence === message.seq
)
);
return filteredMisses.length === 0 ? null : (
<CollapsibleSection
key={chain}
Expand Down Expand Up @@ -400,7 +411,7 @@ function SettingsButton() {
);
}

function Monitor() {
function Monitor({ governorInfo }: { governorInfo?: CloudGovernorInfo | null }) {
const { currentNetwork } = useNetworkContext();
const [lastBlockByChainWrapper, setLastBlockByChainWrapper] = useState<
DataWrapper<LastBlockByChain>
Expand Down Expand Up @@ -466,7 +477,7 @@ function Monitor() {
<SettingsButton />
</Box>
<Box mb={2}>
<Misses />
<Misses governorInfo={governorInfo} />
</Box>
<Typography variant="h4">Chains</Typography>
<Box pl={0.5}>
Expand Down

0 comments on commit 72241b8

Please sign in to comment.