Skip to content

Commit

Permalink
check signatures in CP sync backfill with LC
Browse files Browse the repository at this point in the history
When using trusted node sync with light client (`--trusted-block-root`),
the trust assumption on the server is reduced to solely be responsible
for data availability, but not data correctness. This means that we must
check block proposer signatures against the downloaded checkpoint, as
they are not covered by the block root.

Note that this lowers the backfill speed when using LC based CP sync
due to the extra checks, by about 60% for me.
  • Loading branch information
etan-status committed Apr 26, 2023
1 parent 1ccb36b commit 4b210c2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion beacon_chain/trusted_node_sync.nim
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,17 @@ proc doTrustedNodeSync*(
data = blck.get()

withBlck(data[]):
if (let res = dag.addBackfillBlock(blck.asSigVerified()); res.isErr()):
let res =
case syncTarget.kind
of TrustedNodeSyncKind.TrustedBlockRoot:
# Trust-minimized sync: the server is only trusted for
# data availability, responses must be verified
dag.addBackfillBlock(blck)
of TrustedNodeSyncKind.StateId:
# The server is fully trusted to provide accurate data;
# it could have provided a malicious state
dag.addBackfillBlock(blck.asSigVerified())
if res.isErr():
case res.error()
of VerifierError.Invalid,
VerifierError.MissingParent,
Expand Down

0 comments on commit 4b210c2

Please sign in to comment.