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

IAVL Dependency Inversion Refactor - investigate and create issues #14

Closed
3 tasks
Tracked by #1172
p0mvn opened this issue Feb 1, 2022 · 2 comments
Closed
3 tasks
Tracked by #1172

IAVL Dependency Inversion Refactor - investigate and create issues #14

p0mvn opened this issue Feb 1, 2022 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@p0mvn
Copy link
Member

p0mvn commented Feb 1, 2022

Background

There are a few dependencies on structs instead of interfaces. This is a violation of the dependency inversion principle. Instead of depending on concrete implementations, we should be depending on abstractions. The most problematic examples are in the mutable and the immutable tree where we have nodeDb member as a struct instead of an interface.

Such violations make the system more brittle because a change in the concrete implementation may affect the code across the system. In addition, it makes it more difficult to test the structs that depend on the concrete implementations because we cannot mock them. Only interfaces can be mocked with gomock. For example, since nodeDB is not an interface, to test the mutable tree, we are forced to mock the database interface instead.

Therefore, we would like to investigate the codebase and create issues for all occurrences of the violation of the dependency inversion principle similar to mutable and immutable trees depending on the.

Acceptance Criteria

@p0mvn p0mvn moved this from 🔍 Needs Review to 🕒 Todo in Osmosis Chain Development Feb 1, 2022
@p0mvn p0mvn added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed labels Feb 1, 2022
@p0mvn p0mvn removed the help wanted Extra attention is needed label Feb 1, 2022
@p0mvn
Copy link
Member Author

p0mvn commented Feb 21, 2022

One more relevant issue: #24

@p0mvn
Copy link
Member Author

p0mvn commented May 10, 2022

Given how risky changes on IAVL are. I think that this refactor is not worth the effort so I'm going to close this. Please let me know if any concerns

@p0mvn p0mvn closed this as completed May 10, 2022
Repository owner moved this from Todo 🕒 to Done ✅ in Osmosis Chain Development May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

1 participant