derekpierre
7a389e2c39
Improve OperatorBondedTracker coverage.
2022-11-16 12:28:17 -05:00
derekpierre
b2f71dd5c6
Add more conditions/lingo tests.
2022-11-16 12:28:17 -05:00
derekpierre
dc488624e8
Improve testing for ConditionLingo, utils. Remove unceessary check for function_abi.
2022-11-16 12:28:15 -05:00
derekpierre
ceee8bd2e9
Add tests for evaluate_condition() utils method. Fix incorrect type in method.
2022-11-16 12:27:12 -05:00
Kieran Prasch
6ca73c2849
remove lisence header from tests
2022-11-16 13:27:47 +00:00
James Campbell
bdaaafd9c3
Fix newsfragment and ensure conditions test has a valid method
2022-11-15 14:58:56 +00:00
James Campbell
4c5dadbad4
Resolve `function_abi` AFTER condition is initialized
...
Fixes #3012
Problem
-------
- when specifying a `standard_contract_type`, the `function_abi` is resolved
immediately
- when this condition is serialized, it contains both `standard_contract_type`
and `function_abi`, which we are trying to prevent
Solution
--------
- call `_resolve_abi` after the condition is initialized
2022-11-15 14:47:11 +00:00
James Campbell
656ff8071c
Improve error types raised by Return Values
2022-11-14 18:27:48 +00:00
James Campbell
775d890d3b
Allow returnValueTest key to be None in serialization
2022-11-14 14:32:29 +00:00
Kieran Prasch
2c5db8e1f8
snake case t staking data fixture.
2022-11-14 14:32:29 +00:00
Kieran Prasch
38283661b1
Strict typing for _resolve_abi; Simplifies enforcement of single-function ABI for condition definition.
2022-11-14 14:32:27 +00:00
James Campbell
48cc132580
Use web3 to find functions from contract abi in return value test
2022-11-14 14:32:13 +00:00
James Campbell
52038237ad
Add test to ensure eval can't run on context variable in return key
2022-11-14 14:32:13 +00:00
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