[#1425] Remove SetEACL-related code

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-10-08 16:44:34 +03:00
parent 936ebbb8e5
commit 4190fba86d
Signed by: fyrchik
SSH key fingerprint: SHA256:m/TTwCzjnRkXgnzEx9X92ccxy1CcVeinOgDb3NPWWmg
8 changed files with 0 additions and 156 deletions

View file

@ -159,9 +159,6 @@ func dumpSingleContainer(bw *io.BufBinWriter, ch util.Uint160, inv *invoker.Invo
if err != nil { if err != nil {
return nil, fmt.Errorf("%w: %v", errInvalidContainerResponse, err) return nil, fmt.Errorf("%w: %v", errInvalidContainerResponse, err)
} }
if len(ea.Value) != 0 {
cnt.EACL = ea
}
return cnt, nil return cnt, nil
} }
@ -258,10 +255,6 @@ func restoreOrPutContainers(containers []Container, isOK func([]byte) bool, cmd
func putContainer(bw *io.BufBinWriter, ch util.Uint160, cnt Container) { func putContainer(bw *io.BufBinWriter, ch util.Uint160, cnt Container) {
emit.AppCall(bw.BinWriter, ch, "put", callflag.All, emit.AppCall(bw.BinWriter, ch, "put", callflag.All,
cnt.Value, cnt.Signature, cnt.PublicKey, cnt.Token) cnt.Value, cnt.Signature, cnt.PublicKey, cnt.Token)
if ea := cnt.EACL; ea != nil {
emit.AppCall(bw.BinWriter, ch, "setEACL", callflag.All,
ea.Value, ea.Signature, ea.PublicKey, ea.Token)
}
} }
func isContainerRestored(cmd *cobra.Command, wCtx *helper.InitializeContext, containerHash util.Uint160, bw *io.BufBinWriter, hashValue util.Uint256) (bool, error) { func isContainerRestored(cmd *cobra.Command, wCtx *helper.InitializeContext, containerHash util.Uint160, bw *io.BufBinWriter, hashValue util.Uint256) (bool, error) {
@ -322,7 +315,6 @@ type Container struct {
Signature []byte `json:"signature"` Signature []byte `json:"signature"`
PublicKey []byte `json:"public_key"` PublicKey []byte `json:"public_key"`
Token []byte `json:"token"` Token []byte `json:"token"`
EACL *EACL `json:"eacl"`
} }
// EACL represents extended ACL struct in contract storage. // EACL represents extended ACL struct in contract storage.

View file

@ -308,9 +308,6 @@ const (
ContainerNonAlphabetModeIgnoreContainerDelete = "non alphabet mode, ignore container delete" ContainerNonAlphabetModeIgnoreContainerDelete = "non alphabet mode, ignore container delete"
ContainerDeleteContainerCheckFailed = "delete container check failed" ContainerDeleteContainerCheckFailed = "delete container check failed"
ContainerCouldNotApproveDeleteContainer = "could not approve delete container" ContainerCouldNotApproveDeleteContainer = "could not approve delete container"
ContainerNonAlphabetModeIgnoreSetEACL = "non alphabet mode, ignore set EACL"
ContainerSetEACLCheckFailed = "set EACL check failed"
ContainerCouldNotApproveSetEACL = "could not approve set EACL"
FrostFSNonAlphabetModeIgnoreConfig = "non alphabet mode, ignore config" FrostFSNonAlphabetModeIgnoreConfig = "non alphabet mode, ignore config"
FrostFSCantRelaySetConfigEvent = "can't relay set config event" FrostFSCantRelaySetConfigEvent = "can't relay set config event"
FrostFSFrostfsWorkerPool = "frostfs worker pool" FrostFSFrostfsWorkerPool = "frostfs worker pool"

View file

@ -48,7 +48,3 @@ func (cp *Processor) handleDelete(ev event.Event) {
zap.Int("capacity", cp.pool.Cap())) zap.Int("capacity", cp.pool.Cap()))
} }
} }
func (cp *Processor) handleSetEACL(_ event.Event) {
cp.log.Warn(logs.SkipDeprecatedNotification, zap.String("type", "set EACL"))
}

View file

