@@ -592,13 +592,20 @@ function executeChangePermissionsMessage(
592592 let message = cache . getChangePermissionsMessage ( id ) ;
593593 let address = reader . advance ( 20 ) . toHexString ( ) ; // address should always be 20 bytes
594594
595+ // Get valid_through
596+ let validThrough = decodeU64 ( reader ) as i32 ;
597+ if ( ! reader . ok ) {
598+ return ;
599+ }
600+
595601 // Get the length of the new premissions list
596602 let permissionsListLength = decodeU64 ( reader ) as i32 ;
597603 if ( ! reader . ok ) {
598604 return ;
599605 }
600606
601607 let permissionEntry = cache . getPermissionListEntry ( address ) ;
608+ permissionEntry . validThrough = BigInt . fromI32 ( validThrough )
602609 let oldPermissionList = permissionEntry . permissions ;
603610 let newPermissionList = new Array < String > ( ) ;
604611
@@ -609,17 +616,20 @@ function executeChangePermissionsMessage(
609616
610617 message . block = messageBlock . id ;
611618 message . address = address ;
619+ message . validThrough = validThrough ;
612620 message . oldPermissions = oldPermissionList ;
613621 message . newPermissions = newPermissionList ;
614622 message . data = reader . diff ( snapshot ) ;
615623
616624
617625 let list = globalState . permissionList ;
618- list . push ( permissionEntry . id ) ;
626+ if ( ! list . includes ( permissionEntry . id ) ) {
627+ list . push ( permissionEntry . id ) ;
628+ } else if ( permissionsListLength == 0 ) {
629+ // this will remove the now empty permission entry from the list, preventing spam
630+ list . splice ( list . indexOf ( permissionEntry . id ) , 1 )
631+ }
619632 globalState . permissionList = list ;
620-
621- // might want to remove it from the "allow list" if the new permission list length is 0
622- // Right now the address won't be able to execute anything on that case, but it can spam
623633}
624634
625635function executeResetStateMessage (
0 commit comments