relab / hotstuff

MIT License
167 stars 53 forks source link

Puzzles about ExecCommand function in client/client_gorums.pb.go #30

Closed seafooler closed 3 years ago

seafooler commented 3 years ago

As commented by the function:

ExecCommand sends a command to all replicas and waits for valid signatures
from f+1 replicas

However, the HotStuff paper argues that 2f+1 signatures are needed. What's the reason for this inconsistency?

johningve commented 3 years ago

This comment is slightly inaccurate. It should really read "...waits for responses from f+1 replicas." Anyway, the ExecCommand function is used by clients to send commands to replicas. The clients do not participate in the consensus protocol, they only submit commands. It is up to the replicas to reach a consensus on which commands should be executed and in which order. Indeed, replicas need 2f + 1 valid signatures from other replicas in order to reach consensus, but a client only needs to receive responses from f + 1 replicas in order to verify that the command has been executed. This is just as described in the first paragraph on "Basic HotStuff" from the paper.

I hope that helps :)

seafooler commented 3 years ago

This comment is slightly inaccurate. It should really read "...waits for responses from f+1 replicas." Anyway, the ExecCommand function is used by clients to send commands to replicas. The clients do not participate in the consensus protocol, they only submit commands. It is up to the replicas to reach a consensus on which commands should be executed and in which order. Indeed, replicas need 2f + 1 valid signatures from other replicas in order to reach consensus, but a client only needs to receive responses from f + 1 replicas in order to verify that the command has been executed. This is just as described in the first paragraph on "Basic HotStuff" from the paper.

I hope that helps :)

Thanks so much for your timely reply, that is really helpful and successfully answers my doubts.

seafooler commented 3 years ago

This comment is slightly inaccurate. It should really read "...waits for responses from f+1 replicas." Anyway, the ExecCommand function is used by clients to send commands to replicas. The clients do not participate in the consensus protocol, they only submit commands. It is up to the replicas to reach a consensus on which commands should be executed and in which order. Indeed, replicas need 2f + 1 valid signatures from other replicas in order to reach consensus, but a client only needs to receive responses from f + 1 replicas in order to verify that the command has been executed. This is just as described in the first paragraph on "Basic HotStuff" from the paper.

I hope that helps :)

I'm sorry for having another doubt. As the HotStuff states, the client should only send the command to the primary node. However, it seems that 'ExecCommand' method sends the command to all the replicas.

johningve commented 3 years ago

As the HotStuff states, the client should only send the command to the primary node.

This is simply an implementation detail. You can choose to have the clients send commands to only the primary, or maybe the primary plus a couple of backups, or simply all replicas. By sending the commands to all replicas, we don't have to worry about a faulty primary, and it makes it easy to change the primary often. However, if you are running with a massive amount of replicas, then it makes more sense to send the commands to a subset of the replicas.

seafooler commented 3 years ago

As the HotStuff states, the client should only send the command to the primary node.

This is simply an implementation detail. You can choose to have the clients send commands to only the primary, or maybe the primary plus a couple of backups, or simply all replicas. By sending the commands to all replicas, we don't have to worry about a faulty primary, and it makes it easy to change the primary often. However, if you are running with a massive amount of replicas, then it makes more sense to send the commands to a subset of the replicas.

I see! Thanks again for your help :)