fix(core): cache beacon config for signing-domain resolution - #567
fix(core): cache beacon config for signing-domain resolution#567iamquang95 wants to merge 4 commits into
Conversation
|
@claude review this PR |
|
Claude finished @iamquang95's task in 5m 7s —— View job Review:
|
emlautarom1
left a comment
There was a problem hiding this comment.
Couple of notes:
- The endpoints suggested to be cached with a TTL never change in the most popular Beacon clients (Lighthouse, Prysm and Teku, representing ~90%). We might as well just cache for the lifetime of the application and avoid the TTL complexity.
- We should explore dropping the
eth2apicrate as is: instead of relying on code generation, we can use agents to have a tailor made crate that exposes the endpoints that we need precisely, with full control over the underlying HTTP client. This is a lot more work but simplifies the build process, total LOC, improves error reporting, etc.
With this, I'm not sure we want to go this route right now unless it's a hard requirement for the MVP (ie. testnet shows that without it Pluto misbehaves)
Fixes #563.
Signing-domain resolution hit the BN live on every verification — 4 HTTP calls per attester partial-sig check — and a BN failure mid-verification was misreported to the VC as 400 "partial signature verification failed". Charon avoids both via caching in its go-eth2-client fork.
BeaconNodeClient(now a singleArc<Inner>) embeds a config cache for spec/genesis/fork_schedule: 5-min TTL, concurrent cold lookups coalesce into one fetch, errors and empty/malformed responses never cached.fetch_domain*methods are deleted, leaving one domain derivation.SigningError→ HTTP by provenance: BN/config failure 502, invalid submitted signature 400, invalid trusted key material (e.g. bad pubshare) 500.