Skip to content

Commit ff294b2

Browse files
committed
sidechain/deploy: Use committee witness for the Balance contract
In v0.19.1 Balance contract uses epoch subscription mechanism requiring committee witness of the deployment transaction. Signed-off-by: Leonard Lyubich <[email protected]>
1 parent c7ec832 commit ff294b2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/morph/deploy/contracts.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ type syncNeoFSContractPrm struct {
6060
tryDeploy bool
6161
// is contract must be deployed by the committee
6262
committeeDeployRequired bool
63+
// additional allowed contracts to be added to the NNS one if committeeDeployRequired
64+
extraCommitteeDeployAllowedContracts []util.Uint160
6365

6466
// optional constructor of extra arguments to be passed into method deploying
6567
// the contract. If returns both nil, no data is passed (noExtraDeployArgs can
@@ -129,7 +131,7 @@ func syncNeoFSContract(ctx context.Context, prm syncNeoFSContractPrm) (util.Uint
129131
if prm.committeeDeployRequired {
130132
deployCommitteeActor, err := newCommitteeNotaryActorWithCustomCommitteeSigner(prm.blockchain, prm.localAcc, prm.committee, func(s *transaction.Signer) {
131133
s.Scopes = transaction.CustomContracts
132-
s.AllowedContracts = []util.Uint160{prm.nnsContract}
134+
s.AllowedContracts = append(prm.extraCommitteeDeployAllowedContracts, prm.nnsContract)
133135
})
134136
if err != nil {
135137
return util.Uint160{}, fmt.Errorf("create Notary service client sending deploy transactions to be signed by the committee: %w", err)

pkg/morph/deploy/deploy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,8 @@ func Deploy(ctx context.Context, prm Prm) error {
490490
syncPrm.localNEF = prm.BalanceContract.Common.NEF
491491
syncPrm.localManifest = prm.BalanceContract.Common.Manifest
492492
syncPrm.domainName = domainBalance
493+
syncPrm.committeeDeployRequired = true
494+
syncPrm.extraCommitteeDeployAllowedContracts = []util.Uint160{netmapContractAddress}
493495
syncPrm.buildExtraDeployArgs = noExtraDeployArgs
494496

495497
prm.Logger.Info("synchronizing Balance contract with the chain...")
@@ -501,6 +503,9 @@ func Deploy(ctx context.Context, prm Prm) error {
501503

502504
prm.Logger.Info("Balance contract successfully synchronized", zap.Stringer("address", balanceContractAddress))
503505

506+
syncPrm.committeeDeployRequired = false
507+
syncPrm.extraCommitteeDeployAllowedContracts = nil
508+
504509
// 5. Reputation
505510
syncPrm.localNEF = prm.ReputationContract.Common.NEF
506511
syncPrm.localManifest = prm.ReputationContract.Common.Manifest
@@ -541,6 +546,7 @@ func Deploy(ctx context.Context, prm Prm) error {
541546
syncPrm.localManifest = prm.ContainerContract.Common.Manifest
542547
syncPrm.domainName = domainContainer
543548
syncPrm.committeeDeployRequired = true
549+
syncPrm.extraCommitteeDeployAllowedContracts = []util.Uint160{netmapContractAddress}
544550
syncPrm.buildExtraDeployArgs = func() ([]interface{}, error) {
545551
return []interface{}{
546552
notaryDisabledExtraUpdateArg,

0 commit comments

Comments
 (0)