From de9b3ea2d4bb0aa8cc3c47276f2ce1dfccb4324f Mon Sep 17 00:00:00 2001 From: Kieran Prasch Date: Wed, 6 Oct 2021 19:40:26 -0700 Subject: [PATCH] Update Amonia --- nucypher/characters/unlawful.py | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/nucypher/characters/unlawful.py b/nucypher/characters/unlawful.py index df75f021f..a4e0722e2 100644 --- a/nucypher/characters/unlawful.py +++ b/nucypher/characters/unlawful.py @@ -118,28 +118,13 @@ class Amonia(Alice): alice_clone.__class__ = cls return alice_clone - @staticmethod - def enact_without_tabulating_responses(policy, network_middleware, arrangements, **_kwargs): - for ursula, kfrag in zip(arrangements, policy.kfrags): - arrangement = arrangements[ursula] - payload = policy._make_enactment_payload(kfrag) - message_kit = policy.publisher.encrypt_for(ursula, payload) - - try: - network_middleware.enact_policy(ursula, bytes(message_kit)) - except Exception as e: - # I don't care what went wrong - I will keep trying to ram arrangements through. - continue - def grant_without_paying(self, *args, **kwargs): - """ - I take what I want for free. - """ + """I take what I want for free.""" def what_do_you_mean_you_dont_tip(policy, *args, **kwargs): return b"He convinced me, gimme back my $" - with patch("nucypher.policy.policies.BlockchainPolicy._publish_to_blockchain", what_do_you_mean_you_dont_tip): + with patch("nucypher.policy.policies.BlockchainPolicy._publish", what_do_you_mean_you_dont_tip): return super().grant(*args, **kwargs) def circumvent_safegaurds_and_grant_without_paying(self, *args, **kwargs): @@ -148,7 +133,7 @@ class Amonia(Alice): Can I grant for free if I change the client code to my liking? """ - with patch("nucypher.policy.policies.Policy._enact_arrangements", self.enact_without_tabulating_responses): + with patch("nucypher.policy.policies.Policy._publish", self.grant_without_paying): return self.grant_without_paying(*args, **kwargs) def grant_while_paying_the_wrong_nodes(self, @@ -172,6 +157,6 @@ class Amonia(Alice): return receipt['transactionHash'] - with patch("nucypher.policy.policies.BlockchainPolicy._publish_to_blockchain", + with patch("nucypher.policy.policies.BlockchainPolicy._publish", publish_wrong_payee_address_to_blockchain): - return super().grant(handpicked_ursulas=ursulas_to_trick_into_working_for_free, *args, **kwargs) + return super().grant(ursulas=ursulas_to_trick_into_working_for_free, *args, **kwargs)