onflow / flow-core-contracts

Cadence smart contracts that define core functionality of the Flow protocol
https://onflow.org
The Unlicense
87 stars 50 forks source link

[DKG whiteboard] Restriction on broadcast #283

Open tarakby opened 2 years ago

tarakby commented 2 years ago

Context

The contract allows participating nodes to broadcast as many and as long data as they want. This issue is about adding restrictions to the messages sent on the whiteboard to avoid malicious behaviour:

Definition of Done:

joshuahannan commented 2 years ago

rename the contract file to FlowDKGWhiteboard

AFAIK, we won't be able to change the name of the contract because that is an incompatible upgrade

update the contract to only accept certain sizes of broadcasts to the whiteboard (this is not about the size of final submissions which seems to be checked already)

This should be fine to upgrade

update the contract to accept a maximum number of broadcast per node per DGK instance.

This'll be difficult because it would require adding a new field to the contract, which is an incompatible upgrade. There is a workaround for this, but it is pretty awkward. What is limit were you thinking about setting? And is there another way to enforce it? (Transaction fees would prevent a node sending too many, but I don't know what your limit would be)

tarakby commented 2 years ago

AFAIK, we won't be able to change the name of the contract because that is an incompatible upgrade

I only meant the name of the cdc file in the repo.

This'll be difficult because it would require adding a new field to the contract, which is an incompatible upgrade.

It's not sure we would like to implement this, as our code may send some transactions twice to the whiteboard and we don't want to censor the last messages. Let's wait for Jordan and I to confirm the need for this first before thinking further. The limit would be something like 270 in mature Flow.

joshuahannan commented 2 years ago

I only meant the name of the cdc file in the repo.

I don't like having contract file names that are different than the contract names themselves, so I would prefer to avoid this. I don't think it'll make much of a difference

tarakby commented 2 years ago

Fair enough. I'll make a PR to add clarifying comments about the contract is used for in DKG. Issue description updated.