Skip to content

Commit

Permalink
Add versioning and release with changesets (#22)
Browse files Browse the repository at this point in the history
* Caigo package

* Relay client caigo integration

* Config Tracker: fetch latest config details

* Gw calls: billing details, latest config details, latest config

* OCR2 types builders

* Adjusting contract reader to the client changes

* parseConfigEvent into a separate file

* Relay structure refactoring

* CallOps for calling the contract

* Using DecodeBytes to decode offchain config

* Checking for stake config + config values from db

* Parsing RelayConfig, propagating contract id further into providers

* Fixing tests

* Relay restructuring: chainlink subfolder and root component

* Fixing tests

* Restructing for Relayer module rebase

* Add versioning

* Run prettier

* Revert prettier

* Add package for core components

* Update chainlink-starknet package description

Co-authored-by: Kristijan Rebernisak <[email protected]>

* Add contributing file

* Split releases from changesets

* Create release workflow folder, make root package public

* Root package must be private

* Add changelog index

* Use nix

* Fix links to packages

* Remove link to root

* Move relayer into sub directory

* Revert /relayer subdirectory

* Move /starknet and /chainlink into /relayer

* Remove duplicate code

* Sync aggregator-test.ts with base branch

* Change to network-component-protocol notation

* Rename starknet gauntlet cli release workflow

* Try different gauntlet-core version

* Revert gauntlet-core to 0.3.0

* Rebase on config tracker branch

* Fix pkg path in relay test workflow

* Update module name

* Set up cairo venv before testing

* Remove redundant python initialization

* Remove nix from gauntlet_run_tests

* Add nix to gauntlet_run_tests

* Fix gauntlet path in changelog.md

* Godepgraph script to generate png of module dependencies

* Wrapping all errors for better context

* Removing OCR2 prefix from reading funcs

* Renaming LatestConfig -> ConfigFromEventAt

* Fixing tests + cleanup

* Integrate blueprint into starknet initial commit

* improvements set config

* move test network utils to tests

* update deps

* update config with latest core version

* Fix starknet-devnet in Nix environment

* Starkgate tests (#23)

* npm starkgate and test

* test clean

* required changes fixed

* format fixe

* fix format with prettier

* bump libocr (#39)

* bump libocr

* go mod tidy

* Using DecodeBytes to decode offchain config

* Remove owner from deployment input in ocr2 test

* Update hard hat version in contracts package

* Use string array as input to offchain_config

* Replace smartcontractkit/chainlink-starknet with local version

* Move ops folder into relayer folder

* Change offchain_config from BN[] to string[] in setConfig

* Removing go.work build dependency

* Fix Relayer CI workflow

* Fix relayer workflow NIX working dir

* Try to fix CI

* fixup

* Update nix action

* Fix test

* Rename directories to match package names

Co-authored-by: Sergei Drugalev <[email protected]>
Co-authored-by: Kristijan Rebernisak <[email protected]>
Co-authored-by: Akhil Chainani <[email protected]>
Co-authored-by: RodrigoAD <[email protected]>
Co-authored-by: Blaž Hrastnik <[email protected]>
Co-authored-by: Aaron Lu <[email protected]>
  • Loading branch information
7 people authored Jul 13, 2022
1 parent 0cd4e98 commit 0bdad78
Show file tree
Hide file tree
Showing 172 changed files with 1,176 additions and 184 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
45 changes: 45 additions & 0 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Changesets

on:
push:
branches:
- main

jobs:
changesets:
name: Changesets
runs-on: ubuntu-latest
steps:
# Checkout this repository
- name: Checkout Repo
uses: actions/checkout@f25a3a9f25bd5f4c5d77189cab02ff357b5aedeb # v2.4.1
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
# Get tool versions
- name: Get tool versions
uses: smartcontractkit/[email protected]
id: tool-versions
# Install nix
- name: Install Nix
uses: cachix/install-nix-action@v17
with:
nix_path: nixpkgs=channel:nixos-unstable
# Set up Node.js
- name: Setup Node.js ${{ steps.tool-versions.outputs.nodejs_version }}
uses: actions/setup-node@master
with:
node-version: ${{ steps.tool-versions.outputs.nodejs_version }}
# Install dependencies using yarn
- name: Install Dependencies
run: nix develop -c yarn install --frozen-lockfile
# Create PR that will update versions or trigger publish
- name: Create Release Pull Request
uses: changesets/action@master
id: changesets
with:
publish: nix develop -c yarn release
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 2 additions & 6 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@ jobs:
uses: actions/checkout@f25a3a9f25bd5f4c5d77189cab02ff357b5aedeb # v2.4.1

- name: Install Nix
uses: cachix/install-nix-action@v14
uses: cachix/install-nix-action@v17
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/vij683ly7sl95nnhb67bdjjfabclr85m/install
install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixos-unstable

- name: Run unit tests
run: nix develop -c ./scripts/test.sh
2 changes: 1 addition & 1 deletion .github/workflows/e2e_custom_cl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
${{ runner.os }}-go-
- name: Download Go Vendor Packages
if: steps.cache-packages.outputs.cache-hit != 'true'
run: go mod download
run: cd integration-tests && go mod download
- name: Install Ginkgo CLI
run: go install github.com/onsi/ginkgo/v2/[email protected]
- name: Run Tests
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/gauntlet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,9 @@ jobs:
id: tool-versions

- name: Install Nix
uses: cachix/install-nix-action@v14
uses: cachix/install-nix-action@v17
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/vij683ly7sl95nnhb67bdjjfabclr85m/install
install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixos-unstable

- name: Setup Node ${{ steps.tool-versions.outputs.nodejs_version }}
uses: actions/setup-node@v2
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/relay.yml → .github/workflows/relayer.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: relay
name: relayer

on:
push:

defaults:
run:
working-directory: relayer

jobs:
relay_run_unit_tests:
name: Relay Run Unit Tests
relayer_run_unit_tests:
name: Relayer Run Unit Tests
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres@localhost:5432/postgres?sslmode=disable
Expand All @@ -27,19 +31,15 @@ jobs:
uses: actions/checkout@f25a3a9f25bd5f4c5d77189cab02ff357b5aedeb # v2.4.1

- name: Install Nix
uses: cachix/install-nix-action@v14
uses: cachix/install-nix-action@v17
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/vij683ly7sl95nnhb67bdjjfabclr85m/install
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixos-unstable

- name: Compile relay
- name: Compile module
run: nix develop -c go build -v ./pkg/...

- name: Run unit tests
run: nix develop -c go test -v ./pkg/...

- name: Run tests with the race detector enabled
run: nix develop -c go test -v ./pkg/... -race -count=10
run: nix develop -c go test -v ./pkg/... -race -count=10
48 changes: 48 additions & 0 deletions .github/workflows/release/starknet-gauntlet-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Starknet Gauntlet CLI Release

on:
push:
tags:
- "@chainlink/starknet-gauntlet-cli@[0-9]+.[0-9]+.[0-9]"

jobs:
starknet-gauntlet-cli-release:
name: Starknet Gauntlet CLI Release
runs-on: ubuntu-latest
steps:
# Checkout this repository
- name: Checkout Repo
uses: actions/checkout@f25a3a9f25bd5f4c5d77189cab02ff357b5aedeb # v2.4.1
# Get tool versions
- name: Get tool versions
uses: smartcontractkit/[email protected]
id: tool-versions
# Install nix
- name: Install Nix
uses: cachix/install-nix-action@v17
with:
nix_path: nixpkgs=channel:nixos-unstable
# Set up Node.js
- name: Setup Node.js ${{ steps.tool-versions.outputs.nodejs_version }}
uses: actions/setup-node@master
with:
node-version: ${{ steps.tool-versions.outputs.nodejs_version }}
# Install dependencies using yarn
- name: Install Dependencies
run: nix develop -c yarn install --frozen-lockfile
# Build gauntlet binary
- name: Build Gauntlet
run: nix develop -c yarn bundle
# Store gauntlet-cli version
- name: Set Env Variables
run: echo "STARKNET_GAUNTLET_CLI=$(npm info @chainlink/starknet-gauntlet-cli version)" >> $GITHUB_ENV
# Upload gauntlet binary to gauntlet-cli release
- name: Upload Gauntlet Binary
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: bin/chainlink-starknet-*
file_glob: true
tag: |
@chainlink/starknet-gauntlet-cli@${{ env.STARKNET_GAUNTLET_CLI }}
overwrite: false
24 changes: 24 additions & 0 deletions .github/workflows/release/starknet-relayer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Starknet Relayer Release

on:
push:
tags:
- "@chainlink/starknet-relayer@[0-9]+.[0-9]+.[0-9]"

jobs:
starknet-relayer-release:
name: Release Starknet Relayer
runs-on: ubuntu-latest
steps:
# Checkout this repository
- name: Checkout Repo
uses: actions/checkout@f25a3a9f25bd5f4c5d77189cab02ff357b5aedeb # v2.4.1
# Store starknet version
- name: Set Env Variables
run: echo "STARKNET_RELAYER=$(npm info @chainlink/starknet-relayer version)" >> $GITHUB_ENV
# Release code under vX.X.X
- name: Release Code
uses: softprops/action-gh-release@v1
with:
tag_name: relayer/v${{ env.STARKNET_RELAYER }}
token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,6 @@ dmypy.json

# vscode project settings
.vscode/

# go workspace settings
go.work
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog Index

This repository adheres to [Semantic Versioning](http://semver.org/).

Chainlink-Starknet contains a number of projects, all individually versioned and released. Please consult the following changelogs for more information:

- [@chainlink/starknet-relayer](/relayer/)
- [@chainlink/starknet-gauntlet](/packages-ts/starknet-gauntlet/)
- [@chainlink/starknet-gauntlet-cli](/packages-ts/starknet-gauntlet-cli/)
- [@chainlink/starknet-gauntlet-ocr2](/packages-ts/starknet-gauntlet-ocr2/)
- [@chainlink/starknet-gauntlet-oz](/packages-ts/starknet-gauntlet-oz/)
- [@chainlink/starknet-gauntlet-argent](/packages-ts/starknet-gauntlet-argent/)
- [@chainlink/starknet-gauntlet-starkgate](/packages-ts/starknet-gauntlet-starkgate/)
- [@chainlink/starknet-contracts](/contracts/)
- [@chainlink/starknet-integration-tests](/integration-tests/)

If a project is pre-v1.0, minor version bumps may cause breaking changes. All breaking changes are noted in changelogs.

Official project releases can be found here: https://github.com/smartcontractkit/chainlink-starknet/releases
43 changes: 43 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Chainlink Starknet monorepo contributing guide

🎈 Thanks for your help improving the project! We are so happy to have you!

## Workflow for Pull Requests

🚨 Before making any non-trivial change, please first open an issue describing the change to solicit feedback and guidance. This will increase the likelihood of the PR getting merged.

In general, the smaller the diff the easier it will be for us to review quickly.

In order to contribute, fork the appropriate branch, for non-breaking changes to production that is `develop` and for the next release that is normally `release/X.X.X` branch.

Additionally, if you are writing a new feature, please ensure you add appropriate test cases.

Follow the [Getting Started](./docs/getting-started.md) guide to set up your local development environment.

We recommend using the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format on commit messages.

Unless your PR is ready for immediate review and merging, please mark it as 'draft' (or simply do not open a PR yet).

**Bonus:** Add comments to the diff under the "Files Changed" tab on the PR page to clarify any sections where you think we might have questions about the approach taken.

### Response time:

We aim to provide a meaningful response to all PRs and issues from external contributors within 5 business days.

### Changesets

We use [changesets](https://github.com/atlassian/changesets) to manage releases of our various packages.
You _must_ include a `changeset` file in your PR when making a change that would require a new package release.

Adding a `changeset` file is easy:

1. Navigate to the root of the monorepo.
2. Run `yarn changeset`. You'll be prompted to select packages to include in the changeset. Use the arrow keys to move the cursor up and down, hit the `spacebar` to select a package, and hit `enter` to confirm your selection. Select _all_ packages that require a new release as a result of your PR.
3. Once you hit `enter` you'll be prompted to decide whether your selected packages need a `major`, `minor`, or `patch` release. We follow the [Semantic Versioning](https://semver.org/) scheme. Please avoid using `major` releases for any packages that are still in version `0.y.z`.
4. Commit your changeset and push it into your PR. The changeset bot will notice your changeset file and leave a little comment to this effect on GitHub.

### Rebasing

We use the `git rebase` command to keep our commit history tidy.
Rebasing is an easy way to make sure that each PR includes a series of clean commits with descriptive commit messages
See [this tutorial](https://docs.gitlab.com/ee/topics/git/git_rebase.html) for a detailed explanation of `git rebase` and how you should use it to maintain a clean commit history.
14 changes: 7 additions & 7 deletions docs/gauntlet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
- [Local Install](./getting_started.md#setup)
- [Binary](./getting_started.md#binary)
- [Basic Setup](./getting_started.md#basic-setup)
- [CLI](../../packages-ts/gauntlet-starknet-cli/README.md)
- [Example Contract](../../packages-ts/gauntlet-starknet-example/README.md)
- [OZ Contracts](../../packages-ts/gauntlet-starknet-oz/README.md)
- [Starkgate Contracts](../../packages-ts/gauntlet-starknet-starkgate/README.md)
- [Argent Contracts](../../packages-ts/gauntlet-starknet-argent/README.md)
- [OCR2 Contracts](../../packages-ts/gauntlet-starknet-ocr2/README.md)
- [Multisig Contracts](../../packages-ts/gauntlet-starknet-multisig/README.md)
- [CLI](../../packages-ts/starknet-gauntlet-cli/README.md)
- [Example Contract](../../packages-ts/starknet-gauntlet-example/README.md)
- [OZ Contracts](../../packages-ts/starknet-gauntlet-oz/README.md)
- [Starkgate Contracts](../../packages-ts/starknet-gauntlet-starkgate/README.md)
- [Argent Contracts](../../packages-ts/starknet-gauntlet-argent/README.md)
- [OCR2 Contracts](../../packages-ts/starknet-gauntlet-ocr2/README.md)
- [Multisig Contracts](../../packages-ts/starknet-gauntlet-multisig/README.md)
- Contribute
2 changes: 1 addition & 1 deletion docs/gauntlet/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ ACCOUNT=0x...
PRIVATE_KEY=0x...
```

In order to get this configuration, go to [how to setup an account](../../packages-ts/gauntlet-starknet-account/README.md#setup-an-account)
In order to get this configuration, go to [how to setup an account](../../packages-ts/starknet-gauntlet-account/README.md#setup-an-account)

If you are interacting with a local network and do not want to use any wallet, execute every command with the flag `--noWallet`
4 changes: 2 additions & 2 deletions integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
github.com/onsi/ginkgo/v2 v2.1.3
github.com/onsi/gomega v1.19.0
github.com/smartcontractkit/chainlink-starknet v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/chainlink-testing-framework v1.1.18
github.com/smartcontractkit/helmenv v1.0.71
)
Expand Down Expand Up @@ -194,4 +194,4 @@ require (

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

replace github.com/smartcontractkit/chainlink-starknet => ../../chainlink-starknet
replace github.com/smartcontractkit/chainlink-starknet/relayer => ../../chainlink-starknet/relayer
7 changes: 7 additions & 0 deletions integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@chainlink/starknet-integration-tests",
"version": "0.0.1",
"license": "MIT",
"dependencies": {},
"devDependencies": {}
}
2 changes: 1 addition & 1 deletion integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
it "github.com/smartcontractkit/chainlink-starknet/integration-tests"
"github.com/smartcontractkit/chainlink-starknet/ops"
"github.com/smartcontractkit/chainlink-starknet/relayer/ops"
"github.com/smartcontractkit/chainlink-testing-framework/actions"
"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/client"
Expand Down
Loading

0 comments on commit 0bdad78

Please sign in to comment.