Skip to content

Commit

Permalink
Merge pull request #1178 from kleros/dev
Browse files Browse the repository at this point in the history
Next Release
  • Loading branch information
jaybuidl authored Aug 25, 2023
2 parents d01a888 + 3510cf4 commit fd9a7d8
Show file tree
Hide file tree
Showing 56 changed files with 878 additions and 719 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: "CodeQL Advanced"

on:
merge_group:
branches:
- master
- dev
push:
branches:
- master
- dev
pull_request:
# The branches below must be a subset of the branches above
branches:
- master
- dev
schedule:
- cron: '26 1 * * 6'

permissions:
actions: read

jobs:
codeql-advanced-analysis:
name: Analyze
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language:
- javascript

steps:
- 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

# 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.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# 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.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@29b1f65c5e92e24fe6b6647da1eaabe529cec70f # v2.3.3
with:
category: "/language:${{matrix.language}}"
19 changes: 15 additions & 4 deletions .github/workflows/contracts-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@ on:
push:
branches:
- master
- dev
paths-ignore:
- "kleros-sdk/**"
- "services/**"
- "subgraph/**"
- "web/**"
pull_request:
branches:
- "*"
paths-ignore:
- "kleros-sdk/**"
- "services/**"
- "subgraph/**"
- "web/**"

permissions: # added using https://github.com/step-security/secure-workflows
contents: read
Expand All @@ -34,14 +45,14 @@ jobs:
54.185.253.63:443
- name: Setup Node.js environment
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: 16.x

- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/checkout@7739b9ba2efcda9dde65ad1e3c2dbe65b41dfba7

- name: Cache node modules
uses: actions/cache@67b839edb68371cc5014f6cea11c9aa77238de78
uses: actions/cache@f7ebb81a3f195b4fb88dab7c14e2f7aff52045aa
env:
cache-name: cache-node-modules
with:
Expand Down Expand Up @@ -72,7 +83,7 @@ jobs:
working-directory: contracts

