Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
cache: true

- name: Run Go generators
run: go generate ./.../gen
run: go generate ./...

- name: Ensure generated code is clean
run: git diff --exit-code
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
cache: true

- name: Run Go generators
run: go generate ./.../gen
run: go generate ./...

- name: Install golint
run: go install golang.org/x/lint/golint@latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
cache: true

- name: Run Go generators
run: go generate ./.../gen
run: go generate ./...

- name: Ensure generated code is clean
run: git diff --exit-code
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this fork follows Semantic Versioning for tagged releases.

## Unreleased
### Breaking
- Rename the Go module to `github.com/threshold-network/threshold-common`. Consumers must migrate imports, generator invocations, and module requirements together; see [MIGRATION.md](MIGRATION.md). Existing tags retain their original module identity.

### Added
- Release guide and initial changelog stub for the fork of `keep-core/keep-common`.
- Release guide and initial changelog stub for the fork of `keep-network/keep-common`.

### Changed
- Bump minimum Go toolchain to 1.26.8 to include standard library security fixes; CI and releases read this version from `go.mod`.
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ to this document in a pull request.

== Getting started

1. Fork https://github.com/keep-network/keep-common[`keep-network/keep-common`]
1. Fork https://github.com/threshold-network/threshold-common[`threshold-network/threshold-common`]
2. Clone your fork
3. Follow the
https://github.com/keep-network/keep-common/blob/main/README.adoc[installation
https://github.com/threshold-network/threshold-common/blob/main/README.adoc[installation
steps] in the README.
4. Enable
https://help.github.com/en/articles/about-commit-signature-verification[commit
Expand All @@ -26,6 +26,6 @@ unit tests for new features)

=== Continuous Integration

Keep uses
Threshold uses
https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions[Github
Actions] for continuous integration. All workflows must be green to merge a PR.
87 changes: 87 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Migrating to threshold-common

The new repository and Go module are
`github.com/threshold-network/threshold-common`. Package names and exported APIs
are unchanged by the rebrand, but import paths are part of Go package identity.
Update an application's complete dependency graph consistently.

There is one root Go module in this repository, including the command-line code
generators. There is no npm, Python, Rust, or container publication configured
here. GitHub releases are published by `.github/workflows/release.yml`.

## Release order

1. Review and test the module/import/template changes while the repository is
still named `threshold-network/keep-common`.
2. An administrator renames that repository to `threshold-common`. Coordinate
this with merging the rebrand; the new module cannot be fetched from its new
location before the repository exists there. Verify repository integrations,
branch protections, scheduled jobs, and release permissions after the rename.
3. Update local remotes, badges, and external automation. Preserve GitHub's old
repository redirect: do not create another `threshold-network/keep-common`
repository. Keep all historical tags unchanged.
4. Publish the first new-path release (planned `v1.8.0`) using [RELEASE.md](RELEASE.md).
Validate a clean external download through the Go proxy/checksum database and
directly from GitHub before advancing consumers.
5. Finalize and merge downstream PRs, including `go.mod`, `go.sum`, generated
bindings, and generator invocations. An unreleased version or a local testing
replacement must not be merged into a consumer's release branch.

GitHub redirects repository URLs, but that does not change the `module`
declaration in a tagged commit. Old tags still declare
`github.com/keep-network/keep-common`; they are not releases of the new module.
The original upstream `keep-network/keep-common` is a separate repository, not
an alias for this Threshold fork. Do not redirect its historical issue links to
this repository.

## Consumer changes

- Replace `github.com/keep-network/keep-common` imports and generator commands
with `github.com/threshold-network/threshold-common`.
- Remove any replacement such as
`github.com/keep-network/keep-common => github.com/threshold-network/keep-common`.
- Require the published new-path release directly. Run `go mod tidy` to generate
authentic checksums; do not rename existing `go.sum` entries by hand.
- Regenerate contract/command bindings from their ABI inputs with the renamed
generator. Update `.go.tmpl` sources and their embedded Go templates together.
- Verify `go list -m all` and `go list -deps ./...` contain no unintended old
common module. A mixed graph can contain distinct named Go types even when
source declarations match. A `replace` in this library's `go.mod` would not
propagate to consumers and is not a compatibility solution.
- Match the minimum Go version in this module's `go.mod` (currently 1.26.8) in
consumer builds, CI, and Docker builders. Account for the existing dependency
upgrade to go-ethereum 1.17.3 when moving from an older common release.

