Skip to content

Commit

Permalink
Merge branch 'dev' into testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
jaybuidl committed Jun 5, 2024
2 parents 7e14ea2 + c867679 commit b476818
Show file tree
Hide file tree
Showing 49 changed files with 2,615 additions and 709 deletions.
84 changes: 38 additions & 46 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

name: CodeQL Advanced
on:
push:
branches: [ master ]
branches:
- master
- dev
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches:
- master
- dev
schedule:
- cron: '37 20 * * 6'
- cron: "37 20 * * 6" # Every Saturday on 8:37pm UTC

permissions:
contents: read
Expand All @@ -35,44 +27,44 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Harden Runner
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
with:
egress-policy: audit
- name: Harden Runner
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3
1 change: 0 additions & 1 deletion .github/workflows/contracts-testing.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Contracts Testing

on:
workflow_dispatch:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
name: 'Dependency Review'
name: Dependency Review
on: [pull_request]

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-bots.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Build and Deploy Bots
on: [workflow_dispatch]

permissions:
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.

name: Scorecard supply-chain security
on:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See
branch_protection_rule: # To guarantee Maintained check is occasionally updated. See

# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '20 7 * * 2'
- cron: "20 5 * * 0" # Every Sunday at 5:20 AM UTC
push:
branches: ["dev"]
branches:
- dev
pull_request:
# The branches below must be a subset of the branches above
branches:
- dev

# Declare default permissions as read only.
permissions: read-all
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: SonarCloud Analysis
on:
# Trigger analysis when pushing in master or pull requests, and when creating
# a pull request.
Expand All @@ -8,7 +9,6 @@ on:
pull_request:
types: [opened, synchronize, reopened]

name: SonarCloud Analysis
permissions:
contents: read

Expand Down
6 changes: 6 additions & 0 deletions tea.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://tea.xyz/what-is-this-file
---
version: 1.0.0
codeOwners:
- '0x79AEf56BD3569b8Fc720Fa2c04878582E14b51AE'
quorum: 1
10 changes: 10 additions & 0 deletions veascan-subgraph-inbox/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
type _Schema_
@fulltext(
name: "snapshotQuery"
language: en
algorithm: rank
include: [{ entity: "Snapshot", fields: [{ name: "epochString" }, { name: "stateRootString" }] }]
)