- name: Upload a build artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05
with:
name: code-coverage-report
path: contracts/coverage
6 changes: 5 additions & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: 'Dependency Review'
uses: actions/dependency-review-action@7d90b4f05fea31dde1c4a1fb3fa787e197ea93ab # v3.0.7
uses: actions/dependency-review-action@f6fff72a3217f580d5afd49a46826795305b63c7 # v3.0.8
with:
base-ref: ${{ github.event.pull_request.base.sha || 'dev' }}
head-ref: ${{ github.event.pull_request.head.sha || github.ref }}
4 changes: 2 additions & 2 deletions .github/workflows/deploy-bots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/checkout@7739b9ba2efcda9dde65ad1e3c2dbe65b41dfba7
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1
- uses: aws-actions/setup-sam@12a6719db503425e98edcc798b6779590a450e8f
- uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355
- uses: aws-actions/configure-aws-credentials@131c7b6fd10c0d7f36e1e49650b241d91ee327b9
with:
aws-access-key-id: ${{ secrets.STAGING_AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.STAGING_AWS_SECRET_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
with:
sarif_file: results.sarif
6 changes: 3 additions & 3 deletions .github/workflows/sentry-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
sentry.io:443
54.185.253.63:443
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/checkout@7739b9ba2efcda9dde65ad1e3c2dbe65b41dfba7

- name: Cache node modules
uses: actions/cache@67b839edb68371cc5014f6cea11c9aa77238de78
uses: actions/cache@f7ebb81a3f195b4fb88dab7c14e2f7aff52045aa
env:
cache-name: cache-node-modules
with:
Expand All @@ -45,7 +45,7 @@ jobs:
${{ runner.os }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
- name: Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: 16

Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
},
"solidity-va.test.defaultUnittestTemplate": "hardhat",
"solidity-language-server.trace.server.verbosity": "message",
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.packageManager": "yarn",
"prettier.useEditorConfig": true,
"prettier.configPath": "prettier-config/.prettierrc.js"
Expand Down
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "0.8.2",
"ts-node": "^10.9.1",
"typechain": "^8.2.0",
"typechain": "^8.3.1",
"typescript": "^4.9.5"
},
"dependencies": {
Expand Down
3 changes: 3 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"arbitrum",
"autorestart",
"codegen",
"commify",
"commitlint",
"consts",
"COOLDOWN",
"datetime",
"devnet",
Expand All @@ -32,6 +34,7 @@
"solhint",
"typechain",
"Unslashed",
"viem",
"wagmi"
],
"ignoreWords": [],
Expand Down
24 changes: 24 additions & 0 deletions scripts/cancel-all-netlify-builds.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

function cancelSiteDeploy() #sideId
{
local sideId=$1
readarray -t builds < <(netlify api listSiteDeploys -d '{ "site_id": "'$sideId'", "state": "new"}' | jq --compact-output '.[]')
for build in "${builds[@]}"
do
local name=$(jq -r .name <<< $build)
local branch=$(jq -r .branch <<< $build)
if [[ "$branch" == "dev" || "$branch" == "master" ]]; then
continue;
fi
echo "Cancelling build for $name $branch"
netlify api cancelSiteDeploy -d '{ "deploy_id": "'$(jq -r .id <<< $build)'"}' > /dev/null
done
}

# netlify api listSites | jq '. | map([.name, .id])'
v2Site="86d94ae8-f655-46a4-a859-d68696173f3a"
v2ContractsSite="dd8bc215-e054-407f-92ef-d61511720928"

cancelSiteDeploy $v2Site
cancelSiteDeploy $v2ContractsSite
9 changes: 1 addition & 8 deletions web/src/components/CasesDisplay/CasesGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const Container = styled.div`
gap: 8px;
`;

// 24px as margin-top since we already have 8px from the flex gap
const StyledPagination = styled(StandardPagination)`
margin-top: 24px;
margin-left: auto;
Expand All @@ -26,13 +25,7 @@ export interface ICasesGrid {
casesPerPage: number;
}

const CasesGrid: React.FC<ICasesGrid> = ({
disputes,
currentPage,
setCurrentPage,
numberDisputes,
casesPerPage,
}) => {
const CasesGrid: React.FC<ICasesGrid> = ({ disputes, currentPage, setCurrentPage, numberDisputes, casesPerPage }) => {
return (
<>
<Container>
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/CasesDisplay/Stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ const FieldWrapper = styled.div`
gap: 8px;
`;

const SeparatorLabel = styled.label`
margin-left: 8px;
margin-right: 8px;
`;

const Field: React.FC<{ label: string; value: string }> = ({ label, value }) => (
<FieldWrapper>
<label>{label}</label>
<small>{value}</small>
</FieldWrapper>
);

const SeparatorLabel = styled.label`
margin-left: 8px;
margin-right: 8px;
`;

const Separator: React.FC = () => <SeparatorLabel>|</SeparatorLabel>;

const Stats: React.FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/ConnectWallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const SwitchChainButton: React.FC = () => {
<Button
isLoading={isLoading}
disabled={isLoading}
text={`Switch to ${SUPPORTED_CHAINS[DEFAULT_CHAIN].chainName}`}
text={`Switch to ${SUPPORTED_CHAINS[DEFAULT_CHAIN].name}`}
onClick={handleSwitch}
/>
);
Expand Down
32 changes: 16 additions & 16 deletions web/src/components/DisputeCard/PeriodBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@ import React from "react";
import styled, { Theme } from "styled-components";
import { Periods } from "consts/periods";

export interface IPeriodBanner {
id: number;
period: Periods;
}

const getPeriodColors = (period: Periods, theme: Theme): [string, string] => {
switch (period) {
case Periods.appeal:
return [theme.tint, theme.tintMedium];
case Periods.execution:
return [theme.secondaryPurple, theme.mediumPurple];
default:
return [theme.primaryBlue, theme.mediumBlue];
}
};

const Container = styled.div<Omit<IPeriodBanner, "id">>`
height: 45px;
width: auto;
Expand Down Expand Up @@ -54,6 +38,22 @@ const Container = styled.div<Omit<IPeriodBanner, "id">>`
}};
`;

export interface IPeriodBanner {
id: number;
period: Periods;
}

const getPeriodColors = (period: Periods, theme: Theme): [string, string] => {
switch (period) {
case Periods.appeal:
return [theme.tint, theme.tintMedium];
case Periods.execution:
return [theme.secondaryPurple, theme.mediumPurple];
default:
return [theme.primaryBlue, theme.mediumBlue];
}
};

const getPeriodLabel = (period: Periods): string => {
switch (period) {
case Periods.appeal:
Expand Down
8 changes: 2 additions & 6 deletions web/src/components/DisputeCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import styled from "styled-components";
import { useNavigate } from "react-router-dom";
import { formatEther } from "viem";
import Skeleton from "react-loading-skeleton";
import { StyledSkeleton } from "components/StyledSkeleton";
import { Card } from "@kleros/ui-components-library";
import { Periods } from "consts/periods";
import { CasesPageQuery } from "queries/useCasesQuery";
Expand All @@ -17,10 +17,6 @@ const StyledCard = styled(Card)`
min-width: 312px;
width: auto;
height: 260px;
.react-loading-skeleton {
z-index: 0;
}
`;

const Container = styled.div`
Expand Down Expand Up @@ -58,7 +54,7 @@ const DisputeCard: React.FC<CasesPageQuery["disputes"][number]> = ({
: getPeriodEndTimestamp(lastPeriodChange, currentPeriodIndex, court.timesPerPeriod);
const { data: disputeTemplate } = useDisputeTemplate(id, arbitrated.id as `0x${string}`);
const title = isUndefined(disputeTemplate) ? (
<Skeleton />
<StyledSkeleton />
) : (
disputeTemplate?.title ?? "The dispute's template is not correct please vote refuse to arbitrate"
);
Expand Down
Loading

0 comments on commit fd9a7d8

Please sign in to comment.