Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

IPC-39: Publish preemptive data #112

Merged
merged 20 commits into from
Mar 31, 2023
Merged

IPC-39: Publish preemptive data #112

merged 20 commits into from
Mar 31, 2023

Conversation

aakoshh
Copy link
Contributor

@aakoshh aakoshh commented Mar 14, 2023

Closes consensus-shipyard/ipc#463

Changes in this PR:

  • added Client::publish_preemptive(subnet_id, bytes) to publish arbitrary data to an arbitrary subnet
  • added Event::ReceivedPreemptive(subnet_id, bytes) to the events emitted by Service::subscribe()
  • changed pin_subnet to subscribe to a topic based on the (child) subnet ID and the network name to receive pre-emptive data

The idea is that agents on the parent network pin the ID of child subnets they know exist, because they are interested in resolving data from them, so it's a natural assumption that they would want to benefit from pre-emptively published data as well.

By contrast, we could have used a topic based on the parent subnet ID, which would allow anyone to publish any made-up subnet ID. I reckon this would be difficult to regulate, as the potential number of subnets is unknown, so coming up with stable Gossipsub topic parameters would be tricky; for example we can't predict the volume and frequency of data published to this topic up front, and therefore we can't easily filter out overproducing peers.

While anyone can publish data to the subnet specific topics as well, it is more likely that we have expectations about how much data we expect from subnets we know about.

Potential enhancements

It is possible that an agent would want to opt-out of this feature, in case it is abused. At least with the resolve method they already know that the CID has been signed and embedded, whereas here anyone can push whatever they want. Perhaps it would be a good idea to attach the peer ID to the event, so the agent can report bad behaviour.

What exactly should the agents publish? At the moment it's raw bytes, expected to be inserted into an in-memory Blockstore temporarily after its CID is calculated by the agent, expecting that soon it would have to be resolved anyway. The message is intentionally identical from all agents, so Gossipsub can filter duplicates.

Note that is unlikely that we could use group signatures here. At best a checkpoint is signed, but there are no Merkle proofs we can use to prove that a sequence of bytes is actually a message that's included in the checkpoint. Although, the voting mechanism in consensus-shipyard/ipc#447 could be used by the validators in the child-subnet to gather quorum over individual messages. However, every member could potentially publish the same message with slightly different quorum composition, defeating the duplicate filters.

@aakoshh aakoshh requested a review from adlrocha March 14, 2023 17:19
Base automatically changed from ipc-101-gossip-votes to main March 31, 2023 07:44
@adlrocha adlrocha merged commit 2f35d30 into main Mar 31, 2023
@adlrocha adlrocha deleted the ipc-39-publish-preemptive branch March 31, 2023 08:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IPLD Resolver: Pre-publish messages
2 participants