Skip to content

Commit

Permalink
apis and data models for data wrangling prior to calculating divergen…
Browse files Browse the repository at this point in the history
…t blocks...coming up

automate the creation of divergent blocks

broken

fix conflict with sqlalchemy version

make the dispute stage an enum

all apis v0 and insomnia requests

cleanup and documentation on how to run the application

remove debugger

modify version of ipfshttpclient, change module name from web3 to w3

addendum to readme requirements

container file and Makescripts

Update README.md

multi stage docker build. use poetry inside of docker

Build dockerfile

added cicd and k8s files

run on updated k8s .github paths

fix cicd context

fix repo name

moving some fields to enums. cleanup some async code

base frontend for dispute portal

foundation redux actions

bump webpack, setup base dispute page

expose get all disputes

list disputes

simplify state with zustand

merge state updates

swap out the stages of the dispute

allows frontend to toggle the stages of the dispute

swap state in the frontend prior to revalidation. revalidation still hits later

sort, filter, visualize uploaded data

dispute portal list events

Fix rainbow

Fix setup when the config file is not yet created

Define files to use when publishing package

Add bin and cleanup gitignore

filter disputes by status (#13)

* filter by status

* Update README.md

Simplify cli (#14)

* remove dispute command and show help by default

* update README.md

* fix usage

Add Economics section and fetch network settings (#15)

Sort disputes by date (#16)

v0.2.0

Add defaultDisplayName to indexer and fisherman (#17)

Check thawing period before resolving dispute (#19)

Support for multiple ids on show and improved styling (#20)

* Support for multiple ids on show and improved styling

* Replace treeify with object-treeify

Add closing epoch startBlock and poi info (#21)

v0.3.0

[#24] Fix show command (#25)

v0.3.1

remove conf file

testing deployment
  • Loading branch information
goaaron committed Sep 23, 2021
1 parent bd80f71 commit cf4bf77
Show file tree
Hide file tree
Showing 121 changed files with 14,589 additions and 190 deletions.
10 changes: 10 additions & 0 deletions .github/scripts/kustomize-apply.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -e # immediately fail the script on any command error

ENVIRONMENT="$1"
IMAGE="$2"
DIR=$(dirname "$0")
cd $DIR/../../.k8s/$ENVIRONMENT

kustomize edit set image $IMAGE
kustomize build | kubectl apply -f -
58 changes: 58 additions & 0 deletions .github/workflows/server-ci-cd-mainnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Production CI/CD
on:
push:
paths:
- 'server/**'
- 'k8s/**'
- '.github/**'
env:
BASE_IMAGE: ghcr.io/edgeandnode/graph-disputes-server
APP_NAME: graph-disputes-server

jobs:
build-test:
runs-on: ubuntu-latest
steps:

- name: Checkout the repo
uses: actions/checkout@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./server
cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:latest
cache-to: type=inline
tags: |
${{ env.BASE_IMAGE }}:${{ github.sha }}
${{ env.BASE_IMAGE }}:latest
push: true

deploy:
if: github.ref == 'refs/heads/goaaron/poi_dispute_service'
runs-on: ubuntu-latest
needs: build-test
steps:

- name: Checkout the repo
uses: actions/checkout@v2

- name: Set up kubectl
uses: google-github-actions/get-gke-credentials@main
with:
cluster_name: ${{ secrets.GCP_CLUSTER_NAME }}
location: ${{ secrets.GCP_CLUSTER_LOCATION }}
credentials: ${{ secrets.GCP_SA_KEY_PRODUCTION }}

- name: Set a new k8s image and apply the manifests
run: .github/scripts/kustomize-apply.sh mainnet $APP_NAME=$BASE_IMAGE:$GITHUB_SHA

- name: Wait for pod to be ready
run: kubectl rollout status statefulset $APP_NAME --timeout=5m
19 changes: 6 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# Ignore zeppelin contracts
node_modules/

# Ignore build stuff
cache/
build/
dist/

# Coverage tests
coverage/

# Hardhat cache
cached/

# Ignore solc bin output
bin/

# Others
.env
.DS_Store
.vscode

__pycache__/

#data files
*.csv
service-key.json

4 changes: 4 additions & 0 deletions .k8s/mainnet/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- server.yaml
56 changes: 56 additions & 0 deletions .k8s/mainnet/server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: graph-disputes-server
spec:
serviceName: graph-disputes-server
replicas: 1
selector:
matchLabels:
app: graph-disputes-server
template:
metadata:
labels:
app: graph-disputes-server
spec:
imagePullSecrets:
- name: docker-registry
containers:
- name: app
image: ghcr.io/graph-disputes-server
env:
- name: DB_HOST
valueFrom:
secretKeyRef:
name: graph-disputes-server-db-credentials
key: host
- name: DB_PORT
valueFrom:
secretKeyRef:
name: graph-disputes-server-db-credentials
key: port
- name: DB_NAME
valueFrom:
secretKeyRef:
name: graph-disputes-server-db-credentials
key: name
- name: DB_USER
valueFrom:
secretKeyRef:
name: graph-disputes-server-db-credentials
key: user
- name: DB_PASS
valueFrom:
secretKeyRef:
name: graph-disputes-server-db-credentials
key: pass
volumeMounts:
- name: data-key
mountPath: /app
volumes:
- name: data-key
secret:
secretName: graph-disputes-server-data-key
items:
- key: key.json
path: service-key.json
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ Run `graph-disputes` with no parameters to see a list of commands.
graph-dispute setup

# General
graph-disputes dispute list
graph-disputes dispute show <disputeID>
graph-disputes list [--status <accepted|rejected|draw|undecided|all>]
graph-disputes show <disputeID>

# Submitter
graph-disputes dispute create indexing <allocationID> <deposit>
graph-disputes dispute create query <attestation> <deposit>
graph-disputes create indexing <allocationID> <deposit>
graph-disputes create query <attestation> <deposit>

# Arbitrator
graph-disputes dispute resolve reject <disputeID>
graph-disputes dispute resolve accept <disputeID>
graph-disputes dispute resolve draw <disputeID>
graph-disputes dispute resolve verify <payload>
graph-disputes resolve reject <disputeID>
graph-disputes resolve accept <disputeID>
graph-disputes resolve draw <disputeID>
graph-disputes resolve verify <payload>
```


Expand Down Expand Up @@ -123,7 +123,7 @@ The Arbitration process is managed by a Multisig that can be changed anytime by

### List Disputes

The `list` command allows shows you the active disputes:
The `list` command shows you the active (undecided) disputes:

```bash
graph-dispute list
Expand Down
3 changes: 3 additions & 0 deletions bin/graph-disputes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

require('../dist/index')
4 changes: 4 additions & 0 deletions frontend/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
presets: [['next/babel']],
plugins: [['import', { libraryName: 'antd', style: true }]],
};
10 changes: 10 additions & 0 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
};
30 changes: 30 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
15 changes: 15 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine": "lf",
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
29 changes: 29 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# nextjs-ant-design-typescript
![GitHub](https://img.shields.io/github/license/gnokoheat/nextjs-ant-design-typescript) ![GitHub top language](https://img.shields.io/github/languages/top/gnokoheat/nextjs-ant-design-typescript) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/gnokoheat/nextjs-ant-design-typescript) ![GitHub last commit](https://img.shields.io/github/last-commit/gnokoheat/nextjs-ant-design-typescript)

Next.js + Ant design + Typescript

![](https://github.com/gnokoheat/nextjs-ant-design-typescript/blob/master/docs/nextjs-antdesign-typescript.gif?raw=true)

- Including simple structure & layout

## Usage
1. Copy this repository.
```
git clone https://github.com/gnokoheat/nextjs-ant-design-typescript
cd nextjs-ant-design-typescript/
```
2. Install dependencies
```
yarn install
```

3. Run app
``` bash
# Dev
yarn dev

# Production
yarn build
yarn start
```
7 changes: 7 additions & 0 deletions frontend/assets/base.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import './utils/media-queries.less';
@import './resets/base.reset.less';

:root {
--color-light-gray: #f3f3f3;
--body-container-normal-background-color: var(--color-light-gray);
}
3 changes: 3 additions & 0 deletions frontend/assets/resets/base.reset.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background-color: var(--body-container-normal-background-color) !important;
}
25 changes: 25 additions & 0 deletions frontend/assets/utils/media-queries.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@screen-xs: 480px;
@screen-sm: 768px;
@screen-md: 992px;
@screen-lg: 1200px;

@screen-sm-min: @screen-sm;
@screen-md-min: @screen-md;
@screen-xs-min: @screen-xs;
@screen-lg-min: @screen-lg;

@screen-xs-max: (@screen-sm-min - 1);
@screen-sm-max: (@screen-md-min - 1);
@screen-md-max: (@screen-lg-min - 1);

@xs-and-up: ~'only screen';
@xs-only: ~'only screen and (max-width: @{screen-xs-max})';
@sm-and-up: ~'only screen and (min-width: @{screen-sm-min})';
@sm-only: ~'only screen and (min-width: @{screen-sm-min}) and (max-width: @{screen-sm-max})';
@md-and-up: ~'only screen and (min-width: @{screen-md-min})';
@md-only: ~'only screen and (min-width: @{screen-md-min}) and (max-width: @{screen-md-max})';
@lg-and-up: ~'only screen and (min-width: @{screen-lg-min})';
@lg-only: @lg-and-up;
@mobile: @xs-only;
@tablet: @sm-only;
@desktop: @md-and-up;
Loading

0 comments on commit cf4bf77

Please sign in to comment.