Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions rips/rustchain-core/src/anti_spoof/network_challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ class NetworkChallengeProtocol:
def __init__(self, validator_pubkey: str, hardware_profile: Dict):
self.pubkey = validator_pubkey
self.hardware = hardware_profile
# Generate a random signing key instead of deriving from pubkey
self._signing_key = secrets.token_bytes(32)
self.validator = AntiSpoofValidator()
self.pending_challenges: Dict[str, Challenge] = {}
self.failure_count = 0
Expand All @@ -458,8 +460,8 @@ def should_challenge(self, block_height: int, target_pubkey: str) -> bool:

def create_challenge(self, target_pubkey: str, target_hardware: Dict) -> Challenge:
"""Create a challenge for another validator"""
# Use pubkey as signing key for demo (use real keys in production)
privkey = hashlib.sha256(self.pubkey.encode()).digest()
# Use randomly-generated signing key (not derivable from public key)
privkey = self._signing_key

challenge = self.validator.generate_challenge(
target_pubkey=target_pubkey,
Expand Down
Loading