Skip to content

feat(gateway): expose StateGetRandomnessDigestFromBeacon#13339

Merged
rvagg merged 2 commits into
masterfrom
rvagg/StateGetRandomnessDigestFromBeacon-gateway
Sep 17, 2025
Merged

feat(gateway): expose StateGetRandomnessDigestFromBeacon#13339
rvagg merged 2 commits into
masterfrom
rvagg/StateGetRandomnessDigestFromBeacon-gateway

Conversation

@rvagg
Copy link
Copy Markdown
Member

@rvagg rvagg commented Sep 12, 2025

Used by PDP, uses chain data to get historic randomness which is local and fairly fast. This is the main blocker for a PDP-only miner from using a public gateway only.

The main issue with being able to use this is the the lookback limit, for a 24h proving period you'd want to be able to look back up to 24h to submit a proof; I think a gateway, like glif, that had a 24h window should be OK for submitting proofs as long as they're done slightly early or on time.

Edit: No, we set the challenge epoch in the future at each window, so the lookback will be really small regardless, so I don't think there's a problem here with short lookback windows.

Used by PDP, uses chain data to get randomness which is local and fairly fast.
@rvagg rvagg requested review from ZenGround0 and Copilot September 12, 2025 02:32
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FilOz Sep 12, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR exposes the StateGetRandomnessDigestFromBeacon method in the Gateway API to support PDP-only miners using public gateways. The main purpose is to enable miners to retrieve historic randomness from the chain without requiring access to a full node.

Key changes:

  • Add StateGetRandomnessDigestFromBeacon method to the Gateway interface and implementation
  • Update gateway proxy to handle the new method with appropriate rate limiting and validation
  • Regenerate API proxy code and update OpenRPC documentation

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
gateway/proxy_fil_v1.go Implements the gateway proxy method with chain rate limiting and tipset validation
api/api_gateway.go Adds the method to the Gateway interface definition
api/proxy_gen.go Auto-generated proxy code for the new method
extern/filecoin-ffi Updates submodule commit reference
build/openrpc/*.json Updates line number references in OpenRPC documentation
CHANGELOG.md Documents the new feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread gateway/proxy_fil_v1.go
@BigLep BigLep moved this from 📌 Triage to 🔎 Awaiting Review in FilOz Sep 12, 2025
Copy link
Copy Markdown
Contributor

@rjan90 rjan90 left a comment

Choose a reason for hiding this comment

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

One comment from CoPilot there, which might make sense based on my limited search. Else the changes look good.

@github-project-automation github-project-automation Bot moved this from 🔎 Awaiting Review to ✔️ Approved by reviewer in FilOz Sep 16, 2025
@rvagg
Copy link
Copy Markdown
Member Author

rvagg commented Sep 17, 2025

No, Copilot is wrong. The check does both for me - the tipset at which I'm anchoring the search for the epoch, and the rand epoch itself. So I can't anchor the search for the tipset back too far (default being HEAD, aka EmptyTSK), and randEpoch is actually a Filecoin epoch that I want to select from on that chain, so it can't be too far back either. checkKeyedTipSetHeight gives me both checks in one (and does its own EmptyTSK -> HEAD conversion for me).

@rvagg rvagg enabled auto-merge (squash) September 17, 2025 03:15
@rvagg rvagg merged commit 08b62be into master Sep 17, 2025
97 checks passed
@rvagg rvagg deleted the rvagg/StateGetRandomnessDigestFromBeacon-gateway branch September 17, 2025 03:19
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FilOz Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

4 participants