Skip to content

Commit

Permalink
[ Feature Branch ] Genesis allocs validation (#489)
Browse files Browse the repository at this point in the history
* fix go.work version declaration

* add genesis predeploy test, validation metadata for chains 10,34443 and wire up

* undo accidental changes

* fix ci config

* add sepolia/worldcoin

* add worldchain

* some small fixes

chain 480 passes!

* change format of genesis creation command

* add nvm

* 4801 passes

* introduce monorepoBuildCommand artifact

* try removing source command

* install nvm

* no need to install just

* linting

* introduce boolean switch for using legacy deployments format

* Get mode, metal and zora genesis.allocs validation working (#496)

* introduce node_version

need to reexamine writeDeploymentsLegacy

* fix bug in writeDeploymentsLegacy

* fix declaration of legacy deployments and add note

* improve diff

* use hardhat Deployment type to pad data and avoid unmarshaling errors

e.g. on mode

* fix writeDeploymentsLegacy, mode now validates!

* remove note

* introduce  GenesisCreationCommand mapping

allows metadata file to choose from a list and have chainId automatically injected into command

* introduce BuilldCommand mapping

* op sepolia validates

* remove UseLegacyDeploymentsFormat

* remove op mainnet metadata for now

* remove op sepolia (it doesn't validate yet)

* echo nvm version

* just codegen

* load nvm

* fix

* try installing nvm in a step

* require node_version to be set

* just lint-all

* attempt to patch genesis creation source code

 to make validation work at a wider range of commits

* adds metal metadata -- validates!

* add zora metadata -- validates!

* Enhance `add-chain` tool to capture deploy config and monorep commit information  (#504)

* add-chain: ingest and store deploy-config and genesis-creation commit

* remove genesis-system-configs dir

we no longer use this

* add test data for deploy-config

* check errs properly

* link validation to add-chain

* fix up add-chain e2e tests

* simplify test side effect handling

* don't bother cleaning up -test genesis validation inputs

(They now don't end up bound into the validation package)

* tweak spacing

* prefer os.ModePerm over 0o777

* typo

* typo

* remove unused params

* use commented constants for metadata defaults

* fix clean-add-chain cmd

* use localised, gitignored optimism-temporary directory for genesis validation purposes (#507)

* Get genesis validation checks to run on CI (#529)

* switch to cimg/go:1.22.6-node docker image for genesis validation

* remove set -e

(nvm.sh exits with code 3, we can apparently just ignore that)

* use bash instead of sh

* use . instead of source

* install pnpm

* move optimism-temporary out from under superchain-registry

this seems to make go module resolution work as expected

* do not allow validate-genesis to timeout

* improve pipefail behaviour

we allow the scripts which load nvm and gvm to fail

* just lint-all

* remove all set -e behaviour

gives highest chance that validation can succeed

* stream output from test

helps with debugging, prevents timeouts on circleci

* try running as a matrix

* add base and base sepolia to genesis validation list (#530)

* add base sepolia to genesis validation list

* add base mainnet to genesis validation list

* Add validation metadata for Lisk mainnet + testnet (#531)

* temp:  gk/genadd lisk mainnet (revertme)

* add lisk metadata for genesis validation

* temp: add lisk sepolia (revertme)

* add genesis validation metadata for lisk sepolia

* Update .circleci/config.yml

* add comment

* just tidy-all

* harmonize op-geth version

* improve naming of ci steps

* dedupe perChainTestName

* remove temporary directory after tests run

* tidy up test script

* rename test

* rename commands

* add testGenesisAllocsMetadata

* use dynamic config building in CI (#534)

* use dynamic config building in CI

This works by having a small workflow run, compute the list of chain ids to run genesis validation checks on, and then modify a subsequent config file which circleci then runs.

* add comment

* fan in

* fix

* fix script

* Update .circleci/continue_config.yml

Co-authored-by: Vinod Damle <[email protected]>

---------

Co-authored-by: Vinod Damle <[email protected]>

* remove temporarily added chains (#535)

* git restore --source=main -- superchain

* just codegen

* just lint-all

* lint

* typo

* enhance comment

* swap op-node1 and op-node2

to retain chronological ordering

* add explainer about parallelism

* modify message in genesis-allocs-all-ok

* simplify patch file

* tweak go version in golang-validate-genesis-allocs job

* remove the test artifacts written to validationInputsDir

* don't forget we swapped opnode1<>opnode2

* fix another opnode1<>opnode2 permutation

* Revert "simplify patch file"

This reverts commit 9b7f6d8.

* fix op-node1/2 err

* add note about gvm

---------

Co-authored-by: Vinod Damle <[email protected]>
  • Loading branch information
geoknee and vdamle authored Sep 3, 2024
1 parent 389619c commit 9c9ba65
Show file tree
Hide file tree
Showing 44 changed files with 1,654 additions and 238 deletions.
235 changes: 16 additions & 219 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,230 +1,27 @@
version: 2.1

orbs:
go: circleci/[email protected]
node: circleci/[email protected]
slack: circleci/[email protected]

commands:
notify-failures-on-main:
description: "Notify Slack for CI job failures"
parameters:
channel:
type: string
steps:
- slack/notify:
channel: << parameters.channel >>
event: fail
template: basic_fail_1
branch_pattern: main
install-just:
description: "Install just"
steps:
- run:
name: "Install just"
command: |
wget -qO - 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null
echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list
sudo apt update
sudo apt install just
install-foundry:
description: "Installs foundry"
steps:
- run:
# need foundry to execute 'cast call' within add-chain script
name: Install foundry
command: |
echo "SHELL=$SHELL"
# Set up directory structure
mkdir -p $HOME/.foundry/bin
echo 'export PATH="$HOME/.foundry/bin:$PATH"' >> $BASH_ENV
source $BASH_ENV
# Download foundryup and make it executable
curl -sSL "https://raw.githubusercontent.com/foundry-rs/foundry/master/foundryup/foundryup" -o $HOME/.foundry/bin/foundryup
chmod +x $HOME/.foundry/bin/foundryup
# this allows us to use CircleCI's dynamic configuration feature
setup: true

$HOME/.foundry/bin/foundryup
forge --version
orbs:
continuation: circleci/[email protected]

jobs:
golang-lint:
executor:
name: go/default # is based on cimg/go
tag: '1.21'
steps:
- checkout
- install-just
- run: just lint-all
- run:
name: check git tree is clean
command: git diff --exit-code
golang-modules-tidy:
executor:
name: go/default # is based on cimg/go
tag: '1.21'
steps:
- checkout
- install-just
- run: just tidy-all
- run:
name: check git tree is clean
command: git diff --exit-code
golang-test:
shell: /bin/bash -eo pipefail
executor:
name: go/default # is based on cimg/go
tag: '1.21'
setup-genesis-allocs-validation:
macos:
xcode: 14.2.0
resource_class: macos.m1.medium.gen1
steps:
- checkout
- install-just
- install-foundry
- run:
name: run superchain module unit tests
command: just test-superchain
- run:
name: run validation module unit tests
command: just test-validation
- run:
name: run add-chain module unit tests
command: just test-add-chain
- notify-failures-on-main:
channel: C03N11M0BBN # to slack channel `notify-ci-failures`
golang-validate-modified:
shell: /bin/bash -eo pipefail
executor:
name: go/default # is based on cimg/go
tag: '1.21'
steps:
- checkout
- install-just
- install-foundry
- run:
name: run validation checks
command: just validate-modified-chains main # TODO ideally this is the base branch
golang-validate-all:
shell: /bin/bash -eo pipefail
executor:
name: go/default # is based on cimg/go
tag: '1.21'
steps:
- checkout
- install-just
- install-foundry
- run:
name: run validation checks on all chains
command: just validate "*"
- notify-failures-on-main:
channel: C07GQQZDW1G # to slack channel `notify-superchain-validation-failures`
golang-promotion-test:
shell: /bin/bash -eo pipefail
executor:
name: go/default # is based on cimg/go
tag: '1.21'
steps:
- checkout
- install-just
- install-foundry
- run:
name: run validation checks
command: just promotion-test
- slack/notify:
event: always
custom: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":control_knobs: The daily report on standard candidate chains is ready!"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "👀 View Report",
"emoji": true
},
"url": "${CIRCLE_BUILD_URL}"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Click the link to see what validation checks would fail if all candidate chains were promoted to standard (and exclusions removed)."
}
]
}
]
}
channel: C07GZVCCUS0 # to slack channel `notify-superchain-promotion-failures`
publish-bot:
environment:
NODE_AUTH_TOKEN: $NPM_TOKEN # Use NPM_TOKEN as the auth token
docker:
- image: cimg/node:18 # Use Node.js 18
steps:
- checkout
- run:
name: Set deployment token
command: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
- env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run:
name: Build and publish package on NPM 📦
command: pnpm release
check-codegen:
executor:
name: go/default # is based on cimg/go
tag: '1.21'
steps:
- checkout
- install-just
- run:
name: Run codegen
command: just codegen
- run:
name: check git tree is clean
command: git diff --exit-code
name: Generate list of chainids and insert into continue_config.yml file
command: |
bash validation/genesis/validation-inputs/generate-test-config.sh
- continuation/continue:
configuration_path: .circleci/continue_config.yml
parameters: '{}'

workflows:
hourly:
jobs:
- golang-validate-all:
context:
- slack
- golang-test:
context:
- slack
triggers:
- schedule:
cron: "0 * * * *"
filters:
branches:
only:
- main
nightly:
jobs:
- golang-promotion-test:
context:
- slack
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- main
pr-checks:
setup:
jobs:
- golang-lint
- golang-modules-tidy
- golang-test
- golang-validate-modified
- check-codegen
- setup-genesis-allocs-validation
Loading

0 comments on commit 9c9ba65

Please sign in to comment.