File tree Expand file tree Collapse file tree
apexchainx_calculator/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1639,8 +1639,11 @@ impl SLACalculatorContract {
16391639
16401640 // All public methods added in alphabetical order for deterministic output.
16411641 // Lifecycle:
1642- methods. push_back ( method ( "accept_admin" , true , "admin" , "adm_acc" ) ) ;
1643- methods. push_back ( method ( "accept_operator" , true , "operator" , "op_acc" ) ) ;
1642+ // Note: accept_admin/accept_operator are called by the proposed address
1643+ // (not the current role holder), so auth is "none" — only an address
1644+ // equality check against the pending slot is performed.
1645+ methods. push_back ( method ( "accept_admin" , true , "none" , "adm_acc" ) ) ;
1646+ methods. push_back ( method ( "accept_operator" , true , "none" , "op_acc" ) ) ;
16441647 // Calculation:
16451648 methods. push_back ( method ( "calculate_sla" , true , "operator" , "sla_calc" ) ) ;
16461649 methods. push_back ( method ( "calculate_sla_view" , false , "none" , "" ) ) ;
Original file line number Diff line number Diff line change @@ -7386,15 +7386,14 @@ fn test_get_public_api_is_deterministic() {
73867386}
73877387
73887388#[ test]
7389+ #[ test]
7390+ #[ should_panic]
73897391fn test_get_public_api_requires_initialization ( ) {
73907392 let env = Env :: default ( ) ;
73917393 env. mock_all_auths ( ) ;
73927394 let cid = env. register_contract ( None , SLACalculatorContract ) ;
73937395 let client = SLACalculatorContractClient :: new ( & env, & cid) ;
73947396
7395- // Without initialization, get_public_api should return NotInitialized error
7396- let result = std:: panic:: catch_unwind ( std:: panic:: AssertUnwindSafe ( || {
7397- client. get_public_api ( ) ;
7398- } ) ) ;
7399- assert ! ( result. is_err( ) , "get_public_api should fail before initialization" ) ;
7397+ // Without initialization, get_public_api should panic with NotInitialized
7398+ client. get_public_api ( ) ;
74007399}
You can’t perform that action at this time.
0 commit comments