masa-finance / masa-bittensor

Bittensor Subnet Config
https://masa.ai
MIT License
0 stars 0 forks source link

MVP Blacklist implementation #87

Closed teslashibe closed 2 weeks ago

teslashibe commented 3 weeks ago

MVP Blacklist Implementation

Issue

Current logic in main does not implement even basic blacklisting functionality, and we are getting warnings in the miner console that we are accepting requests from any neuron. There is a basic blacklist function in the template, but it is not implemented.

Solution

CLI Params

I was able to toggle on vpermit checks (i.e. enforcing only calls from validators, or neurons w/ a valid permit) by passing --blacklist.force_validator_permit to the miner run call:

python neurons/miner.py --blacklist.force_validator_permit

this runs the check self.metagraph.validator_permit[uid] using the synapse requester's uid, and if false, blacklists the request (returns the synapse, without any response.)

Implementation

the last step is actually calling this function. in neurons/miner.py's forward function, adding the following implements the blacklist function already present in the template:

[blacklisted, reason] = await self.blacklist(synapse)
if blacklisted:
    bt.logging.warning(f"Blacklisting un-registered hotkey for reason: {reason}")
    return synapse
teslashibe commented 3 weeks ago

This is captured in this PR: https://github.com/masa-finance/masa-bittensor/pull/86 @grantdfoster @hide-on-bush-x

mudler commented 2 weeks ago

PR still in flight