11import { ethers } from "hardhat" ;
22import { expect } from "chai" ;
3- import { mine } from "@nomicfoundation/hardhat-network-helpers" ;
43import { ERRORS } from "./helpers/errors" ;
54
65// NATIVE ADDRESSES
7- const GOV_ADMIN = "0x1212000000000000000000000000000000000000" ;
86const GOV_PROXY = "0x1212000000000000000000000000000000000001" ;
9- const GOV_IMP = "0x1212100000000000000000000000000000000001" ;
107const POLICY_PROXY = "0x1212000000000000000000000000000000000002" ;
11- const POLICY_IMP = "0x1212100000000000000000000000000000000002" ;
128const REWARD_PROXY = "0x1212000000000000000000000000000000000003" ;
13- const REWARD_IMP = "0x1212100000000000000000000000000000000003" ;
14- const SYS_CALL = "0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE" ;
9+ const KEYMANAGEMENT_PROXY = "0x1212000000000000000000000000000000000008" ;
1510
1611// CONFIG
1712const CONSENSUS_SIZE = 7 ;
@@ -34,6 +29,9 @@ const MIN_GAS_TIP_CAP = ethers.parseUnits("1", "gwei");
3429const BASE_FEE = ethers . parseUnits ( "1" , "gwei" ) ;
3530const CANDIDATE_LIMIT = 2000 ;
3631
32+ // MOCK PUBKEYS
33+ const PUBKEY = "0x04a8c8762d32477f5bd0ccff58d35a7b7ace2fbbd0c0d61874bd405bc0af415690d16f585bcec5f51d1fdddfd0d4543cb0a9d40f0447b62a7c4b1a0f24c45ccb01" ;
34+
3735describe ( "Policy" , function ( ) {
3836
3937 let Policy : any , Governance : any ;
@@ -50,6 +48,7 @@ describe("Policy", function () {
5048 const governance_deploy = await ethers . deployContract ( "Governance" ) ;
5149 const reward_deploy = await ethers . deployContract ( "GovReward" ) ;
5250 const policy_deploy = await ethers . deployContract ( "Policy" ) ;
51+ const keymanagement_deploy = await ethers . deployContract ( "KeyManagement" ) ;
5352
5453 // Copy Bytecode to native address
5554 const governance_code = await ethers . provider . send ( "eth_getCode" , [ governance_deploy . target ] ) ;
@@ -61,6 +60,9 @@ describe("Policy", function () {
6160 const policy_code = await ethers . provider . send ( "eth_getCode" , [ policy_deploy . target ] ) ;
6261 await ethers . provider . send ( "hardhat_setCode" , [ POLICY_PROXY , policy_code ] ) ;
6362
63+ const keymanagement_code = await ethers . provider . send ( "eth_getCode" , [ keymanagement_deploy . target ] ) ;
64+ await ethers . provider . send ( "hardhat_setCode" , [ KEYMANAGEMENT_PROXY , keymanagement_code ] ) ;
65+
6466 const governance_contract = require ( "../artifacts/solidity/Governance.sol/Governance.json" ) ;
6567 Governance = new ethers . Contract ( GOV_PROXY , governance_contract . abi , signers [ 0 ] ) ;
6668 const contract = require ( "../artifacts/solidity/Policy.sol/Policy.json" ) ;
@@ -151,7 +153,7 @@ describe("Policy", function () {
151153 } ) ;
152154
153155 it ( "Should deactivate governance if is a candidate" , async function ( ) {
154- await Governance . connect ( signers [ 7 ] ) . registerCandidate ( 500 , { value : REGISTER_FEE } ) ;
156+ await Governance . connect ( signers [ 7 ] ) . registerCandidate ( 500 , PUBKEY , { value : REGISTER_FEE } ) ;
155157 for ( let i = 0 ; i < 3 ; i ++ ) {
156158 await expect (
157159 Policy . connect ( signers [ i ] ) . addBlackList ( signers [ 7 ] )
@@ -204,7 +206,7 @@ describe("Policy", function () {
204206 } ) ;
205207
206208 it ( "Should activate governance if is a candidate" , async function ( ) {
207- await Governance . connect ( signers [ 7 ] ) . registerCandidate ( 500 , { value : REGISTER_FEE } ) ;
209+ await Governance . connect ( signers [ 7 ] ) . registerCandidate ( 500 , PUBKEY , { value : REGISTER_FEE } ) ;
208210 for ( let i = 0 ; i < 3 ; i ++ ) {
209211 await expect (
210212 Policy . connect ( signers [ i ] ) . addBlackList ( signers [ 7 ] )
0 commit comments