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

(BEDS-1052) VDB: validator search by hex graffiti #1229

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

remoterami
Copy link
Contributor

No description provided.

@remoterami remoterami force-pushed the BEDS-1052/vdb-hex-graffiti branch from ff20945 to 672d573 Compare January 2, 2025 16:24
Copy link

cloudflare-workers-and-pages bot commented Jan 2, 2025

Deploying beaconchain with  Cloudflare Pages  Cloudflare Pages

Latest commit: f698e55
Status: ✅  Deploy successful!
Preview URL: https://476864b7.beaconchain.pages.dev
Branch Preview URL: https://beds-1052-vdb-hex-graffiti.beaconchain.pages.dev

View logs

@remoterami remoterami force-pushed the BEDS-1052/vdb-hex-graffiti branch from 672d573 to f698e55 Compare January 2, 2025 16:27
reGraffiti = regexp.MustCompile(`^.{2,}$`) // at least 2 characters, so that queries won't time out
reCursor = regexp.MustCompile(`^[A-Za-z0-9-_]+$`) // has to be base64
reGraffiti = regexp.MustCompile(`^.{2,}$`) // at least 2 characters, so that queries won't time out
reGraffitiHex = regexp.MustCompile(`^(0x)?([0-9a-fA-F]{2}){2,}$`) // at least 2 bytes, so that queries won't time out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Should this be a valid hex input?

> curl --location 'http://0.0.0.0:8081/api/i/search' \
                          --header 'Content-Type: application/json' \
                          --data '{
                          "input":"0x0000000000000000000000000000000000000000000000000000000000000000",
                          "networks":["holesky"]
                      }'
                      
{"data":[{"type":"validators_by_graffiti","chain_id":17000,"value":{"graffiti":"","hex":"0x0000000000000000000000000000000000000000000000000000000000000000","count":72496}}]}

Copy link
Contributor Author

@remoterami remoterami Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, clarified and the answer is "yes can do that for now". Can exclude empty graffitis later if we run into issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: Frontend would pass the graffiti string, not hex, to the endpoint for adding validators to a dashboard by their graffiti and passing an empty graffiti counts as not passing it at all. See:


image

I believe we have to forbid empty graffitis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bummer! Applied, needs explicit handling though since look-arounds aren't a thing in go's regexp

@remoterami
Copy link
Contributor Author

remoterami commented Jan 7, 2025

I added some validation checks for maximum graffiti size of 32 bytes (which actually is a chain parameter but I doubt anyone would be messing with this..).
Also since we're doing full match search only, the hex graffiti should only be accepted and returned as a fixed size string

reGraffiti = regexp.MustCompile(`^.{2,}$`) // at least 2 characters, so that queries won't time out
reCursor = regexp.MustCompile(`^[A-Za-z0-9-_]+$`) // has to be base64
reGraffiti = regexp.MustCompile(`^.{2,}$`) // at least 2 characters, so that queries won't time out
reGraffitiHex = regexp.MustCompile(`^(0x)?([0-9a-fA-F]{2}){2,}$`) // at least 2 bytes, so that queries won't time out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: Frontend would pass the graffiti string, not hex, to the endpoint for adding validators to a dashboard by their graffiti and passing an empty graffiti counts as not passing it at all. See:


image

I believe we have to forbid empty graffitis

Copy link
Contributor

@LuccaBitfly LuccaBitfly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@remoterami remoterami merged commit 5b0b5c3 into staging Jan 14, 2025
4 checks passed
@remoterami remoterami deleted the BEDS-1052/vdb-hex-graffiti branch January 14, 2025 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants