Commit Graph

4047 Commits (2135d32885b759b22e079b2ba6acf001f1beff2d)

Author SHA1 Message Date
KPrasch d0ce5f9c47
Apply suggestions from code review 2024-03-25 13:32:16 -04:00
KPrasch 2cbf9f9ddb
skip tests use live network requests 2024-03-25 13:32:14 -04:00
derekpierre 9f8dfffd11 Allow EventScanner to obtain different events as part of the same call to reduce overall rpc calls. Multiple events can be obtained by one call, instead of making one getLogs call per event.
EventScanner will no longer take specified filters since more than one event type can be obtained at a time. We don't utilize event specific filters currently anyway - and we probably won't need to.
2024-02-13 10:53:03 -05:00
derekpierre 4c42344785 Update test to use updated name for cache member variable. 2024-02-13 10:53:03 -05:00
derekpierre 755cbd1511 Don't reuse the same SSL context. Use a new SSL context per connection so that the ca data can be updated accordingly. 2024-02-13 10:53:03 -05:00
derekpierre c4019d165e Add test that ensures that when ursula restarts and its tls certificate changes, that a P2PSession can reconnect to it and update its cache.
Co-authored-by: Kieran Prasch <kieranprasch@gmail.com>
2024-02-13 10:53:03 -05:00
derekpierre d4b257fc66 Add test regarding already having an invalid cert and it getting refreshed as part of retry. 2024-02-13 10:53:03 -05:00
derekpierre 6545dc3e88 Make start chunk size optional and default to min chunk size unless specified otherwise. Having 20 as the default negates the initial use of min chunk size which seems like a waste. I can see a potential usage for not wanting to use the min chunk size for a specific case of scanning a large number of blocks but seems unnecessary otherwise. 2024-02-13 10:53:03 -05:00
derekpierre 19caae9a2d Fix SimpleTask to actually use class INTERVAL value instead of its own - caused EventScannerTask to use 60s instead of the 120s it had defined. 2024-02-13 10:53:03 -05:00
derekpierre ab738805cb Re-inforce scanner test that larger chunk sizes do result in lower rpc calls. 2024-02-13 10:53:03 -05:00
derekpierre a4d759ba7a Add tests for auto migration scenarios for select_config_file. 2024-02-13 10:53:03 -05:00
derekpierre c5b86572c9 Actor now uses cached Ritual object whenever available which has aggregated transcript bytes on it - this saves more RPC calls for already completed/active Ritual whose values (that we care about) don't change at the moment.
Aggregated transcript is no longer cached separately (but as part of cached Ritual object) so update code/tests accordingly.
2024-02-13 10:53:03 -05:00
derekpierre abd6549dad Re-inforce decryption test that relies on caching but raising and exception if a function call is made to not use the cache for validators. 2024-02-13 10:53:03 -05:00
derekpierre 611445f80e Don't cache derived decryption shares - what in the hell was I thinking, they are ciphertext specific at the moment. 2024-02-13 10:53:03 -05:00
derekpierre f5eb270e90 Add integration and acceptance test to ensure that cached values work for decryption, and that even without a populated cache decryption can still occur. 2024-02-13 10:53:03 -05:00
derekpierre 0c23e1727f Update tests now that transcript bytes are no longer stored in dkg storage - it was only used in tests. 2024-02-13 10:53:03 -05:00
derekpierre ddc1b454e5 Use `nucypher-contracts:main` as the canonical source for contract registries.
Add test to ensure github raw path is actually correct.
2024-02-13 10:53:03 -05:00
KPrasch 2a4d99cb1f Update tests/acceptance/ape-config.yaml 2024-02-13 10:53:03 -05:00
derekpierre f8609a3d01 Add test for updated tx receipt processing logic which removes the txhash from dkg storage whenever the pending tx hash is determined to have been actually mined, either successfully (status=1) or not.
If the tx is already mined then the Coordinator contract should be the source of truth for how to proceed.
2024-02-13 10:53:03 -05:00
derekpierre 00788e9001 Remove use of index within Participant struct - we don't specifically use it. 2024-02-13 10:53:03 -05:00
derekpierre c84060b2bd Include 0 as a value for testing participant pagination - a page size of 0 indicates that all participants should be returned without needing to know the number of participants there are. 2024-02-13 10:53:03 -05:00
derekpierre e1a74366a0 Don't obtain entire ritual when only specific participant information is needed for determining participation state. 2024-02-13 10:53:03 -05:00
derekpierre 6c56dd2d9b Simplify search for participant for post_aggregation in MockCoordinatorAgent. 2024-02-13 10:53:03 -05:00
derekpierre 9709ad7466 Fix inner function names to make linter happy. 2024-02-13 10:53:03 -05:00
derekpierre fad20719fc Add acceptant test for various pagination combinations for obtaining participants for a ritual. 2024-02-13 10:53:03 -05:00
derekpierre 6df1c037b7 Reduce public scope of rituals object on MockCoordinatorAgent. We don't really want anything changing state directly. 2024-02-13 10:53:03 -05:00
Kieran Prasch eabc61deaa relocates the remaining Coordinator models to eth/models.py 2024-02-13 10:53:03 -05:00
KPrasch 5f8d68fe08 bugfix: always handle transaction hashes instead of transcripts for dkg tracking. Updates mocks to return txhash instead of receipt for transcript and aggregation posting. 2024-02-13 10:53:03 -05:00
KPrasch e5782c65f8 agent layer: isolates coordinator function interface exposure (abstracting page management to actors) 2024-02-13 10:53:03 -05:00
derekpierre 399497befc Modified the MockCoordinatorAgent to separate state from values returned or else it gives a false sense of validated tests. For example, `get_ritual` should adhere to its API by returning Participant objects with/without transcripts.
Consequently, only transactions are allowed to modified state, and get calls only return copies of objects.
Update associated test accordingly that needed to mock return from underlying object and not copy.
2024-02-13 10:53:03 -05:00
derekpierre c64e4bfc42 Have Ritual struct store ritual id instead of passing both of them together. 2024-02-13 10:53:03 -05:00
KPrasch 6fc96d3352 sync _UpAndDownInTheWater mocks 2024-02-13 10:53:03 -05:00
KPrasch 6dfe7f9953 Updates ritual and participant mocks; sync MockCoordinator 2024-02-13 10:53:03 -05:00
KPrasch 96cac14fd5 handle shared coordinator reads and dkg artifact preperation logic between ursula and decryptors. 2024-02-13 10:53:03 -05:00
KPrasch 8cd51eebf5 temp. use a fork to contract dependencies. 2024-02-13 10:53:03 -05:00
KPrasch c1495b66a7 updates mocks to sync with coordinator agent updates 2024-02-13 10:53:03 -05:00
KPrasch 2c26384c39 removes business logic from coordinator agent, plainly exposes participant views without mutation. 2024-02-13 10:53:03 -05:00
Kieran Prasch ca0ca483de with_participants=False by default 2024-02-13 10:53:03 -05:00
Kieran Prasch 9632f97737 include index in the nucypher-local model of participants 2024-02-13 10:53:03 -05:00
KPrasch 0d04902ea1 skip a test that is planned for removal 2024-02-13 10:53:03 -05:00
KPrasch 4d06ad441d linting 2024-02-13 10:53:03 -05:00
KPrasch 1fcf3c84a8 fully deprecates the node storage API 2024-02-13 10:53:03 -05:00
Kieran Prasch 2c1183bbce apply black code formatting and ruff import sorting to select modules 2024-02-13 10:53:03 -05:00
Kieran Prasch 9e6bc1dbc7 preserve node storage dependency injection for ursulas. 2024-02-13 10:53:03 -05:00
Kieran Prasch 0f05d3d4f5 customizes certificate handling request session adapter for ursula p2p services 2024-02-13 10:53:03 -05:00
Kieran Prasch 7ad2635b83 use NodeStorage as the implcit default, removes storage confiuration abilities. 2024-02-13 10:53:03 -05:00
Kieran Prasch 2a6c6a2b35 isolate cert caching from memory adapter 2024-02-13 10:53:03 -05:00
Kieran Prasch 1b6b61e334 Makes network middleware loally certificate agnostic 2024-02-13 10:53:03 -05:00
Kieran Prasch 13758d14a0 removes certificate filepath handling 2024-02-13 10:53:03 -05:00
KPrasch 6bc2d4bad2 include block height in the node's html status web page. 2024-01-24 11:45:21 +01:00
Kieran Prasch 8af8133c2d utilize the flask test client on Ursula to integration test ipv4 resolution from flask request headers. 2024-01-23 19:21:26 +01:00
KPrasch 55f8b2102b respond to RFCs in PR #3398 2024-01-23 19:21:26 +01:00
KPrasch 5e63167dc9 skips a test that is planned for removal in #3382 2024-01-23 19:21:26 +01:00
KPrasch d06bb7af9a repairs a p2p validity test that implements /ping. Linting. 2024-01-23 19:21:26 +01:00
KPrasch 1f83e2c5ab baseline unit testing for ping ip utils 2024-01-23 19:21:26 +01:00
KPrasch fcaf99ee59 mock ipv4 address resolution in MockRestMiddleware 2024-01-23 19:21:26 +01:00
KPrasch e553014446 properly handle both ipv4 and ipv6 addresses 2024-01-23 19:21:26 +01:00
derekpierre ffb34ad6f8 Fix test since the number of successful decryption requests can vary because of concurrency, and how the threshold decryption client executes the requests in parallel (thread pool size etc.). 2024-01-23 15:54:46 +01:00
derekpierre 8535e628c7 Added metric for tracking last scanned block by ritual tracker scanner task.
Added test.
2024-01-23 13:27:35 +01:00
derekpierre 931cdde08e Use prometheus Summary metric for decryption request count/sum instead of Counter for richer metrics including time taken. 2024-01-23 13:27:35 +01:00
derekpierre c974b94b18 Add test for starting prometheus exporter. 2024-01-23 13:27:35 +01:00
derekpierre d4651d678b Update "active_stake" value to be denominated in ether and not wei. 2024-01-23 13:27:35 +01:00
derekpierre 205e94f6fa Remove unnecessary fixture as parameter from test. 2024-01-23 13:27:35 +01:00
derekpierre 4b5e128936 Add tests for PrometheusMetricsTracker. 2024-01-23 13:27:35 +01:00
derekpierre 6abd173bd6 Check decryption requests metrics values during ritual acceptance test. 2024-01-23 13:27:35 +01:00
derekpierre 720f133693 Move mock_prometheus out of fixtures and into conftest for integration tests to reduce scope now that prometheus is optional. 2024-01-23 13:27:35 +01:00
derekpierre 0cecdef487 Add test for OperatorMetricsCollector. 2024-01-23 13:27:35 +01:00
derekpierre 5fef462501 Update prometheus test for non-default interval collection. 2024-01-23 13:27:35 +01:00
derekpierre 7bffda41fe Fix failing test; prometheus must be enabled. 2024-01-23 13:27:35 +01:00
derekpierre e86e2b7cc6 Make enabling prometheus optional.
Allow metrics-port to be specified via cli option.
2024-01-23 13:27:35 +01:00
KPrasch 8dbaaaa8fd Apply suggestions from code review
Co-authored-by: Derek Pierre <derek.pierre@gmail.com>
2024-01-23 13:27:35 +01:00
Manuel Montenegro 253a2067e3 Remove unused metrics 2024-01-23 13:27:35 +01:00
Manuel Montenegro 9512d7b286 Convert node discovery metrics from enum to gauge
Actually, the two possible states for learning_status metric are
`stopped` and `running`. So a enum type metric can be considered an
overkill that introduces confusion to exported metrics.
2024-01-23 13:27:35 +01:00
Manuel Montenegro 933a28697d Add metrics for root and child networks
Up to now, there is any distinction between root and child networks, so
the only metrics about Blockchain was related to root network.

