-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PP-428: Refactor to use ethers and hardhat WIP PP-428: Separete relay hub test into another file PP-428: Working 27 tests PP-428: Working 33 tests PP-428: Troubleshooting timeout error. WIP chore(test): relayhub testing. 31 tests passing. 1 pending PP-428: wip debuggins final test chore(test): all testing working for relayhub chore(test): increase gas limit to 0.01 usd for relayhub tests test: unit tests for relay verifier test: unit tests for deployVerifier test: customSmartWalletDeployVerifier tests test: fix typo on function name feat: add draft tests for verify method feat: advance test on verify feat: improve tests for verify() function feat: add unit tests for SmartWallet.execute() feat: add unit tests for SmartWallet.directExecute() feat: delete not required tests feat: add new test and delete not required expects after pair revision fix: minor changes from pair revision fix: refactoring the EIP712 library fix: minor changes for pair revision test[relay-hub]: refactor with pr suggestions test: remove duplicated code and fix type error in relayhub tests test: remove comments from relay hub tests feat: contract deployment with hardhat and ethers chore: lint test: divided deployment script into modules test: fix test fix: send in real contract instance feat: do not deploy UtilToken on mainnet refactor(ethers): cleans up deployer chore(ethers): removes hh dependency compiler refactor(ethers): cleans up deployer chore: fix merge conflicts test(rif-relay-contracts): add tests for the penalizer contract test(rif-relay-contracts): update dependency Feature/PP-278/PP-329/tasks-over-scripts (#75) * feat: implement hardhat tasks * chore: lint * chore: no .vscode folder * fix: typo on function, relocate map creation * chore: lint Co-authored-by: Christos Otarola <christos@Christoss-MacBook-Pro.local>
- Loading branch information
1 parent
b013360
commit 4e596d3
Showing
24 changed files
with
3,508 additions
and
3,276 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
name: CI for RIF-Relay-Contract | ||
on: [push] | ||
jobs: | ||
lint&test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
lint_and_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Check Codestyles errors | ||
run: npm run ci:format | ||
- name: Check Codestyles errors | ||
run: npm run ci:format | ||
|
||
- name: Check Linter bugs for Typescript | ||
run: npm run ci:lint | ||
- name: Check Linter bugs for Typescript | ||
run: npm run ci:lint | ||
|
||
- name: Download rif-relay node configuration | ||
run: | | ||
wget https://raw.githubusercontent.com/rsksmart/rif-relay/develop/docker/node.conf | ||
wget https://raw.githubusercontent.com/rsksmart/rif-relay/develop/docker/logback.xml | ||
- name: Download rif-relay node configuration | ||
run: | | ||
wget https://raw.githubusercontent.com/rsksmart/rif-relay/develop/docker/node.conf | ||
wget https://raw.githubusercontent.com/rsksmart/rif-relay/develop/docker/logback.xml | ||
- name: Run docker image | ||
run: docker run -d -p 127.0.0.1:4444:4444 -p 127.0.0.1:4445:4445 --name enveloping-rskj -it -v $PWD/logback.xml:/etc/rsk/logback.xml -v $PWD/node.conf:/etc/rsk/node.conf rsksmart/rskj:IRIS-3 --regtest | ||
- name: Run docker image | ||
run: docker run -d -p 127.0.0.1:4444:4444 -p 127.0.0.1:4445:4445 --name enveloping-rskj -it -v $PWD/logback.xml:/etc/rsk/logback.xml -v $PWD/node.conf:/etc/rsk/node.conf rsksmart/rskj:IRIS-3 --regtest | ||
|
||
- name: Run tests | ||
run: npm run ci:test | ||
- name: Run tests | ||
run: npm run ci:test |
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 |
---|---|---|
|
@@ -14,3 +14,5 @@ artifacts | |
/build | ||
/dist | ||
/contracts-exposed | ||
|
||
.vscode |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"hardhat.31337":{"Penalizer":"0x5FbDB2315678afecb367f032d93F642f64180aa3","RelayHub":"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512","SmartWallet":"0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0","SmartWalletFactory":"0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9","DeployVerifier":"0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9","RelayVerifier":"0x5FC8d32690cc91D4c39d9d3abcBD16989F875707","CustomSmartWallet":"0x0165878A594ca255338adfa4d48449f69242Eb8F","CustomSmartWalletFactory":"0xa513E6E4b8f2a923D98304ec87F64353C4D5C853","CustomSmartWalletDeployVerifier":"0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6","UtilToken":"0x610178dA211FEF7D417bC0e6FeD39F05609AD788","VersionRegistry":"0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"},"regtest.33":{"Penalizer":"0x77A151FE2Ac2300Ccc89FD00330Add038e6e6B45","RelayHub":"0x05840bf34268900b255eFdeAb4E8b18A74Ec822E","SmartWallet":"0xE66d6095193f9Bec61F46d47EB2AC3C4315b01F1","SmartWalletFactory":"0x55898Faccf2D03C6B4d0564b33cC6D397Ca32A17","DeployVerifier":"0xe3d09A82a6f07Ca1B4C6964866075473531E426E","RelayVerifier":"0x9F54ffdB097e4c87C539bcA6DBaeE4BA5F74700C","CustomSmartWallet":"0x4F64cCeC8e2692Bf674f5EAa4E0170B14db8e709","CustomSmartWalletFactory":"0x151A4b94c288a6be9eE48d63949b1d44Dc4e2999","CustomSmartWalletDeployVerifier":"0x091E9C08dA594c831002309E139389d8eCa2A99e","UtilToken":"0xB3647664cD22BcC7B1defEbD3767Df9a0B3E4009","VersionRegistry":"0xBa755AEF160f11185Fc2726DAdd9D3B029aEE50f"}} |
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { ContractTransaction } from 'ethers'; | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
import { getExistingConfig } from './deploy'; | ||
|
||
export const allowTokens = async ( | ||
taskArgs: { tokenlist: string }, | ||
hre: HardhatRuntimeEnvironment | ||
) => { | ||
const tokenAddresses = taskArgs.tokenlist.split(','); | ||
|
||
const { ethers, network } = hre; | ||
|
||
if (!network) { | ||
throw new Error('Unknown Network'); | ||
} | ||
|
||
const { chainId } = network.config; | ||
|
||
if (!chainId) { | ||
throw new Error('Unknown Chain Id'); | ||
} | ||
|
||
const contractAddresses = getExistingConfig(); | ||
|
||
if (!contractAddresses) { | ||
throw new Error('No contracts deployed'); | ||
} | ||
|
||
const networkChainKey = `${network.name}.${chainId}`; | ||
|
||
const deployVerifierAddress = | ||
contractAddresses[networkChainKey].DeployVerifier; | ||
const relayVerifierAddress = contractAddresses[networkChainKey].RelayVerifier; | ||
const customDeployVerifierAddress = | ||
contractAddresses[networkChainKey].CustomSmartWalletDeployVerifier; | ||
|
||
if (!deployVerifierAddress) { | ||
throw new Error('Could not obtain deploy verifier address'); | ||
} | ||
|
||
if (!relayVerifierAddress) { | ||
throw new Error('Could not obtain relay verifier address'); | ||
} | ||
|
||
if (!customDeployVerifierAddress) { | ||
throw new Error('Could not obtain custom deploy verifier address'); | ||
} | ||
|
||
const deployVerifier = await ethers.getContractAt( | ||
'DeployVerifier', | ||
deployVerifierAddress | ||
); | ||
const relayVerifier = await ethers.getContractAt( | ||
'RelayVerifier', | ||
relayVerifierAddress | ||
); | ||
const customDeployVerifier = await ethers.getContractAt( | ||
'CustomSmartWalletDeployVerifier', | ||
customDeployVerifierAddress | ||
); | ||
|
||
const verifierMap: Map< | ||
string, | ||
{ acceptToken: (tokenAddress: string) => Promise<ContractTransaction> } | ||
> = new Map(); | ||
verifierMap.set('deployVerifier', deployVerifier); | ||
verifierMap.set('relayVerifier', relayVerifier); | ||
verifierMap.set('customDeployVerifier', customDeployVerifier); | ||
|
||
for (const tokenAddress of tokenAddresses) { | ||
for (const [key, verifier] of verifierMap) { | ||
try { | ||
await verifier.acceptToken(tokenAddress); | ||
} catch (error) { | ||
console.error( | ||
`Error adding token with address ${tokenAddress} to allowed tokens on ${key}` | ||
); | ||
throw error; | ||
} | ||
} | ||
} | ||
console.log('Tokens allowed successfully!'); | ||
}; |
Oops, something went wrong.