Skip to content

Deprecates "funding account" and account creation options#1130

Merged
KPrasch merged 2 commits intonucypher:sekanjabinfrom
KPrasch:drama-school
Jul 24, 2019
Merged

Deprecates "funding account" and account creation options#1130
KPrasch merged 2 commits intonucypher:sekanjabinfrom
KPrasch:drama-school

Conversation

@KPrasch
Copy link
Member

@KPrasch KPrasch commented Jul 22, 2019

The name says it all.

@KPrasch KPrasch added CLI This effects the nucypher CLI ux design User experience enhancements Ursula 👩‍🚀 Effects the "Ursula" development area labels Jul 22, 2019
@KPrasch KPrasch marked this pull request as ready for review July 22, 2019 23:35
@KPrasch KPrasch changed the title [WIP] Deprecates "funding account" and account creation options Deprecates "funding account" and account creation options Jul 22, 2019
if not self.token_balance >= amount:
raise self.StakerError(f"Insufficient token balance ({self.token_agent}) "
f"for new stake initialization of {amount}")
raise self.InsufficientTokens(f"Insufficient token balance ({self.token_agent}) "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if checksum_address:
if not is_checksum_address(checksum_address):
raise ValueError(f"{checksum_address} is an invalid EIP-55 checksum address.")
if not is_checksum_address(checksum_address):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have a decorator for this, IIRC?

@click.option('--offline', help="Operate in offline mode", is_flag=True)
@click.option('--provider-uri', help="Blockchain provider's URI i.e. 'file:///path/to/geth.ipc'", type=click.STRING)
@click.option('--funding-address', help="Address to stake NU ERC20 tokens", type=EIP55_CHECKSUM_ADDRESS)
@click.option('--pre-funded', help="Do not fund new stake's accounts", is_flag=True, default=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍



def test_initialize_stake_with_existing_staking_account(software_stakeholder, stake_value, token_economics):
def test_initialize_stake_with_existing_account(software_stakeholder, stake_value, token_economics):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

_receipt = testerchain.wait_for_receipt(txhash)

token_agent = Agency.get_agent(NucypherTokenAgent)
token_agent.transfer(amount=NU(200_000, 'NU').to_nunits(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@michwill
Copy link
Contributor

Looks good, but somehow I have the following problem.
If I run all tests with py.test, it fails with eth.exceptions.OutOfGas: Out of gas: Needed 4424000 - Remaining 4375218 - Reason: Write contract code for CREATE. But somehow, if I run the failing test with py.test -x tests/crypto/test_powers.py, it works fine.

@michwill
Copy link
Contributor

michwill commented Jul 23, 2019

Despite having the registry set, nucypher stake still tries to use memory registry in this PR:

nucypher stake --registry-filepath ~/.local/share/nucypher/dev_contract_registry.json list

raises an exception with the following message:

nucypher.blockchain.eth.registry.NoRegistry: No registry at filepath: ::memory-registry::

Should all the commands work after merging this PR?

@KPrasch
Copy link
Member Author

KPrasch commented Jul 23, 2019

@michwill - I suspect that you were running the tests at the same time you were running this command? I think there is an outstanding bug, wherein your config file is overwritten by some test. Looking into this (This is Issue is not introduced in this PR).

Yes - I think all previously functional commands will still work here.

Copy link
Member

@derekpierre derekpierre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤠

@michwill
Copy link
Contributor

@KPrasch not at the same time: before. But I see what you say - maybe can remove all configs after running tests

@codecov
Copy link

codecov bot commented Jul 23, 2019

Codecov Report

Merging #1130 into sekanjabin will decrease coverage by 23.54%.
The diff coverage is 10.52%.

Impacted file tree graph

@@               Coverage Diff               @@
##           sekanjabin    #1130       +/-   ##
===============================================
- Coverage          82%   58.46%   -23.55%     
===============================================
  Files              72       71        -1     
  Lines            9733     9616      -117     
===============================================
- Hits             7982     5622     -2360     
- Misses           1751     3994     +2243
Impacted Files Coverage Δ
nucypher/cli/stake.py 26.19% <0%> (-45.33%) ⬇️
nucypher/blockchain/eth/actors.py 40.14% <14.28%> (-36.92%) ⬇️
nucypher/blockchain/eth/policies.py 0% <0%> (-77.62%) ⬇️
nucypher/utilities/controllers.py 28.2% <0%> (-66.67%) ⬇️
nucypher/keystore/keystore.py 32.53% <0%> (-63.86%) ⬇️
nucypher/characters/control/interfaces.py 35.51% <0%> (-60.75%) ⬇️
nucypher/characters/lawful.py 36.81% <0%> (-53.28%) ⬇️
nucypher/network/server.py 37.21% <0%> (-48.44%) ⬇️
nucypher/characters/unlawful.py 0% <0%> (-46.43%) ⬇️
nucypher/policy/models.py 45.64% <0%> (-46.08%) ⬇️
... and 42 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df10a43...301f684. Read the comment docs.

@KPrasch
Copy link
Member Author

KPrasch commented Jul 23, 2019

@michwill - I added an additional mock to help ensure that the default configuration root is not being written to the disk during tests. I do not know for certain that it is fixed.

Copy link
Contributor

@michwill michwill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It worked!

@KPrasch KPrasch merged commit 54a5684 into nucypher:sekanjabin Jul 24, 2019
@KPrasch KPrasch deleted the drama-school branch March 22, 2021 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI This effects the nucypher CLI Ursula 👩‍🚀 Effects the "Ursula" development area ux design User experience enhancements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants