[#55] policy: Swap signature check order
While implementing the changes for FrostFS ID it became obvious, that committee signature check can be rather costly (`getCommittee` call + multiaddress construction + checking witness). In real scenarious it will mostly fail, so it makes sense do it last. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
0dda536d4a
commit
f30fb324ff
1 changed files with 3 additions and 4 deletions
|
@ -47,14 +47,13 @@ func _deploy(data any, isUpdate bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkAuthorization(ctx storage.Context) {
|
func checkAuthorization(ctx storage.Context) {
|
||||||
if runtime.CheckWitness(common.AlphabetAddress()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
admin := getAdmin(ctx)
|
admin := getAdmin(ctx)
|
||||||
if admin != nil && runtime.CheckWitness(admin) {
|
if admin != nil && runtime.CheckWitness(admin) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if runtime.CheckWitness(common.AlphabetAddress()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
panic(ErrNotAutorized)
|
panic(ErrNotAutorized)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue