Double hashing in the guardian

Change-Id: Ieeb9d9c0e258cf63ae0ce1d7fd1215eef6f1ced2
This commit is contained in:
Hendrik Hofstadt 2021-07-20 09:55:42 +02:00
parent 54aadf5f5a
commit bb446fb338
1 changed files with 3 additions and 1 deletions

View File

@ -178,7 +178,9 @@ func (v *VAA) SigningMsg() (common.Hash, error) {
return common.Hash{}, fmt.Errorf("failed to serialize signing body: %w", err)
}
hash := crypto.Keccak256Hash(body)
// In order to save space in the solana signature verification instruction, we hash twice so we only need to pass in
// the first hash (32 bytes) vs the full body data.
hash := crypto.Keccak256Hash(crypto.Keccak256Hash(body).Bytes())
return hash, nil
}