Skip to content

Commit

Permalink
Merge pull request #3297 from keep-network/chaosnet
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuba authored Sep 22, 2022
2 parents 5cf99c5 + a56ed71 commit a7934a4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import type { DeployFunction } from "hardhat-deploy/types"

const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { getNamedAccounts, deployments, helpers } = hre
const { deployer } = await getNamedAccounts()
const { deployer, chaosnetOwner } = await getNamedAccounts()
const { execute } = deployments
const { to1e18 } = helpers.number

const POOL_WEIGHT_DIVISOR = to1e18(1) // TODO: Update value
Expand All @@ -18,6 +19,13 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
waitConfirmations: 1,
})

await execute(
"BeaconSortitionPool",
{ from: deployer },
"transferChaosnetOwnerRole",
chaosnetOwner
)

if (hre.network.tags.etherscan) {
await helpers.etherscan.verify(BeaconSortitionPool)
}
Expand Down
5 changes: 5 additions & 0 deletions solidity/random-beacon/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ const config: HardhatUserConfig = {
goerli: 0,
// mainnet: ""
},
chaosnetOwner: {
default: 3,
goerli: 0,
// mainnet: ""
},
},
external: {
contracts:
Expand Down
2 changes: 1 addition & 1 deletion solidity/random-beacon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"dependencies": {
"@keep-network/hardhat-helpers": "^0.6.0-pre.15",
"@keep-network/sortition-pools": "^2.0.0-pre.13",
"@keep-network/sortition-pools": "^2.0.0-pre.15",
"@openzeppelin/contracts": "^4.6.0",
"@thesis/solidity-contracts": "github:thesis/solidity-contracts#4985bcf",
"@threshold-network/solidity-contracts": "development"
Expand Down
2 changes: 2 additions & 0 deletions solidity/random-beacon/test/BeaconDkgValidator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const fixture = async () => {
constants.poolWeightDivisor
)) as SortitionPool

await sortitionPool.deactivateChaosnet()

const DKGValidator = await ethers.getContractFactory("BeaconDkgValidator")
const dkgValidator = (await DKGValidator.deploy(
sortitionPool.address
Expand Down
4 changes: 3 additions & 1 deletion solidity/random-beacon/test/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export async function randomBeaconDeployment(): Promise<DeployedContracts> {
const staking: TokenStaking =
await helpers.contracts.getContract<TokenStaking>("TokenStaking")

const { deployer } = await helpers.signers.getNamedSigners()
const { deployer, chaosnetOwner } = await helpers.signers.getNamedSigners()

const sortitionPool: SortitionPool = await helpers.contracts.getContract(
"BeaconSortitionPool"
Expand All @@ -103,6 +103,8 @@ export async function randomBeaconDeployment(): Promise<DeployedContracts> {
await updateTokenStakingParams(t, staking, deployer)
await setFixtureParameters(randomBeacon)

await sortitionPool.connect(chaosnetOwner).deactivateChaosnet()

const contracts: DeployedContracts = {
sortitionPool,
staking,
Expand Down
8 changes: 4 additions & 4 deletions solidity/random-beacon/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -978,10 +978,10 @@
"@openzeppelin/upgrades" "^2.7.2"
openzeppelin-solidity "2.4.0"

"@keep-network/sortition-pools@^2.0.0-pre.13":
version "2.0.0-pre.13"
resolved "https://registry.yarnpkg.com/@keep-network/sortition-pools/-/sortition-pools-2.0.0-pre.13.tgz#80dbe8066ce378ae4242c3aef6864224477a9e41"
integrity sha512-+6VXCJyYT3+HApDExeySHjOgezg+umvdpm5lZXIUlhSx7xmbXSK/YwLXkdeWkGyVdyfwRO4ZXo1CbscbC0XGnA==
"@keep-network/sortition-pools@^2.0.0-pre.15":
version "2.0.0-pre.15"
resolved "https://registry.yarnpkg.com/@keep-network/sortition-pools/-/sortition-pools-2.0.0-pre.15.tgz#3a289f7cd502e5d6c629f2fb625d390b77c02950"
integrity sha512-FuEk6uvIL5n82LnxyP6piV8Y7eRae3Vp7n1yQcSK2M9+gaZqzT1eaxX6FtZrXMzAOz3M+aQ8X3DVEyTScQOO2Q==
dependencies:
"@openzeppelin/contracts" "^4.3.2"
"@thesis/solidity-contracts" "github:thesis/solidity-contracts#4985bcf"
Expand Down

0 comments on commit a7934a4

Please sign in to comment.