-
Notifications
You must be signed in to change notification settings - Fork 373
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
feat: support custom VM domain #2911
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2911 +/- ##
==========================================
+ Coverage 63.18% 63.26% +0.07%
==========================================
Files 561 561
Lines 78636 78520 -116
==========================================
- Hits 49690 49677 -13
+ Misses 25569 25462 -107
- Partials 3377 3381 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
Signed-off-by: moul <[email protected]>
// ChainDomain is the primary domain name for the chain and its packages. | ||
ChainDomain string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why add this here instead of in genesis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that I prefer your idea. I'm waiting for more feedback before making the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree it should be in genesis. Allows us more easily to find problems when there's a mismatch between two nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switching the PR to draft until I finish and merge #3003.
Co-authored-by: n0izn0iz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe look at changing this for gno.land/pkg/gnoweb/gnoweb.go
as well. No other significant places breaking that I can see, at least in our codebase.
// be realms and as such to have their state persisted. This is used by [IsRealmPath]. | ||
const RealmPathPrefix = "gno.land/r/" | ||
var ReGnoRealmPath = regexp.MustCompile(`^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}/r/`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use this to validate the chain domain elsewhere.
parts := strings.Split(s, "/") | ||
if len(parts) > 0 { | ||
// Check if the first part contains a dot | ||
if strings.Contains(parts[0], ".") { | ||
return false // It's a domain, so it's not part of the standard library | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return strings.IndexByte(s[:strings.IndexByte(s, '/')+1], '.') < 0
@@ -27,6 +27,10 @@ func GetChainID(m *gno.Machine) string { | |||
return GetContext(m).ChainID | |||
} | |||
|
|||
func GetChainDomain(m *gno.Machine) string { | |||
return GetContext(m).ChainDomain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is used to write the import paths, should this not be largely known by gno files already (so no need for the function)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for when your p/
package is imported from one chain to another. The code remains the same, but the behavior may change.
I like the feature. I shared it with the core contribs so we have some warning ahead of time of what we want to do :) |
Draft because depending on #3003 |
Introducing the concept of "ChainDomain," a local primary domain for packages.
The next step, which will be another PR, is to ensure that we can launch a gnoland/gnodev instance while importing a local folder or using a genesis to preload packages from other domains. This will allow users to add packages only to the primary domain while accessing packages from multiple domains. The result will be a preview of the upcoming IBC era, where a single chain can add packages only to its domain but can fetch missing dependencies from other registered zones.
Depends on #2910
Depends on #3003
Blocks a new PR that will add multidomain support.
Related with #2904 (comment)