forked from TrueCloudLab/frostfs-contract
parent
27f5944f30
commit
4585f96acf
4 changed files with 8 additions and 8 deletions
|
@ -138,7 +138,7 @@ func TransferX(from, to interop.Hash160, amount int, details []byte) bool {
|
||||||
var ( // for invocation collection without notary
|
var ( // for invocation collection without notary
|
||||||
alphabet []common.IRNode
|
alphabet []common.IRNode
|
||||||
nodeKey []byte
|
nodeKey []byte
|
||||||
inderectCall bool
|
indirectCall bool
|
||||||
)
|
)
|
||||||
|
|
||||||
if notaryDisabled {
|
if notaryDisabled {
|
||||||
|
@ -148,7 +148,7 @@ func TransferX(from, to interop.Hash160, amount int, details []byte) bool {
|
||||||
panic("transferX: this method must be invoked from inner ring")
|
panic("transferX: this method must be invoked from inner ring")
|
||||||
}
|
}
|
||||||
|
|
||||||
inderectCall = common.FromKnownContract(
|
indirectCall = common.FromKnownContract(
|
||||||
ctx,
|
ctx,
|
||||||
runtime.GetCallingScriptHash(),
|
runtime.GetCallingScriptHash(),
|
||||||
containerContractKey,
|
containerContractKey,
|
||||||
|
@ -160,7 +160,7 @@ func TransferX(from, to interop.Hash160, amount int, details []byte) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if notaryDisabled && !inderectCall {
|
if notaryDisabled && !indirectCall {
|
||||||
threshold := len(alphabet)*2/3 + 1
|
threshold := len(alphabet)*2/3 + 1
|
||||||
id := common.InvokeID([]interface{}{from, to, amount}, []byte("transfer"))
|
id := common.InvokeID([]interface{}{from, to, amount}, []byte("transfer"))
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ func InvokeID(args []interface{}, prefix []byte) []byte {
|
||||||
- it is indirect invocation from other smart-contract.
|
- it is indirect invocation from other smart-contract.
|
||||||
|
|
||||||
However there is a possible attack, when malicious inner ring node creates
|
However there is a possible attack, when malicious inner ring node creates
|
||||||
malicious smart-contract in morph chain to do inderect call.
|
malicious smart-contract in morph chain to do indirect call.
|
||||||
|
|
||||||
MaliciousIR -(1 invoke)-> [ Malicious Contract ] -(1 invoke) -> [ Balance Contract ]
|
MaliciousIR -(1 invoke)-> [ Malicious Contract ] -(1 invoke) -> [ Balance Contract ]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: "NeoFS Container"
|
name: "NeoFS Container"
|
||||||
safemethods: ["get", "owner", "list", "eacl", "getContainerSize", "listContainerSizes", "version"]
|
safemethods: ["get", "owner", "list", "eACL", "getContainerSize", "listContainerSizes", "version"]
|
||||||
events:
|
events:
|
||||||
- name: containerPut
|
- name: containerPut
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
@ -80,7 +80,7 @@ func AddKey(owner []byte, keys []interop.PublicKey) bool {
|
||||||
var ( // for invocation collection without notary
|
var ( // for invocation collection without notary
|
||||||
alphabet []common.IRNode
|
alphabet []common.IRNode
|
||||||
nodeKey []byte
|
nodeKey []byte
|
||||||
inderectCall bool
|
indirectCall bool
|
||||||
)
|
)
|
||||||
|
|
||||||
if notaryDisabled {
|
if notaryDisabled {
|
||||||
|
@ -90,7 +90,7 @@ func AddKey(owner []byte, keys []interop.PublicKey) bool {
|
||||||
panic("addKey: invocation from non inner ring node")
|
panic("addKey: invocation from non inner ring node")
|
||||||
}
|
}
|
||||||
|
|
||||||
inderectCall = common.FromKnownContract(
|
indirectCall = common.FromKnownContract(
|
||||||
ctx,
|
ctx,
|
||||||
runtime.GetCallingScriptHash(),
|
runtime.GetCallingScriptHash(),
|
||||||
containerContractKey,
|
containerContractKey,
|
||||||
|
@ -121,7 +121,7 @@ addLoop:
|
||||||
info.Keys = append(info.Keys, pubKey)
|
info.Keys = append(info.Keys, pubKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
if notaryDisabled && !inderectCall {
|
if notaryDisabled && !indirectCall {
|
||||||
threshold := len(alphabet)*2/3 + 1
|
threshold := len(alphabet)*2/3 + 1
|
||||||
id := invokeIDKeys(owner, keys, []byte("add"))
|
id := invokeIDKeys(owner, keys, []byte("add"))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue