diff --git a/beacon_chain/trusted_node_sync.nim b/beacon_chain/trusted_node_sync.nim index 18d48adf45..4a4dd4cfd6 100644 --- a/beacon_chain/trusted_node_sync.nim +++ b/beacon_chain/trusted_node_sync.nim @@ -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,