Skip to content

Commit

Permalink
clarify the difference between the two proofs/roots
Browse files Browse the repository at this point in the history
  • Loading branch information
stbrody committed Oct 22, 2024
1 parent 857b5c9 commit fb38835
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions event-svc/src/event/validator/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,19 @@ impl TimeEventValidator {
.get(&chain_id)
.ok_or_else(|| eth_rpc::Error::NoChainProvider(chain_id.clone()))?;

let proof = provider.get_chain_inclusion_proof(event.proof()).await?;
let chain_proof = provider.get_chain_inclusion_proof(event.proof()).await?;

if proof.root_cid != event.proof().root() {
// Compare the root CID in the TimeEvent's AnchorProof to the root CID that was actually
// included in the transaction onchain.
if chain_proof.root_cid != event.proof().root() {
return Err(eth_rpc::Error::InvalidProof(format!(
"the root CID is not in the transaction (root={})",
event.proof().root()
"the root CID is not in the transaction (anchor proof root={}, blockchain transaction root={})",
event.proof().root(),
chain_proof.root_cid,
)));
}

Ok(Timestamp(proof.timestamp))
Ok(Timestamp(chain_proof.timestamp))
}
}

Expand Down

0 comments on commit fb38835

Please sign in to comment.