Skip to content

Commit

Permalink
Merge branch 'main' into tmigone/allow-early-closure
Browse files Browse the repository at this point in the history
  • Loading branch information
tmigone committed Mar 18, 2024
2 parents 0a7dca8 + 59154f7 commit 54af1a7
Show file tree
Hide file tree
Showing 461 changed files with 50,229 additions and 11,391 deletions.
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": []
}
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ runs:
run: yarn --immutable
- name: Build
shell: bash
run: yarn build
run: yarn build || yarn build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI - packages/contracts

env:
CI: true
Expand All @@ -23,7 +23,9 @@ jobs:
- name: Set up environment
uses: ./.github/actions/setup
- name: Run tests
run: yarn test:coverage
run: |
pushd packages/contracts
yarn test:coverage
- name: Upload coverage report
uses: codecov/codecov-action@v3
with:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/ci-token-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI - packages/token-distribution

env:
CI: true

on:
push:
branches: "*"
paths:
- packages/token-distribution/**
pull_request:
branches: "*"
paths:
- packages/token-distribution/**
workflow_dispatch:

jobs:
test-ci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Run tests
run: yarn test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: E2E
name: E2E - packages/contracts

env:
CI: true
Expand All @@ -9,7 +9,7 @@ on:
paths:
- packages/contracts/contracts/**
- packages/contracts/config/**
- packages/contracts/e2e/**
- packages/contracts/test/e2e/**
- packages/contracts/tasks/**
- packages/contracts/scripts/**
- packages/contracts/hardhat.config.ts
Expand All @@ -18,7 +18,7 @@ on:
paths:
- packages/contracts/contracts/**
- packages/contracts/config/**
- packages/contracts/e2e/**
- packages/contracts/test/e2e/**
- packages/contracts/tasks/**
- packages/contracts/scripts/**
- packages/contracts/hardhat.config.ts
Expand All @@ -41,4 +41,5 @@ jobs:
sed -i'' -e 's/^\(.*dev.period.*\)/# \1/' docker-compose.yaml
./test-node.bash --init --batchposters 0 --redundantsequencers 0 --detach
popd
pushd packages/contracts
L1_NETWORK=localnitrol1 L2_NETWORK=localnitrol2 yarn test:e2e
6 changes: 3 additions & 3 deletions .github/workflows/verifydeployed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
with:
name: contract-artifacts
path: |
build
cache/*.json
packages/contracts/build
packages/contracts/cache/*.json
verify:
name: Verify deployments
Expand All @@ -54,7 +54,7 @@ jobs:
name: contract-artifacts

- name: Verify contracts on Defender
run: yarn hardhat --network ${{ inputs.network }} verify-defender ${{ inputs.contracts }}
run: cd packages/contracts && yarn hardhat --network ${{ inputs.network }} verify-defender ${{ inputs.contracts }}
env:
DEFENDER_API_KEY: "${{ secrets.DEFENDER_API_KEY }}"
DEFENDER_API_SECRET: "${{ secrets.DEFENDER_API_SECRET }}"
Expand Down
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ yarn-error.log*
node_modules/

# Yarn
.yarn/*
.yarn/
!.yarn/patches
!.yarn/releases
!.yarn/plugins
Expand All @@ -21,6 +21,7 @@ cached/
# Build artifacts
dist/
build/
deployments/hardhat/

# Ignore solc bin output
bin/
Expand All @@ -42,4 +43,10 @@ tx-*.log
addresses-fork.json

# Keys
.keystore
.keystore

# Graph client
.graphclient

tx-builder-*.json
!tx-builder-template.json
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
nodeLinker: node-modules
nmHoistingLimits: workspaces
40 changes: 32 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ This repository is a Yarn workspaces monorepo containing the following packages:
| Package | Latest version | Description |
| --- | --- | --- |
| [contracts](./packages/contracts) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Fcontracts.svg)](https://badge.fury.io/js/@graphprotocol%2Fcontracts) | Contracts enabling the open and permissionless decentralized network known as The Graph protocol. |
| [eslint-graph-config](./packages/eslint-graph-config) | [![npm version]()]() | Shared linting and formatting rules for TypeScript projects. |
| [token-distribution](./packages/token-distribution) | - | Contracts managing token locks for network participants |
| [sdk](./packages/sdk) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Fsdk.svg)](https://badge.fury.io/js/@graphprotocol%2Fsdk) | TypeScript based SDK to interact with the protocol contracts |
| [solhint-graph-config](./packages/eslint-graph-config) | [![npm version]()]() | Shared linting and formatting rules for Solidity projects. |


## Development
Expand Down Expand Up @@ -65,21 +68,42 @@ $ yarn
$ yarn build
```

### Versioning a package
### Versioning and publishing packages

To version a package, run the following command from the root of the repository:
We use [changesets](https://github.com/changesets/changesets) to manage package versioning, this ensures that all packages are versioned together in a consistent manner and helps with generating changelogs.

#### Step 1: Creating a changeset

A changeset is a file that describes the changes that have been made to the packages in the repository. To create a changeset, run the following command from the root of the repository:

```bash
# Change directory to the package you want to version
$ cd packages/<package-name>
$ yarn changeset
```

Changeset files are stored in the `.changeset` directory until they are packaged into a release. You can commit these files and even merge them into your main branch without publishing a release.

# Bump the version
$ yarn version <major|minor|patch>
#### Step 2: Creating a package release

When you are ready to create a new package release, run the following command to package all changesets, this will also bump package versions and dependencies:

```bash
$ yarn changeset version
```

### Step 3: Tagging the release

__Note__: this step is meant to be run on the main branch.

After creating a package release, you will need to tag the release commit with the version number. To do this, run the following command from the root of the repository:

```bash
$ yarn changeset tag
$ git push --follow-tags
```

__Note on cross referenced packages__: Bumping the version of a package that is cross referenced by another package will automatically bump the dependency version in the other package. For example, if you bump the version of `sdk` from `0.0.1` to `0.0.2`, the required version of `sdk` in the `contracts` package will automatically be bumped to `0.0.2`. Depending on the nature of the change you might need to bump (and publish) a new version of the `contracts` package as well.
#### Step 4: Publishing a package release

### Publishing a package
__Note__: this step is meant to be run on the main branch.

Packages are published and distributed via NPM. To publish a package, run the following command from the root of the repository:

Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"packageManager": "[email protected]",
"workspaces": [
"packages/contracts",
"packages/sdk"
"packages/eslint-graph-config",
"packages/sdk",
"packages/solhint-graph-config",
"packages/token-distribution"
],
"scripts": {
"postinstall": "husky install",
Expand All @@ -19,6 +22,7 @@
"test": "yarn workspaces foreach --all --parallel --verbose --interlaced run test"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"husky": "^8.0.3"
Expand Down
7 changes: 0 additions & 7 deletions packages/contracts/.eslintignore

This file was deleted.

19 changes: 0 additions & 19 deletions packages/contracts/.eslintrc

This file was deleted.

4 changes: 0 additions & 4 deletions packages/contracts/.prettierignore

This file was deleted.

35 changes: 0 additions & 35 deletions packages/contracts/.prettierrc.json

This file was deleted.

51 changes: 51 additions & 0 deletions packages/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# @graphprotocol/contracts

## 6.2.1

### Patch Changes

- Round up when calculating curation tax
- Round up when calculating consecutive stake thawing periods

## 6.2.0

### Minor Changes

- Update implementation addresses with GGP 31, 34 and 35

### Patch Changes

- 554af2c: feat(utils): add utility to parse subgraph ids
- Updated dependencies [554af2c]
- Updated dependencies [c5641c5]
- @graphprotocol/sdk@0.5.0

## 6.1.3

### Patch Changes

- Ensure globbing is enabled in prepack

## 6.1.2

### Patch Changes

- Correctly pass ts file list to tsc in prepack

## 6.1.1

### Patch Changes

- Use prepack to correctly prepare outputs for the published package

## 6.1.0

### Minor Changes

- Introduce changesets for versioning
- Add new staging implementations including GGPs 31, 34 and 35
- Add new testnet implementations including GGPs 31, 34 and 35

### Patch Changes

- Fixes for verifyAll and bridge:send-to-l2 hardhat tasks
4 changes: 2 additions & 2 deletions packages/contracts/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ Scenarios are defined by an optional script and a test file:
- Optional ts script
- The objective of this script is to perform actions on the protocol to advance it's state to the desired one.
- Should follow hardhat script convention.
- Should be named e2e/scenarios/{scenario-name}.ts.
- Should be named test/e2e/scenarios/{scenario-name}.ts.
- They run before the test file.
- Test file
- Should be named e2e/scenarios/{scenario-name}.test.ts.
- Should be named test/e2e/scenarios/{scenario-name}.test.ts.
- Standard chai/mocha/hardhat/ethers test file.
Loading

0 comments on commit 54af1a7

Please sign in to comment.