kleros/kleros-v2

View on GitHub

Showing 1,392 of 1,493 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it("Stakes in subcourt and should draw jurors in subcourt", async () => {
const stake = async (wallet: HDNodeWallet) => {
await core
.connect(wallet)
.setStake(CHILD_COURT, ONE_THOUSAND_PNK * 5n, { gasLimit: 5000000 })
Severity: Major
Found in contracts/test/arbitration/draw.ts and 1 other location - About 3 days to fix
contracts/test/arbitration/draw.ts on lines 317..381

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it("Stakes in subcourt and should draw jurors in parent court", async () => {
const stake = async (wallet: HDNodeWallet) => {
await core
.connect(wallet)
.setStake(CHILD_COURT, ONE_THOUSAND_PNK * 5n, { gasLimit: 5000000 })
Severity: Major
Found in contracts/test/arbitration/draw.ts and 1 other location - About 3 days to fix
contracts/test/arbitration/draw.ts on lines 383..447

Similar blocks of code found in 2 locations. Consider refactoring.
Open

describe("When the Phase passes back to Staking", () => {
before("Setup", async () => {
await reachStakingPhaseAfterDrawing();
balanceBefore = await pnk.balanceOf(deployer);
});
Severity: Major
Found in contracts/test/arbitration/staking.ts and 1 other location - About 2 days to fix
contracts/test/arbitration/staking.ts on lines 107..136

Similar blocks of code found in 2 locations. Consider refactoring.
Open

describe("When the Phase passes back to Staking", () => {
before("Setup", async () => {
await reachStakingPhaseAfterDrawing();
balanceBefore = await pnk.balanceOf(deployer);
});
Severity: Major
Found in contracts/test/arbitration/staking.ts and 1 other location - About 2 days to fix
contracts/test/arbitration/staking.ts on lines 349..378

Identical blocks of code found in 2 locations. Consider refactoring.
Open

describe("When stake is decreased back to the previous amount", () => {
it("Should cancel out the stake decrease back", async () => {
balanceBefore = await pnk.balanceOf(deployer);
expect(await sortition.latestDelayedStakeIndex(deployer, 2)).to.be.equal(1);
await expect(core.setStake(2, PNK(2000)))
Severity: Major
Found in contracts/test/arbitration/staking.ts and 1 other location - About 2 days to fix
contracts/test/arbitration/staking-neo.ts on lines 673..696

Identical blocks of code found in 2 locations. Consider refactoring.
Open

describe("When stake is decreased back to the previous amount", () => {
it("Should cancel out the stake decrease back", async () => {
balanceBefore = await pnk.balanceOf(deployer);
expect(await sortition.latestDelayedStakeIndex(deployer, 2)).to.be.equal(1);
await expect(core.setStake(2, PNK(2000)))
Severity: Major
Found in contracts/test/arbitration/staking-neo.ts and 1 other location - About 2 days to fix
contracts/test/arbitration/staking.ts on lines 324..347

Identical blocks of code found in 4 locations. Consider refactoring.
Open

describe("When stake is increased", () => {
it("Should transfer PNK but delay the stake increase", async () => {
expect(await sortition.delayedStakeWriteIndex()).to.be.equal(0);
expect(await sortition.delayedStakeReadIndex()).to.be.equal(1);
await pnk.approve(core.target, PNK(1000));
Severity: Major
Found in contracts/test/arbitration/staking.ts and 3 other locations - About 2 days to fix
contracts/test/arbitration/staking-neo.ts on lines 426..448
contracts/test/arbitration/staking-neo.ts on lines 649..671
contracts/test/arbitration/staking.ts on lines 300..322

Identical blocks of code found in 4 locations. Consider refactoring.
Open

describe("When stake is increased", () => {
it("Should transfer PNK but delay the stake increase", async () => {
expect(await sortition.delayedStakeWriteIndex()).to.be.equal(0);
expect(await sortition.delayedStakeReadIndex()).to.be.equal(1);
await pnk.approve(core.target, PNK(1000));
Severity: Major
Found in contracts/test/arbitration/staking-neo.ts and 3 other locations - About 2 days to fix
contracts/test/arbitration/staking-neo.ts on lines 649..671
contracts/test/arbitration/staking.ts on lines 83..105
contracts/test/arbitration/staking.ts on lines 300..322

Identical blocks of code found in 4 locations. Consider refactoring.
Open

describe("When stake is increased", () => {
it("Should transfer PNK but delay the stake increase", async () => {
expect(await sortition.delayedStakeWriteIndex()).to.be.equal(0);
expect(await sortition.delayedStakeReadIndex()).to.be.equal(1);
await pnk.approve(core.target, PNK(1000));
Severity: Major
Found in contracts/test/arbitration/staking-neo.ts and 3 other locations - About 2 days to fix
contracts/test/arbitration/staking-neo.ts on lines 426..448
contracts/test/arbitration/staking.ts on lines 83..105
contracts/test/arbitration/staking.ts on lines 300..322

Identical blocks of code found in 4 locations. Consider refactoring.
Open

describe("When stake is increased", () => {
it("Should transfer PNK but delay the stake increase", async () => {
expect(await sortition.delayedStakeWriteIndex()).to.be.equal(0);
expect(await sortition.delayedStakeReadIndex()).to.be.equal(1);
await pnk.approve(core.target, PNK(1000));
Severity: Major
Found in contracts/test/arbitration/staking.ts and 3 other locations - About 2 days to fix
contracts/test/arbitration/staking-neo.ts on lines 426..448
contracts/test/arbitration/staking-neo.ts on lines 649..671
contracts/test/arbitration/staking.ts on lines 83..105

Identical blocks of code found in 2 locations. Consider refactoring.
Open

describe("When stake is increased back to the previous amount", () => {
it("Should delay the stake increase", async () => {
balanceBefore = await pnk.balanceOf(deployer);
expect(await sortition.latestDelayedStakeIndex(deployer, 2)).to.be.equal(1);
await expect(core.setStake(2, PNK(2000)))
Severity: Major
Found in contracts/test/arbitration/staking.ts and 1 other location - About 2 days to fix
contracts/test/arbitration/staking-neo.ts on lines 583..605

Identical blocks of code found in 2 locations. Consider refactoring.
Open

describe("When stake is increased back to the previous amount", () => {
it("Should delay the stake increase", async () => {
balanceBefore = await pnk.balanceOf(deployer);
expect(await sortition.latestDelayedStakeIndex(deployer, 2)).to.be.equal(1);
await expect(core.setStake(2, PNK(2000)))
Severity: Major
Found in contracts/test/arbitration/staking-neo.ts and 1 other location - About 2 days to fix
contracts/test/arbitration/staking.ts on lines 236..258

Identical blocks of code found in 4 locations. Consider refactoring.
Open

describe("When stake is decreased", async () => {
it("Should delay the stake decrease", async () => {
expect(await sortition.delayedStakeWriteIndex()).to.be.equal(0);
expect(await sortition.delayedStakeReadIndex()).to.be.equal(1);
expect(await sortition.latestDelayedStakeIndex(deployer, 2)).to.be.equal(0);
Severity: Major
Found in contracts/test/arbitration/staking-neo.ts and 3 other locations - About 2 days to fix
contracts/test/arbitration/staking-neo.ts on lines 560..581
contracts/test/arbitration/staking.ts on lines 150..171
contracts/test/arbitration/staking.ts on lines 213..234

Identical blocks of code found in 4 locations. Consider refactoring.
Open

describe("When stake is decreased", async () => {
it("Should delay the stake decrease", async () => {
expect(await sortition.delayedStakeWriteIndex()).to.be.equal(0);
expect(await sortition.delayedStakeReadIndex()).to.be.equal(1);
expect(await sortition.latestDelayedStakeIndex(deployer, 2)).to.be.equal(0);
Severity: Major
Found in contracts/test/arbitration/staking-neo.ts and 3 other locations - About 2 days to fix
contracts/test/arbitration/staking-neo.ts on lines 495..516
contracts/test/arbitration/staking.ts on lines 150..171
contracts/test/arbitration/staking.ts on lines 213..234

Similar blocks of code found in 3 locations. Consider refactoring.
Open

const deployUpgradeKlerosCore: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts, getChainId } = hre;
 
// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
Severity: Major
Found in contracts/deploy/upgrade-kleros-core-v0.8.0.ts and 2 other locations - About 2 days to fix
contracts/deploy/upgrade-dispute-kit-v0.8.0.ts on lines 10..45
contracts/deploy/upgrade-sortition-module-v0.8.0.ts on lines 10..45

Similar blocks of code found in 3 locations. Consider refactoring.
Open

const deployUpgradeSortitionModule: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts, getChainId } = hre;
 
// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
Severity: Major
Found in contracts/deploy/upgrade-sortition-module-v0.8.0.ts and 2 other locations - About 2 days to fix
contracts/deploy/upgrade-dispute-kit-v0.8.0.ts on lines 10..45
contracts/deploy/upgrade-kleros-core-v0.8.0.ts on lines 10..45

Similar blocks of code found in 3 locations. Consider refactoring.
Open

const deployUpgradeDisputeKit: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts, getChainId } = hre;
 
// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
Severity: Major
Found in contracts/deploy/upgrade-dispute-kit-v0.8.0.ts and 2 other locations - About 2 days to fix
contracts/deploy/upgrade-kleros-core-v0.8.0.ts on lines 10..45
contracts/deploy/upgrade-sortition-module-v0.8.0.ts on lines 10..45

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const GlobalStyle = createGlobalStyle`
:root {
--toastify-color-info: ${({ theme }) => theme.klerosUIComponentsPrimaryBlue};
--toastify-color-success: ${({ theme }) => theme.klerosUIComponentsSuccess};
--toastify-color-warning: ${({ theme }) => theme.klerosUIComponentsWarning};
Severity: Major
Found in web-devtools/src/styles/global-style.ts and 1 other location - About 2 days to fix
web/src/styles/global-style.ts on lines 3..132

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const GlobalStyle = createGlobalStyle`
:root {
--toastify-color-info: ${({ theme }) => theme.primaryBlue};
--toastify-color-success: ${({ theme }) => theme.success};
--toastify-color-warning: ${({ theme }) => theme.warning};
Severity: Major
Found in web/src/styles/global-style.ts and 1 other location - About 2 days to fix
web-devtools/src/styles/global-style.ts on lines 3..119

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it("Should execute the delayed stakes by withdrawing PNK and reducing the stakes", async () => {
await expect(await sortition.executeDelayedStakes(10))
.to.emit(sortition, "StakeSet")
.withArgs(deployer, 2, PNK(1000), PNK(3000));
expect(await sortition.getJurorBalance(deployer, 2)).to.be.deep.equal([
Severity: Major
Found in contracts/test/arbitration/staking-neo.ts and 1 other location - About 1 day to fix
contracts/test/arbitration/staking-neo.ts on lines 613..628
Severity
Category
Status
Source
Language