Importing core/types from precompile/{modules,contract} results in a circular dependency because types -> params -> precompile/modules -> precompile/contract -> types.
How this works
precompile/modules only depended on precompile/contract for interfaces; by moving the interfaces into the new precompile/interfaces package, there is no longer a transitive dependency params -> precompile/modules -> precompile/contract.
Note that this only allows importing core/types from precompile/contract but not from precompile/modules. This is OK as the latter is merely a registry that has implementations injected into it.
Visualising the dependency graph (raw Graphviz below) with:
$ go install github.com/loov/goda@latest
$ goda graph -cluster -short ./params ./core/types ./precompile/{contract,modules,precompileconfig} | dot -Tpng > depgraph.png
Why this should be merged
Importing
core/types
fromprecompile/{modules,contract}
results in a circular dependency becausetypes
->params
->precompile/modules
->precompile/contract
->types
.How this works
precompile/modules
only depended onprecompile/contract
for interfaces; by moving the interfaces into the newprecompile/interfaces
package, there is no longer a transitive dependencyparams -> precompile/modules -> precompile/contract
.Note that this only allows importing
core/types
fromprecompile/contract
but not fromprecompile/modules
. This is OK as the latter is merely a registry that has implementations injected into it.Visualising the dependency graph (raw Graphviz below) with:
Before
After (as at
12febd1
PoC)How this was tested
How is this documented
Raw Graphviz input
Dependency graph at
caf34ea
master:Dependency graph at
12febd1
proof-of-concept: