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

limit import path length #2053

Closed
thehowl opened this issue May 7, 2024 · 6 comments · Fixed by #2108
Closed

limit import path length #2053

thehowl opened this issue May 7, 2024 · 6 comments · Fixed by #2108
Assignees
Labels
good first issue Good for newcomers 📦 ⛰️ gno.land Issues or PRs gno.land package related

Comments

@thehowl
Copy link
Member

thehowl commented May 7, 2024

From PR comment comment: #875 (comment)

We should limit the length of a package path. A limit like 128 or 256 characters sounds reasonable.

@thehowl thehowl added good first issue Good for newcomers 📦 ⛰️ gno.land Issues or PRs gno.land package related labels May 7, 2024
@r3v4s
Copy link
Contributor

r3v4s commented May 8, 2024

just to be sure, do we have code(or plan) that limits length of pkg_path when deploying package or realm ??

@thehowl
Copy link
Member Author

thehowl commented May 8, 2024

@r3v4s we don't have any code yet that does it, this issue is about adding precisely that?

though I'm not sure I understood your question

@r3v4s
Copy link
Contributor

r3v4s commented May 8, 2024

@r3v4s we don't have any code yet that does it, this issue is about adding precisely that?

though I'm not sure I understood your question

You did understood perfectly. IMHO, rather than limiting the length to 128, I prefer setting it to 256 because it allows more leeway.

@Kouteki Kouteki added this to the 🏗4️⃣ test4.gno.land milestone May 10, 2024
@thinhnx-var
Copy link
Contributor

in case nobody gonna do this, I will take part in this issue. @thehowl

@thinhnx-var
Copy link
Contributor

thinhnx-var commented May 15, 2024

AFAIK, in oder to limit the total length of pkgPath with regex, we need the the look assertion like this

regexp.MustCompile(`^(?=.{0,256}$)gno\.land\/(?:p|r)(?:\/_?[a-z]+[a-z0-9_]*)+$`)

which is not currently supported in regexp

Im thinking about len(mempkg.Path) but maybe it effects the benchmarks.
What do you think? @r3v4s @thehowl

@r3v4s
Copy link
Contributor

r3v4s commented May 15, 2024

AFAIK, in oder to limit the total length of pkgPath with regex, we need the the look assertion like this

regexp.MustCompile(`^(?=.{0,256}$)gno\.land\/(?:p|r)(?:\/_?[a-z]+[a-z0-9_]*)+$`)

which is not currently supported in regexp

Im thinking about len(mempkg.Path) but maybe it effects the benchmarks. What do you think? @r3v4s @thehowl

It's shame that regexp doesn't support lookaheads. I really can't think of any option other than what you suggested(len(mempkg.Path)).

I'm worried about bench too, but shouldn't this length limit only applies to when we deploy contract(gnokey maketx addpkg) if it is, I don't think bench is going to be big problem

@Kouteki Kouteki linked a pull request May 15, 2024 that will close this issue
7 tasks
@Kouteki Kouteki assigned Kouteki and thinhnx-var and unassigned Kouteki May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers 📦 ⛰️ gno.land Issues or PRs gno.land package related
Projects
Development

Successfully merging a pull request may close this issue.

4 participants