Skip to content

Commit

Permalink
Add fork workflow instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
prettymuchbryce authored and roy-dydx committed Apr 16, 2024
1 parent 2cd0d1a commit a900d83
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 11 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- v0.38.x
- dydx-fork-**

jobs:
build:
Expand All @@ -21,7 +22,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand All @@ -43,7 +44,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand All @@ -65,7 +66,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
name: Check generated code
on:
pull_request:
push:
branches:
- v0.38.x
- dydx-fork-**

permissions:
contents: read
Expand All @@ -18,7 +20,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- uses: actions/checkout@v4

Expand All @@ -43,7 +45,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- uses: actions/checkout@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- v0.38.x
- dydx-fork-**

jobs:
e2e-test:
Expand All @@ -15,7 +16,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: '1.22'
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ on:
push:
branches:
- v0.38.x
- dydx-fork-**

jobs:
govulncheck:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"
check-latest: true
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- "**.go"
branches:
- v0.38.x
- dydx-fork-**

jobs:
tests:
Expand All @@ -17,7 +18,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ endif
#? proto-gen: Generate protobuf files
proto-gen: check-proto-deps
@echo "Generating Protobuf files"
@go run github.com/bufbuild/buf/cmd/buf generate
@go run github.com/bufbuild/buf/cmd/buf@latest generate --path proto/tendermint
@mv ./proto/tendermint/abci/types.pb.go ./abci/types/
@cp ./proto/tendermint/rpc/grpc/types.pb.go ./rpc/grpc
.PHONY: proto-gen
Expand Down
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# dYdX Fork of CometBFT

This is a lightweight fork of CometBFT. The current version of the forked code resides on the [default branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches#about-the-default-branch).

## Making Changes to the Fork

1. Open a PR against the current default branch (i.e. `dydx-fork-v0.38.2`).
2. Get approval, and merge.
3. After merging, update the `v4` repository's `go.mod`, and `go.sum` files with your merged `$COMMIT_HASH`.
4. (In `dydxprotocol/v4`) `go mod edit -replace github.com/cometbft/cometbft=github.com/dydxprotocol/cometbft@$COMMIT_HASH`
5. (In `dydxprotocol/v4`) `go mod tidy`
6. (In `dydxprotocol/v4`) update package references in `mocks/Makefile`. See [here](https://github.com/dydxprotocol/v4/pull/848) for an example.
7. Open a PR in `dydxprotocol/v4` to bump the version of the fork.

## Fork maintenance

We'd like to keep the `main` branch up to date with `cometbft/cometbft`. You can utilize GitHub's [sync fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) button to accomplish this. ⚠️ Please only use this on the `main` branch, not on the fork branches as it will discard our commits.⚠️

Note that this doesn't pull in upstream tags, so in order to do this follow these steps:
1. `git fetch upstream`
2. `git push --tags`

## Updating CometBFT to new versions

When a new version of CometBFT is published, we may want to adopt the changes in our fork. This process can be somewhat tedious, but below are the recommended steps to accomplish this.

1. Ensure the `main` branch and all tags are up to date by following the steps above in "Fork maintenance".
2. Create a new branch off the desired CometBFT commit using tags. `git checkout -b dydx-fork-$VERSION <CometBFT repo's tag name>`. The new branch should be named something like `dydx-fork-$VERSION` where `$VERSION` is the version of CometBFT being forked (should match the CometBFT repo's tag name). i.e. `dydx-fork-v0.38.2`.
3. Push the new branch.
4. Open a PR which cherry-picks each commit in the current default branch, in order, on to the new `dydx-fork-$VERSION` branch (note: you may want to consider creating multiple PRs for this process if there are difficulties or merge conflicts). For example, `git cherry-pick <commit hash>`.
5. Get approval, and merge.
6. Update `dydxprotocol/v4` by following the steps in "Making Changes to the fork" above.
7. Set `dydx-fork-$VERSION` as the [default branch](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/changing-the-default-branch) in this repository.

# CometBFT

[Byzantine-Fault Tolerant][bft] [State Machine Replication][smr]. Or
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/cometbft/cometbft

go 1.21
go 1.22

require (
github.com/BurntSushi/toml v1.2.1
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
COMETBFT_BUILD_OPTIONS += badgerdb,boltdb,cleveldb,rocksdb
COMETBFT_BUILD_OPTIONS += badgerdb,boltdb,cleveldb

include ../../common.mk

Expand Down

0 comments on commit a900d83

Please sign in to comment.