| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review against SWIP-74 rev 3 (ethersphere/SWIPs #111), which now specifies the challenge–response claim this PR started from. The findings were checked adversarially against the code, the spec and bee's p2p wrapper on master. (Edited: cursor semantics, test flow and counter list aligned with SWIP-74 rev 3 as pushed.) State of the PR. Seven commits 2026-09-12..24; 424 lines of non-generated Go and HeadlineThe scaffold follows SWIP-74 in three places and diverges from it in one that matters; Follows: one create-or-attach join (Jopen in the registry: "joins an existing cohort Diverges — and the divergence is the right one. The publisher role is claimed by a
Lifecycle: the broker handler is fire-and-forget — it spawns the per-stream goroutine Wire, message by message
The takeover semantics in the Claim comment ("the current stream becomes the publisher Streams and state
Not started, and expected not to beValidation on the publish path (id substitution, SOC check with the address, owner == TestsTestJoin asserts a challenge round trip and never sends a Message, so it would pass Small thingsClaim sends Sig: topic; two log lines say "read join ack" in the write loop and the What to ask for
Open
|
Sorry, something went wrong.
Round 2, against the six commits since the review (d28ced3..14b89a5) and the seven "design decisions" from our chat, checked against SWIP-74 rev 4 (#111), which since yesterday carries the claim as a SOC — your idea, with the spec's fields inside it. Where a point was already in the review above and the code has not changed, it is only listed as still open. What improved
The scheme, decision by decision
The arguments in chat
The code
Where the two designs meet — a construction for the SWIPacud's best idea is to carry the claim as a SOC body so that one existing call verifies id = keccak256("bps-claim:v1" ‖ topic) 44-byte preimage; a feed id's is 40 bytes
owner = addr so the address is keccak256(id ‖ addr)
payload = S ‖ O_B ‖ index 72 bytes
The broker (or any receiver of a claim) computes the expected address from the id it A point for the specThe same reasoning shows the address field on Broadcast is computable by every What to ask acud
|
Sorry, something went wrong.
There was a problem hiding this comment.
Overall, this is not what we settled on.
Please read the spec and keep to it, lets get rid of all other complications.
Sorry, something went wrong.
| return | ||
| } | ||
|
|
||
| // we might want to do some input validation to see that the broker isn't tricking us |
There was a problem hiding this comment.
you mean we MUST do
Sorry, something went wrong.
| return nil | ||
| } | ||
|
|
||
| func (s *session) Claim(ctx context.Context, soc []byte) error { |
There was a problem hiding this comment.
why duplicate? exact as Broadcast
Sorry, something went wrong.
| return | ||
| } | ||
| select { | ||
| case ch1 <- m.Soc: |
There was a problem hiding this comment.
again validation completely missing. Why do we repeat the exact same stuff we do with subscribers,
only the forarding is different really
Sorry, something went wrong.
| errInvalidTopic = errors.New("bps: invalid topic") | ||
| errInvalidPrincipal = errors.New("bps: invalid principal") | ||
| errInvalidIdentity = errors.New("bps: invalid identity") | ||
| errCohortMismatch = errors.New("bps: cohort binding mismatch") |
There was a problem hiding this comment.
mismatch?
Sorry, something went wrong.
| if err != nil { | ||
| return nil, fmt.Errorf("claim soc: %w", err) | ||
| } | ||
| if err := b.verifyClaim(proofSoc, co.principal, member.challenge, s.selfOverlay.Bytes(), co.topic); err != nil { |
There was a problem hiding this comment.
can we please
Sorry, something went wrong.
There was a problem hiding this comment.
i can't see how salting solves the replay problem and we definitely agreed that the per-peer challenge is fine, so i'm not sure why you've retracted this now.
Sorry, something went wrong.
There was a problem hiding this comment.
it is definitely per peer, but just generated from a cohort secret which means we do not need to remember it
Sorry, something went wrong.
| s.mtx.Unlock() | ||
| return | ||
| } | ||
| for _, m := range co.members { |
There was a problem hiding this comment.
surely , if members is just the write channels, then you need to compare the key to the publisher of the message.
Luckily that is available if the soc is validated, which seems to be forgotten, see #L395 and redundantly L202-205
Sorry, something went wrong.
|
|
||
| publisher := member | ||
| txCh := make(chan []byte) | ||
| go func() { |
There was a problem hiding this comment.
why not define this as the fanout on the cohort?
Sorry, something went wrong.
|
|
||
| // binding decides how a cohort's publisher claim is verified. The topic | ||
| // binding named in Join picks the implementation; feed is the only one for now. | ||
| type binding interface { |
There was a problem hiding this comment.
why do yo need this unnecessary complexity now?
Sorry, something went wrong.
There was a problem hiding this comment.
because there was already an insistence that the topic binding must be specified in the protocol on the wire. i would say that for the MVP that was not needed in the first place and we could have broken it in later iterations. in any case i don't see the extra 80 lines file as a large overhead in this case.
Sorry, something went wrong.
| return soc.CreateAddress(id, principal) | ||
| } | ||
|
|
||
| func (feedBinding) verifyClaim(s *soc.SOC, principal, challenge, broker, topic []byte) error { |
There was a problem hiding this comment.
The verifier should take the cohort spec and the broadcast msg as argument. That should have everything to validate. Totally no need to reify this binding. Really.
Please lets simplify.
Sorry, something went wrong.
There was a problem hiding this comment.
i would prefer not to pass protocol protobuf messages around outside the scope of reading and writing messages. that's why the other intermediate fat layers exist. broadcast is exactly the soc we pass here. what do you gain by leaking the underlying message?
Sorry, something went wrong.
There was a problem hiding this comment.
right, fine but its no longere the wire msg
this feels like it is just random args e pass
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Checklist
Description
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):
AI Disclosure