Skip to content

Commit

Permalink
Speed up root chain contracts deployment (#1906)
Browse files Browse the repository at this point in the history
speed up root chain contracts deployment
  • Loading branch information
dusan-maksimovic committed Sep 13, 2023
1 parent 5241598 commit 182aadd
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions command/rootchain/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,15 +560,13 @@ func deployContracts(outputter command.OutputFormatter, client *jsonrpc.Client,
return fmt.Errorf("deployment of %s contract failed", contract.name)
}

resultsLock.Lock()
defer resultsLock.Unlock()

deployResults := make([]*deployContractResult, 0, 2)
implementationAddress := types.Address(receipt.ContractAddress)

results[contract.name] = newDeployContractsResult(contract.name,
deployResults = append(deployResults, newDeployContractsResult(contract.name,
implementationAddress,
receipt.TransactionHash,
receipt.GasUsed)
receipt.GasUsed))

if contract.hasProxy {
proxyContractName := getProxyNameForImpl(contract.name)
Expand All @@ -583,10 +581,17 @@ func deployContracts(outputter command.OutputFormatter, client *jsonrpc.Client,
return fmt.Errorf("deployment of %s contract failed", proxyContractName)
}

results[proxyContractName] = newDeployContractsResult(proxyContractName,
deployResults = append(deployResults, newDeployContractsResult(proxyContractName,
types.Address(receipt.ContractAddress),
receipt.TransactionHash,
receipt.GasUsed)
receipt.GasUsed))
}

resultsLock.Lock()
defer resultsLock.Unlock()

for _, deployResult := range deployResults {
results[deployResult.Name] = deployResult
}

return nil
Expand Down

0 comments on commit 182aadd

Please sign in to comment.