-
Notifications
You must be signed in to change notification settings - Fork 1
/
fund_deposit.go
41 lines (36 loc) · 1.23 KB
/
fund_deposit.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package types
import (
proto "github.com/gogo/protobuf/proto"
"github.com/tendermint/tendermint/crypto/tmhash"
)
func (c FundDepositRequest) ValidateBasic() error {
//TODO: Validate id?
//TODO: Validate cosmos sender?
return nil
}
// Hash implements IncomingTx.Hash
// modify this with care as it is security sensitive. If an element of the claim is not in this hash a single hostile validator
// could engineer a hash collision and execute a version of the claim with any unhashed data changed to benefit them.
// note that the Orchestrator is the only field excluded from this hash, this is because that value is used higher up in the store
// structure for who has made what claim and is verified by the msg ante-handler for signatures
func (msg *FundDepositRequest) ClaimHash() ([]byte, error) {
fundDepositRequestClaimHash := NewFundDepositRequestClaimHash(
msg.SrcChainId,
msg.SrcChainType,
msg.SrcTxHash,
msg.SrcTimestamp,
msg.Contract,
msg.DepositId,
msg.BlockHeight,
msg.DestChainId,
msg.Amount,
msg.DestAmount,
msg.SrcToken,
msg.Recipient,
msg.Depositor,
msg.PartnerId,
msg.Message,
msg.DepositWithMessage)
out, err := proto.Marshal(fundDepositRequestClaimHash)
return tmhash.Sum([]byte(out)), err
}