For pre-release testing, use a temporary `go.work` or an uncommitted local
replacement pointing to the reviewed common checkout. This validates source
compatibility only; it does not validate the future published version or its
checksums. Remove the testing override and repeat validation after publication.

## Downstream baseline

The migration baseline is `threshold-network/keep-core` **dev**, the release
candidate that is expected to merge to main before this rename is actioned.
As verified on 2026-09-16 at `a90ce1bf0738a35e4e3881f634f07520c2b8529e`:

- [PR #4327](https://github.com/threshold-network/keep-core/pull/4327) absorbed
both runtime packages and generators into keep-core. `go.mod`, `go.sum`,
imports, and generator invocations no longer depend on this repository.
- The sole remaining `keep-common` reference is a link to original upstream
issue #117 in the tBTC generator Makefile. It describes a historical ABI
workaround and should stay unchanged.
- [PR #4256](https://github.com/threshold-network/keep-core/pull/4256) tracks the
release to main. Verify it has landed before the cutover. The older main
branch still uses a replacement at `v1.7.1-tlabs.0`; do not reintroduce that
external dependency into dev just to rename it.

Search maintained branches, private build tooling, and external consumers before
closing the cutover issue: GitHub code search primarily covers default branches
and is not proof that every consumer has been found. Consumers of the original
upstream or of another organization's fork are not automatically consumers of
this Threshold fork. Historical release snapshots should retain their pins
unless their owners explicitly choose to migrate them.

## References

- [Go module paths and replacement rules](https://go.dev/ref/mod)
- [GitHub repository rename behavior](https://docs.github.com/en/repositories/creating-and-managing-repositories/renaming-a-repository)
26 changes: 14 additions & 12 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
= `keep-common`
= `threshold-common`

https://github.com/keep-network/keep-common/actions/workflows/client.yml[image:https://img.shields.io/github/actions/workflow/status/keep-network/keep-common/client.yml?branch=main&event=push&label=Go build[Go build status]]
https://github.com/threshold-network/threshold-common/actions/workflows/client.yml[image:https://img.shields.io/github/actions/workflow/status/threshold-network/threshold-common/client.yml?branch=main&event=push&label=Go build[Go build status]]
https://docs.threshold.network[image:https://img.shields.io/badge/docs-website-green.svg[Docs]]
https://discord.gg/threshold[image:https://img.shields.io/badge/chat-Discord-5865f2.svg[Chat with us on Discord]]

Common libraries and tools used across Keep repositories. This repository is a
fork of https://github.com/keep-core/keep-common[`keep-core/keep-common`],
Common Go libraries and tools used across Threshold repositories. This repository is a
fork of https://github.com/keep-network/keep-common[`keep-network/keep-common`],
continuing independently from the upstream `v1.7.0` tag.

See link:RELEASE.md[Release guide] and link:CHANGELOG.md[Changelog] for versioning,
tagging, and history.
tagging, and history. See link:MIGRATION.md[Migration guide] for the
`github.com/threshold-network/threshold-common` module path and coordinated
repository rename.

== Getting started

```
go mod tidy
go generate ./.../gen
go generate ./...
go test ./...
```

== Toolchain & CI

- Go: 1.26.8 or newer (CI uses `actions/setup-go@v6` with the version from `go.mod` and module cache).
- Go: 1.26.8 or newer (CI uses `actions/setup-go@v7` with the version from `go.mod` and module cache).
- Checks: `go generate` (enforced clean), `go vet`, `go build`, `go test` via `gotestsum`.
- Security: `govulncheck` (blocking in CI and releases), `gosec` pinned version.
- Lint: `golint` installed via `go install`.
Expand All @@ -32,12 +34,12 @@ See link:RELEASE.md[Release guide] for versioning, tagging, and publishing steps

== Directory structure

The directory structure used in the `keep-common` repository is the same as
used on other Keep repositories, and very similar to that used in other Go
The directory structure used in the `threshold-common` repository is the same as
used on other Threshold repositories, and very similar to that used in other Go
projects:

```
keep-common/
threshold-common/
tools/ <1>
generators/ <2>
pkg/ <3>
Expand All @@ -49,7 +51,7 @@ keep-common/
relay/
relay.go, *.go
```
<1> Keep tools have categorized directories here, which are typically Go
<1> Threshold tools have categorized directories here, which are typically Go
commands that can be used from other repositories.
<2> Code generators in particular live in this subtree.
<3> All additional Go packages live in `pkg/`.
Expand All @@ -67,7 +69,7 @@ keep-common/

* Clone this repo
* Install Go v1.26.8 or newer
* Generate go files: `$ go generate ./.../gen`
* Generate go files: `$ go generate ./...`
* Build the project: `$ go build ./...`
* Run tests: `$ go test ./...`

Expand Down
48 changes: 35 additions & 13 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
# Release Guide

Process for publishing tagged Go module releases for this fork of `keep-common`.
Publish tagged releases of the `github.com/threshold-network/threshold-common`
Go module. This repository continues the history of `keep-common`; historical
tags keep their original module declarations and checksums.

## Versioning
1) Use SemVer tags on `main`: `vX.Y.Z` when matching upstream versions; append `-tlabs.N` for fork-only releases (increment `N` for subsequent fork tags at the same base version).
2) Latest known upstream tag is `v1.7.0` from https://github.com/keep-network/keep-common (tracked via git tags). Upstream is unmaintained, so future releases proceed independently on this fork.

## Pre-release Checklist
1) Sync with upstream: pull the latest upstream tag/commit, resolve conflicts, and ensure CI is green.
2) Generators: `go generate ./.../gen`; verify the worktree is clean afterward.
3) Module sanity: `go mod tidy` (expect no diff) and `go list ./...` to confirm dependencies and packages resolve.
4) Quality gates: `go vet ./...`, `go test ./...`, and `govulncheck ./...` using the Go version in `go.mod`. Install the pinned scanner with `go install golang.org/x/vuln/cmd/govulncheck@v1.8.0`; add `go test -race ./...` for concurrency-heavy changes.
5) Changelog: update `CHANGELOG.md` with Added/Changed/Fixed/Breaking notes and mention the upstream commit/tag you synced.
Use immutable SemVer tags on `main`. The first release under the new module path
is planned as `v1.8.0`, after the repository rename and the checks in
[MIGRATION.md](MIGRATION.md). Confirm that the tag is unused before publishing.
Do not move or reuse the inherited `v1.7.0` or `v1.7.1-tlabs.*` tags. The old
`-tlabs.N` suffix records the fork's earlier releases; it is not required for
new Threshold releases.

