feat(validator): Implement validator reputation system#230
feat(validator): Implement validator reputation system#230dharapandya85 wants to merge 9 commits intoWeb3Novalabs:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@dharapandya85 link to issue being addressed |
Akshola00
left a comment
There was a problem hiding this comment.
write thorough tests for these functions you have included, also add thier interfaces
make sure to also perform neccessary validations, create getter functions for the frontend and follow the standard ie: natspec commments where neccessary and modularized error and events
if you are stuck or have any questiosn reach out to me @Akshola00 on telegram
Akshola00
left a comment
There was a problem hiding this comment.
better variable naming would be appreciated also
src/predifi.cairo
Outdated
| ValidatorPerformanceUpdated:ValidatorPerformanceUpdated, | ||
| } | ||
|
|
||
| #[derive(Drop,starknet::Event)] |
There was a problem hiding this comment.
there is an event file for these
src/predifi.cairo
Outdated
| /// @notice Slash a validator by reducing reputation and treasury. | ||
| /// @param validator Validator address to slash. | ||
| /// @param amount Amount to slash. | ||
| fn slash_validator(ref self:ContractState,validator:ContractAddress,amount:u256){ |
There was a problem hiding this comment.
slash shoulnt take in any amount, it should be halved ie /2
src/predifi.cairo
Outdated
|
|
||
| /// @notice Distribute validator fees among validators based on reputation. | ||
| /// @param pool_id ID fo the pool to distribute fees for. | ||
| fn distribute_validator_fees(ref self:ContractState,pool_id:u256){ |
There was a problem hiding this comment.
this validator fee is to be distributed to only the validators of that pool that chose the correct option, not all validators
perform neccessary assert statements here, assert the pool has ended assert that the pool has been resolved and assert that the fees are shared to only the validators that chose the correct option, not all validators and not all validators of a pool
src/predifi.cairo
Outdated
| } | ||
| } | ||
|
|
||
| // ----------------------------------------- |
There was a problem hiding this comment.
this comment is not neccessary, pls remove
tests/test_predifi.cairo
Outdated
There was a problem hiding this comment.
wirte tests in the test validator use already existing setup and follow the standard there
we are using foundry to test not cfg tests
Akshola00
left a comment
There was a problem hiding this comment.
ci is still failaing, meaning build and test are still failing
run make pr before you push to always see weather everything needed for the ci is passing
There was a problem hiding this comment.
great all events are here now, easier to modify later and structured
tests/test_validators.cairo
Outdated
| } | ||
| #[test] | ||
| fn test_slash_validator_halves_rep_and_treasury(){ | ||
| let (_contract_address, mut state)= deploy_contract("src/predifi.cairo"); |
There was a problem hiding this comment.
does this work deploy_contract("src/predifi.cairo"); ?
this doesnt work
tests/test_predifi.cairo
Outdated
There was a problem hiding this comment.
all tests youre writting should be in the test validators, and youre required to use the existing test setup to make your tests modular
There was a problem hiding this comment.
also add edge case testing
src/predifi.cairo
Outdated
|
|
||
| /// @notice Slash a validator by halving reputation and treasury. | ||
| /// @param validator Validator address to slash. | ||
| fn slash_validator(ref self:Storage,validator:ContractAddress){ |
There was a problem hiding this comment.
why are you referencing storage here instead of contract state here ?
src/predifi.cairo
Outdated
| /// @notice Update validator performance and adjust reputation. | ||
| /// @param validator Address of the validator. | ||
| /// @param success True if validation was correct, false otherwise. | ||
| fn update_performance(ref self:ContractState,validator:ContractAddress,success:bool){ |
|
@dharapandya85 reach out to me on tg @Akshola00 if you have an issues here |
|
@dharapandya85 any updates on this |
…dharapandya85/predifi into feat/validator-incentive-system
|
@dharapandya85 build is failing |
|
@dharapandya85 is attempting to deploy a commit to the shola's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Got it! Sorry for the mess. |

Fixes #223
Current Validator system lacks incentive system. This PR introduces a validator incentive system.
distribute_validate_feesfunction divides fees equally. Reputation score is tracked with validator reputation system. Success count is tracked for each validator.