@@ -15,18 +15,19 @@ import (
15
15
// GuardianProofProducer always returns an optimistic (dummy) proof.
16
16
type GuardianProofProducer struct {
17
17
returnLivenessBond bool
18
- DummyProofProducer
18
+ * SGXProofProducer
19
19
}
20
20
21
- func NewGuardianProofProducer (returnLivenessBond bool ) * GuardianProofProducer {
21
+ func NewGuardianProofProducer (sgxProofProducer * SGXProofProducer , returnLivenessBond bool ) * GuardianProofProducer {
22
22
return & GuardianProofProducer {
23
+ SGXProofProducer : sgxProofProducer ,
23
24
returnLivenessBond : returnLivenessBond ,
24
25
}
25
26
}
26
27
27
28
// RequestProof implements the ProofProducer interface.
28
29
func (g * GuardianProofProducer ) RequestProof (
29
- _ context.Context ,
30
+ ctx context.Context ,
30
31
opts * ProofRequestOptions ,
31
32
blockID * big.Int ,
32
33
meta * bindings.TaikoDataBlockMetadata ,
@@ -51,6 +52,13 @@ func (g *GuardianProofProducer) RequestProof(
51
52
}, nil
52
53
}
53
54
55
+ // Each guardian prover should check the block hash with raiko at first,
56
+ // before submitting the guardian proof, if raiko can return a proof without
57
+ // any error, which means the block hash is valid.
58
+ if _ , err := g .SGXProofProducer .RequestProof (ctx , opts , blockID , meta , header ); err != nil {
59
+ return nil , err
60
+ }
61
+
54
62
return g .DummyProofProducer .RequestProof (opts , blockID , meta , header , g .Tier ())
55
63
}
56
64
0 commit comments