Skip to content

Commit 7946fbb

Browse files
committed
Add compile time type assertions
1 parent 7f97453 commit 7946fbb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib_libwasmvm.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,12 @@ type hasSubMessages interface {
546546
SubMessages() []types.SubMsg
547547
}
548548

549+
// make sure the types implement the interface
550+
// cannot put these next to the types, as the interface is private
551+
var _ hasSubMessages = (*types.IBCBasicResult)(nil)
552+
var _ hasSubMessages = (*types.IBCReceiveResult)(nil)
553+
var _ hasSubMessages = (*types.ContractResult)(nil)
554+
549555
func DeserializeResponse(gasLimit uint64, deserCost types.UFraction, gasReport *types.GasReport, data []byte, response any) error {
550556
gasForDeserialization := deserCost.Mul(uint64(len(data))).Floor()
551557
if gasLimit < gasForDeserialization+gasReport.UsedInternally {

0 commit comments

Comments
 (0)