Skip to content

Commit

Permalink
feat: check roles cron
Browse files Browse the repository at this point in the history
* fix: wrong lzEndpoint function name

* chore: check-roles github action

* feat: roles script that run every day and send a discord message

* chore: add DISCORD_TOKEN to env in ci

* feat: convert the check-roles message to embed

* chore: specify the chain_ids to run the script

* feat: don't post new messages unless something new is here

* chore: use ci profile in check-roles ci

* feat: update logs for a better understanding in checkRoles script

* chore: use matrixes inside check-roles ci with run for each chain id

* chore: compile inside check-roles ci

* chore: add MAINNET uri

* 

* fix: filter out undefined embed message

* chore: set parallel to 2

* chore: install dependencies in check-roles ci

* fix: check if the key is a decimal in checkScript

* chore: try eth_node_uri_mainnet with llamarpc

* chore: try to setup repo before

* chore: update back to all chain ids

* chore: set max parallel to 1

* chore: retry forge script checkRoles

* chore: set timeout for retries

* chore: remove on PR run check-roles script
  • Loading branch information
0xtekgrinder authored Feb 9, 2024
1 parent 92df1c4 commit 07a037f
Show file tree
Hide file tree
Showing 9 changed files with 749 additions and 110 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
#ETH_NODE_URI_FORK=http://localhost:8545
#MNEMONIC_FORK=""

#DISCORD_TOKEN=""
60 changes: 60 additions & 0 deletions .github/workflows/check-roles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "check-roles"

env:
FOUNDRY_PROFILE: "ci"

on:
schedule:
- cron: "0 0 * * *" # every day at midnight

jobs:
check-roles:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
chain: [1,42161,137,100,43114,8453,56,42220,1101,10,59144]
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Setup repo
uses: ./.github/actions/setup-repo
with:
registry-token: ${{ secrets.GH_REGISTRY_ACCESS_TOKEN }}

- name: Compile
run: forge build

- uses: nick-fields/retry@v2
with:
max_attempts: 5
command: forge script CheckRoles
timeout_minutes: 60
env:
ETH_NODE_URI_MAINNET: ${{ secrets.ETH_NODE_URI_MAINNET }}
ETH_NODE_URI_ARBITRUM: ${{ secrets.ETH_NODE_URI_ARBITRUM }}
ETH_NODE_URI_AVALANCHE: ${{ secrets.ETH_NODE_URI_AVALANCHE }}
ETH_NODE_URI_OPTIMISM: ${{ secrets.ETH_NODE_URI_OPTIMISM }}
ETH_NODE_URI_POLYGON: ${{ secrets.ETH_NODE_URI_POLYGON }}
ETH_NODE_URI_GNOSIS: ${{ secrets.ETH_NODE_URI_GNOSIS }}
ETH_NODE_URI_BSC: ${{ secrets.ETH_NODE_URI_BSC }}
ETH_NODE_URI_CELO: ${{ secrets.ETH_NODE_URI_CELO }}
ETH_NODE_URI_POLYGON_ZKEVM: ${{ secrets.ETH_NODE_URI_POLYGON_ZKEVM }}
ETH_NODE_URI_BASE: ${{ secrets.ETH_NODE_URI_BASE }}
ETH_NODE_URI_LINEA: ${{ secrets.ETH_NODE_URI_LINEA }}
CHAIN_IDS: ${{ matrix.chain }}

- name: Run script
run: yarn check-roles
env:
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ optimizer = true
optimizer_runs = 1000
solc_version = "0.8.23"
ffi = true
fs_permissions = [{ access = "read-write", path = "./scripts/proposals/payload.json"}]
fs_permissions = [{ access = "read-write", path = "./scripts/proposals/payload.json"}, { access = "read-write", path = "./scripts/roles.json"}]

[fuzz]
runs = 10000
Expand Down
2 changes: 1 addition & 1 deletion lib/utils
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"prettier": "prettier --write '**/*.sol'",
"lint": "yarn lint:check --fix",
"lint:check": "solhint --max-warnings 20 \"**/*.sol\"",
"check-roles": "node utils/checkRoles.js",
"verify": "forge verify-contract --chain-id 100 --watch --constructor-args $(cast abi-encode 'constructor(address,address,uint48,uint32,uint256,uint48,uint256,uint256,uint256)' '0xD622c71aba9060F393FEC67D3e2B9335292bf23B' '0x769A713bF0589d495008e5a7c78fABafb9C35F39' 300 3600 100000000000000000000000 60 20 75 60) 0x882dD02d7F2F06B7e968ECb97B1B62Bf51B3af4a AngleGovernor",
"verify:governor": "forge verify-contract --chain-id 1 --watch --show-standard-json-input > etherscan.json --solc-input --optimizer-runs=1000 --constructor-args 0x0000000000000000000000000c462dbb9ec8cd1630f1728b2cfd2769d09f0dd500000000000000000000000027000546a968aac25e9a709c098f1254e333b1930000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000005460000000000000000000000000000000000000000000000152d02c7e14af68000000000000000000000000000000000000000000000000000000000000000002a300000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000001c20 0xcaAa0114CB9Fe229643B8193375b21f695e6593C AngleGovernor",
"verify:sender": "forge verify-contract --chain-id 1 --watch --constructor-args $(cast abi-encode 'constructor(address)' '0x66a71dcef29a0ffbdbe3c6a460a3b5bc225cd675') 0x71D670A690eF3E0dbD819F63168ce58EE5587f49 ProposalSender",
Expand All @@ -43,10 +44,11 @@
"devDependencies": {
"@angleprotocol/sdk": "^0.25.0",
"@layerzerolabs/lz-sdk": "^0.0.30",
"discord.js": "^14.14.1",
"prettier": "^2.0.0",
"prettier-plugin-solidity": "^1.1.3",
"solhint": "^3.5.1",
"solhint-plugin-prettier": "^0.0.5"
},
"dependencies": {}
}
}
2 changes: 1 addition & 1 deletion scripts/Interfaces.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ interface ILayerZeroBridge {

function treasury() external view returns (address);

function lzEndPoint() external view returns (address);
function lzEndpoint() external view returns (address);
}
Loading

0 comments on commit 07a037f

Please sign in to comment.