issues
search
prosopo
/
protocol
GNU General Public License v3.0
3
stars
4
forks
source link
unit tests
#377
Open
goastler
opened
1 year ago
goastler
commented
1 year ago
factors to test:
captcha:
[ ] test get all user accounts
[x] test payee to dapp payee mapping and vice versa
[ ] provider funds dipping below threshold should make them inactive
[ ] dapp funds dipping below threshold should make them inactive
[x] provider_set_dataset rejects matching content id and id
[ ] provider_set_dataset either id as default should deactivate the provider
[x] provider_deregister returns stake
[x] provider deregister updates the seed iff was active
[x] provider deactivate updates the seed iff was active
[x] provider deactivate moves provider into inactive group
[x] ctor author guard pass
[x] ctor author guard fail
[x] fields set in ctor, test using getters
[x] get_seeds should include all seeds in the rewind window + the current seed (test seeds get added and dropped accordingly)
[x] get_admin
[x] get_max_provider_fee
[x] get_min_num_active_providers
[x] get_rewind_window
[x] get_max_user_history_age
[x] get_max_user_history_len
[ ] get_random_active_provider dapp missing
[ ] get_random_active_provider
[ ] get_random_active_provider_at dapp missing
[ ] get_random_active_provider_at block before rewind window
[ ] get_random_active_provider_at block in future
[ ] get_random_active_provider_at dapp inactive
[ ] get_random_active_provider_at no active providers
[ ] get_random_active_provider_at
[ ] get_seed_user_dapp_at reproducible
[ ] get_active_providers_at (test it works at different blocks with different active/inactive statuses per block)
[x] get_rewind_window_start (test normal + if too close to start block)
[x] get_provider_at block in future
[x] get_provider_at block past rewind window
[ ] get_provider_at does not exist error
[ ] get_provider_at drops old versions past rewind window
[ ] get_provider_at
[x] get_dapp_at block in future
[x] get_dapp_at block past rewind window
[ ] get_dapp_at does not exist error
[ ] get_dapp_at drops old versions past rewind window
[ ] get_dapp_at
[x] get_seed_at block in future
[x] get_seed_at block past rewind window
[x] get_seed_at drops old versions past rewind window
[x] get_seed_at
[x] get_seed
[x] update_seed only works once per block per caller (returns false)
[x] update_seed logs old seeds
[x] update_seed drops old seeds from the logs past rewind window
[x] update_seed can only be called by admin or provider
[ ] update_seed provider caller must have been active for 1 or more block
[x] update_seed provider caller must be active
[x] update_seed reproducibility
[x] update_seed
[x] get_payees (make sure unique) - btreeset?
[x] get_dapp_payees (make sure unique) - btreeset?
[x] get_statuses (make sure unique) - btreeset?
[x] get_provider_stake_threshold
[x] get_dapp_stake_threshold
[x] provider_register already exists
[x] provider_register invalid fee
[x] provider_register url empty
[x] provider_register url in use
[x] provider_register add funds
[x] provider_register nevers activates provider (as reg fn is not for that)
[x] provider_register logs old provider None
[x] provider_register doesn't updates seed
[x] provider_register
[x] provider_update doesn't exist
[x] provider_update invalid fee
[ ] provider_update default dataset_id ensure deactivated (test other activation factors against this)
[ ] provider_update default dataset_id_content deactivated (test other activation factors against this)
[ ] provider_update matching dataset_id and dataset_id_content means deactivated (test other activation factors against this)
[x] provider_update url empty
[x] provider_update url in use
[x] provider_update add funds
[x] provider_update activates provider if balance correct + dataset set correctly
[x] provider_update logs old provider not None
[x] provider_update updates seed
[x] provider_update
[x] provider_fund doesn't exist
[x] provider_fund activates provider if balance correct + dataset set correctly
[ ] provider_fund default dataset_id ensure deactivated (test other activation factors against this)
[ ] provider_fund default dataset_id_content deactivated (test other activation factors against this)
[ ] provider_fund matching dataset_id and dataset_id_content means deactivated (test other activation factors against this)
[x] provider_fund updates seed
[x] provider_fund
[x] provider_deactivate doesn't exist
[x] provider_deactivate deactivates provider if active
[x] provider_deactivate does nothing if provider if inactive
[x] provider_deactivate logs provider if modification
[x] provider_deactivate updates seed
[x] provider_deactivate
[x] provider_deregister doesn't exist
[x] provider_deregister err if provider not found
[x] provider_deregister logs None for provider
[x] provider_deregister removes provider from the contract in provider_accounts and provider groups
[x] provider_deregister updates seed
[x] provider_deregister
[x] provider_set_dataset doesn't exist
[x] provider_set_dataset updates seed
[ ] provider_set_dataset default dataset_id ensure deactivated (test other activation factors against this)
[ ] provider_set_dataset default dataset_id_content deactivated (test other activation factors against this)
[ ] provider_set_dataset matching dataset_id and dataset_id_content means deactivated (test other activation factors against this)
[x] provider_set_dataset
[x] dapp_register err if already exists
[ ] dapp_register does not allow dapp to become active
[x] dapp_register logs old dapp None
[x] dapp_register adds dapp to dapps and to dapp_accounts
[x] dapp_register checks if dapp is contract
[x] dapp_register
[x] dapp_update err if not already exists
[x] dapp_update marks dapp as active if funds sufficient
[x] dapp_update marks dapp as inactive if funds insufficient
[x] dapp_update logs old dapp
[x] dapp_update no change does nothing (e.g. no log)
[x] dapp_update adds dapp to dapps and to dapp_accounts
[x] dapp_update checks if dapp is contract
[x] dapp_update
[x] dapp_fund marks dapp as active if funds sufficient
[x] dapp_fund
[x] dapp_fund err if doesn't exist
[ ] dapp_deactivate
[x] dapp_deactivate doesn't exist
[ ] dapp_deactivate logs dapp
[ ] dapp_deregister logs dapp None
[ ] dapp_deregister
[x] dapp_deregister doesn't exist
[ ] provider_commit
[ ] provider_commit updates seed
[ ] provider_commit records commit in user history
[ ] provider_commit invalid signature
[ ] provider_commit invalid payload
[ ] provider_commit invalid pub key
[ ] provider_commit checks requested_at recency
[ ] provider_commit checks completed_at recency
[ ] provider_commit checks requested_at and completed_at closeness (too close is impossible)
[ ] provider_commit
[ ] provider_commit creates new user as necessary
[ ] provider_commit rejects duplicate commits
[ ] provider_commit checks dapp is active at requested_at block
[ ] provider_commit checks provider was chosen at the requested_at block
[ ] provider_commit checks the provider was active at the requested_at block
[ ] provider_commit_many
[ ] get_user_history_summary
[ ] dapp_operator_is_human_user
[ ] dapp_operator_last_correct_captcha
[ ] get_captcha_data
[ ] get_captcha_data non-existent
[ ] get_dapp_user
[ ] get_dapp_user non-existent
[ ] get_captcha_solution_commitment
[ ] get_captcha_solution_commitment missing
[ ] list_providers_by_status
[x] get all dapp accounts
[x] get all provider accounts
[x] withdraw
[x] withdraw insufficient funds
[x] withdraw not authorised
[x] terminate
[x] terminate not authorised
[x] set_code_hash
[x] set_code_hash not authorised
[x] set_admin
[x] set_admin not authorised
[x] seed initialised to 0 in ctor
[x] only author can instantiate contract
proxy:
[x] withdraw
[x] withdraw insufficient funds
[x] withdraw not authorised
[x] terminate
[x] terminate not authorised
[x] set_code_hash
[x] set_code_hash not authorised
[x] set_admin
[x] set_admin not authorised
[x] set forward address
[x] set forward address not authorised
[x] ctor sets caller as admin
[x] only author can instantiate contract
common:
[x] check test accounts unique
[x] check test accounts funded
factors to test:
captcha:
proxy:
common: