Skip to content

Bare Deployment and Retargeting Workflow#1344

Merged
KPrasch merged 14 commits intonucypher:masterfrom
KPrasch:otto
Sep 30, 2019
Merged

Bare Deployment and Retargeting Workflow#1344
KPrasch merged 14 commits intonucypher:masterfrom
KPrasch:otto

Conversation

@KPrasch
Copy link
Member

@KPrasch KPrasch commented Sep 17, 2019

Motivation

Deployment tooling and UX response to state verification failures experienced during StakingEscrow upgrade. Provides a workflow to help mitigate a partially completed contract upgrade.

Points of Interest
  • Engagement of _deploy_essential without deploying a proxy any additional transactions via CLI (--bare).
  • Proxy contract upgrade / retargeting without contract re-deployment (nucypher upgrade --retarget ...).
  • Adds deployer methods for better direct-access to contracts both targeted and, untargeted by proxies.
  • Allows for an alternate registry output file path to be used via depolyment CLI (--registry-outfile).
  • Clean-up registry mocking and fixture usage. (always use MOCK_REGISTRY_FILEPATH)

Based on #1345 and #1350

Re-Attempt at Upgrade/Re-Target

without gas limit -> https://gist.github.com/KPrasch/58b26d20dc2fef7505e4634e5680f49e
with gas limit -> https://gist.github.com/KPrasch/5977b5ce353c4ea832219d1a76f2faab

Successful Upgrade
(nucypher) kieran@pegasus:~/Git/nucypher$ nucypher-deploy upgrade --contract-name StakingEscrow --provider ~/.ethereum/goerli/geth.ipc --poa --hw-wallet 
WARNING: --etherscan is disabled. If you want to see deployed contracts and TXs in your browser, activate --etherscan.
Configured to registry filepath /home/kieran/.local/share/nucypher/contract_registry.json
0 | 0xb3aD00CB3fEcbfe729cb496C70aC420FDc229AAC 
1 | 0xcC0678E51a8237b762c09d6548d2d07285609e98 
Select deployer account [0]: 0
Selected 0xb3aD00CB3fEcbfe729cb496C70aC420FDc229AAC - Continue? [y/N]: y


Deployer ETH balance: 4.266476613
Enter existing contract upgrade secret: 
Enter new contract upgrade secret: 
Repeat for confirmation: 
Confirm deploy new version of StakingEscrow and retarget proxy? [y/N]: y
Successfully deployed and upgraded StakingEscrow
OK | 0xcb45d757ada0bcb6680dd612e32801abbe6e229a50f813cce95871b8ba14eabe (6198413 gas)
Block #1331807 | 0x20e4b2a612adb87a04a58862c0ed65c331e1ae6dc67633730577a2cb97ba7886
 See https://goerli.etherscan.io/tx/0xcb45d757ada0bcb6680dd612e32801abbe6e229a50f813cce95871b8ba14eabe

OK | 0xc412091ff584e97dbd7d4d48293cfc0e598305a9e99bd44940f4e9fb845be38a (309496 gas)
Block #1331808 | 0xb11804c63bbfa97459385685b83f1f7573e5055fb1f35b4a8a075201a6bfc1e2
 See https://goerli.etherscan.io/tx/0xc412091ff584e97dbd7d4d48293cfc0e598305a9e99bd44940f4e9fb845be38a

@KPrasch KPrasch added Enhancement New or improved features CLI This effects the nucypher CLI labels Sep 17, 2019
@KPrasch KPrasch changed the title "Download Registry" CLI Command [WIP] "Download Registry" CLI Command Sep 17, 2019
@codecov
Copy link

codecov bot commented Sep 19, 2019

Codecov Report

Merging #1344 into master will decrease coverage by 0.12%.
The diff coverage is 77.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1344      +/-   ##
==========================================
- Coverage   83.07%   82.94%   -0.13%     
==========================================
  Files          72       72              
  Lines       10327    10457     +130     
