-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy path16_disable_fraud_challenges.ts
44 lines (36 loc) · 1.64 KB
/
16_disable_fraud_challenges.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import type { HardhatRuntimeEnvironment } from "hardhat/types"
import type { DeployFunction } from "hardhat-deploy/types"
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, ethers, getNamedAccounts } = hre
const { execute } = deployments
const { deployer } = await getNamedAccounts()
deployments.log("disabling fraud challenges in the Bridge")
// To disable the fraud challenge mechanism, we need to make the fraud
// challenge deposit extremely high. The deposit value is determined by the
// fraudChallengeDepositAmount governance parameter. This parameter is uint96.
// The maximum value for the uint96 is 2^96-1 = 79228162514264337593543950335.
const fraudChallengeDepositAmount = ethers.BigNumber.from(
"79228162514264337593543950335"
)
// To emphasize the fact that frauds are disabled, we set:
// - fraudChallengeDefeatTimeout to uint32 max value (2^32-1 = 4294967295)
// - fraudSlashingAmount to zero,
// - fraudNotifierRewardMultiplier to zero.
const fraudChallengeDefeatTimeout = ethers.BigNumber.from("4294967295")
const fraudSlashingAmount = ethers.BigNumber.from("0")
const fraudNotifierRewardMultiplier = ethers.BigNumber.from("0")
await execute(
"Bridge",
{ from: deployer, log: true, waitConfirmations: 1 },
"updateFraudParameters",
fraudChallengeDepositAmount,
fraudChallengeDefeatTimeout,
fraudSlashingAmount,
fraudNotifierRewardMultiplier
)
}
export default func
func.tags = ["DisableFraudChallenges"]
func.dependencies = ["Bridge"]
func.skip = async (hre: HardhatRuntimeEnvironment): Promise<boolean> =>
hre.network.name !== "mainnet"