Skip to content

Commit

Permalink
Merge branch 'dev' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin committed Oct 18, 2024
2 parents 5358dc2 + 5f38b90 commit 35617c6
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 43 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/ai-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
- uses: rubensflinco/[email protected]
name: "Code Review by Gemini AI"
id: review
continue-on-error: true
with:
gemini_api_key: ${{ secrets.GEMINI_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -95,29 +96,31 @@ jobs:
When a line start with a minus (`-`) it means that the line was removed, when it starts with plus (`+`) it means that the line was added.
log_level: "DEBUG"

- name: Add thumbs down reaction if something went wrong
if: steps.review.outcome == 'failure'
run: gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_DOWN}){reaction{content}subject{id}}}"
- name: Get current job ID
id: get-job-id
run: |
job_uri=$(gh run --repo ${{ github.repository }} view ${{ github.run_id }} --json jobs --jq '.jobs[] | select(.name == "${{ github.job }}") | .url')
echo "job_uri=$job_uri" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ID: ${{ github.event.comment.node_id }}

- name: Get Gemini step log
if: steps.review.outcome == 'failure'
id: get-gemini-log
run: |
echo "gemini_log<<EOF" >> $GITHUB_OUTPUT
gh run view ${{ steps.review.outputs.run_id }} --log >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Add comment with log
if: steps.review.outcome == 'failure'
uses: actions/github-script@v6
with:
script: |
const runUrl = `${{ steps.get-job-id.outputs.job_uri }}#step:8:1`;
const commentBody = `Gemini Code Review encountered an error. [View the run here](${runUrl}).\n\nSee **Code Review by Gemini AI** step as it may still contains some review before failing.`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Gemini Code Review encountered an error. Here is the step log:\n\n```\n${{ steps.get-gemini-log.outputs.gemini_log }}\n```'
body: commentBody
});
- name: Add thumbs down reaction if something went wrong
if: failure()
run: gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_DOWN}){reaction{content}subject{id}}}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ID: ${{ github.event.comment.node_id }}
1 change: 0 additions & 1 deletion apps/web/components/ActivatePoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type ActiveMemberProps = {

export function ActivatePoints({
strategy,
communityAddress,
isMember,
isMemberActivated,
}: ActiveMemberProps) {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/CheckPassport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { Button } from "./Button";
import { Skeleton } from "./Skeleton";
import { Modal } from "@/components";
import { isProd } from "@/configs/isProd";
import { usePubSubContext } from "@/contexts/pubsub.context";
import { useChainIdFromPath } from "@/hooks/useChainIdFromPath";
import { useSubgraphQuery } from "@/hooks/useSubgraphQuery";
import { CV_PASSPORT_THRESHOLD_SCALE } from "@/utils/numbers";
import { usePubSubContext } from "@/contexts/pubsub.context";

type SubmitPassportResponse = {
data: any;
Expand Down
41 changes: 25 additions & 16 deletions apps/web/components/DisputeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
const [isDisputeCreateLoading, setIsDisputeCreateLoading] = useState(false);
const chainId = useChainIdFromPath();
const [rulingLoading, setisRulingLoading] = useState<number | false>(false);
const [error, setError] = useState("");

const arbitrationConfig = proposalData.arbitrableConfig;

Expand Down Expand Up @@ -113,7 +114,7 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
});

const totalStake =
arbitrationCost && arbitrationConfig ?
arbitrationCost != null && arbitrationConfig ?
arbitrationCost + BigInt(arbitrationConfig.challengerCollateralAmount)
: undefined;
const lastDispute =
Expand Down Expand Up @@ -175,14 +176,18 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
});

