Repository navigation
Conversation
🛡️ Trivy security scan (CRITICAL,HIGH,MEDIUM,LOW)Go dependenciesNo findings at CRITICAL,HIGH,MEDIUM,LOW. Container imageNo findings at CRITICAL,HIGH,MEDIUM,LOW. |
|
📊 Test Coverage: ✅ Passed — 96% of changed lines covered, min 80% |
tdprajwal
left a comment
There was a problem hiding this comment.
Self-review notes for reviewers.
| } | ||
| return model.Agreement{}, nil | ||
| // Unknown callers are not cached, so unsigned requests cannot fill Redis. | ||
| if len(records) > 0 { |
There was a problem hiding this comment.
Unknown callers aren't cached. This check runs before the signature is verified, so caching every name would let anyone fill Redis.
| if refusal == nil || !fromCache { | ||
| return refusal | ||
| } | ||
| // Never refuse on a cached answer; recheck the registry first. |
There was a problem hiding this comment.
A refusal is never served from cache, so a reinstated network gets in at once. The cost is one registry call per refused request (noted in the PR description)
| } | ||
|
|
||
| // judgeRequester applies what we agreed with caller to one request. | ||
| func judgeRequester(ctx context.Context, caller, action string, schemaContexts []string, agreed model.Agreement) error { |
There was a problem hiding this comment.
judgeRequester is the original logic moved out unchanged, so it can run twice.
|
We don't need the changes in
Please drop that folder from this PR and remove |
|
Done: dropped the |
|
Please add tests for the agreement cache in
|
|
The cache needs Redis, and helmcharts has none for the adapter. Please carry the change there, as a separate PR:
|
|
Added tests for the agreement cache in |
|
The helmcharts change is up as a separate PR: OpenAgriNet/helmcharts#125 (Redis in quick-start, and |
|
Superseded by #132. |
Closes #109
What
agreementWith), including "no agreement" for callers the registry knows. Registry errors are not cached.config/provider-adapter.yaml(cacheTTL: 30s).Testing
go test ./...passes.Note
A suspension can take up to
cacheTTL(30s) to take effect; reinstatement is immediate. For an instant effect, delete theregistry_*keys in Redis. Instant barring is left for a follow-up.A refusal based on a cached answer re-checks the registry, so a peer that keeps sending refused requests still reaches the registry once per request.