Commit Graph

6527 Commits (v7.5.0)

Author SHA1 Message Date
KPrasch fb4ed7c008
condition providers set -> list 2024-05-28 15:48:23 +02:00
KPrasch 97d10b951a
detailed utility logging for default RPC endpoints 2024-05-28 15:48:23 +02:00
KPrasch faba9a10b9
Expands RPC health check logical branching to handle detailed failure cases; prepare for logging integration. 2024-05-28 15:48:23 +02:00
KPrasch 6509b2b3d7
Compares system time with block time for each default RPC provider. 2024-05-28 15:48:23 +02:00
KPrasch be515e26be
Relocate default RPC endpoint list to a standalone repository controlled by nucypher. 2024-05-28 15:48:23 +02:00
Kieran 48a8bf1e0f
lint 2024-05-28 15:48:23 +02:00
Kieran bd1962a58c
introduces default RPC endpoint health check utilities, and plant an initial entrypoint at node startup. 2024-05-28 15:48:23 +02:00
Kieran 2ac0aba53f
Introduce hardcoded default RPC endpoint; localize chain IDs, blockchain names to constants.py 2024-05-28 15:48:23 +02:00
derekpierre 06e56bbc72
Properly sort imports in relevant files causing the ruff CI check to fail. 2024-05-28 08:55:48 -04:00
derekpierre 0e83c1c158
Add a default freshness check for SIWE messages - this prevents perpetual reuse of the same SIWE message.
Improve auth exception messages and update tests to check for relevant messages.
Add tests for stale SIWE messages.
2024-05-16 19:46:42 -04:00
derekpierre bced969340
Update exception message to include underlying exception. 2024-05-16 18:38:35 -04:00
derekpierre d699c93bf9
Make auth tests more maintainable by improving fixture parameter usage. 2024-05-15 16:52:06 -04:00
derekpierre 00235c0dff
Check that address matches expected address for SIWE authentication. 2024-05-15 11:06:12 -04:00
derekpierre c023e924f1
Fix resolution of scheme using string and not enum. 2024-05-15 11:05:12 -04:00
derekpierre f10f9e463f
Minor cleanup. 2024-05-14 17:16:19 -04:00
derekpierre e6d1534d1f
Initial plumbing for authenticating :userAddress context variable information provided using SIWE instead of EIP712 which we've traditionally used.
Leave some room for other possibilities.
2024-05-14 16:55:14 -04:00
derekpierre f4080f6f86
Stop using deprecated method for :userAddress verification - use alternative API method. 2024-05-13 09:26:35 -04:00
KPrasch f8b2bbba9a
Bump version: 7.3.0 → 7.4.0 2024-05-13 09:25:49 -04:00
KPrasch df3b0b2666
Merge pull request #3409 from KPrasch/revoke
removes the `/revoke` endpoint
2024-05-07 09:24:45 -04:00
Kieran c529d71b35
Removal of auxilliary revocation usage. 2024-05-07 09:24:45 -04:00
KPrasch 4a413c25fc
Removes the /revoke REST endpoint. 2024-05-07 09:24:36 -04:00
derekpierre 24b548f192
Adjust logic for creating blockchain provider based on endpoint provided. 2024-04-30 09:30:15 -04:00
derekpierre 031f484b85
Remove sign_transaction and sign_message from EthereumClient - clients shouldn't do any account management/signing.
Raise exceptions from Web3Signer if used for signing - an explicit signer should be used instead of this fallback.
Remove EthereumTesterClient since no longer needed and therefore from_w3() is no longer needed either; actual signer objects are used for signing transactions/messages in tests.
2024-04-29 16:33:18 -04:00
derekpierre 60b0ad9155
Remove account management functions from Web3Signer since external blockchain clients can't actually do signing, other than in tests; better mimic real world functionality. 2024-04-29 10:34:23 -04:00
derekpierre 2b4b0ad9f5
Modify Vladimir to use InMemorySigner. 2024-04-29 10:34:18 -04:00
derekpierre 5baac93058
InMemorySigner should implement _get_signer() like other Signers and not __get_signer(). 2024-04-29 10:34:11 -04:00
derekpierre b0991441c5
Removes customized RPC clients/shims; with standardization of providers there is less need for such specialized clients.
Limit providers to only http/https.

Based on some work previously done by Kieran, but was abandoned due it becoming stale and diverging from git history.

