Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(lib/runtime): ext_default_child_storage_next_key_version_1 return None correctly #3473

Merged
merged 8 commits into from
Sep 11, 2023
12 changes: 6 additions & 6 deletions lib/runtime/wazero/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -1172,17 +1172,17 @@ func ext_default_child_storage_next_key_version_1(

keyToChild := read(m, childStorageKey)
keyBytes := read(m, key)
child, err := storage.GetChildNextKey(keyToChild, keyBytes)
childNextKey, err := storage.GetChildNextKey(keyToChild, keyBytes)
if err != nil {
logger.Errorf("failed to get child's next key: %s", err)
return 0
return mustWrite(m, rtCtx.Allocator, noneEncoded)
}

ret, err := write(m, rtCtx.Allocator, scale.MustMarshal(&child))
if err != nil {
panic(err)
if childNextKey == nil {
return mustWrite(m, rtCtx.Allocator, noneEncoded)
}
return ret

return mustWrite(m, rtCtx.Allocator, scale.MustMarshal(&childNextKey))
}

func ext_default_child_storage_root_version_1(
Expand Down