diff --git a/container/config.yml b/container/config.yml index 14ad5a2..82e0505 100644 --- a/container/config.yml +++ b/container/config.yml @@ -14,6 +14,12 @@ events: type: PublicKey - name: token type: ByteArray + - name: PutSuccess + parameters: + - name: containerID + type: Hash256 + - name: publicKey + type: PublicKey - name: containerDelete parameters: - name: containerID @@ -22,6 +28,10 @@ events: type: Signature - name: token type: ByteArray + - name: DeleteSuccess + parameters: + - name: containerID + type: ByteArray - name: setEACL parameters: - name: eACL @@ -32,6 +42,12 @@ events: type: PublicKey - name: token type: ByteArray + - name: SetEACLSuccess + parameters: + - name: containerID + type: ByteArray + - name: publicKey + type: PublicKey - name: StartEstimation parameters: - name: epoch diff --git a/container/container_contract.go b/container/container_contract.go index 596d88b..17901e1 100644 --- a/container/container_contract.go +++ b/container/container_contract.go @@ -276,6 +276,7 @@ func PutNamed(container []byte, signature interop.Signature, } runtime.Log("added new container") + runtime.Notify("PutSuccess", containerID, publicKey) } // checkNiceNameAvailable checks if nice name is available for the container. @@ -357,6 +358,7 @@ func Delete(containerID []byte, signature interop.Signature, token []byte) { } removeContainer(ctx, containerID, ownerID) runtime.Log("remove container") + runtime.Notify("DeleteSuccess", containerID) } // Get method returns structure that contains stable marshaled Container structure, @@ -464,6 +466,7 @@ func SetEACL(eACL []byte, signature interop.Signature, publicKey interop.PublicK common.SetSerialized(ctx, key, rule) runtime.Log("success") + runtime.Notify("SetEACLSuccess", containerID, publicKey) } // EACL method returns structure that contains stable marshaled EACLTable structure, diff --git a/netmap/config.yml b/netmap/config.yml index a183ec8..407e7f6 100644 --- a/netmap/config.yml +++ b/netmap/config.yml @@ -7,12 +7,22 @@ events: parameters: - name: nodeInfo type: ByteArray + - name: AddPeerSuccess + parameters: + - name: publicKey + type: PublicKey - name: UpdateState parameters: - name: state type: Integer - name: publicKey type: PublicKey + - name: UpdateStateSuccess + parameters: + - name: publicKey + type: PublicKey + - name: state + type: Integer - name: NewEpoch parameters: - name: epoch diff --git a/netmap/netmap_contract.go b/netmap/netmap_contract.go index be2ca3f..f61fead 100644 --- a/netmap/netmap_contract.go +++ b/netmap/netmap_contract.go @@ -202,6 +202,9 @@ func AddPeerIR(nodeInfo []byte) { common.CheckAlphabetWitness(common.AlphabetAddress()) addToNetmap(ctx, storageNode{info: nodeInfo}) + + publicKey := nodeInfo[2:35] // V2 format: offset:2, len:33 + runtime.Notify("AddPeerSuccess", interop.PublicKey(publicKey)) } // AddPeer method adds new candidate to the next network map if it was invoked @@ -225,12 +228,12 @@ func AddPeer(nodeInfo []byte) { nodeKey = common.InnerRingInvoker(alphabet) } + // V2 format + publicKey := nodeInfo[2:35] // offset:2, len:33 + // If notary is enabled or caller is not an alphabet node, // just emit the notification for alphabet. if !notaryDisabled || len(nodeKey) == 0 { - // V2 format - publicKey := nodeInfo[2:35] // offset:2, len:33 - common.CheckWitness(publicKey) if notaryDisabled { runtime.Notify("AddPeer", nodeInfo) @@ -256,6 +259,7 @@ func AddPeer(nodeInfo []byte) { } addToNetmap(ctx, candidate) + runtime.Notify("AddPeerSuccess", interop.PublicKey(publicKey)) } // UpdateState method updates state of node from the network map candidate list. @@ -316,6 +320,8 @@ func UpdateState(state int, publicKey interop.PublicKey) { default: panic("unsupported state") } + + runtime.Notify("UpdateStateSuccess", publicKey, state) } // UpdateStateIR method tries to change node state in the network map. @@ -335,6 +341,7 @@ func UpdateStateIR(state nodeState, publicKey interop.PublicKey) { default: panic("unsupported state") } + runtime.Notify("UpdateStateSuccess", publicKey, state) } // NewEpoch method changes epoch number up to provided epochNum argument. Can