Co-authored-by: Kieran Prasch <kieranprasch@gmail.com>
2024-04-29 10:34:10 -04:00
derekpierre 40037f22a6
Prune public chains to only the ones currently being used. 2024-04-29 10:34:00 -04:00
derekpierre f2f7c24bba
Allow duration as a parameter to make_staking_provider_reservoir function call. This call is used by Porter. 2024-04-25 10:15:56 -04:00
derekpierre 45f05e3134
Update other calls to get active providers based on duration. 2024-04-25 09:12:23 -04:00
derekpierre 74cc426cb1
Update get_active_staking_providers call for TACoApplicationAgent/TACoChildApplicationAgent to accept an optional duration parameter, with the default value being 0. 2024-04-25 09:12:18 -04:00
derekpierre 394dc6018e
Resubmit tx within `on_broadcast_failure` callback; removes the queued tx and resubmits a new tx. This prevents other queued txs for other rituals from being starved by one failing tx for a specific ritual. 2024-04-24 18:57:53 -04:00
Derek Pierre 6089db5fa8
Merge pull request #3487 from derekpierre/logging-one-more-thing
One more thing: Individual logging observers need to adhere to log levels
2024-04-24 17:12:49 -04:00
derekpierre 49e295e0e7
Log message about verified operator to debug instead of info. 2024-04-24 16:08:57 -04:00
derekpierre 27fe4c7f10
Observers themselves should adhere to log levels since other Loggers may be used which don't check log level before passing to observers. 2024-04-22 20:39:39 -04:00
derekpierre 2500fe1507
Fix inconsistent return from `sign_transaction`; either a SignedTransaction is returned or HexBytes. Reverting to lowest common denominator which is HexBytes (bytes). This issue was noticed while running the nucypher_dkg script which failed - it uses a keystore signer. 2024-04-22 14:15:28 -04:00
derekpierre 83e0ea153a
Clean up StdoutEmitter and log to the logging system where appropriate. 2024-04-19 14:59:59 -04:00
derekpierre 121bbbc4f4
Add tests for management of global observers for logging.
No-ops whenever trying to start/stop an already started/stopped global observer
Properly save and restore state within context manager for pausing logging.
2024-04-19 14:59:57 -04:00
derekpierre 47944092bd
Separate text file logs from json file logs. JSON logs are overly verbose and should only be enabled if explicitly indicated (probably for monitoring/scraping of logs), and should not be enabled by default. It's setting should be kept separate from text file logging. 2024-04-19 14:59:47 -04:00
derekpierre ba9e5c4240
Properly track observers so that the correct instances can be used for removal if necessary. 2024-04-19 11:11:31 -04:00
derekpierre fafff095db
Use a proper console logger from twisted that properly formats messages. 2024-04-19 11:11:30 -04:00
derekpierre 9d012c4fc0
Logger should limit logging by underlying observers based on log level. 2024-04-19 11:11:25 -04:00
derekpierre be76467192
Update embedded lynx contract registry based on latest lynx upgrade and updated registry from `nucypher-contracts`. 2024-04-18 13:37:30 -04:00
derekpierre 59a8901ed5
Agents need to better handle overloaded functions. Web3py does not resolve the function based on the number of args provided, so we need to resolve the function ourselves.
In some cases we've been lucky that the function we wanted to use was first to be returned instead of the other one, in which case the call will fail. This change makes the method to use more explicit by using the signature. Eventually the old function that was overloaded will be removed from the contract and is therefore no longer a problem - until then we need to properly/deterministically handle the overload case.
2024-04-18 13:37:29 -04:00
derekpierre 46b858d876
Update embedded mainnet contract registry based on updated registry from `nucypher-contracts`. This was missed from the last mainnet update but the nodes were fine because it pulls the registry from github as a priority over the embedded registry. 2024-04-18 13:37:27 -04:00
derekpierre 6064ee01b1
Remove old and no longer used code associated with operator information. 2024-04-18 13:37:26 -04:00
derekpierre ccb5a7631a
Only retrieve struct values from contract based on number of expected fields in associated python struct. This better maintains compatibility whenever the struct in the contract adds fields. 2024-04-18 13:37:25 -04:00
derekpierre 238c4cb5aa
Add TODO for usages of the stdout emitter, should these just be log messages. 2024-04-17 13:20:26 -04:00
derekpierre 1673a7e7a4
Fix incorrect typehint for return value of method for executing synchronous transactions. 2024-04-17 13:20:25 -04:00
derekpierre ba8f519d08
Check ritual status before resubmitting a tx to prevent infinite loops due to DKG ritual failures for other reasons eg. mismatch aggregated transcript from other node, timeout etc. 2024-04-17 13:20:02 -04:00
derekpierre 59bc9f8bf4
Add a default on_broadcast callback implementation that simply prints broadcast tx information, if one is not provided.
The default behaviour is to print tx info that is basically the equivalent of want a synchronous tx would print - same reason that the StdoutEmitter is used instead of the logger.
Use common utility for determining cost of broadcasted tx.
2024-04-15 13:30:58 -04:00
derekpierre 5514f57d43
Add typehint for return of _setup_async_tx_hooks method for Operator. 2024-04-15 13:30:52 -04:00
derekpierre fd4b209f9e
Fix KeyError bug when clearing cached async tx if it doesn't already exist. 2024-04-15 13:30:51 -04:00
derekpierre 43c9d92c63
Clear async tx once transaction is successfully finalized; no need to store it since data already updated on blockchain because tx was finalized. 2024-04-15 13:30:50 -04:00
derekpierre 1f4199f35b
Make data member for DKGStorage private for safety. 2024-04-15 13:30:49 -04:00
derekpierre dcb93abed8
Don't store async_txs on the ActiveRitualTracker since it only cares about events; utilize existing DKG storage for operator. This will also allow for easier logic for clearing when no longer needed by the Operator.
Modify DKGStorage to store async txs.
Update tests accordingly.
2024-04-15 13:30:47 -04:00
derekpierre c5adbfde98
Update Operator to handle the various callbacks used by async transactions for improved fault tolerance when publishing a transcript or aggregated transcript.
Implementations of the callbacks for error cases may resubmit a tx to execute for fault tolerance.
2024-04-15 13:30:42 -04:00
derekpierre 4c6b8afcc0
Add speedup strategy to the ATxM object being used since it is no longer a default strategy used by the underlying library. 2024-04-15 13:30:41 -04:00
derekpierre 14c9d49d8e
Add AsyncTxHooks helper class for defining async tx callbacks when using send_async_transaction and the atxm library.
Allow AsyncTxHooks to be specified when executing an async transaction.
2024-04-15 13:30:40 -04:00
Manuel Montenegro 0ad33b8baa
Simplify code
Co-authored-by: Derek Pierre <derek.pierre@gmail.com>
2024-04-15 17:03:29 +02:00
Manuel Montenegro c0c39c5e20
Fix typo in help
Co-authored-by: Derek Pierre <derek.pierre@gmail.com>
2024-04-15 16:59:23 +02:00
Manuel Montenegro dbce8cf09d
Add --metrics-listen-address CLI Prometheus option
This option was accidentally removed during the return of Prometheus
exporter.
2024-04-15 14:14:59 +02:00
snoppy 6a7a3bb921 chore: fix typos 2024-04-11 12:03:38 -04:00
derekpierre f4c5623653
Fix incorrect rebase change. Revert line to what it was before. 2024-04-10 09:31:01 -04:00
derekpierre f2e7e2d63d
Update tapir registry based on latest deployment to polygon amoy. 2024-04-10 09:09:23 -04:00
derekpierre 3086e7d942
Don't use ETH in text about tx cost since it could be MATIC. 2024-04-10 09:07:11 -04:00
derekpierre eae9992158
Update Lynx contract registry with latest Lynx deployment on Polygon Amoy as part of migration from Polygon Mumbai. 2024-04-10 09:04:13 -04:00
derekpierre 9dcfdf0458
Update chain information to include polygon amoy as a valid chain. 2024-04-10 09:04:09 -04:00
derekpierre 8a5aec5ca6
Rename Polygon Mumbai enum to Polygon Amoy. 2024-04-10 09:04:00 -04:00
derekpierre b771d0d198
Migrate configuration file when provided. 2024-03-25 13:43:01 -04:00
derekpierre 6f7779def3
Update embedded tapir contract registry. 2024-03-25 13:32:47 -04:00
derekpierre a4a4988ca1
Adjust call to TACoApplication.getActiveStakingProviders. Needs to be properly addressed by #3458 to take a duration value. 2024-03-25 13:32:43 -04:00
derekpierre fd08570b2f
Add additional values belonging to StakingProviderInfo for TACoChildApplicationAgent. 2024-03-25 13:32:42 -04:00
KPrasch 783664a173
handles importing of test packages in production builds 2024-03-25 13:32:36 -04:00
KPrasch edbead6791
repsond to RFCs in PR #3437:
- removes stale newsfrag
- do not return Deferred from SimpleTask.start and SimpleTask.stop
- removes eager atxm startup with ursula startup.
- remove unused token agent methods
- add spaces after periods in select logs
- more...
2024-03-25 13:32:26 -04:00
KPrasch b1fef5d6b1
removes interval parapeter from subclass constructors of SimpleTask 2024-03-25 13:32:25 -04:00
KPrasch 69bd09bfe3
crash ursula on invalid event dispatch. 2024-03-25 13:32:24 -04:00
KPrasch c16f93707a
promotes phase id to a NamedTuple. 2024-03-25 13:32:23 -04:00
KPrasch bf2dbbc2c0
respond to RFCs in PR #3437 2024-03-25 13:32:22 -04:00
KPrasch 8b4e6bf09a
unit/integration test demonstrating async tx tracking by ursula. 2024-03-25 13:32:20 -04:00
KPrasch 416164a846
integrate atxm (see original history in https://github.com/nucypher/nucypher/pull/3424, https://github.com/nucypher/atxm)
- atx integration test
- eliminate 'fire and forget'
- warp space-time
2024-03-25 13:32:19 -04:00
KPrasch a31bda8c9e
updates import for newer version of cryptography 2024-03-25 13:32:10 -04:00
KPrasch 4ae72f94ab
update local signer integration to support newer version of eth_account. 2024-03-25 13:32:09 -04:00
KPrasch 57b9ffe7ee
Bump version: 7.2.0 → 7.3.0 2024-03-25 13:31:52 -04:00
Derek Pierre 04a2b66672 Apply RFCs from #3444
Co-authored-by: David Núñez <david@nucypher.com>
2024-02-13 10:53:03 -05: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 0a01fb900b Use the correct Logger class.
Use f-strings for event scanning logging.
2024-02-13 10:53:03 -05:00
derekpierre 919e5007ed Update mainnet contract registry with latest changes deployed to mainnet - getParticipants that allows for paging results. 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 d6d2f8d80c Simplify netloc replacement of request url. 2024-02-13 10:53:03 -05:00
derekpierre 29ccc48310 Use built-in ssl function for obtaining ssl certs. 2024-02-13 10:53:03 -05:00
derekpierre efd39bdc1c Don't raise when a new teacher cannot be selected from the list of known_nodes. 2024-02-13 10:53:03 -05:00
David Núñez 6b2effe664 The return of simple_cache_middleware 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 7257d4df7e Move chunk, reorg window settings to ActiveRitualTracker - more applicable there since it has context for the chain being scanned etc.
Increase reorg window to 20 since we've noticed that Polygon block reorgs can be that large (sometimes larger).
Increase min chunk size to 60. Using 10 was seemingly too small give Polygon's shorter block time.
2024-02-13 10:53:03 -05:00
derekpierre c89a5668b6 Allow caller of select_config_file to specify whether to auto-migrate config files with older versions.
By default auto migration does not happen, and the user is prompted.
During ursula run auto migration is set to true so that there are no user prompts for migration.
2024-02-13 10:53:03 -05:00
derekpierre 0b2999421b Automatically migrate configuration files to latest version.
Modify OldVersion exception to include old version number.
2024-02-13 10:53:03 -05:00
derekpierre b59978e815 Reuse response headers variable instead of using two different variables with the same value for response headers. 2024-02-13 10:53:03 -05:00
derekpierre 98b4c9db34 Clear all ritual data instead of just Ritual object when node observes that ritual is not active. 2024-02-13 10:53:03 -05:00
derekpierre 61adba7207 Even though the ritual is cached, the node still checks its status on chain on purpose (the endtimestamp could have been extended). Remove active ritual cache entry if ritual is ever deemed to be no longer active by the Coordinator contract. 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 635238f5a6 Cache an active Ritual object as part of DKGStorage. Now that the ritual object is cached, there is no need to separately cache the aggregated transcript. 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 0351c7726e Incorporate caching of validators list into _resolve_validators() method - much simpler set up that cleans up usages of resolve_validators() everywhere else. 2024-02-13 10:53:03 -05:00
derekpierre 31e1c18a69 Add ability to clear the cache values for a specific ritual - for now it beneficial for testing; perhaps can be good for future revoke functionality. 2024-02-13 10:53:03 -05:00
derekpierre 083df6664f Fix missing return statement for getting decryption share. 2024-02-13 10:53:03 -05:00
derekpierre b674732f71 Utilize DKGStorage cache more effectively to obtain validators, aggregated transcript, and decryption share for a ritual - this will reduce RPC calls, and additional computations. 2024-02-13 10:53:03 -05:00
derekpierre f767865131 Remove storage of node's transcript bytes for each ritual - it isn't used
Allow caching of list of validators used in round 1 - allows potential reuse for round 2, and during threshold decryption if needed.
Allow caching of node's decryption share for a completed ritual - allows for reuse for the same ritual.
Use named constants as key values for entries in DKGStorage - just simpler.
2024-02-13 10:53:03 -05:00
derekpierre 6fe1a9462c Update typehint for method to derive decryption share. 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
Kieran Prasch 35845d9185 Updates remote regstry source url to reference the main branch on nucypher/nuypher github. 2024-02-13 10:53:03 -05:00
KPrasch b50e754c31 Correction of ABI ordering inside the registry for future diff preservation 2024-02-13 10:53:03 -05:00
KPrasch b9d9119756 removes the /node_metadata GET endpoint. 2024-02-13 10:53:03 -05:00
KPrasch 00e8eff231 Update nucypher/blockchain/eth/agents.py
Co-authored-by: piotr-roslaniec <39299780+piotr-roslaniec@users.noreply.github.com>
2024-02-13 10:53:03 -05:00
KPrasch fed7edcc9d updates embeded registry to sync with nucypher-contracts v0.19.0 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 651f2601ad Once a receipt is obtained clear the tx hash from the dkg storage utility. 2024-02-13 10:53:03 -05:00
derekpierre 077a2f4234 Perform all phase checks in one function including pending tx.
For pending tx we don't currently care about the receipt - we will care soon for retry/replacement functionality but that is expected to be handled by a separate task.
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 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 f2dff32a33 Add type hint to aggregate_transcripts call. 2024-02-13 10:53:03 -05:00
derekpierre 84dc5b96bb Max results can be 0, but it should not be negative. 2024-02-13 10:53:03 -05:00
derekpierre 5939e6a00c Raise RuntimeError whenever round 1 called for a ritual that the node is not participating in - participation state should have prevented call to perform_round_1.
Use dkg_size value on Ritual instead of length of providers.
Some code cleanup with comments.
2024-02-13 10:53:03 -05:00
KPrasch ee472163eb Return dkg phase fetching to operator as methods; Respond to RFCs in PR #3419
Co-Authored-By: derekpierre <derek.pierre@gmail.com>
2024-02-13 10:53:03 -05:00
derekpierre 89fa5a2d88 Make get_participants non-public since it is really an internal function used when getting a ritual object - it is never/should never be called separately. 2024-02-13 10:53:03 -05:00
KPrasch 38c26d81aa respond to RFCs in PR #3419 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
Kieran Prasch a3d8cb00e9 linting, code cleanup, localizes Participant constructor usage. 2024-02-13 10:53:03 -05:00
KPrasch 91c8486f7a use dkg storage txhashes to determine if there is a tracked pending dkg transaction. 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 2a73c816be agent layer: sets by default for transcript and aggregation posting 2024-02-13 10:53:03 -05:00
KPrasch b959354b0d annotations and commentary for dkg phase preconditions. 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
KPrasch a9e4a87e6c actor layer: isolate remotely fetched data models for dkg rounds 2024-02-13 10:53:03 -05:00
KPrasch b2db18aa86 isolates ritual pending handlers 2024-02-13 10:53:03 -05:00
KPrasch 550ce7c8c7 linting 2024-02-13 10:53:03 -05:00
derekpierre f80b7c939a Implement pagination to obtain participants from contract, and Remove participants as an optional parameter from get_ritual since True was the default, and False was never used. 2024-02-13 10:53:03 -05:00
derekpierre aaeeb0db10 Check whether ritual is active before checking whether the node is a participant in it. 2024-02-13 10:53:03 -05:00
derekpierre 623c4356a9 Obtain transcript if checking whether it has already been set for round 1, or else it will always be assumed to not be set. 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 cdea26074d annotates rpc calls 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 9f8661c0bb handle validator resolution independantly from transcript downloads. 2024-02-13 10:53:03 -05:00
KPrasch 2d1c044215 use an actor-layer abstraction for assembling coordinator data 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
KPrasch ba4c86066b removes bulk data downloading interface from coordinator agent 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
Kieran Prasch 7fa08a25ad disables transcript downloading by bob during retrieval 2024-02-13 10:53:03 -05:00
Kieran Prasch 955564c688 exposes paginated view of participants (with transcripts) in coordinator agent. 2024-02-13 10:53:03 -05:00
Kieran Prasch 5e834c6330 exposes new coordinator views for getParticipantProviders and isProviderParticipating 2024-02-13 10:53:03 -05:00
Kieran Prasch 9405a35b31 sets with_participants=False by default. 2024-02-13 10:53:03 -05:00
Kieran Prasch 00d15e3a3a do not read peer transcript data when self-verifying ritual participation (when handling threshold decryption requests). 2024-02-13 10:53:03 -05:00
Kieran Prasch 381dd00163 code quality: unpack return of to avoid extra comprehensions 2024-02-13 10:53:03 -05:00
Kieran Prasch a66f88d573 do not read peer transcript data when performing round 1. 2024-02-13 10:53:03 -05:00
Kieran Prasch 7caead29ca bugfix: RitualError is not defined. 2024-02-13 10:53:03 -05:00
KPrasch 10b7c53c4b Update nucypher/network/nodes.py 2024-02-13 10:53:03 -05:00
KPrasch 4d06ad441d linting 2024-02-13 10:53:03 -05:00
KPrasch 356a8645f5 include config migration for node_storage deprecation 2024-02-13 10:53:03 -05:00
KPrasch 1fcf3c84a8 fully deprecates the node storage API 2024-02-13 10:53:03 -05:00
KPrasch c98e31c366 disables ssl hostname checking 2024-02-13 10:53:03 -05:00
Kieran Prasch bd173e97e4 linting 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 32fb9f5742 removes dead code 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
Kieran Prasch 1ab6e2e121 collapse storages 2024-02-13 10:53:03 -05:00
Kieran Prasch da58a4aae7 in-memory certificate handling utilities 2024-02-13 10:53:03 -05:00
KPrasch 1afe48211e Bump version: 7.1.0 → 7.2.0 2024-02-13 10:53:03 -05:00
derekpierre 95ac122e49 Reduce the eagerness of the ActiveRitualTracker by having it scan for events every 2mins. instead of every 20s. 2024-01-25 15:31:01 +01:00
David Núñez d37bbf88bc Don't use gas strategies
Gas strategies are meant only for legacy transactions (pre-EIP1559). See https://web3py.readthedocs.io/en/stable/gas_price.html
2024-01-24 15:55:35 +01:00
KPrasch 6bc2d4bad2 include block height in the node's html status web page. 2024-01-24 11:45:21 +01:00
KPrasch 2fe61f5cc3 include latest event scanner block in json status endpoint 2024-01-24 11:45:21 +01:00
KPrasch 7bac254aae use the threshold favicon instead of nucypher to fix http 404ing on the node status web page. 2024-01-23 20:47:44 +01:00
KPrasch a58e11ea0b handle both pending and validated transactions when logging from parsed dkg storage. 2024-01-23 20:47:44 +01:00
KPrasch fb13103b14 fixes several log formatting issues. 2024-01-23 20:47:44 +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 28a0cc750e removes (redundant) trusted proxy allow listing; documents incoming ip handling functions. 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
KPrasch a712706e7b adopt the 'global' language convention pertaining to public IPv4 addresses 2024-01-23 19:21:26 +01:00
KPrasch 527640170c renames _ipv4_to_ipv6 -> _ipv6_to_ipv4 2024-01-23 19:21:26 +01:00
KPrasch 28af3f9eda Handle public IPv4 address resolution for incoming requests via /ping 2024-01-23 19:21:26 +01:00
derekpierre eec504e54b Round up the value of batch size and thread pool size which are both decimal factors of the threshold; without rounding up small threshold values can experience slower decryption executions for associated ritual. 2024-01-23 15:54:46 +01:00
derekpierre edc4f939c1 Make last scanned block metric a class variable on ActiveRitualTracker. 2024-01-23 13:27:35 +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 d4651d678b Update "active_stake" value to be denominated in ether and not wei. 2024-01-23 13:27:35 +01:00
derekpierre 18764d7a08 Add specific metric for decryption successes. Renamed metric from errors to failures. 2024-01-23 13:27:35 +01:00
derekpierre 3a191041de Increase robustness of prometheus metrics task by implementing a PrometheusMetricsTracker. 2024-01-23 13:27:35 +01:00
derekpierre 667ccbe389 Rename key for discovery status gauge. 2024-01-23 13:27:35 +01:00
derekpierre e9ea0ddb23 Use the correct registry object to unregister some collectors. 2024-01-23 13:27:35 +01:00
derekpierre 5171c012ca Add prometheus metrics for tracking threshold decryption requests and errors. 2024-01-23 13:27:35 +01:00
derekpierre c76ef13f9d Improve help text for --metrics-interval cli parameter. 2024-01-23 13:27:35 +01:00
derekpierre ec22fcbc49 Fix comment. 2024-01-23 13:27:35 +01:00
derekpierre e3bbd84ffd Create OperatorMetricsCollector to collect data about matic balance and operator confirmation (better to check confirmation on child application).
Move operator confirmation metric from StakingProviderInfo collector to Operator collector.
2024-01-23 13:27:35 +01:00
derekpierre 236e03343f Rename existing metrics values to remove _gauge suffix. 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 920df0e47d Remove Operator and Event metrics
- Event metrics collector was not being used at all, so we can safely
  remove it.
- Operator metrics collector is exporting the operator eth balance,
  which is not relevant anymore.
2024-01-23 13:27:35 +01:00
Manuel Montenegro 4cca43c0a6 Format code 2024-01-23 13:27:35 +01:00
Manuel Montenegro e6c5293779 Move imports to the top of the file
Since commit de85e7fa, prometheus is a required dependency for Ursula.
So conditional imports of prometheus are no longer necessary.
2024-01-23 13:27:35 +01:00
Manuel Montenegro 13948b2625 Remove unused code and TODO 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 7f82edd7ab Make Prometheus exporter always run along Ursula
Prometheus metrics is going to be a necessary part for the Threshold
network. Through them, the network can know if the PRE nodes are meeting
the nodes requirement. This can be useful, for instance, to calculate
the staking rewards.

So, the export of these metrics must be mandatory and not an option that
the user can enable or disable using commands flags.
2024-01-23 13:27:35 +01:00
Manuel Montenegro 7f70c9a086 Disable default collector metrics
By default, prometheus exports 'process', 'gc' and 'platform' collector
metrics. This information is not useful in our case and introduces some
noise to the metrics, so they have been disabled.
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
KPrasch 2ae6ce85b0
Merge pull request #3393 from cygnusv/nojoin
Optimize use of decryption request WorkerPool
2024-01-19 15:01:36 +01:00
David Núñez 55e653cf75
Tweak WorkerPool parameters 2024-01-19 12:13:15 +01:00
derekpierre 4100754976 Raise exception for sampling when there aren't enough nodes to sample. 2024-01-19 11:04:31 +01:00
derekpierre bad425f17f Raise exception when the reservoir of values to draw from is less than required successes. 2024-01-19 11:04:31 +01:00
Piotr Roslaniec b0f9fe1897 fix darker linting 2024-01-18 12:41:45 +01:00
Piotr Roslaniec 04b3202877 set MAX_UPLOAD_CONTENT_LENGTH to 250kb 2024-01-18 12:41:45 +01:00
David Núñez deb3391131
Increment DEFAULT_DECRYPTION_TIMEOUT to 30 sec 2024-01-17 16:32:52 +01:00
David Núñez 773fa467a6
Reraise exceptions inside TDec worker tasks as ThresholdDecryptionRequestFailed 2024-01-17 16:32:00 +01:00
David Núñez a7af04beb8
Randomize sequence of addresses for decryption requests 2024-01-17 16:26:55 +01:00
David Núñez d0c25cf8d4
Include batch_size as a parameter of ThresholdDecryptionRequestFactory 2024-01-17 15:35:12 +01:00
derekpierre be8820786f Implement a random stagger delay when nodes submit aggregated transcripts. 2024-01-17 09:31:32 -05:00
derekpierre 8a341dd87c Use an increased modifier for posting aggregation in case node is the last node and needs more gas for additoinal logic of being the last node to submit aggregated transcript.
Basically a race condition for who will be last.
2024-01-17 09:31:32 -05:00
derekpierre 0d71361f88 Have the EventScanner take a break after crashing and then restarting. 2024-01-17 09:31:32 -05:00
derekpierre 172fefe74f Obtain node ferveo public key from Coordinator contract instead of learning.
Co-authored-by: Kieran Prasch <kieranprasch@gmail.com>
2024-01-17 09:31:32 -05:00
David Núñez 7e8caefabb
Fix parameter typing 2024-01-17 12:56:16 +01:00
David Núñez dedf747fe2
Fix incorrect exception message 2024-01-17 12:51:44 +01:00
David Núñez 70d7fe1319
Most importantly, no need to wait for all threads to finalize
This was making the whole process as slow as the slowest decryption request
2024-01-17 12:51:12 +01:00
David Núñez e19dd65b3c
Wait enough time before firing a new batch of decryption requests 2024-01-17 12:50:26 +01:00
David Núñez 30a39c59d8
Batch size should start with a bit over the threshold, just in case 2024-01-17 12:48:49 +01:00
David Núñez 43df0adf7b
Fix parameter name 2024-01-17 12:47:02 +01:00
derekpierre c0a59d48d7
Bump version: 7.0.4 → 7.1.0 2024-01-10 11:56:45 -05:00
derekpierre 0565509752 Sync tapir contract registry with latest contracts deployed to Tapir testnet. 2024-01-10 11:41:34 -05:00
derekpierre 4b81e5a59f Update lynx contract registry. 2024-01-04 13:23:02 -05:00
derekpierre 99ebdfe8dc Deprecate use of goerli blockchain; Lynx will now use Sepolia. 2024-01-04 13:23:02 -05:00
Kieran Prasch a82253b66b
removes incorrect typing 2023-12-21 09:30:50 -05:00
derekpierre 8b8f65baf9 Bump version: 7.0.3 → 7.0.4 2023-12-15 09:54:02 -05:00
derekpierre 5d808a7ca1 Only sleep during block_until_ready when not (bonded and funded). 2023-12-15 09:48:39 -05:00
Kieran Prasch 4b029f707c Bump version: 7.0.2 → 7.0.3 2023-12-11 18:19:16 +01:00
Kieran Prasch 050b774909 Startup poll rate 10s -> 120s 2023-12-11 18:15:35 +01:00
Kieran Prasch 9279dd2393 Bump version: 7.0.1 → 7.0.2 2023-12-07 18:50:22 +01:00
Kieran Prasch a4270774a3 sync mainnet contract registry 2023-12-07 18:48:48 +01:00
Kieran Prasch 4a122bf0bd Bump version: 7.0.0 → 7.0.1 2023-12-04 16:14:40 +01:00
derekpierre 363eb3975c Always raise ConditionEvalError (previously EvalError) instead of returning then raising.
Update tests.
2023-12-01 13:59:03 -05:00
Kieran Prasch c3d126f522 Bump version: 7.0.0-rc.10 → 7.0.0 2023-12-01 11:29:11 +01:00
Kieran Prasch d55e60b978 sync lynx contract registry after upgrades to child app and coordinator 2023-11-29 16:13:35 +01:00
Kieran Prasch f488733508 sync embedded contract registries 2023-11-28 15:20:51 +01:00
Kieran Prasch d61a7487dc Refactor EvalError as an exception class. 2023-11-28 14:22:41 +01:00
derekpierre f3e90a74b6 Appease my OCD by putting the timeout parameter after context. 2023-11-28 13:42:45 +01:00
derekpierre 37490696c6 Clarify use of timeouts. 2023-11-28 13:42:45 +01:00
derekpierre 4398c63892 Use constants for timeout values for reencryption and decryption. 2023-11-28 13:42:45 +01:00
derekpierre e151f1644a Fix chaotic test given how participant public keys are now used. 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 16b8a93943 Allow Bob.retrieve/retrieve_and_decrypt(...) to specify a decryption timeout - defaults to 10s 2023-11-28 13:42:45 +01:00
derekpierre e8526f915d It's ok not to resolve the entire cohort, we just need a threshold of them. In most cases the entire cohort should be learned about, but in the rare case of only a threshold known about that is fine. 2023-11-28 13:42:45 +01:00
derekpierre 65fb84281f Allow Bob.threshold_decrypt(...) to specify a decryption timeout - defaults to 15s. 2023-11-28 13:42:45 +01:00
derekpierre cfc7e1cf93 Update comment for base class ThresholdAccessControlClient. 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 ac86e7f5cf s/getOperatorFromStakingProvider/stakingProviderToOperator 2023-11-28 12:44:44 +01:00
David Núñez c7fa7d835b s/stakingProviderFromOperator/operatorToStakingProvider
Closes #3350
2023-11-28 12:44:44 +01:00
derekpierre c0d12e14e4 Bump version: 7.0.0-rc.9 → 7.0.0-rc.10 2023-11-17 12:37:09 -05:00
derekpierre fcc72af563 Update lynx contract registry to incorporate latest lynx deployment. 2023-11-17 12:24:11 -05:00
derekpierre 191e46cd78 Update polygon endpoint help string. 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 d6a1e3f01f Update RitualStatus names to match Coordinator contract. 2023-11-17 12:20:36 -05:00
derekpierre 1cd6a09e25 Use CoordinatorAgent.is_ritual_active where appropriate. 2023-11-17 12:20:36 -05:00
derekpierre 66980d676b Add is_ritual_active function to CoordinatorAgent. 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 74b5495321 Some code clean up based on RFCs from #3341. 2023-11-17 12:18:06 -05:00
derekpierre 2841392b06 Use class reference for exception instead of instance. 2023-11-17 12:18:06 -05:00
derekpierre 4ed1ef12c9 Fix linter errors. 2023-11-17 12:18:06 -05:00
derekpierre bd5cab04b6 Accept base StakerSamplingApplicationAgent when making staker reservoir used for sampling - either TACoApplication (PRE) or TACoChildApplication (TACo CBD) can be used. 2023-11-17 12:18:06 -05:00
derekpierre 7b14234404 Additional methods for reading data from TACoChildApplication contract. 2023-11-17 12:18:06 -05:00
derekpierre 20f2702649 Commonize functionality for staker sampling for both TACoApplication and TACoChildApplication. 2023-11-17 12:18:06 -05:00
David Núñez 270a5c3902 Touches to context module 2023-11-16 16:45:11 +01:00
David Núñez d82cbf4347 List of values in contexts are now resolved 2023-11-16 16:45:11 +01:00
David Núñez 8fde668e8d Add deeper resolution of context variables
Now we can recursively resolve list of variables
2023-11-16 16:45:11 +01:00
David Núñez 470b72b64d Introduce regex for context variable names 2023-11-16 16:45:11 +01:00
David Núñez c52a41b0a8 Resolve circular dependency with ReturnValueTest 2023-11-16 16:45:11 +01:00
David Núñez b43eb85cca Relocate context variables resolution method to context module 2023-11-16 16:45:11 +01:00
derekpierre 672c8c8dfe Collapse `_process_active_staking_providers_info` into `get_active_staking_providers`. 2023-11-10 09:37:45 -05:00
derekpierre 756b3ee2c7 Update StakingProviderInfo struct based on changes to TACoChildApplication. 2023-11-10 09:37:45 -05:00
derekpierre f75ba8b85d Update handling of the staking provider data returned from TACoApplication.getActiveStakingProviders 2023-11-10 09:37:45 -05:00
Kieran Prasch 0e2c4cdc87 Bump version: 7.0.0-rc.8 → 7.0.0-rc.9 2023-11-08 12:22:05 +01:00
Kieran Prasch 034c64ba3d linting 2023-11-08 12:00:39 +01:00
Kieran Prasch 3b2d492b07 removes unused nucypher code 2023-11-08 12:00:39 +01:00
Kieran Prasch 6a8fdc0c3c removes unused cli code 2023-11-08 12:00:39 +01:00
Kieran Prasch b05f742d86 removes unused cli options 2023-11-08 12:00:39 +01:00
Kieran Prasch aec953cdd9 removes unused constants 2023-11-08 12:00:39 +01:00
derekpierre ca11706ac3 Update seed node URL for `seeds.nucypher.network` to include port 9151. 2023-11-08 11:51:29 +01:00
derekpierre da983dd330 Ensure that registry domain is handle properly now that we are using TACoDomain objects instead of strings. 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 a620a2d86f Be more eager validating return value schema.
Ensure index is non-negative integer.
2023-11-08 11:51:29 +01:00