## Tagging & Publishing
1) Tag: `git tag -a vX.Y.Z -m "Release vX.Y.Z"` (or `vX.Y.Z-tlabs.N` for fork-specific releases).
2) Push tag: `git push origin vX.Y.Z[-tlabs.N]`.
3) CI: pushing a `v*` tag triggers the release workflow to regenerate code, run vet/tests and blocking vulnerability checks, and publish a GitHub release with a placeholder body referencing `CHANGELOG.md`. Edit the GitHub release afterward to paste the changelog excerpt and upstream baseline notes.
## Pre-release checklist

1. Complete the coordinated repository/module cutover in [MIGRATION.md](MIGRATION.md).
2. Run `go generate ./...` and verify `git diff --exit-code`. This includes the
generator templates themselves, as well as the promise fixtures.
3. Run `go mod tidy -diff` and `go list ./...`.
4. Run `go vet ./...`, `go build ./...`, `go test ./...`, and `govulncheck ./...`
using the Go version in `go.mod`. Install the pinned scanner with
`go install golang.org/x/vuln/cmd/govulncheck@v1.8.0`. Add `go test -race ./...`
for concurrency changes.
5. Move the appropriate `CHANGELOG.md` entries into the release section,
explicitly documenting the new module path and consumer migration.

## Tagging and publishing

