Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADR 109: Internalize specific packages to reduce surface area #1485

Merged

Conversation

thanethomson
Copy link
Contributor

@thanethomson thanethomson commented Oct 11, 2023

Partially addresses #1484, based on #1483.

One concern I have is around the possibility that this PR internalizes certain types that are present in publicly accessible function signatures as parameters or return types. This will take some work to address.

  • I've already confirmed that the linter being run on the Cosmos SDK main branch doesn't pick up any missing code-related issues at this point.

This PR currently internalizes about 64k lines of code.


PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
@thanethomson thanethomson added this to the 2023-Q4 milestone Oct 11, 2023
@thanethomson thanethomson changed the title ADR 109: Internalize non-critical code ADR 109: Internalize packages Oct 11, 2023
@thanethomson thanethomson changed the title ADR 109: Internalize packages ADR 109: Internalize specific packages to reduce surface area Oct 11, 2023
Signed-off-by: Thane Thomson <[email protected]>
@thanethomson thanethomson marked this pull request as ready for review October 12, 2023 11:36
@thanethomson thanethomson requested review from a team as code owners October 12, 2023 11:36
Copy link
Contributor

@lasarojc lasarojc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes, which are many but all straightforward, look good to me.
Regarding the use of internal structures as parameters and results in public API, isn't that detected by the linter?

@@ -135,15 +135,17 @@ func (app *localClient) OfferSnapshot(ctx context.Context, req *types.RequestOff
}

func (app *localClient) LoadSnapshotChunk(ctx context.Context,
req *types.RequestLoadSnapshotChunk) (*types.ResponseLoadSnapshotChunk, error) {
req *types.RequestLoadSnapshotChunk,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are formatting this way, then there are other places that should be changed.
I would rather make all such changes together.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #604.

@thanethomson
Copy link
Contributor Author

Regarding the use of internal structures as parameters and results in public API, isn't that detected by the linter?

It seems not. See https://github.com/cometbft/go-internalized-example

@thanethomson thanethomson merged commit 1511af9 into feature/adr109-reduce-go-api-surface Oct 16, 2023
16 checks passed
@thanethomson thanethomson deleted the thane/adr109/internalize branch October 16, 2023 11:44
@thanethomson thanethomson restored the thane/adr109/internalize branch October 16, 2023 12:02
@thanethomson thanethomson deleted the thane/adr109/internalize branch October 16, 2023 12:04
@thanethomson thanethomson mentioned this pull request Nov 13, 2023
3 tasks
github-merge-queue bot pushed a commit that referenced this pull request Nov 15, 2023
* ADR 109: Internalize specific packages to reduce surface area (#1485)

* consensus: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* evidence: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* inspect: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* state: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* blocksync: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* statesync: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* store: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/async: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/autofile: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/bits: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/clist: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/cmap: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/events: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/fail: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/flowrate: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/os: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/progressbar: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/protoio: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/pubsub: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/net: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/rand: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/service: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/strings: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/sync: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/tempfile: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* libs/timer: Move into internal

Signed-off-by: Thane Thomson <[email protected]>

* Add changelog entries

Signed-off-by: Thane Thomson <[email protected]>

---------

Signed-off-by: Thane Thomson <[email protected]>

* ADR 109: Modularize test infra (#1488)

* test/e2e: Split out as separate module

Signed-off-by: Thane Thomson <[email protected]>

* test/loadtime: Split out as separate module

Signed-off-by: Thane Thomson <[email protected]>

* test/e2e: Remove optimization from Docker image construction

Signed-off-by: Thane Thomson <[email protected]>

* Ensure that linter covers E2E framework and app

Signed-off-by: Thane Thomson <[email protected]>

* Update CI linting to cover submodules

Signed-off-by: Thane Thomson <[email protected]>

* Add changelog entry

Signed-off-by: Thane Thomson <[email protected]>

* Expand linter coverage to loadtime tool

Signed-off-by: Thane Thomson <[email protected]>

* Add missing phony entries

Signed-off-by: Thane Thomson <[email protected]>

* test/e2e: Sync debug Dockerfile with primary Dockerfile

Signed-off-by: Thane Thomson <[email protected]>

---------

Signed-off-by: Thane Thomson <[email protected]>

* chore: ADR 109: go mod tidy (#1606)

* go mod tidy

Signed-off-by: Thane Thomson <[email protected]>

* go.mod: Remove patch version

Signed-off-by: Thane Thomson <[email protected]>

* go.mod: Remove new toolchain directives

Signed-off-by: Thane Thomson <[email protected]>

---------

Signed-off-by: Thane Thomson <[email protected]>

* ADR 109: Fix mock generation (#1607)

* internal: Fix mockery code generation script paths

Signed-off-by: Thane Thomson <[email protected]>

* make mockery

Signed-off-by: Thane Thomson <[email protected]>

---------

Signed-off-by: Thane Thomson <[email protected]>

---------

Signed-off-by: Thane Thomson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants