Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: test cases for registry #14

Merged
merged 24 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
857acc8
init
mohandast52 Mar 15, 2024
5de0a89
move ADDRESSES to typescript
mohandast52 Mar 15, 2024
14a6c7d
Fix eslint, enable git workflow
Tanya-atatakai Mar 15, 2024
402c738
Update git workflow
Tanya-atatakai Mar 17, 2024
81b6bdb
Fix test running
Tanya-atatakai Mar 17, 2024
f027486
tests added for fallback handler
mohandast52 Mar 18, 2024
16a95d2
test-cases for multi_send_call_only
mohandast52 Mar 18, 2024
1c1e2b5
mock dummySvmConnectivity for failing tests
mohandast52 Mar 18, 2024
d2875dd
arrange test folders
mohandast52 Mar 18, 2024
71fa367
Fix git workflow jobs, comment test for registry
Tanya-atatakai Mar 18, 2024
05bd986
Make gitleaks not fail
Tanya-atatakai Mar 18, 2024
1d9a3c2
service details works
mohandast52 Mar 18, 2024
d465d92
details tests
mohandast52 Mar 18, 2024
ef9297c
list agents and list components working
mohandast52 Mar 19, 2024
80ba37c
test-pasees
mohandast52 Mar 19, 2024
7417791
fixes
mohandast52 Mar 19, 2024
c94348e
Merge pull request #13 from valory-xyz/fix/git-workflow
mohandast52 Mar 19, 2024
b0f8ecc
Uncomment test step for registry
Tanya-atatakai Mar 19, 2024
6049417
update yarn.lock
mohandast52 Mar 19, 2024
a9ed542
Merge branch 'mohan/registry-test-cases' of github.com-personal:valor…
mohandast52 Mar 19, 2024
70ad7c2
delete package-lock.json
mohandast52 Mar 19, 2024
98c6a33
Fix gitleaks
Tanya-atatakai Mar 19, 2024
517bb6b
Update gitleaksignores
Tanya-atatakai Mar 19, 2024
e87f009
Merge pull request #15 from valory-xyz/fix/gitleaks-ignore
mohandast52 Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"env": {
"browser": true,
Expand All @@ -24,7 +23,8 @@
}
]
}
]
],
"react-hooks/exhaustive-deps": "warn"
}
},
{
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/autonolas-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Autonolas registry
on:
push:
branches:
- main
paths:
- 'apps/autonolas-registry/**'
pull_request:
paths:
- 'apps/autonolas-registry/**'

jobs:
build:
continue-on-error: False
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install modules
run: yarn
- run: git branch --track main origin/main
- name: Run ESLint
run: yarn nx lint autonolas-registry
- name: Run Test
run: yarn nx test autonolas-registry
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: '1.17.7'
- run: |
wget https://github.com/zricethezav/gitleaks/releases/download/v8.10.1/gitleaks_8.10.1_linux_x64.tar.gz && \
tar -xzf gitleaks_8.10.1_linux_x64.tar.gz && \
sudo install gitleaks /usr/bin && \
gitleaks detect -r apps/autonolas-registry/gitleaks-report.json -s apps/autonolas-registry -v
40 changes: 0 additions & 40 deletions .github/workflows/main.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/tokenomics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# TODO: figure out how to trigger workflow from vercel for nx

name: Tokenomics
on:
push:
branches:
- main
paths:
- 'apps/tokenomics/**'
pull_request:
paths:
- 'apps/tokenomics/**'

jobs:
build:
continue-on-error: False
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install modules
run: yarn
- run: git branch --track main origin/main
- name: Run ESLint
run: yarn nx lint tokenomics
- name: Run Test
run: yarn nx test tokenomics
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: '1.17.7'
- run: |
wget https://github.com/zricethezav/gitleaks/releases/download/v8.10.1/gitleaks_8.10.1_linux_x64.tar.gz && \
tar -xzf gitleaks_8.10.1_linux_x64.tar.gz && \
sudo install gitleaks /usr/bin && \
gitleaks detect -r apps/tokenomics/gitleaks-report.json -s apps/tokenomics -v
347 changes: 232 additions & 115 deletions apps/autonolas-registry/.gitleaksignore

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
import { Address } from 'viem';
import {
LOCAL_FORK_ID,
LOCAL_FORK_ID_GNOSIS,
LOCAL_FORK_ID_POLYGON,
} from 'util/constants';
} from '../../util/constants';

