diff --git a/frostfsid/frostfsid_contract.go b/frostfsid/frostfsid_contract.go index 250deeb..80991fb 100644 --- a/frostfsid/frostfsid_contract.go +++ b/frostfsid/frostfsid_contract.go @@ -401,6 +401,7 @@ func DeleteSubject(addr interop.Hash160) { storage.Delete(ctx, subjectAdditionalKey(subj.AdditionalKeys[i], addr)) storage.Delete(ctx, addressKey(contract.CreateStandardAccount(subj.AdditionalKeys[i]))) } + storage.Delete(ctx, addressKey(addr)) storage.Delete(ctx, sKey) removeSubjectFromNamespace(ctx, subj.Namespace, addr) diff --git a/tests/frostfsid_test.go b/tests/frostfsid_test.go index 2f0865a..72be569 100644 --- a/tests/frostfsid_test.go +++ b/tests/frostfsid_test.go @@ -629,6 +629,9 @@ func TestAdditionalKeyFromPrimarySubject(t *testing.T) { subjDPrimaryKey, err := keys.NewPrivateKey() require.NoError(t, err) + subjFPrimaryKey, err := keys.NewPrivateKey() + require.NoError(t, err) + invoker.Invoke(t, stackitem.Null{}, createSubjectMethod, defaultNamespace, subjAPrimaryKey.PublicKey().Bytes()) invoker.Invoke(t, stackitem.Null{}, createSubjectMethod, defaultNamespace, subjBPrimaryKey.PublicKey().Bytes()) @@ -647,6 +650,10 @@ func TestAdditionalKeyFromPrimarySubject(t *testing.T) { invoker.InvokeFail(t, "key is occupied", addSubjectKeyMethod, subjAKeyAddr, subjDPrimaryKey.PublicKey().Bytes()) invoker.Invoke(t, stackitem.Null{}, deleteSubjectMethod, subjBKeyAddr) invoker.Invoke(t, stackitem.Null{}, addSubjectKeyMethod, subjAKeyAddr, subjDPrimaryKey.PublicKey().Bytes()) + + invoker.Invoke(t, stackitem.Null{}, createSubjectMethod, defaultNamespace, subjFPrimaryKey.PublicKey().Bytes()) + invoker.Invoke(t, stackitem.Null{}, deleteSubjectMethod, subjFPrimaryKey.PublicKey().GetScriptHash()) + invoker.Invoke(t, stackitem.Null{}, createSubjectMethod, defaultNamespace, subjFPrimaryKey.PublicKey().Bytes()) } func checkPublicKeyResult(t *testing.T, s *vm.Stack, err error, key *keys.PrivateKey) {