type Message @entity {
id: ID!
txHash: Bytes!
Expand All @@ -11,10 +19,12 @@ type Message @entity {
type Snapshot @entity {
id: ID!
epoch: BigInt
epochString: String
caller: Bytes
txHash: Bytes
timestamp: BigInt
stateRoot: Bytes
stateRootString: String
messages: [Message!]! @derivedFrom(field: "snapshot")
numberMessages: BigInt!
taken: Boolean!
Expand Down
2 changes: 2 additions & 0 deletions veascan-subgraph-inbox/src/VeaInbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ export function handleSnapshotSaved(event: SnapshotSaved): void {
currentSnapshot.taken = true;
currentSnapshot.caller = event.transaction.from;
currentSnapshot.stateRoot = stateRoot;
currentSnapshot.stateRootString = stateRoot.toHexString();
currentSnapshot.timestamp = event.block.timestamp;
currentSnapshot.txHash = event.transaction.hash;
currentSnapshot.epoch = epoch;
currentSnapshot.epochString = epoch.toString();
currentSnapshot.save();

// Create a new snapshot entity to be the current snapshot.
Expand Down
2 changes: 2 additions & 0 deletions veascan-subgraph-inbox/subgraph.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
specVersion: 0.0.4
schema:
file: ./schema.graphql
features:
- fullTextSearch
dataSources:
- kind: ethereum
name: VeaInbox
Expand Down
1 change: 1 addition & 0 deletions veascan-subgraph-outbox/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type Claim @entity {
challenged: Boolean!
challenge: Challenge @derivedFrom(field: "claim")
verification: Verification @derivedFrom(field: "claim")
verified: Boolean!
honest: Boolean!
txHash: Bytes!
}
Expand Down
1 change: 1 addition & 0 deletions veascan-subgraph-outbox/src/VeaOutbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function handleClaimed(event: Claimed): void {
claim.timestamp = event.block.timestamp;
claim.bridger = event.transaction.from; // same as event.params.claimer
claim.challenged = false;
claim.verified = false;
claim.honest = false;
claim.save();
}
Expand Down
1 change: 1 addition & 0 deletions veascan-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"src": "./src",
"hooks": "./src/hooks",
"consts": "./src/consts",
"contexts": "./src/contexts",
"styles": "./src/styles",
"svgs": "./src/assets/svgs",
"utils": "./src/utils",
Expand Down
46 changes: 29 additions & 17 deletions veascan-web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useState, useCallback } from "react";
import React, { useCallback, useEffect, useState } from "react";
import styled from "styled-components";
import { useList } from "react-use";
import { BigNumber } from "ethers";
import { StandardPagination } from "@kleros/ui-components-library";
import Layout from "components/Layout";
import SnapshotAccordion from "components/SnapshotAccordion/SnapshotAccordion";
import SnapshotAccordion from "components/SnapshotAccordion";
import TxFilterHeader from "components/TxFilterHeader";
import { useSnapshots, getSnapshotId } from "hooks/useSnapshots";
import { getSnapshotId, useSnapshots } from "hooks/useSnapshots";
import { mapDataForAccordion } from "utils/mapDataForAccordion";
import { useFiltersContext } from "./contexts/FiltersContext";

const SNAPSHOTS_PER_PAGE = 5;

Expand All @@ -25,16 +25,27 @@ const App = () => {
const [currentPage, setCurrentPage] = useState(1);
const [
pageTracking,
{ push: pushPageTracking, removeAt: removeAtPageTracking },
{
push: pushPageTracking,
removeAt: removeAtPageTracking,
clear: clearPageTracking,
},
] = useList<IPageTracking>();
const { data } = useSnapshots(
pageTracking.at(-1)?.shownSnapshots,
pageTracking.at(-1)?.timestamp,
SNAPSHOTS_PER_PAGE
);
const numPages = data?.totalSnapshots
.div(BigNumber.from(SNAPSHOTS_PER_PAGE))
.toNumber();

const { fromChain, toChain, statusFilter } = useFiltersContext();

useEffect(() => {
if (currentPage !== 1) {
clearPageTracking();
setCurrentPage(1);
}
}, [fromChain, toChain, statusFilter]);

const handlePageChange = useCallback(
(newPage: number) => {
if (newPage > currentPage)
Expand All @@ -54,15 +65,16 @@ const App = () => {
<TxFilterHeader />
{data ? (
<>
<SnapshotAccordion items={mapDataForAccordion(data.snapshots)} />
{numPages && numPages > 0 && (
<StyledPagination
numPages={numPages!}
currentPage={currentPage}
callback={handlePageChange}
hideNumbers
/>
)}
<SnapshotAccordion
key={currentPage}
items={mapDataForAccordion(data.snapshots)}
/>
<StyledPagination
numPages={data.isMorePages ? currentPage + 1 : currentPage}
currentPage={currentPage}
callback={handlePageChange}
hideNumbers
/>
</>
) : (
<p>loading...</p>
Expand Down
13 changes: 13 additions & 0 deletions veascan-web/src/assets/svgs/chains/gnosis.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions veascan-web/src/components/Layout/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import BuiltByKleros from "components/BuiltByKleros";
import React from "react";
import styled, { css } from "styled-components";
import { smallScreenStyle } from "styles/smallScreenStyle";
import BuiltByKleros from "components/BuiltByKleros";
import Lines from "tsx:svgs/footer/lines.svg";
import IconGithub from "tsx:svgs/icons/github.svg";
import IconTelegram from "tsx:svgs/icons/telegram.svg";
import IconTwitter from "tsx:svgs/icons/twitter.svg";
import { smallScreenStyle } from "styles/smallScreenStyle";

const LINKS = [
{
Expand Down Expand Up @@ -109,9 +109,9 @@ const Footer: React.FC = () => (
<StyledBuiltByKleros />
<Logo>VeA</Logo>
<SocialMedia>
{LINKS.map(({ href, Icon }, i) => (
{LINKS.map(({ href, Icon }) => (
<StyledLink
key={i}
key={href}
{...{ href }}
target="_blank"
rel="noopener noreferrer"
Expand Down
6 changes: 3 additions & 3 deletions veascan-web/src/components/Layout/Navbar/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useRef } from "react";
import styled, { css } from "styled-components";
import { useClickAway, useToggle } from "react-use";
import MenuLink from "./MenuLink";
import QuestionIcon from "tsx:svgs/icons/question.svg";
import BugIcon from "tsx:svgs/icons/bug.svg";
import BookIcon from "tsx:svgs/icons/book.svg";
import OpenBookIcon from "tsx:svgs/icons/open-book.svg";
import MenuLink from "./MenuLink";
import { smallScreenStyle } from "styles/smallScreenStyle";

const ITEMS = [
Expand Down Expand Up @@ -92,8 +92,8 @@ const Menu: React.FC = () => {
<Wrapper {...{ ref }}>
<StyledQuestion onClick={() => toggle()} />
<MenuContainer {...{ isOpen }}>
{ITEMS.map((item, i) => (
<MenuLink {...item} key={i} />
{ITEMS.map((item) => (
<MenuLink key={item.text} {...item} />
))}
</MenuContainer>
</Wrapper>
Expand Down
Loading

0 comments on commit b476818

Please sign in to comment.