Merge milestone/v0.5-bearers-runtime into main (v0.5 Bearers Runtime feature milestone release)
v0.5 Bearers Runtime — 7 runtime REQs (REQ-033..039) shipped as feature. 8 modules promoted to runtime (MsgServer + simtest). cosmos-sdk v0.50.8 + ibc-go v8.2.1 added (G-006 controlled exception). G-003 + locked-const firewalls intact. 8 keeper packages ≥80% coverage. 5 GRILL decisions ratified; 8 binding fixes landed; 5 P1+ flagged for v0.6+. ---ci--- project: oy phase: 8 milestone: v0.5 status: complete requirements: covered: [REQ-033, REQ-034, REQ-035, REQ-036, REQ-037, REQ-038, REQ-039] partial: [] ---/ci---
This commit is contained in:
@@ -497,15 +497,40 @@ func isForeignTypesImport(ip string) bool {
|
||||
return parts[len(parts)-1] == "types"
|
||||
}
|
||||
|
||||
// ownModuleImport returns the x/<module> import path prefix a file at the
|
||||
// given path belongs to, or "" if the file is not under an x/<module>/
|
||||
// subtree. A file in x/<module>/keeper/, x/<module>/types/, or
|
||||
// x/<module>/module.go all belong to the same x/<module> module and may
|
||||
// import their own x/<module>/types package (same-module, NOT cross-module).
|
||||
// G-003's intent is to block CROSS-module struct imports, not same-module
|
||||
// keeper→types imports (which are the runtime promotion pattern in v0.5).
|
||||
func ownModuleImport(path string) string {
|
||||
dir := filepath.Dir(path)
|
||||
// Walk up to find the x/<module> root: the dir whose parent is "x".
|
||||
// file = .../x/<module>[/...]/file.go
|
||||
// Walk up at most 4 levels to find the module root under x/.
|
||||
d := dir
|
||||
for i := 0; i < 4; i++ {
|
||||
if filepath.Base(filepath.Dir(d)) == "x" {
|
||||
module := filepath.Base(d)
|
||||
return "github.com/oy/openyield/x/" + module
|
||||
}
|
||||
d = filepath.Dir(d)
|
||||
if d == "/" || d == "." {
|
||||
break
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ownTypesImport returns the x/<module>/types import path a file at the
|
||||
// given path belongs to, or "" if the file is not under a types package.
|
||||
func ownTypesImport(path string) string {
|
||||
dir := filepath.Dir(path)
|
||||
if filepath.Base(dir) != "types" {
|
||||
ownMod := ownModuleImport(path)
|
||||
if ownMod == "" {
|
||||
return ""
|
||||
}
|
||||
module := filepath.Base(filepath.Dir(dir))
|
||||
return "github.com/oy/openyield/x/" + module + "/types"
|
||||
return ownMod + "/types"
|
||||
}
|
||||
|
||||
// packageDir resolves a Go import path to its filesystem directory by
|
||||
|
||||
Reference in New Issue
Block a user