-
Notifications
You must be signed in to change notification settings - Fork 1
/
crosschain_ack_receipt.go
42 lines (36 loc) · 1.33 KB
/
crosschain_ack_receipt.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
42
package types
import (
"github.com/cometbft/cometbft/crypto/tmhash"
proto "github.com/cosmos/gogoproto/proto"
)
func (c CrosschainAckReceipt) 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 *CrosschainAckReceipt) ClaimHash() ([]byte, error) {
crosschainAckReceiptClaimHash := NewCrosschainAckReceiptClaimHash(
msg.AckReceiptSrcChainId,
msg.Contract,
msg.AckReceiptIdentifier,
msg.AckReceiptBlockHeight,
msg.AckReceiptTxHash,
msg.RelayerRouterAddress,
msg.RequestIdentifier,
msg.AckSrcChainId,
msg.AckRequestIdentifier,
msg.FeeConsumed,
msg.AckExecData,
msg.AckExecStatus,
)
out, err := proto.Marshal(crosschainAckReceiptClaimHash)
return tmhash.Sum([]byte(out)), err
}
func (msg *CrosschainAckReceipt) GetChainId() string {
return msg.AckReceiptSrcChainId
}