const MAINNET_ADDRESSES = {
type Addresses = {
serviceManagerToken: Address;
serviceRegistryL2: Address;
serviceRegistryTokenUtility: Address;
operatorWhitelist: Address;
};

type L1Addresses = {
agentRegistry: Address;
componentRegistry: Address;
registriesManager: Address;
serviceManagerToken: Address;
serviceRegistry: Address;
serviceRegistryTokenUtility: Address;
operatorWhitelist: Address;
};

const MAINNET_ADDRESSES: L1Addresses = {
agentRegistry: '0x2F1f7D38e4772884b88f3eCd8B6b9faCdC319112',
componentRegistry: '0x15bd56669F57192a97dF41A2aa8f4403e9491776',
registriesManager: '0x9eC9156dEF5C613B2a7D4c46C383F9B58DfcD6fE',
Expand All @@ -14,14 +32,14 @@ const MAINNET_ADDRESSES = {
operatorWhitelist: '0x42042799B0DE38AdD2a70dc996f69f98E1a85260',
};

const GNOSIS_ADDRESSES = {
const GNOSIS_ADDRESSES: Addresses = {
serviceManagerToken: '0x04b0007b2aFb398015B76e5f22993a1fddF83644',
serviceRegistryL2: '0x9338b5153AE39BB89f50468E608eD9d764B755fD',
serviceRegistryTokenUtility: '0xa45E64d13A30a51b91ae0eb182e88a40e9b18eD8',
operatorWhitelist: '0x526E064cB694E8f5B7DB299158e17F33055B3943',
};

const POLYGON_ADDRESSES = {
const POLYGON_ADDRESSES: Addresses = {
serviceManagerToken: '0x04b0007b2aFb398015B76e5f22993a1fddF83644',
serviceRegistryL2: '0xE3607b00E75f6405248323A9417ff6b39B244b50',
serviceRegistryTokenUtility: '0xa45E64d13A30a51b91ae0eb182e88a40e9b18eD8',
Expand All @@ -35,7 +53,7 @@ const POLYGON_ADDRESSES = {
* - optimistic
* - celo
*/
const COMMON_TEST_ADDRESSES = {
const COMMON_TEST_ADDRESSES: Addresses = {
serviceManagerToken: '0x5BA58970c2Ae16Cf6218783018100aF2dCcFc915',
serviceRegistryL2: '0x31D3202d8744B16A120117A053459DDFAE93c855',
serviceRegistryTokenUtility: '0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994',
Expand Down Expand Up @@ -110,38 +128,31 @@ export const ADDRESSES = {
11155420: COMMON_TEST_ADDRESSES,
// celo alfajores - testnet for celo
44787: COMMON_TEST_ADDRESSES,
// local
31337: {
agentRegistry: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
componentRegistry: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
registriesManager: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
serviceRegistry: '0x998abeb3E57409262aE5b751f60747921B33613E',
serviceManager: '0x4c5859f0F772848b2D91F1D83E2Fe57935348029',
serviceRegistryTokenUtility: '0x36C02dA8a0983159322a80FFE9F24b1acfF8B570',
operatorWhitelist: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D',
// used for testing - service creation/update token address
ERC20Token: '0x1291Be112d480055DaFd8a610b7d1e203891C274',
},
[LOCAL_FORK_ID]: MAINNET_ADDRESSES,
[LOCAL_FORK_ID_GNOSIS]: GNOSIS_ADDRESSES,
[LOCAL_FORK_ID_POLYGON]: POLYGON_ADDRESSES,
};
} as const;

export type ChainIds = keyof typeof ADDRESSES;

type MultisigAddress = {
[chainId in ChainIds]: Address[];
};
// TODO: add testcases for all networks
/**
* check addresses here - GnosisSafeMultisig
* Addresses: https://github.com/valory-xyz/autonolas-registries/blob/main/docs/configuration.json
*/
export const multisigAddresses = {
export const multisigAddresses: MultisigAddress = {
1: ['0x46C0D07F55d4F9B5Eed2Fc9680B5953e5fd7b461'],
5: ['0x65dD51b02049ad1B6FF7fa9Ea3322E1D2CAb1176'],
10: ['0xE43d4F4103b623B61E095E8bEA34e1bc8979e168'],
100: ['0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE'],
137: ['0x3d77596beb0f130a4415df3D2D8232B3d3D31e44'],
8453: ['0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac'],
10200: ['0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994'],
80001: ['0x9dEc6B62c197268242A768dc3b153AE7a2701396'],
84532: ['0x19936159B528C66750992C3cBcEd2e71cF4E4824'],
31337: ['0x0E801D84Fa97b50751Dbf25036d067dCf18858bF'],
42161: ['0x63e66d7ad413C01A7b49C7FF4e3Bb765C4E4bd1b'],
42220: ['0x63e66d7ad413C01A7b49C7FF4e3Bb765C4E4bd1b'],
421614: ['0x19936159B528C66750992C3cBcEd2e71cF4E4824'],
Expand All @@ -152,21 +163,20 @@ export const multisigAddresses = {
[LOCAL_FORK_ID_POLYGON]: ['0x3d77596beb0f130a4415df3D2D8232B3d3D31e44'],
};

// TODO: add testcases for all networks
/**
* check addresses here - GnosisSafeSameAddressMultisig
* Addresses: https://github.com/valory-xyz/autonolas-registries/blob/main/docs/configuration.json
*/
export const multisigSameAddresses = {
export const multisigSameAddresses: MultisigAddress = {
1: ['0xfa517d01DaA100cB1932FA4345F68874f7E7eF46'],
5: ['0x06467Cb835da623384a22aa902647784C1c9f5Ae'],
10: ['0xb09CcF0Dbf0C178806Aaee28956c74bd66d21f73'],
100: ['0x6e7f594f680f7aBad18b7a63de50F0FeE47dfD06'],
137: ['0xd8BCC126ff31d2582018715d5291A508530587b0'],
10200: ['0xE16adc7777B7C2a0d35033bd3504C028AB28EE8b'],
8453: ['0xFbBEc0C8b13B38a9aC0499694A69a10204c5E2aB'],
80001: ['0xd6AA4Ec948d84f6Db8EEf25104CeE0Ecd280C74e'],
84532: ['0x10100e74b7F706222F8A7C0be9FC7Ae1717Ad8B2'],
31337: ['0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf'],
42161: ['0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac'],
42220: ['0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac'],
421614: ['0x10100e74b7F706222F8A7C0be9FC7Ae1717Ad8B2'],
Expand All @@ -177,21 +187,20 @@ export const multisigSameAddresses = {
[LOCAL_FORK_ID_POLYGON]: ['0xd8BCC126ff31d2582018715d5291A508530587b0'],
};

// TODO: add testcases for all networks
/**
* check addresses here - MultiSendCallOnly
* https://github.com/safe-global/safe-deployments/blob/main/src/assets/v1.3.0/multi_send_call_only.json
*/
export const safeMultiSend = {
export const safeMultiSend: MultisigAddress = {
1: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
5: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
10: ['0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B'],
100: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
137: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
8453: ['0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B'],
10200: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
80001: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
84532: ['0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B'],
31337: ['0x9d4454B023096f34B160D6B654540c56A1F81688'],
42161: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
42220: ['0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B'],
421614: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
Expand All @@ -202,21 +211,22 @@ export const safeMultiSend = {
[LOCAL_FORK_ID_POLYGON]: ['0x40A2aCCbd92BCA938b02010E17A5b8929b49130D'],
};

// TODO: add testcases for all networks
/**
* check addresses here
* https://github.com/safe-global/safe-deployments/blob/main/src/assets/v1.3.0/compatibility_fallback_handler.json
*/
export const FALLBACK_HANDLER = {
export const FALLBACK_HANDLER: {
[chainId in ChainIds]: Address;
} = {
1: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
5: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
10: '0x017062a1dE2FE6b99BE3d9d37841FeD19F573804',
100: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
137: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
8453: '0x017062a1dE2FE6b99BE3d9d37841FeD19F573804',
10200: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
80001: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
84532: '0x017062a1dE2FE6b99BE3d9d37841FeD19F573804',
31337: '0x0000000000000000000000000000000000000000',
mohandast52 marked this conversation as resolved.
Show resolved Hide resolved
42161: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
42220: '0x017062a1dE2FE6b99BE3d9d37841FeD19F573804',
421614: '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4',
Expand Down
2 changes: 1 addition & 1 deletion apps/autonolas-registry/common-util/Details/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Header, DetailsTitle } from './styles';

const { Text } = Typography;

const Details = ({
export const Details = ({
id,
type,
getDetails,
Expand Down
Loading
Loading