diff --git a/pkg/core/native/management.go b/pkg/core/native/management.go index b30266624..eee25bef6 100644 --- a/pkg/core/native/management.go +++ b/pkg/core/native/management.go @@ -614,7 +614,7 @@ func checkScriptAndMethods(script []byte, methods []manifest.Method) error { offsets := bitfield.New(l) for i := range methods { if methods[i].Offset >= l { - return errors.New("out of bounds method offset") + continue } offsets.Set(methods[i].Offset) } diff --git a/pkg/core/native/native_test/management_test.go b/pkg/core/native/native_test/management_test.go index e2c690c16..2f212c9d6 100644 --- a/pkg/core/native/native_test/management_test.go +++ b/pkg/core/native/native_test/management_test.go @@ -135,13 +135,20 @@ func TestManagement_ContractDeploy(t *testing.T) { badManifest := cs1.Manifest badManifest.ABI.Methods = make([]manifest.Method, len(cs1.Manifest.ABI.Methods)) copy(badManifest.ABI.Methods, cs1.Manifest.ABI.Methods) - badManifest.ABI.Methods[0].Offset = 100500 // out of bounds + badManifest.ABI.Methods[0].Offset = 100500 // out of bounds, but it's OK, this method will not be checked then. manifB, err := json.Marshal(&badManifest) require.NoError(t, err) - managementInvoker.InvokeFail(t, "out of bounds method offset", "deploy", nefBytes, manifB) - }) + tx := c.PrepareInvokeNoSign(t, "deploy", nefBytes, manifB) + tx.Signers = []transaction.Signer{{}} // Need dummy signer to deploy. + b := c.NewUnsignedBlock(t, tx) + ic := c.Chain.GetTestVM(trigger.Application, tx, b) + t.Cleanup(ic.Finalize) + ic.VM.LoadWithFlags(tx.Script, callflag.All) + err = ic.VM.Run() + require.NoError(t, err) + }) t.Run("bad methods in manifest 2", func(t *testing.T) { var badManifest = cs1.Manifest badManifest.ABI.Methods = make([]manifest.Method, len(cs1.Manifest.ABI.Methods))