This change splits the metrics into two networks.
2024-01-23 13:27:35 +01:00
Manuel Montenegro 6a72807aec Add Prometheus metrics endpoint to running logs 2024-01-23 13:27:35 +01:00
Manuel Montenegro e51d637706 Add integration test for prometheus exporter
Test if start_prometheus_exporter has been properly called when running
Ursula.
2024-01-23 13:27:35 +01:00
Manuel Montenegro 8c914ba30f Remove redundant code in test_prometheus.py 2024-01-23 13:27:35 +01:00
Manuel Montenegro 2e6ed2f29c Add CLI tests for Prometheus 2024-01-23 13:27:35 +01:00
Manuel Montenegro 78bbeb7dc1 Add mock for prometheus exporter start function
Since Prometheus exporter has become a non-optional part of Ursula, the
function start_prometheus_exporter is always called when running a new
Ursula.

Some tests, like test_ursula_run_ip_checkup runs several Ursulas, so
this function is called multiple times.

Only one instance of Prometheus exporter must be run at same time, so
this make the tests to fail because some Prometheus errors are raised.

Co-authored-by: LunarBytes <kieran@nucypher.com>
2024-01-23 13:27:35 +01:00
Manuel Montenegro 11f973a97a Rename host Prometheus metrics
- host_info has been renamed to client_info
- node_discovery has been renamed to node_discovery_status
- New field for client_info: `app: TACo`
2024-01-23 13:27:35 +01:00
Manuel Montenegro 40628ae991 Remove metrics prefix 2024-01-23 13:27:35 +01:00
Manuel Montenegro ac1893cd50 Remove optional imports of Prometheus
Prometheus is now a dependency that is always installed along with
nucypher. For this reason, it doesn't make sense to check if Prometheus
is installed before importing it.
2024-01-23 13:27:35 +01:00
derekpierre 76b9d4af28 Add unit tests for testing MergedReservoir and PrefetchStrategy. 2024-01-19 11:04:31 +01:00
derekpierre a8c68109ab Add auto-use fixture to limit maximum post aggregation delay. 2024-01-17 09:31:32 -05:00
derekpierre c5bf021c24 Update tests to have ferveo public keys obtained from CoordinatorAgent/Coordinator contract.
Co-authored-by: Kieran Prasch <kieranprasch@gmail.com>
2024-01-17 09:31:32 -05:00
derekpierre 99ebdfe8dc Deprecate use of goerli blockchain; Lynx will now use Sepolia. 2024-01-04 13:23:02 -05:00
derekpierre d48cf22d0d Update test token used based on latest changes to `nucypher-contracts`. 2023-12-15 09:48:39 -05:00
derekpierre 363eb3975c Always raise ConditionEvalError (previously EvalError) instead of returning then raising.
Update tests.
2023-12-01 13:59:03 -05:00
derekpierre 4398c63892 Use constants for timeout values for reencryption and decryption. 2023-11-28 13:42:45 +01:00
derekpierre fa45bb568f Bob does not need to resolve the cohort himself, it will be performed by the `ThresholdAccessControlClient` - so it was redundant. 2023-11-28 13:42:45 +01:00
derekpierre f33e5075ba Update solidity version used for acceptance tests (matches version in `nucypher-contracts`). 2023-11-28 13:42:45 +01:00
derekpierre 5589bf16a8 Increase default connection timeout and allow overriding via env variable.
Increase default certificate retrieval timeout and allow overriding via env variable.
Better utilize connect/read timeout functionality for requests library calls.
Update TestMiddlewareClient to still work with new changes.
2023-11-28 13:42:45 +01:00
David Núñez f42488796d Make linter happy 2023-11-28 12:44:44 +01:00
David Núñez 74260a7a11 Update tests/acceptance/conftest.py 2023-11-28 12:44:44 +01:00
derekpierre ee1530149d Specify commitment deadline when instantiating TACoApplication contract for tests.
Left some code to uncomment once associated PR in `nucypher-contracts` is merged.
2023-11-28 12:44:44 +01:00
Derek Pierre 8a077bd971 Update ape-config.yaml to use `nucypher-contracts`/`main`.
Co-authored-by: David Núñez <david@nucypher.com>
2023-11-17 12:20:36 -05:00
derekpierre fb9977ab56 Update expected test string based on changes to exception message. 2023-11-17 12:20:36 -05:00
derekpierre 663cd97eb0 Include new EXPIRED status for non-actionable dkg ritual states by nodes. 2023-11-17 12:20:36 -05:00
derekpierre fb6a3ae800 Check whether ritual is active or expired before attempting to get ritual public key. 2023-11-17 12:20:36 -05:00
derekpierre 7e6bafeeb1 Add is_ritual_active to MockCoordinatorAgent. 2023-11-17 12:20:36 -05:00
derekpierre d6a1e3f01f Update RitualStatus names to match Coordinator contract. 2023-11-17 12:20:36 -05:00
derekpierre 93411489a8 Use David's nucypher-contracts branch for updated contract functionality. 2023-11-17 12:20:36 -05:00
derekpierre ff51de058e Consolidate swarm/get_staking_providers into one method that returns an iterable.
Update tests.
2023-11-17 12:18:06 -05:00
derekpierre 0413c2f992 Update staking provider info tests for testing taco application agent. 2023-11-17 12:18:06 -05:00
derekpierre a0efda573c Update sampling tests to test exclusion logic. 2023-11-17 12:18:06 -05:00
derekpierre c9769f617d Update TACoApplicationAgent tests. 2023-11-17 12:18:06 -05:00
derekpierre b3911b47f3 Add sampling and other tests for updated TACoChildApplicationAgent functionality. 2023-11-17 12:18:06 -05:00
David Núñez 0f8ea5e067 Unit tests for context resolution stuff 2023-11-16 16:45:11 +01:00
David Núñez 21625c9910 Forgot to change mock paths after refactoring 2023-11-16 16:45:11 +01:00
David Núñez 4e6af23e81 Fix unit test for context variable resolution 2023-11-16 16:45:11 +01:00
David Núñez 05d151ad81 non-ascii characters are not valid context variables 2023-11-16 16:45:11 +01:00
David Núñez 0c7ebaf943 First pass at unit-testing context variable name validation. Currently fails! 2023-11-16 16:45:11 +01:00
derekpierre 95bca154fc Fix test - remove not applicable case for Python API. 2023-11-08 11:51:29 +01:00
derekpierre 099a72e39e Be more strict with chain field in Schema.
Update tests accordingly.
2023-11-08 11:51:29 +01:00
derekpierre ed5d32203e Update deployment of Coordinator and GlobalAllowList for acceptance tests based on recent changes to `nucypher-contracts`. 2023-11-08 11:51:29 +01:00
derekpierre a620a2d86f Be more eager validating return value schema.
Ensure index is non-negative integer.
2023-11-08 11:51:29 +01:00
Kieran Prasch bd51e2539c respond to RFCs in PR #3318 2023-10-31 17:23:43 +01:00
Kieran Prasch fef10d1e67 improves the efficiency and completeness of startup RPC endpoint checks 2023-10-31 17:23:43 +01:00
Kieran Prasch bd8fbc0626 linting 2023-10-31 17:23:43 +01:00
Kieran Prasch d9d05b3efb Require all domain RPC endpoints are active before node startup 2023-10-31 17:23:43 +01:00
Kieran Prasch d63a6cb93d Expands domains data model to include condition chains 2023-10-31 17:23:43 +01:00
Kieran Prasch 63d2e0265c Makes TACoDomain.__hash__ consistent with __eq__. 2023-10-31 14:30:15 +01:00
Kieran Prasch 9599b9e632 Handle domains during CLI account selection of signers. 2023-10-31 14:30:15 +01:00
Kieran Prasch 0c528eaa7a Linting and Newsfrag for PR #3315 2023-10-31 14:30:15 +01:00
Kieran Prasch f4caacc4b1 update scripts usage of taco domains; conventionally use str() on domains usages 2023-10-31 14:30:15 +01:00
Kieran Prasch c87d4f5d1d forgotten internal API change 2023-10-31 14:30:15 +01:00
Kieran Prasch de8d96e8ea use domain lookups sparingly and cache the lookups results 2023-10-31 14:30:15 +01:00
Kieran Prasch ae9f4b40fa Use a constant for the temporary domain 2023-10-31 14:30:15 +01:00
Kieran Prasch 63b3d4aee9 Use a single collection (SUPPORTED_DOMAINS) for supported domains. 2023-10-31 14:30:15 +01:00
Kieran Prasch 0bc6840b17 do not name shadow domains in reworked mocking 2023-10-31 14:30:15 +01:00
Kieran Prasch 0df05d38f2 Conventionally import (collapsed) domains for namespacing 2023-10-31 14:30:15 +01:00
Kieran Prasch b1afa231d5 use TACoDomain everywhere 2023-10-31 14:30:15 +01:00
Kieran Prasch 09bc914ce7 renames TEMPORARY_DOMAIN -> TEMPORARY_DOMAIN_NAME 2023-10-31 14:30:15 +01:00
Kieran Prasch b538e58f57 use TACoDomain for internal APIs 2023-10-31 14:30:15 +01:00
derekpierre 927f07379c Modify test to call get_context_value instead of calling directive directly. 2023-10-31 11:43:19 +01:00
derekpierre bf328db437 Add unit tests for time condition negative validation of return value type. 2023-10-31 11:43:19 +01:00
derekpierre 38e001fa75 Add tests for condition provider handling. 2023-10-31 11:43:19 +01:00
derekpierre b68652422e Split out validity unit tests into specific condition class tests.
Add tests for more invalid cases across condition types.
Improve tests to ensure that expected message is raised in exceptions.
2023-10-31 11:43:19 +01:00
derekpierre 27c9306f0e Improve naming for context var testing. 2023-10-31 11:43:19 +01:00
derekpierre 4390525197 Add tests for function abi validation for ContractCondition. 2023-10-31 11:43:19 +01:00
derekpierre 0ebcb6ed70 Add test when provided chain id is not an int. 2023-10-31 11:43:19 +01:00
derekpierre 99644475ea Add testing with/without context var only, and both for more robust testing.
Allowing with context var only only allows for testing mismatched expected types when context var is populated at decryption time since it couldn't be checked at condition initialization.
2023-10-31 11:43:19 +01:00
derekpierre 0abebc8546 Add test for unexpected type when comparator value is a sequence. 2023-10-31 11:43:19 +01:00
derekpierre 207bc5329b Remove unnecessary utility function for `validate_condition_lingo`; instead ConditionLingo.from_dict() can be used. 2023-10-31 11:43:19 +01:00
derekpierre ccd214d0f7 Improve testing of negative/failure case for ConditionLingo.from_json. 2023-10-31 11:43:19 +01:00
derekpierre e77b92a223 Add test where return value index is not applicable for data returned from contract call. 2023-10-31 11:43:19 +01:00
Kieran Prasch 4a145e13ba respond to RFCs in PR #3317 2023-10-30 20:58:03 +01:00
Kieran Prasch fc970602a3 apply code linting and formatting 2023-10-30 20:58:03 +01:00
Kieran Prasch 10e18fc353 removes dead cli code: show_staking 2023-10-30 20:58:03 +01:00
derekpierre 56b7fbc43d Update ape config to use oz 5.0.0 and solidity compiler 0.8.22 - same as `nucypher-contracts`.
Don't use ProxyAdmin for acceptance tests anymore since oz 5.0.0 has it built into TransparentUpgradeableProxy.
Don't seprate implementation and proxy contracts for test fixtures - use one and only return proxy.
2023-10-30 20:25:47 +01:00