fn process_random_number_event(&mut self, origin: MessageOrigin, event: RandomNumberEvent) {
        if !origin.is_gatekeeper() {
            error!("Invalid origin {:?} sent a {:?}", origin, event);
            return;
        };

        let expect_random = next_random_number(
            &self.master_key,
            event.block_number,
            event.last_random_number,
        );
        // instead of checking the origin, we directly verify the random to avoid access storage
        if expect_random != event.random_number {
            error!("Fatal error: Expect random number {:?}", expect_random);
            #[cfg(not(feature = "shadow-gk"))]
            panic!("GK state poisoned");
        }
    }
/// Verify on-chain random number
Verify on-chain random number
Verify on - chain random number
fn process_random_number_event(&mut self, origin: MessageOrigin, event: RandomNumberEvent) {
        if !origin.is_gatekeeper() {
            error!("Invalid origin {:?} sent a {:?}", origin, event);
            return;
        };
        let expect_random = next_random_number(
            &self.master_key,
            event.block_number,
            event.last_random_number,
        );
        // instead of checking the origin, we directly verify the random to avoid access storage
        if expect_random != event.random_number {
            error!("Fatal error: Expect random number {:?}", expect_random);
            #[cfg(not(feature = "shadow-gk"))]
            panic!("GK state poisoned");
        }
    }
fn process_random_number_event ( & mut self , origin : MessageOrigin , event : RandomNumberEvent ) { if ! origin . is_gatekeeper ( ) { error ! ( " " origin event ) ; return ; } ; let expect_random = next_random_number ( & self . master_key , event . block_number , event . last_random_number , ) ; // instead of checking the origin, we directly verify the random to avoid access storage if expect_random != event . random_number { error ! ( " " expect_random ) ; # [ cfg ( not ( feature " " ) ) ] panic ! ( " " ) ; } }
Verify on-chain random number
Verify on - chain random number
&mut self
origin
MessageOrigin
event
RandomNumberEvent
&mut self
origin
MessageOrigin
event
RandomNumberEvent