-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use eslint-graph-config for data-edge
- Loading branch information
Showing
23 changed files
with
1,809 additions
and
12,132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const config = require('eslint-graph-config') | ||
|
||
module.exports = [ | ||
...config.default, | ||
{ | ||
rules: { | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/no-unsafe-call': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-unsafe-argument': 'off', | ||
}, | ||
}, | ||
{ | ||
ignores: ['**/reports/*'], | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,59 @@ | ||
import { ethers } from 'hardhat' | ||
import '@nomiclabs/hardhat-ethers' | ||
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers' | ||
import "@nomiclabs/hardhat-ethers"; | ||
import { ethers } from "hardhat"; | ||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; | ||
|
||
import { DataEdge__factory, DataEdge } from '../build/types' | ||
import { expect } from 'chai' | ||
import { DataEdge, DataEdge__factory } from "../build/types"; | ||
import { expect } from "chai"; | ||
|
||
const { getContractFactory, getSigners } = ethers | ||
const { id, hexConcat, randomBytes, hexlify, defaultAbiCoder } = ethers.utils | ||
const { getContractFactory, getSigners } = ethers; | ||
const { id, hexConcat, randomBytes, hexlify, defaultAbiCoder } = ethers.utils; | ||
|
||
describe('DataEdge', () => { | ||
let edge: DataEdge | ||
let me: SignerWithAddress | ||
describe("DataEdge", () => { | ||
let edge: DataEdge; | ||
let me: SignerWithAddress; | ||
|
||
beforeEach(async () => { | ||
;[me] = await getSigners() // eslint-disable-line @typescript-eslint/no-extra-semi | ||
[me] = await getSigners(); // eslint-disable-line @typescript-eslint/no-extra-semi | ||
|
||
const factory = (await getContractFactory('DataEdge', me)) as DataEdge__factory | ||
edge = await factory.deploy() | ||
await edge.deployed() | ||
}) | ||
const factory = (await getContractFactory( | ||
"DataEdge", | ||
me | ||
)) as DataEdge__factory; | ||
edge = await factory.deploy(); | ||
await edge.deployed(); | ||
}); | ||
|
||
describe('submit data', async () => { | ||
it('post any arbitrary data as selector', async () => { | ||
describe("submit data", () => { | ||
it("post any arbitrary data as selector", async () => { | ||
// virtual function call | ||
const txRequest = { | ||
data: '0x123123', | ||
data: "0x123123", | ||
to: edge.address, | ||
} | ||
}; | ||
// send transaction | ||
const tx = await me.sendTransaction(txRequest) | ||
const rx = await tx.wait() | ||
const tx = await me.sendTransaction(txRequest); | ||
const rx = await tx.wait(); | ||
// transaction must work - it just stores data | ||
expect(rx.status).eq(1) | ||
}) | ||
expect(rx.status).eq(1); | ||
}); | ||
|
||
it('post long calldata', async () => { | ||
it("post long calldata", async () => { | ||
// virtual function call | ||
const selector = id('setEpochBlocksPayload(bytes)').slice(0, 10) | ||
const selector = id("setEpochBlocksPayload(bytes)").slice(0, 10); | ||
// calldata payload | ||
const messageBlocks = hexlify(randomBytes(1000)) | ||
const txCalldata = defaultAbiCoder.encode(['bytes'], [messageBlocks]) // we abi encode to allow the subgraph to decode it properly | ||
const txData = hexConcat([selector, txCalldata]) | ||
const messageBlocks = hexlify(randomBytes(1000)); | ||
const txCalldata = defaultAbiCoder.encode(["bytes"], [messageBlocks]); // we abi encode to allow the subgraph to decode it properly | ||
const txData = hexConcat([selector, txCalldata]); | ||
// craft full transaction | ||
const txRequest = { | ||
data: txData, | ||
to: edge.address, | ||
} | ||
}; | ||
// send transaction | ||
const tx = await me.sendTransaction(txRequest) | ||
const rx = await tx.wait() | ||
const tx = await me.sendTransaction(txRequest); | ||
const rx = await tx.wait(); | ||
// transaction must work - it just stores data | ||
expect(rx.status).eq(1) | ||
}) | ||
}) | ||
}) | ||
expect(rx.status).eq(1); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.