Skip to content

Commit 48ea39c

Browse files
authored
Merge pull request #537 from CosmWasm/add-type-assertions
Add compile time type assertions for `hasSubMessages` interface
2 parents 36bb5d2 + 87ce53a commit 48ea39c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib_libwasmvm.go

+8
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,14 @@ 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 (
552+
_ hasSubMessages = (*types.IBCBasicResult)(nil)
553+
_ hasSubMessages = (*types.IBCReceiveResult)(nil)
554+
_ hasSubMessages = (*types.ContractResult)(nil)
555+
)
556+
549557
func DeserializeResponse(gasLimit uint64, deserCost types.UFraction, gasReport *types.GasReport, data []byte, response any) error {
550558
gasForDeserialization := deserCost.Mul(uint64(len(data))).Floor()
551559
if gasLimit < gasForDeserialization+gasReport.UsedInternally {

0 commit comments

Comments
 (0)