-
Notifications
You must be signed in to change notification settings - Fork 1
/
fund_paid.go
37 lines (32 loc) · 1.16 KB
/
fund_paid.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
package types
import (
proto "github.com/gogo/protobuf/proto"
"github.com/tendermint/tendermint/crypto/tmhash"
)
func (c FundsPaidRequest) 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 *FundsPaidRequest) ClaimHash() ([]byte, error) {
fundDepositRequestClaimHash := NewFundPaidRequestClaimHash(
msg.SrcChainId,
msg.SrcChainType,
msg.SrcTxHash,
msg.SrcTimestamp,
msg.Contract,
msg.EventNonce,
msg.BlockHeight,
msg.MessageHash,
msg.Forwarder,
msg.ForwarderRouterAddr,
msg.ExecData,
msg.ExecStatus)
out, err := proto.Marshal(fundDepositRequestClaimHash)
return tmhash.Sum([]byte(out)), err
}