async function handleSubmit() {
setIsDisputeCreateLoading(true);
const reasonHash = await ipfsJsonUpload({ reason }, "disputeReason");
if (!reasonHash) {
return;
if (!reason) {
setError("The dispute reason is required.");
} else {
setIsDisputeCreateLoading(true);
const reasonHash = await ipfsJsonUpload({ reason }, "disputeReason");
if (!reasonHash) {
return;
}
await writeDisputeProposalAsync({
args: [BigInt(proposalData.proposalNumber), reasonHash, "0x0"],
});
}
await writeDisputeProposalAsync({
args: [BigInt(proposalData.proposalNumber), reasonHash, "0x0"],
});
}

const { write: writeSubmitRuling } = useContractWriteWithConfirmations({
Expand Down Expand Up @@ -275,14 +280,18 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
))}
</div>
: <div>
<textarea
id="reason"
value={reason}
onChange={(e) => setReason(e.target.value)}
placeholder="Enter your dispute reason here"
className="textarea textarea-accent w-full mb-4"
rows={5}
/>
<div className="w-full mb-4">
<textarea
id="reason"
value={reason}
onChange={(e) => setReason(e.target.value)}
placeholder="Enter your dispute reason here"
className="textarea textarea-accent w-full"
rows={5}
required
/>
<div className="text-error ml-4 mt-1">{error}</div>
</div>
<InfoBox
infoBoxType="info"
content={`Disputing this proposal stops it from being executed but not from growing in support. The Tribunal has ${rulingTimeout.value} ${rulingTimeout.unit} to settle any disputes before it can be closed and collateral is returned.`}
Expand Down
3 changes: 1 addition & 2 deletions apps/web/components/Forms/CommunityForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export const CommunityForm = ({

const { publish } = usePubSubContext();

const INPUT_TOKEN_MIN_VALUE = 1 / 10 ** tokenGarden.decimals;
const [showPreview, setShowPreview] = useState<boolean>(false);
const [previewData, setPreviewData] = useState<FormInputs>();
const [loading, setLoading] = useState(false);
Expand Down Expand Up @@ -261,7 +260,7 @@ export const CommunityForm = ({
registerOptions={{
min: {
value: 0,
message: `Amount must be greater than 0`,
message: "Amount must be greater than 0",
},
}}
suffix={tokenGarden.symbol}
Expand Down
9 changes: 2 additions & 7 deletions apps/web/components/Forms/ProposalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import { FormInput } from "./FormInput";
import { FormPreview, FormRow } from "./FormPreview";
import { LoadingSpinner } from "../LoadingSpinner";
import { FormAddressInput } from "./FormAddressInput";
import { WalletBalance } from "../WalletBalance";
import { Button, EthAddress } from "@/components";
import { QUERY_PARAMS } from "@/constants/query-params";
Expand All @@ -26,8 +27,6 @@ import { abiWithErrors } from "@/utils/abi";
import { getEventFromReceipt } from "@/utils/contracts";
import { ipfsJsonUpload } from "@/utils/ipfsUtils";
import { formatTokenAmount } from "@/utils/numbers";
import { capitalize } from "@/utils/text";
import { FormAddressInput } from "./FormAddressInput";

//protocol : 1 => means ipfs!, to do some checks later
type FormInputs = {
Expand Down Expand Up @@ -74,8 +73,6 @@ const abiParameters = [
},
];

const ethereumAddressRegEx = /^(0x)?[0-9a-fA-F]{40}$/;

function formatNumber(num: string | number): string {
if (num == 0) {
return "0";
Expand Down Expand Up @@ -141,9 +138,7 @@ export const ProposalForm = ({
},
beneficiary: {
label: "Beneficiary:",
parse: (value: string) => (
<EthAddress address={value as Address}></EthAddress>
),
parse: (value: string) => <EthAddress address={value as Address} />,
},
proposalType: {
label: "Proposal Type:",
Expand Down
3 changes: 1 addition & 2 deletions apps/web/components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import { ReactNode, useEffect, useRef, useState } from "react";
import { ReactNode, useEffect, useRef } from "react";
import { XMarkIcon } from "@heroicons/react/24/outline";

interface ModalProps {
Expand Down Expand Up @@ -51,7 +51,6 @@ export function Modal({
return (
<dialog
className={`modal max-sm:modal-bottom ${className}`}
role="dialog"
ref={dialogRef}
>
<div className="modal-box max-w-5xl overflow-visible w-fit flex flex-col rounded-2xl bg-primary p-0">
Expand Down
1 change: 1 addition & 0 deletions apps/web/components/Skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const Skeleton = ({
.fill(0)
.map((_, i) => (
<div
// eslint-disable-next-line react/no-array-index-key
key={i}
className={`[--fallback-b3:#f0f0f0] skeleton h-5 w-full my-1 rounded-md ${className}`}
/>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/configs/chains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const chainConfigMap: {
subgraphUrl: `${process.env.NEXT_PUBLIC_SUBGRAPH_URL_GNOSIS?.replace("/version/latest", "")}/${SUBGRAPH_PRODNET_VERSION}`,
globalTribunal: "0x1B8C7f06F537711A7CAf6770051A43B4F3E69A7e",
allo: "0x1133eA7Af70876e64665ecD07C0A0476d09465a1",
arbitrator: "0x4d858f327d63bbf693291b96f9e585cac64895a9",
arbitrator: "0x450967c1497ab95df8530a9a8eaae5e951171dee",
passportScorer: "0xd7b72fcb6a4e2857685175f609d1498ff5392e46",
isTestnet: false,
},
Expand Down

0 comments on commit 35617c6

Please sign in to comment.