Commit Graph

422 Commits (7098933a4751bcf8feb8eca061dda80befb51a14)

Author SHA1 Message Date
James Campbell e36b958912 Allow return value to be tuple and use modern `isinstance` over `type` 2022-11-14 14:32:13 +00:00
James Campbell 417c8b0fd4 Fix mocking of tester chain 2022-11-14 14:32:13 +00:00
James Campbell beec9958d1 Add test for method not in standard contract abi 2022-11-14 14:32:13 +00:00
James Campbell 6b2b072e12 Include tests for handling list index in ReturnValue 2022-11-14 14:32:13 +00:00
James Campbell b6f422ff4e Add basic tests for Return Value key 2022-11-14 14:32:10 +00:00
James Campbell 01d414b79a Fix parsing of function abi from standard contracts 2022-11-14 14:31:54 +00:00
James Campbell 3bbbc7b262 Fix function abi schema to be a dict 2022-11-14 14:31:54 +00:00
James Campbell 4ce6f72695 Add basic test for custom abi condition 2022-11-14 14:31:54 +00:00
derekpierre 08bf1a0515 Code cleanup based on RFCs from #3007. 2022-11-10 09:16:36 -05:00
derekpierre 1a56decb1a Move condition-related exceptions to an exceptions module. 2022-11-09 19:20:17 -05:00
Kieran Prasch 77e0f2a1d4 Reduce permitted chains to a tuple. 2022-11-08 02:03:25 +00:00
Kieran Prasch d2dcdb9230 Introduce dynamic multi-chain support; enforce condition chain ID as an int. 2022-11-07 12:51:31 +00:00
Kieran Prasch d1269d1507 atomically extricate porter to nucypher/nucypher-porter 2022-10-27 17:26:32 +01:00
Kieran Prasch 24a5c5e035 Rmeoves Clef and Trezor signer tests 2022-10-27 10:13:18 +01:00
Kieran Prasch 646246ae3f delete datastore modules 2022-10-27 10:12:17 +01:00
Kieran Prasch 17d3888c4d Remove unused specifications, consolidate the remaining ones for use by porter alone. 2022-10-26 13:55:38 +01:00
Kieran Prasch 8f015aa690 Accomodate deprecation of Alice, Bob, and Card CLI in internal APIs and tests. 2022-10-21 10:27:54 +01:00
Kieran Prasch ec07eee6d2 Removes Alice, Bob, and Card CLI 2022-10-18 20:22:25 +02:00
Kieran Prasch baac304d30 Removal of ConditionLingo bytes serialization assertion 2022-10-18 20:10:38 +02:00
Kieran Prasch 5fd04472ab Support for nucypher-core Address and updates ReencryptionResponse function signature 2022-10-18 20:10:38 +02:00
Kieran Prasch 9ae4d5c966 to/from wei method updates for web3 v6+ support 2022-10-18 20:10:37 +02:00
derekpierre b7f1a1085a Apply RFCs from #2980. 2022-10-18 20:09:26 +02:00
derekpierre 15819cde61 Time condition in test should use integers instead of strings. 2022-10-18 20:09:25 +02:00
derekpierre 27d6112de1 Exception occuring during RPC call is propagated back to the caller as error message.
Better exception handling by condition objects either at creation or verification - including some refactoring of RPCCondition/ContractCondition.
Added/updated unit tests.
2022-10-18 20:09:25 +02:00
derekpierre e3446303b7 Remove support for None in ReturnValueTest - solidity has no concept of None/null so not needed. We can revisit later.
Updated condition tests to use 'is True' or 'is False'
Added SubscriptionManager test to show condition test whose contract call returns a struct and that the struct can be tested for equality/inequality.
2022-10-18 20:09:25 +02:00
derekpierre d0d71944b9 Remove __eq__ from ReturnValueTest obj - only needed for tests. 2022-10-18 20:09:25 +02:00
derekpierre 658a4470a2 Apply RFCs from #2974.
Co-authored-by: KPrasch <kieran@nucypher.com>
2022-10-18 20:09:25 +02:00
derekpierre 96c829d5a6 ReturnValueTest can now take any valid value type (including None) for comparison - this provides flexibility based on the result of a contract call.
String value types need to be quoted, but context variables are a special case of strings that don't need to be.
Added tests.
2022-10-18 20:09:25 +02:00
derekpierre d158221794 Add '!=' comparator as a valid comparator for ReturnValueTest.
Updated tests.
2022-10-18 20:09:25 +02:00
derekpierre 0379ce7114 Parameter types for ContractConditions do not have to be strings - we need to be careful with types when checking whether a parameter is a context variable or not.
ERC721 ownerOf function takes an int and not a string which caused failures.
Added/updated tests.
2022-10-18 20:09:25 +02:00
David Núñez 36e5368f3c Add more basic unit tests for ReturnValueTest 2022-10-18 20:09:25 +02:00
David Núñez 7219c749ba Sanitize input to constructor of ReturnValueTest 2022-10-18 20:09:25 +02:00
David Núñez 56af2bf27f Basic unit test for ConditionLingo 2022-10-18 20:09:25 +02:00
David Núñez 7c976751b0 Playing around with malicious input that exploits the use of eval()
This test creates an empty file in the filesystem when evaluating a condition. This shouldn't happen! We fix it later in this PR by using the ast module
2022-10-18 20:09:25 +02:00
derekpierre f972c72470 Code cleanup to condition context variable - follow up RFCs from #2966. 2022-10-18 20:09:25 +02:00
derekpierre 7e8d9eb7f1 Modify tests to use context instead of python parameters. Add test for use of user customized context variable.
Cleanup some test code.
2022-10-18 20:09:25 +02:00
derekpierre f164cfb3a9 Clenup of tests regarding `context`. Minor fix for using lists for ConditionLingo conditions instead of tuple. 2022-10-18 20:09:25 +02:00
derekpierre dc52a58590 Allow for optional enforcement of type safety for the JSON field. The Porter retrieval endpoint will enforce a dictionary type for the `context` parameter..
Updated tests.
2022-10-18 20:09:25 +02:00
derekpierre d77fac4d39 Allow context to be specified as JSON and not base64 JSON.
Remove retrieve tests that utilize url parameters since it is a POST endpoint.
2022-10-18 20:09:25 +02:00
derekpierre 40e2c5c0ea Initial work to have Porter provide 'context' for condition-based re-encryption when applicable. 2022-10-18 20:09:25 +02:00
KPrasch cd11a414bc Apply suggestions from code review
Co-authored-by: Derek Pierre <derek.pierre@gmail.com>
2022-10-18 20:09:25 +02:00
Kieran Prasch 0acfc7e381 Support for web3.py v6 2022-10-18 20:08:52 +02:00
Kieran Prasch b7145c0ab4 Remove core shims; Refactor for mk-embedded conditions. 2022-10-18 20:08:51 +02:00
Kieran Prasch 0aea2256a2 bird run 2022-10-18 20:07:58 +02:00
derekpierre 8a482d9389 Ensure delimiter is used as a single byte, and not a bunch of 0 bytes. Fixed test. 2022-10-18 20:07:58 +02:00
Kieran Prasch 72c6bd5295 Refactoring for interop with nucypher-ts 2022-10-18 20:07:58 +02:00
Kieran Prasch 74a0465cf3 Track lingos and capsules as packets; First working e2e flow. 2022-10-18 20:07:58 +02:00
Kieran Prasch 249c74eb31 Updates tests 2022-10-18 20:07:58 +02:00
Kieran Prasch d9f67f30ce Install nucypher core shims for conditions 2022-10-18 20:07:57 +02:00
Kieran Prasch 2948a198c0 Unit and acceptance tests for condition serialization and evaluation 2022-10-18 20:07:10 +02:00
Kieran Prasch 8d2045a118 conditions expression and evaluation prototype 2022-10-18 20:07:10 +02:00
Kieran Prasch 9e763dad86 expand test vectors 2022-10-18 20:07:10 +02:00
Kieran Prasch 5d4d409b82 Consolidates evm based reencryption conditions to eventually encapsulate payment methods; Reduce scope of conditions to a module 2022-10-18 20:07:10 +02:00
Kieran Prasch 58f4b6e50a Begin sanitization of return test comparators 2022-10-18 20:06:39 +02:00
Kieran Prasch 34bd940976 Establish unit tests for conditions 2022-10-18 20:06:39 +02:00
derekpierre 7689b446a7 Add web controller tests for handling of WorkerPoolException.
Improve efficiency of Porter tests by reducing execution timeout.
2022-04-13 11:05:03 -04:00
derekpierre a8aa869c2d Ursula runs a background task, OperatorBondedTracker, which ensures that it shuts down if no the operator address is no longer bonded to a staking provider. 2022-03-25 10:38:48 -04:00
derekpierre 276b334941 Ensure that worktracker stops on first startup once operator is confirmed. 2022-03-24 20:31:04 -04:00
derekpierre 5f6bee537c Enforce consistency of IP address and port when testing external ip utilities. 2022-03-23 11:43:35 -07:00
Kieran R. Prasch aad511ba30 test adjustments to handle policy registry, in-memory node storage and polygon mocks. 2022-03-22 15:54:36 -07:00
Kieran R. Prasch 99ac4693c2 Handle remote certificate mocks and storage in middleware. 2022-03-22 15:54:36 -07:00
Bogdan Opanchuk 06be01be84 certificate_bytes was renamed to certificate_der 2022-03-13 16:56:09 -07:00
Bogdan Opanchuk 8428ae825a decentralized_identity_evidence was renamed to operator_signature 2022-03-13 16:38:59 -07:00
Bogdan Opanchuk b8199e37ee staker_address was renamed to staking_provider_address 2022-03-13 16:18:41 -07:00
Bogdan Opanchuk 2e5dd70e51 nucypher-core had address parameter names normalized 2022-02-20 23:35:26 -08:00
vzotova 856abe4892 Renames `provider_uri` to `eth_provider_uri` 2022-02-18 11:27:15 +03:00
derekpierre b46432ab6d Purge Aragon/NuCypher DAO specific code. 2022-02-08 15:13:51 -05:00
Kieran Prasch b193465f98 adjust tests 2022-02-08 11:03:50 -08:00
Kieran Prasch 1c34045a81 Prepares economics and deployment constants for use with threshold network. 2022-02-08 11:02:17 -08:00
Kieran Prasch 0e148fbfa8 Skip tests 2022-02-08 11:02:02 -08:00
Kieran Prasch ab2798d819 patch SimplePREApplicationDeployer for ruse in IRL. 2022-02-08 11:01:24 -08:00
KPrasch e8f174e6f0
Merge pull request #2828 from xela7/keystore-generate-mnemonic-id
Keystore.generate can return optional mnemonic words
2022-01-14 12:32:43 -08:00
Bogdan Opanchuk a276cfec25 Disband umbral_adapter 2022-01-08 15:29:22 -08:00
Bogdan Opanchuk 8cb8f16370 Clean up Python parts moved to Rust
And some unused imports
2022-01-08 15:29:22 -08:00
Bogdan Opanchuk e5620c3155 Changes to make the tests pass 2022-01-08 15:29:22 -08:00
Bogdan Opanchuk 02bb2e2f76 Import the standalone package instead of nucypher.core 2022-01-08 15:29:22 -08:00
Alex Tokar 2d1b37f9aa return tuple when interactive=False 2021-11-29 14:03:30 -08:00
Alex Tokar 55d009b667 fixing tests with argument change 2021-11-29 13:44:07 -08:00
xela7 deeba59c78
make test more strict
Co-authored-by: KPrasch <kieranprasch@gmail.com>
2021-11-29 13:39:24 -08:00
Alex Tokar 2415436229 Keystore.generate can return optional mnemonic words 2021-11-24 11:56:26 -08:00
Bogdan Opanchuk 944d3373e7 Normalize the usage of VariableLengthBytestrings
Allow for every Versioned type to be able to deserialize itself from the bytestring.
2021-11-01 13:31:31 -07:00
Bogdan Opanchuk 7197d853d7 Move `signer` to the first position in the parameter list in various core constructors 2021-11-01 13:31:12 -07:00
Bogdan Opanchuk 70b2a1d57b Remove `alice_verifying_key` from `ReencryptionRequest` 2021-11-01 13:31:12 -07:00
Bogdan Opanchuk af404677c7 Make a separately versioned EncryptedKeyFrag instead of using a MessageKit 2021-11-01 13:31:11 -07:00
Bogdan Opanchuk 238a2cfd2a Remove `hrac` from `EncryptedTreasureMap` 2021-10-29 15:06:34 -07:00
Bogdan Opanchuk cdbe0fb546 Fix _decrypt_kfrag() argument name
Kfrags are encrypted by the publisher, not by the kfrag author (Alice)
2021-10-29 15:06:34 -07:00
Kieran Prasch 00a6a67b9a Deprecation of Arrangement datastore. 2021-10-29 07:56:20 -07:00
Bogdan Opanchuk 130308fbf8 Use a mapping for `assigned_kfrags` in `TreasureMap.construct_by_publisher()` 2021-10-15 15:35:35 -07:00
Bogdan Opanchuk 12f601c949 Add `Ursula._decrypt_kfrag()` and dissolve `decrypt_internal()` 2021-10-15 15:19:19 -07:00
Bogdan Opanchuk ca2ae89ba6 Get rid of passing a Callable to EncryptedTreasureMap.decrypt() 2021-10-15 15:19:19 -07:00
Bogdan Opanchuk ef0e619684 Bundle policy encrypting key with TreasureMap 2021-10-15 15:19:19 -07:00
Bogdan Opanchuk e5e598952a Extract NodeMetadata into the core 2021-10-15 15:19:19 -07:00
Bogdan Opanchuk 01c2e9bd71 Move RetrievalKit to core.py 2021-10-15 15:19:19 -07:00
Bogdan Opanchuk 256c93db58 Move [Encrypted]TreasureMap to core.py 2021-10-15 15:19:19 -07:00
Bogdan Opanchuk 3400af3f09 Move AuthorizedKeyFrag to core.py 2021-10-15 15:19:19 -07:00
Bogdan Opanchuk f847f9982c Move HRAC to core.py 2021-10-15 15:19:19 -07:00
Bogdan Opanchuk a3410cadfb Move MessageKit to the temporary core module 2021-10-15 15:19:19 -07:00
Bogdan Opanchuk 18454c721e Use a single InvalidSignature exception instead of three different ones 2021-10-15 15:19:19 -07:00
Bogdan Opanchuk c0c2208826 Extend brands to 4 bytes 2021-09-30 12:13:46 -07:00
Kieran Prasch 894728600e Versioning test touch ups. 2021-09-27 14:32:33 -07:00
Kieran Prasch 582f6182cf Refine and test minor version resolver. 2021-09-27 14:11:33 -07:00
Kieran Prasch 62ab949306 Loosen versioning enforcement to support future minor version backwards compatibility. Respond to RFCs in PR #2767. 2021-09-27 13:51:46 -07:00
Kieran Prasch ba6a49e13c Implements enforced major.minor versioning scheme for serializable entities. 2021-09-24 15:29:20 -07:00
Kieran Prasch 5296ae334d Enforce unique branding. Additional unit testing. 2021-09-23 16:01:25 -07:00
Kieran Prasch f311d4efd3 Implement versioning for Arrangement. 2021-09-23 16:01:25 -07:00
Kieran Prasch 68df8897a5 Basic unit tests for Versioned implementations. 2021-09-23 16:01:25 -07:00
KPrasch 5582a9fd79
Merge pull request #2768 from derekpierre/porter-retrieval
Update Porter endpoint for retrieval
2021-09-19 14:31:47 -07:00
Bogdan Opanchuk defa0e7c75 Fix deprecation warnings 2021-09-15 13:12:21 -07:00
Bogdan Opanchuk 55ef631673 Updates for umbral 0.3 API 2021-09-15 13:12:21 -07:00
derekpierre 3fd901ebf6 Update RetrievalKit field tests to be more robust; fix duplicate decryption of treasure map for tests. 2021-09-14 15:58:08 -04:00
derekpierre 27fe5daf7d Deserialization of MessageKit field now produces a MessageKit object instead of bytes.
Minor update to Porter docs for retrieval endpoint.
2021-09-14 15:58:08 -04:00
derekpierre dfa65a2976 Code cleanup after rebase over retrieval protocol work in #2730. 2021-09-14 15:58:08 -04:00
derekpierre ff6b1bae98 Encrypted and Decrypted treasure map fields. 2021-09-14 15:58:08 -04:00
derekpierre 61c0978e52 Define initial schema for /retrieve_cfrags Porter endpoint - (untested at the moment) 2021-09-14 15:58:08 -04:00
derekpierre ae1e7edf43 Add RetrievalKit field for marshalling/unmarshalling of request/response data that requires a RetrievalKit - intended to be part of Bob's retrieve schema in Porter. 2021-09-14 15:58:08 -04:00
derekpierre 602f2b6d05 Modify EncryptedTreasureMap field so that deserialize produces a TreasureMap object and not bytes. 2021-09-14 15:58:08 -04:00
derekpierre aa1006ca16 Modify Key field so that deserialize produces a PublicKey object and not bytes. 2021-09-14 15:58:08 -04:00
derekpierre 2fec681e66 Skip Porter exec_work_order tests; they'll be reworked for the new retrieve protocol. 2021-09-14 15:58:08 -04:00
Bogdan Opanchuk 1a10ddf7e7 Remove `EncryptedTreasureMap` datastore model 2021-09-08 08:55:49 -07:00
Bogdan Opanchuk 0f85435ac7 Require encrypted_treasure_map in retrieve() 2021-09-08 08:21:04 -07:00
Bogdan Opanchuk 1d3642d960 Retrieval rework 2021-09-08 08:21:03 -07:00
Bogdan Opanchuk a338ff1a69 Don't return the signature along with the MessageKit from MessageKit.author() 2021-09-07 11:58:55 -07:00
Bogdan Opanchuk 41ae6dbcca Move message kits to policy submodule 2021-09-07 11:58:55 -07:00
Bogdan Opanchuk 161bb8f06d Use __bytes__ instead of to_bytes() in MessageKit 2021-09-07 11:58:55 -07:00
Bogdan Opanchuk 3ef534b812 Rename PolicyMessageKit to MessageKit 2021-09-07 11:58:55 -07:00
Bogdan Opanchuk 0b697881a1 Move TLSHostingPower to powers.py
To avoid circular dependencies
2021-09-07 11:58:55 -07:00
Bogdan Opanchuk 3b43eac717 Remove UmbralMessageKit alias 2021-09-07 11:58:55 -07:00
Bogdan Opanchuk 9d2d36cbf3 Remove an unused parameter from TreasureMap.construct_by_publisher() 2021-09-07 11:58:55 -07:00
Kieran R. Prasch 11566990bd Respond to RFCs in PR #2742 2021-08-23 07:53:10 -07:00
Kieran R. Prasch 8e4c7c1594 Renames secret_key -> key_material for CLI BYOK. 2021-08-23 07:51:19 -07:00
Kieran R. Prasch 0d5123f8d6 Allow importing of custom keystore entroy blob by ursula init CLI and Keystore API. 2021-08-22 15:51:15 -07:00
Bogdan Opanchuk 6164137610 Rename m -> threshold, num_kfrags -> shares 2021-08-20 19:26:56 -04:00
Bogdan Opanchuk c595850952 RFCs, part 2 2021-08-19 17:06:45 -04:00
Bogdan Opanchuk caf32842b3 RFCs 2021-08-19 17:06:45 -04:00
Bogdan Opanchuk ad2ad8e3c0 Make HRAC a class and use it as a policy ID 2021-08-19 17:06:45 -04:00
Bogdan Opanchuk 509b8c1bfc Split treasure maps into decrypted and encrypted 2021-08-19 17:06:45 -04:00
Bogdan Opanchuk 5b5cd4bd84 Use HRAC as treasure map ID at all times instead of just in the blockchain case 2021-08-19 17:06:45 -04:00
Bogdan Opanchuk 2be3d727d5 Rename TreasureMap field and datastore model to EncryptedTreasureMap 2021-08-19 17:06:45 -04:00
KPrasch ed67bbcd7b
Merge pull request #2777 from KPrasch/main
Relock Dependencies
2021-08-18 15:43:09 -07:00
KPrasch 79631124b5
Merge pull request #2771 from derekpierre/aug12-hotfix
Include changes and release notes from v5.3.1 hotfix in `main`
2021-08-17 15:47:32 -07:00
Kieran R. Prasch 1f7ee94489 Update eth_account Transaction API imports. 2021-08-17 15:34:44 -07:00
Bogdan Opanchuk 279a647be0 Move ENCRYPTED_KFRAG_PAYLOAD_LENGTH into AuthorizedKeyFrag 2021-08-13 14:46:56 -07:00
Bogdan Opanchuk 8c628da9ea Extract kfrag authorization into a class 2021-08-12 16:34:05 -07:00
Bogdan Opanchuk e5c0bb079e Fix the remainders of Alice/Publisher separation 2021-08-12 16:32:02 -07:00
derekpierre 9487979fae Remove problematic gas feed for now, and make gas feeds more robust against errors.
Ensure median returns an int.
2021-08-12 13:08:30 -04:00
Piotr Roslaniec 7aaa5b128f Apply PR suggestions 2021-08-06 18:10:45 +02:00
Piotr Roslaniec 09e90d17fa Remove remaining 'str' usage 2021-08-06 18:10:43 +02:00
Piotr Roslaniec f710c31e30 Remove empty files 2021-08-06 18:10:22 +02:00
Piotr Roslaniec 6a270c1713 Use pathlib 2021-08-06 18:10:20 +02:00
derekpierre def9ef1116 Ensure that url query parameters in tests are url encoded. Added note about url encoding in docs.
Add unit test for Base64BytesRepresentation field.
Cleanup imports.
2021-07-26 15:14:43 -04:00