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

Move osmomath into its own go.mod #3771

Merged
merged 15 commits into from
Dec 21, 2022
Merged

Conversation

ValarDragon
Copy link
Member

@ValarDragon ValarDragon commented Dec 16, 2022

Closes: #3744 (after we get a tag for this folder, that comes after this is merged)

What is the purpose of the change

Move osmomath into its own go.mod, but all our code set to use latest code in the folder.

Brief Changelog

  • Move osmomath into its own go.mod. To update, change your osmomath import to github.com/osmosis-labs/osmosis/v13/osmomath to github.com/osmosis-labs/osmosis/osmomath

Testing and Verifying

All tests still pass

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? yes
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? yes
  • How is the feature or change documented? N/A

@ValarDragon ValarDragon added V:state/compatible/backport State machine compatible PR, should be backported A:backport/v13.x backport patches to v13.x branch labels Dec 16, 2022
@github-actions github-actions bot added C:app-wiring Changes to the app folder C:x/gamm Changes, features and bugs related to the gamm module. C:x/twap Changes to the twap module labels Dec 16, 2022
Dockerfile Outdated
@@ -19,7 +19,7 @@ RUN apk add --no-cache \

# Download go dependencies
WORKDIR /osmosis
COPY go.mod go.sum ./
Copy link
Member Author

Choose a reason for hiding this comment

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

cc @niccoloraspa @p0mvn is there some more correct way I should be doing this?

AFAIU, we may actually be building against the wrong osmomath rn, since we can cache the osmomath copy.

We need it here though, since go mod download looks for a local osmomath replace

Copy link
Member

Choose a reason for hiding this comment

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

Commented below with suggestions, rest LGTM on a first pass

@@ -0,0 +1,89 @@
module github.com/osmosis-labs/osmosis/osmomath
Copy link
Member

Choose a reason for hiding this comment

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

Can we suffix this with a version?

I think not having a version might contribute to import cycles and other import problems in the future

Copy link
Member Author

@ValarDragon ValarDragon Dec 16, 2022

Choose a reason for hiding this comment

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

This is not 1.0 yet. We only need version suffixes once theres a 2.0

I don't see how we'd get import cycles, though we may get import problems due to API breaks and not tagging a new osmomath. (I feel not super worried about this though, as long as we tag a new osmomath at every osmosis major version or notable osmomath changes)

Copy link
Contributor

Choose a reason for hiding this comment

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

This opens up a discussion of the semantics of versioning for these submodules. What sort of changes are needed for a v2? is it any api breaking changes?

I think this depends on wether we have external users or not, but I'm almost leaning towards that projects importing this should target a specific commit in their go.mod. That way we don't have to worry about breaking changes for external users.

Dockerfile Outdated
@@ -19,7 +19,8 @@ RUN apk add --no-cache \

# Download go dependencies
WORKDIR /osmosis
COPY go.mod go.sum ./
COPY go.work go.mod go.sum ./
COPY osmomath/ ./osmomath
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to only copy osmomath/go.mod and osmomath/go.sum here?

This is so that updates to osmomath code do not trigger wget for wasvm. Having only go.mod will allow that layer to be cached

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me try this, but I believe the answer is no. This is because the main go.mod replaces it with a local folder path, rather than downloading this folder from a normal upstream mirror.

Though we could move all these copies until after the wasmvm wget, I don't understand why we do the go mod download before the wget

Copy link
Contributor

@nicolaslara nicolaslara left a comment

Choose a reason for hiding this comment

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

Agree with moving the COPYs on the docker file and left a comment about versioning. But otherwise this LGTM

@nicolaslara
Copy link
Contributor

Note/warning: when main gets merged into this branch, you'll have issues with the Exp2 tests using osmoassert.

This will be solved by making osmoutils its own module too

@ValarDragon
Copy link
Member Author

Ok I tagged osmomath, and switched make build, make install and dockerfile to not use the go work, and instead depend on either tagged or hashpinned versions.

@ValarDragon
Copy link
Member Author

Should now work per the discussed plan! Going to merge

@ValarDragon ValarDragon merged commit 079702e into main Dec 21, 2022
@ValarDragon ValarDragon deleted the dev/move_osmomath_into_own_mod branch December 21, 2022 20:52
mergify bot pushed a commit that referenced this pull request Dec 21, 2022
* Move osmomath into its own go.mod

* Fix go mods

* fix osmomath test build

* Tryfix e2e test

* Try removing osmomath from the copy line?

* Add osmomath to first copy

* Try another layer

* Make build work off of tagged releases

* Switch prod and E2E builds to ignore go work

* Fix merge conflict

* Add root dir to go work

* Fix conflict

(cherry picked from commit 079702e)

# Conflicts:
#	go.mod
#	go.sum
#	osmomath/decimal_test.go
#	osmomath/exp2_test.go
#	x/gamm/keeper/pool_service.go
#	x/gamm/pool-models/stableswap/pool_test.go
#	x/twap/logic.go
#	x/twap/strategy.go
#	x/twap/strategy_test.go
ValarDragon added a commit that referenced this pull request Dec 21, 2022
* Move osmomath into its own go.mod (#3771)

* Move osmomath into its own go.mod

* Fix go mods

* fix osmomath test build

* Tryfix e2e test

* Try removing osmomath from the copy line?

* Add osmomath to first copy

* Try another layer

* Make build work off of tagged releases

* Switch prod and E2E builds to ignore go work

* Fix merge conflict

* Add root dir to go work

* Fix conflict

(cherry picked from commit 079702e)

# Conflicts:
#	go.mod
#	go.sum
#	osmomath/decimal_test.go
#	osmomath/exp2_test.go
#	x/gamm/keeper/pool_service.go
#	x/gamm/pool-models/stableswap/pool_test.go
#	x/twap/logic.go
#	x/twap/strategy.go
#	x/twap/strategy_test.go

* Tryfix conflicts

* go mod tidy

* Update to osmomath v0.0.2

* refactor(osmoutils): use Dec for additive tolerance instead of Int (#3711)

* refactor(osmoutils): use Dec for additive tolerance instead of Int

* changelog

(cherry picked from commit 5ab7ebf)

# Conflicts:
#	CHANGELOG.md
#	osmomath/binary_search.go
#	x/gamm/pool-models/balancer/pool_test.go
#	x/gamm/pool-models/internal/cfmm_common/lp.go
#	x/gamm/pool-models/stableswap/amm.go
#	x/gamm/pool-models/stableswap/amm_test.go

* tryfix conflict

Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Roman <[email protected]>
@github-actions github-actions bot mentioned this pull request Mar 1, 2024
@github-actions github-actions bot mentioned this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v13.x backport patches to v13.x branch C:app-wiring Changes to the app folder C:x/gamm Changes, features and bugs related to the gamm module. C:x/twap Changes to the twap module T:build V:state/compatible/backport State machine compatible PR, should be backported
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

osmomath: move to its own go.mod
3 participants