Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #362 from keep-network/infra-multi-sanctioned-apps
Browse files Browse the repository at this point in the history
Allow multiple sanctioned applications configured for keep-ecdsa nodes
  • Loading branch information
Sloan Thompson authored Apr 13, 2020
2 parents 5e74b98 + 98b6245 commit 8659c27
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion infrastructure/kube/keep-dev/keep-ecdsa-0-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0x7F68B90dce19d2ac034477B7ba2229106656A084' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/kube/keep-dev/keep-ecdsa-1-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0x7F68B90dce19d2ac034477B7ba2229106656A084' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/kube/keep-dev/keep-ecdsa-2-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0x7F68B90dce19d2ac034477B7ba2229106656A084' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/kube/keep-dev/keep-ecdsa-3-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0x7F68B90dce19d2ac034477B7ba2229106656A084' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/kube/keep-dev/keep-ecdsa-4-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0x7F68B90dce19d2ac034477B7ba2229106656A084' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0xe7e954EbFA6aE231C2108861187426E95a70C4e1' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0xe7e954EbFA6aE231C2108861187426E95a70C4e1' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0xe7e954EbFA6aE231C2108861187426E95a70C4e1' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0xe7e954EbFA6aE231C2108861187426E95a70C4e1' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0xe7e954EbFA6aE231C2108861187426E95a70C4e1' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0xe7e954EbFA6aE231C2108861187426E95a70C4e1' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0xe7e954EbFA6aE231C2108861187426E95a70C4e1' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0xe7e954EbFA6aE231C2108861187426E95a70C4e1' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0xe7e954EbFA6aE231C2108861187426E95a70C4e1' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
value: '3919'
- name: KEEP_DATA_DIR
value: /mnt/keep-ecdsa/data
- name: TBTC_SYSTEM_ADDRESS
- name: SANCTIONED_APPLICATIONS
value: '0xe7e954EbFA6aE231C2108861187426E95a70C4e1' # Shall we extract this property to a configmap?
volumeMounts:
- name: keep-ecdsa-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ const keepBondingContract = getWeb3Contract('KeepBonding')
const tokenStakingContract = getWeb3Contract('TokenStaking')
const keepTokenContract = getWeb3Contract('KeepToken')

// Address of the external TBTCSystem contract which should be set for the InitContainer
// execution.
const tbtcSystemContractAddress = process.env.TBTC_SYSTEM_ADDRESS
// Addresses of the external contracts (e.g. TBTCSystem) which should be set for
// the InitContainer execution. Addresses should be separated with spaces.
const sanctionedApplications = process.env.SANCTIONED_APPLICATIONS.split(" ")

// Returns a web3 contract object based on a truffle contract artifact JSON file.
function getWeb3Contract(contractName) {
Expand All @@ -67,9 +67,6 @@ async function provisionKeepTecdsa() {

console.log('########### Provisioning keep-ecdsa! ###########')

console.log(`\n<<<<<<<<<<<< Create Sortition Pool for TBTCSystem: ${tbtcSystemContractAddress} >>>>>>>>>>>>`)
const sortitionPoolContractAddress = await createSortitionPool(tbtcSystemContractAddress)

console.log(`\n<<<<<<<<<<<< Read operator address from key file >>>>>>>>>>>>`)
const operatorAddress = readAddressFromKeyFile(operatorKeyFile)

Expand All @@ -85,8 +82,17 @@ async function provisionKeepTecdsa() {
console.log(`\n<<<<<<<<<<<< Authorizing Operator Contract ${bondedECDSAKeepFactory.address} >>>>>>>>>>>>`)
await authorizeOperatorContract(operatorAddress, bondedECDSAKeepFactory.address, authorizer)

console.log(`\n<<<<<<<<<<<< Authorizing Sortition Pool Contract ${sortitionPoolContractAddress} >>>>>>>>>>>>`)
await authorizeSortitionPoolContract(operatorAddress, sortitionPoolContractAddress, authorizer)
for (let i = 0; i < sanctionedApplications.length; i++) {
const sanctionedApplicationAddress = sanctionedApplications[i]

console.log(`\n<<<<<<<<<<<< Create Sortition Pool for sanctioned application: ${sanctionedApplicationAddress} >>>>>>>>>>>>`)
const sortitionPoolContractAddress = await createSortitionPool(
sanctionedApplicationAddress
)

console.log(`\n<<<<<<<<<<<< Authorizing Sortition Pool Contract ${sortitionPoolContractAddress} >>>>>>>>>>>>`)
await authorizeSortitionPoolContract(operatorAddress, sortitionPoolContractAddress, authorizer)
}

console.log('\n<<<<<<<<<<<< Creating keep-ecdsa Config File >>>>>>>>>>>>')
await createKeepTecdsaConfig()
Expand Down Expand Up @@ -237,7 +243,7 @@ async function createKeepTecdsaConfig() {

parsedConfigFile.ethereum.ContractAddresses.BondedECDSAKeepFactory = bondedECDSAKeepFactory.address

parsedConfigFile.SanctionedApplications.Addresses = [tbtcSystemContractAddress]
parsedConfigFile.SanctionedApplications.Addresses = [].concat(sanctionedApplications)

parsedConfigFile.LibP2P.Peers = libp2pPeers
parsedConfigFile.LibP2P.Port = libp2pPort
Expand Down

0 comments on commit 8659c27

Please sign in to comment.