forked from TrueCloudLab/frostfs-node
[#834] neofs-adm: Use committee signature when updating alphabet contract
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
6b3a9e6fcc
commit
d996004d80
1 changed files with 21 additions and 8 deletions
|
@ -158,6 +158,13 @@ func (c *initializeContext) deployContracts(method string) error {
|
||||||
Account: acc.Contract.ScriptHash(),
|
Account: acc.Contract.ScriptHash(),
|
||||||
Scopes: transaction.CalledByEntry,
|
Scopes: transaction.CalledByEntry,
|
||||||
}
|
}
|
||||||
|
if method == "migrate" {
|
||||||
|
signer = transaction.Signer{
|
||||||
|
Account: c.CommitteeAcc.Contract.ScriptHash(),
|
||||||
|
Scopes: transaction.CalledByEntry,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res, err := c.Client.InvokeFunction(invokeHash, method, params, []transaction.Signer{signer})
|
res, err := c.Client.InvokeFunction(invokeHash, method, params, []transaction.Signer{signer})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("can't deploy alphabet #%d contract: %w", i, err)
|
return fmt.Errorf("can't deploy alphabet #%d contract: %w", i, err)
|
||||||
|
@ -166,15 +173,21 @@ func (c *initializeContext) deployContracts(method string) error {
|
||||||
return fmt.Errorf("can't deploy alpabet #%d contract: %s", i, res.FaultException)
|
return fmt.Errorf("can't deploy alpabet #%d contract: %s", i, res.FaultException)
|
||||||
}
|
}
|
||||||
|
|
||||||
h, err := c.Client.SignAndPushInvocationTx(res.Script, acc, -1, 0, []client.SignerAccount{{
|
if method == "migrate" {
|
||||||
Signer: signer,
|
if err := c.sendCommitteeTx(res.Script, res.GasConsumed); err != nil {
|
||||||
Account: acc,
|
return err
|
||||||
}})
|
}
|
||||||
if err != nil {
|
} else {
|
||||||
return fmt.Errorf("can't push deploy transaction: %w", err)
|
h, err := c.Client.SignAndPushInvocationTx(res.Script, acc, -1, 0, []client.SignerAccount{{
|
||||||
}
|
Signer: signer,
|
||||||
|
Account: acc,
|
||||||
|
}})
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("can't push deploy transaction: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
c.Hashes = append(c.Hashes, h)
|
c.Hashes = append(c.Hashes, h)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ctrName := range contractList {
|
for _, ctrName := range contractList {
|
||||||
|
|
Loading…
Reference in a new issue