This repository was archived by the owner on May 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed
Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ contract Bridge is Pausable, Context {
6767
6868 event EndKeygen ();
6969
70- event KeyRefresh ();
70+ event KeyRefresh (string hash );
7171
7272 event Retry (string txHash );
7373
@@ -364,9 +364,10 @@ contract Bridge is Pausable, Context {
364364 It's used to trigger the belonging process on the MPC side which also handles keygen function calls order.
365365 @notice Only callable by address that has the right to call the specific function,
366366 which is mapped in {functionAccess} in AccessControlSegregator contract.
367+ @param hash Topology hash which prevents changes during refresh process.
367368 */
368- function refreshKey () external onlyAllowed {
369- emit KeyRefresh ();
369+ function refreshKey (string memory hash ) external onlyAllowed {
370+ emit KeyRefresh (hash );
370371 }
371372
372373 /**
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ contract('Bridge - [admin]', async (accounts) => {
2222 const expectedBridgeAdmin = accounts [ 0 ] ;
2323 const someAddress = "0xcafecafecafecafecafecafecafecafecafecafe" ;
2424 const nullAddress = "0x0000000000000000000000000000000000000000" ;
25+ const topologyHash = "549f715f5b06809ada23145c2dc548db" ;
2526
2627 const bytes32 = "0x0" ;
2728 let ADMIN_ROLE ;
@@ -103,14 +104,16 @@ contract('Bridge - [admin]', async (accounts) => {
103104 await TruffleAssert . reverts ( BridgeInstance . endKeygen ( someAddress ) , "MPC address can't be updated" ) ;
104105 } ) ;
105106
106- it ( 'Should successfully emit "KeyRefresh" event if called by admin' , async ( ) => {
107- const startKeygenTx = await BridgeInstance . refreshKey ( ) ;
107+ it ( 'Should successfully emit "KeyRefresh" event with expected hash value if called by admin' , async ( ) => {
108+ const startKeygenTx = await BridgeInstance . refreshKey ( topologyHash ) ;
108109
109- TruffleAssert . eventEmitted ( startKeygenTx , 'KeyRefresh' ) ;
110+ TruffleAssert . eventEmitted ( startKeygenTx , 'KeyRefresh' , ( event ) => {
111+ return event . hash = topologyHash ;
112+ } ) ;
110113 } ) ;
111114
112115 it ( 'Should fail if "refreshKey" is called by non admin' , async ( ) => {
113- await assertOnlyAdmin ( BridgeInstance . refreshKey ) ;
116+ await assertOnlyAdmin ( BridgeInstance . refreshKey , topologyHash ) ;
114117 } ) ;
115118
116119 // Set Handler Address
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ const deployBridge = async (domainID, admin) => {
235235 "0xbd2a1820" , // adminWithdraw
236236 "0x6ba6db6b" , // startKeygen
237237 "0xd2e5fae9" , // endKeygen
238- "0xf5f63b39 " , // refreshKey
238+ "0xd8236744 " , // refreshKey
239239
240240 ] ,
241241 Array ( 13 ) . fill ( admin )
You can’t perform that action at this time.
0 commit comments