@ -157,11 +157,6 @@ func (cp *Processor) ListenerNotaryParsers() []event.NotaryParserInfo {
p.SetParser(containerEvent.ParseDeleteNotary) p.SetParser(containerEvent.ParseDeleteNotary)
pp = append(pp, p) pp = append(pp, p)
// set EACL
p.SetRequestType(containerEvent.SetEACLNotaryEvent)
p.SetParser(containerEvent.ParseSetEACLNotary)
pp = append(pp, p)
return pp return pp
} }
@ -190,10 +185,5 @@ func (cp *Processor) ListenerNotaryHandlers() []event.NotaryHandlerInfo {
h.SetHandler(cp.handleDelete) h.SetHandler(cp.handleDelete)
hh = append(hh, h) hh = append(hh, h)
// set eACL
h.SetRequestType(containerEvent.SetEACLNotaryEvent)
h.SetHandler(cp.handleSetEACL)
hh = append(hh, h)
return hh return hh
} }

View file

@ -28,7 +28,6 @@ const (
listMethod = "list" listMethod = "list"
containersOfMethod = "containersOf" containersOfMethod = "containersOf"
eaclMethod = "eACL" eaclMethod = "eACL"
setEACLMethod = "setEACL"
deletionInfoMethod = "deletionInfo" deletionInfoMethod = "deletionInfo"
startEstimationMethod = "startContainerEstimation" startEstimationMethod = "startContainerEstimation"

View file

@ -1,51 +0,0 @@
package container
import (
"github.com/nspcc-dev/neo-go/pkg/network/payload"
)
// SetEACL represents structure of notification about
// modified eACL table coming from FrostFS Container contract.
type SetEACL struct {
TableValue []byte
SignatureValue []byte
PublicKeyValue []byte
TokenValue []byte
// For notary notifications only.
// Contains raw transactions of notary request.
NotaryRequestValue *payload.P2PNotaryRequest
}
// MorphEvent implements Neo:Morph Event interface.
func (SetEACL) MorphEvent() {}
// Table returns returns eACL table in a binary FrostFS API format.
func (x SetEACL) Table() []byte {
return x.TableValue
}
// Signature returns signature of the binary table.
func (x SetEACL) Signature() []byte {
return x.SignatureValue
}
// PublicKey returns public keys of container
// owner in a binary format.
func (x SetEACL) PublicKey() []byte {
return x.PublicKeyValue
}
// SessionToken returns binary token of the session
// within which the eACL was set.
func (x SetEACL) SessionToken() []byte {
return x.TokenValue
}
// NotaryRequest returns raw notary request if notification
// was received via notary service. Otherwise, returns nil.
func (x SetEACL) NotaryRequest() *payload.P2PNotaryRequest {
return x.NotaryRequestValue
}
const expectedItemNumEACL = 4

View file

@ -1,75 +0,0 @@
package container
import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
)
func (x *SetEACL) setTable(v []byte) {
if v != nil {
x.TableValue = v
}
}
func (x *SetEACL) setSignature(v []byte) {
if v != nil {
x.SignatureValue = v
}
}
func (x *SetEACL) setPublicKey(v []byte) {
if v != nil {
x.PublicKeyValue = v
}
}
func (x *SetEACL) setToken(v []byte) {
if v != nil {
x.TokenValue = v
}
}
var setEACLFieldSetters = []func(*SetEACL, []byte){
// order on stack is reversed
(*SetEACL).setToken,
(*SetEACL).setPublicKey,
(*SetEACL).setSignature,
(*SetEACL).setTable,
}
const (
// SetEACLNotaryEvent is method name for container EACL operations
// in `Container` contract. Is used as identificator for notary
// EACL changing requests.
SetEACLNotaryEvent = "setEACL"
)
// ParseSetEACLNotary from NotaryEvent into container event structure.
func ParseSetEACLNotary(ne event.NotaryEvent) (event.Event, error) {
var (
ev SetEACL
currentOp opcode.Opcode
)
fieldNum := 0
for _, op := range ne.Params() {
currentOp = op.Code()
switch {
case opcode.PUSHDATA1 <= currentOp && currentOp <= opcode.PUSHDATA4:
if fieldNum == expectedItemNumEACL {
return nil, event.UnexpectedArgNumErr(SetEACLNotaryEvent)
}
setEACLFieldSetters[fieldNum](&ev, op.Param())
fieldNum++
default:
return nil, event.UnexpectedOpcode(SetEACLNotaryEvent, op.Code())
}
}
ev.NotaryRequestValue = ne.Raw()
return ev, nil
}

View file

@ -32,10 +32,6 @@ func (m mock) Delete(_ containerCore.RemovalWitness) error {
return nil return nil
} }
func (m mock) PutEACL(_ containerCore.EACL) error {
return nil
}
func TestInvalidToken(t *testing.T) { func TestInvalidToken(t *testing.T) {
m := mock{} m := mock{}
e := containerSvcMorph.NewExecutor(m, m) e := containerSvcMorph.NewExecutor(m, m)