==========================================
+ Hits         8579     8674      +95     
- Misses       1748     1783      +35
Impacted Files Coverage Δ
nucypher/cli/painting.py 77.66% <100%> (+0.23%) ⬆️
nucypher/utilities/sandbox/constants.py 98.41% <100%> (+0.05%) ⬆️
nucypher/blockchain/eth/clients.py 64.8% <100%> (+0.09%) ⬆️
nucypher/blockchain/eth/interfaces.py 70.42% <52.17%> (-1.1%) ⬇️
nucypher/cli/deploy.py 77.64% <69.76%> (+2.98%) ⬆️
nucypher/blockchain/eth/deployers.py 87.87% <76.54%> (-2.63%) ⬇️
nucypher/blockchain/eth/registry.py 77.73% <84.61%> (+1.51%) ⬆️
nucypher/cli/actions.py 74.48% <85%> (+1.04%) ⬆️
nucypher/blockchain/eth/actors.py 86.07% <95%> (+0.29%) ⬆️
nucypher/network/nodes.py 80.61% <0%> (-1.23%) ⬇️
... and 2 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 28117f5...82c3772. Read the comment docs.

@KPrasch KPrasch changed the title [WIP] "Download Registry" CLI Command [WIP] Bare Deployment and Retargeting Workflow Sep 19, 2019
@KPrasch KPrasch force-pushed the otto branch 2 times, most recently from 16aae86 to 85fc65e Compare September 20, 2019 06:03

# Mock live contract registry reads
LocalContractRegistry.read = lambda *a, **kw: test_registry.read()

Copy link
Member Author

Choose a reason for hiding this comment

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

This mock was not properly restored to the original call - causing some pretty odd CI failures for the tests run in the same container as this test, after this one finishes.

@KPrasch KPrasch requested a review from vzotova September 20, 2019 07:01
@KPrasch KPrasch changed the title [WIP] Bare Deployment and Retargeting Workflow Bare Deployment and Retargeting Workflow Sep 20, 2019
@KPrasch KPrasch marked this pull request as ready for review September 20, 2019 18:14
principal_receipt = self.blockchain.send_transaction(sender_address=self.deployer_address,
contract_function=contract_function,
transaction_gas_limit=transaction_gas_limit)
receipts['principal'] = proxy_receipt
Copy link
Member

Choose a reason for hiding this comment

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

I thought that we want to transfer ownership only for Dispatcher contract, because owner of principal contract is unused

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, interesting. Is there a disadvantage to transferring the old contract also?

KPrasch added a commit to KPrasch/nucypher that referenced this pull request Sep 24, 2019
Copy link
Member

@cygnusv cygnusv left a comment

Choose a reason for hiding this comment

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

This is a first pass at this PR, all things look good for the moment! I'd like to try a manual check anyway.

rollback_receipt = proxy_deployer.rollback(existing_secret_plaintext=existing_secret_plaintext,
new_secret_hash=new_secret_hash,
gas_limit=gas_limit)

Copy link
Member

Choose a reason for hiding this comment

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

Does rollback need a wrap contract step too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm - No I dont think so - since were not handling or deploying a new deployment or registry enrollment.

KPrasch added a commit to KPrasch/nucypher that referenced this pull request Sep 30, 2019
Copy link
Member

@cygnusv cygnusv left a comment

Choose a reason for hiding this comment

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

I deployed contracts with this in a private network, all good :)
Good stuff, @KPrasch !

@KPrasch
Copy link
Member Author

KPrasch commented Sep 30, 2019

Just a heads up - I'm going to squash the last two commits if CI passes.

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.

👍 - @KPrasch Just one outstanding comment in interfaces.py regarding an f-string.

@KPrasch KPrasch merged commit adfd082 into nucypher:master Sep 30, 2019
@KPrasch KPrasch deleted the otto 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 Enhancement New or improved features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants