From 1fc6842917db3efa4449a9160dc524cc0844f50a Mon Sep 17 00:00:00 2001 From: Hendrik Hofstadt Date: Tue, 20 Jul 2021 09:54:11 +0200 Subject: [PATCH] Double hashing on terra Change-Id: Ie3d65030d221585245d94d7650694fc545e72174 --- terra/contracts/wormhole/src/state.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/terra/contracts/wormhole/src/state.rs b/terra/contracts/wormhole/src/state.rs index d0d509ec..a0a5f7eb 100644 --- a/terra/contracts/wormhole/src/state.rs +++ b/terra/contracts/wormhole/src/state.rs @@ -114,6 +114,11 @@ impl ParsedVAA { hasher.update(body); let hash = hasher.finalize().to_vec(); + // Rehash the hash + let mut hasher = Keccak256::new(); + hasher.update(hash); + let hash = hasher.finalize().to_vec(); + // Signatures valid, apply VAA if body_offset + Self::VAA_PAYLOAD_POS > data.len() { return ContractError::InvalidVAA.std_err();