1. From the reviewed commit on `main`, create an annotated `vX.Y.Z` tag and push
that tag to the renamed repository.
2. The `v*` tag workflow regenerates code, runs vet/build/tests and vulnerability
checks, and publishes a GitHub release. Replace its placeholder body with the
changelog excerpt and migration link.
3. In a fresh module outside this checkout, run
`go get github.com/threshold-network/threshold-common@vX.Y.Z` and verify
`go list -m all`. Repeat with the default Go proxy/checksum database and with
`GOPROXY=direct` to check both distribution paths.
4. Finalize downstream version pins and checksums only after the release is
resolvable. Complete their builds and generator checks before merging.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/keep-network/keep-common
module github.com/threshold-network/threshold-common

go 1.26.8

Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/balance_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

"github.com/keep-network/keep-common/pkg/wrappers"
"github.com/threshold-network/threshold-common/pkg/wrappers"
)

// BalanceSource provides a balance info for the given address.
Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/ethutil/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"

chainEthereum "github.com/keep-network/keep-common/pkg/chain/ethereum"
chainEthereum "github.com/threshold-network/threshold-common/pkg/chain/ethereum"
)

type ethereumAdapter struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/ethutil/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"

chainEthereum "github.com/keep-network/keep-common/pkg/chain/ethereum"
chainEthereum "github.com/threshold-network/threshold-common/pkg/chain/ethereum"
)

func TestEthereumAdapter_HeaderByNumber(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/ethutil/balance_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/keep-network/keep-common/pkg/chain/ethereum"
"github.com/threshold-network/threshold-common/pkg/chain/ethereum"
)

// BalanceSource provides a balance info for the given address.
Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/ethutil/error_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"testing"

"github.com/keep-network/keep-common/pkg/chain/ethereum/ethutil"
"github.com/threshold-network/threshold-common/pkg/chain/ethereum/ethutil"

"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/ethutil/ethutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"io/ioutil"
"math/big"

chainEthereum "github.com/keep-network/keep-common/pkg/chain/ethereum"
chainEthereum "github.com/threshold-network/threshold-common/pkg/chain/ethereum"

"github.com/ipfs/go-log"

Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/ethutil/ethutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/ethereum/go-ethereum/common"
"github.com/keep-network/keep-common/pkg/chain/ethereum/ethutil"
"github.com/threshold-network/threshold-common/pkg/chain/ethereum/ethutil"
)

func TestKeyFileDecryption(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/ethutil/mining_waiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/core/types"
"github.com/keep-network/keep-common/pkg/chain/ethereum"
"github.com/threshold-network/threshold-common/pkg/chain/ethereum"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/ethutil/mining_waiter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/keep-network/keep-common/pkg/chain/ethereum"
"github.com/threshold-network/threshold-common/pkg/chain/ethereum"
)

var config = ethereum.Config{
Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/ethutil/rate_limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/keep-network/keep-common/pkg/rate"
"github.com/threshold-network/threshold-common/pkg/rate"
)

type rateLimiter struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/ethutil/rate_limiter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/keep-network/keep-common/pkg/rate"
"github.com/threshold-network/threshold-common/pkg/rate"
)

func TestRateLimiter(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/keep-network/keep-common/pkg/chain/ethereum"
"github.com/keep-network/keep-common/pkg/cmd/flag"
"github.com/threshold-network/threshold-common/pkg/chain/ethereum"
"github.com/threshold-network/threshold-common/pkg/cmd/flag"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/flag/flag_wei.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package flag

import (
"github.com/keep-network/keep-common/pkg/chain/ethereum"
"github.com/threshold-network/threshold-common/pkg/chain/ethereum"
"github.com/spf13/pflag"
)

Expand Down
Loading