forked from TrueCloudLab/frostfs-contract
[TrueCloudLab#3] processing: Rename neofs to frostfs
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
0093e89ad9
commit
402c13a607
4 changed files with 15 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
|||
name: "NeoFS Multi Signature Processing"
|
||||
name: "FrostFS Multi Signature Processing"
|
||||
safemethods: ["verify", "version"]
|
||||
permissions:
|
||||
- methods: ["update"]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Processing contract is a contract deployed in NeoFS mainchain.
|
||||
Processing contract is a contract deployed in FrostFS mainchain.
|
||||
|
||||
Processing contract pays for all multisignature transaction executions when notary
|
||||
service is enabled in the mainchain. Notary service prepares multisigned transactions,
|
||||
|
@ -8,8 +8,8 @@ ask Alphabet nodes to pay for these transactions: nodes can change over time,
|
|||
some nodes will spend sidechain GAS faster. It leads to economic instability.
|
||||
|
||||
Processing contract exists to solve this issue. At the Withdraw invocation of
|
||||
NeoFS contract, a user pays fee directly to this contract. This fee is used to
|
||||
pay for Cheque invocation of NeoFS contract that returns mainchain GAS back
|
||||
FrostFS contract, a user pays fee directly to this contract. This fee is used to
|
||||
pay for Cheque invocation of FrostFS contract that returns mainchain GAS back
|
||||
to the user. The address of the Processing contract is used as the first signer in
|
||||
the multisignature transaction. Therefore, NeoVM executes Verify method of the
|
||||
contract and if invocation is verified, Processing contract pays for the
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
neofsContractKey = "neofsScriptHash"
|
||||
frostfsContractKey = "frostfsScriptHash"
|
||||
|
||||
multiaddrMethod = "alphabetAddress"
|
||||
)
|
||||
|
@ -34,16 +34,16 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
}
|
||||
|
||||
args := data.(struct {
|
||||
addrNeoFS interop.Hash160
|
||||
addrFrostFS interop.Hash160
|
||||
})
|
||||
|
||||
ctx := storage.GetContext()
|
||||
|
||||
if len(args.addrNeoFS) != interop.Hash160Len {
|
||||
if len(args.addrFrostFS) != interop.Hash160Len {
|
||||
panic("incorrect length of contract script hash")
|
||||
}
|
||||
|
||||
storage.Put(ctx, neofsContractKey, args.addrNeoFS)
|
||||
storage.Put(ctx, frostfsContractKey, args.addrFrostFS)
|
||||
|
||||
runtime.Log("processing contract initialized")
|
||||
}
|
||||
|
@ -68,8 +68,8 @@ func Update(script []byte, manifest []byte, data interface{}) {
|
|||
// Alphabet nodes of the Inner Ring.
|
||||
func Verify() bool {
|
||||
ctx := storage.GetContext()
|
||||
neofsContractAddr := storage.Get(ctx, neofsContractKey).(interop.Hash160)
|
||||
multiaddr := contract.Call(neofsContractAddr, multiaddrMethod, contract.ReadOnly).(interop.Hash160)
|
||||
frostfsContractAddr := storage.Get(ctx, frostfsContractKey).(interop.Hash160)
|
||||
multiaddr := contract.Call(frostfsContractAddr, multiaddrMethod, contract.ReadOnly).(interop.Hash160)
|
||||
|
||||
return runtime.CheckWitness(multiaddr)
|
||||
}
|
||||
|
|
|
@ -11,21 +11,21 @@ import (
|
|||
|
||||
const processingPath = "../processing"
|
||||
|
||||
func deployProcessingContract(t *testing.T, e *neotest.Executor, addrNeoFS util.Uint160) util.Uint160 {
|
||||
func deployProcessingContract(t *testing.T, e *neotest.Executor, addrFrostFS util.Uint160) util.Uint160 {
|
||||
c := neotest.CompileFile(t, e.CommitteeHash, processingPath, path.Join(processingPath, "config.yml"))
|
||||
|
||||
args := make([]interface{}, 1)
|
||||
args[0] = addrNeoFS
|
||||
args[0] = addrFrostFS
|
||||
|
||||
e.DeployContract(t, c, args)
|
||||
return c.Hash
|
||||
}
|
||||
|
||||
func newProcessingInvoker(t *testing.T) (*neotest.ContractInvoker, neotest.Signer) {
|
||||
neofsInvoker, irMultiAcc, _ := newNeoFSInvoker(t, 2)
|
||||
hash := deployProcessingContract(t, neofsInvoker.Executor, neofsInvoker.Hash)
|
||||
frostfsInvoker, irMultiAcc, _ := newFrostFSInvoker(t, 2)
|
||||
hash := deployProcessingContract(t, frostfsInvoker.Executor, frostfsInvoker.Hash)
|
||||
|
||||
return neofsInvoker.CommitteeInvoker(hash), irMultiAcc
|
||||
return frostfsInvoker.CommitteeInvoker(hash), irMultiAcc
|
||||
}
|
||||
|
||||
func TestVerify_Processing(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue