From 095aa19d3b7a3ea0d1e67fa1dc60553edfae03ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=B6ller?= Date: Tue, 5 Dec 2023 13:59:03 +0100 Subject: [PATCH 1/2] Add a nil check into accounts.foundryModifySupply --- packages/vm/core/accounts/impl.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/vm/core/accounts/impl.go b/packages/vm/core/accounts/impl.go index 85ae6b7f41..f05495ffdb 100644 --- a/packages/vm/core/accounts/impl.go +++ b/packages/vm/core/accounts/impl.go @@ -309,6 +309,8 @@ func foundryModifySupply(ctx isc.Sandbox) dict.Dict { } out, _ := GetFoundryOutput(state, sn, ctx.ChainID()) + ctx.Requiref(out != nil, "foundry output not found") + nativeTokenID, err := out.NativeTokenID() ctx.RequireNoError(err, "internal") From f88ff5bd45c5cd34204b667a1b5047bd4b4d6ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=B6ller?= Date: Tue, 5 Dec 2023 14:08:58 +0100 Subject: [PATCH 2/2] Reuse existing error --- packages/vm/core/accounts/impl.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/vm/core/accounts/impl.go b/packages/vm/core/accounts/impl.go index f05495ffdb..5e43a08dfb 100644 --- a/packages/vm/core/accounts/impl.go +++ b/packages/vm/core/accounts/impl.go @@ -309,7 +309,9 @@ func foundryModifySupply(ctx isc.Sandbox) dict.Dict { } out, _ := GetFoundryOutput(state, sn, ctx.ChainID()) - ctx.Requiref(out != nil, "foundry output not found") + if out == nil { + panic(errFoundryNotFound) + } nativeTokenID, err := out.NativeTokenID() ctx.RequireNoError(err, "internal")