Skip to content

Coordinator Alpha 12 Support#3213

Merged
derekpierre merged 47 commits intonucypher:contracts-alpha-13from
KPrasch:alpha-12
Sep 14, 2023
Merged

Coordinator Alpha 12 Support#3213
derekpierre merged 47 commits intonucypher:contracts-alpha-13from
KPrasch:alpha-12

Conversation

@KPrasch
Copy link
Copy Markdown
Member

@KPrasch KPrasch commented Aug 28, 2023

Type of PR:
Feature

Required reviews:
3

What this does:

Follow-up PR will be made for coordinator alpha-13 work i.e TACoRoot/Child Application work - #3227

KPrasch and others added 26 commits September 7, 2023 18:27
This commit is aimed to update test to the following changes on
nucypher-contracts repo:
  - Update SimplePREApplication with TACoApplication
  - Replace ThresholdStakingForPREApplicationMock contract with
    ThresholdStakingForTACoApplicationMock
  - Use the new Coordinator contract
  - Add the deployment of StakeInfo contract

The use of these new contracts made necessary the following changes:
  - Add the deployment of a new Token for ritual fees: RitualToken. This
    contract has been added as local deployment.
  - Add the deployment of local contract ConditionNFT

Additionally, this commit updates the key character for arguments in
ape-config.yaml. From '::variable::' to <variable>, which results in a
more legible code.

Finally, this commit solves some linting and formatting issues.

Co-authored-by: LunarBytes <kieran@nucypher.com>
…public keys.

Move G2Point out of Ritual in CoordinatorAgent.
…bject.

MockCoordinatorAgent simply uses a class method to determine threshold (allows for both simple/precomputed) to still be tested in integration tests.
@derekpierre derekpierre changed the base branch from development to contracts-alpha-13 September 12, 2023 17:00
@derekpierre derekpierre marked this pull request as ready for review September 12, 2023 17:00
Copy link
Copy Markdown
Member Author

@KPrasch KPrasch left a comment

Choose a reason for hiding this comment

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

🤠 approved

Copy link
Copy Markdown
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.

🎸 - co-authorship on this PR though 😄

Copy link
Copy Markdown
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.

Initial pass

contract_name: str = "Coordinator"
_proxy_name = None

class G2Point(NamedTuple):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this class necessary?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Getting/setting the provider public key.

conditions: Lingo,
) -> ThresholdMessageKit:
if not self.signer:
raise TypeError("This Enrico doesn't have a signer.")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's missing commit authorship in this line 🤖

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wdym?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think he means that Github Copilot probably helped here 🤖🤖🤖

if not self._policy_pubkey:
if not self._encrypting_key:
raise TypeError(
"This Enrico doesn't know which policy encrypting key he used. Oh well."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh well.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖

Copy link
Copy Markdown

@manumonti manumonti 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 huge! Great work

I have some suggestions, but overall it looks good

if not self._policy_pubkey:
if not self._encrypting_key:
raise TypeError(
"This Enrico doesn't know which policy encrypting key he used. Oh well."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖

conditions: Lingo,
) -> ThresholdMessageKit:
if not self.signer:
raise TypeError("This Enrico doesn't have a signer.")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think he means that Github Copilot probably helped here 🤖🤖🤖

def deploy_contracts(nucypher_contracts: DependencyAPI, accounts):
def deploy_contracts(
nucypher_contracts: DependencyAPI,
test_contracts: DependencyAPI,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

test_contracts are not been deployed using this function.

AFAIK, these test contracts are deployed by APE since they are under the contracts folder. So we can delete this line.

Suggested change
test_contracts: DependencyAPI,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

^ This whole setup is changed in #3227 (follow-up PR) - so this is/will be addressed there.

- name: nucypher-contracts
github: nucypher/nucypher-contracts
ref: main
github: derekpierre/nucypher-contracts
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this is temporal, right? should we add a TODO comment?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes. It can be merged with that reference since the PR is going into an EPIC (#3226), but it will be changed to nucypher-contracts/main as part of merging the epic.

@derekpierre derekpierre dismissed manumonti’s stale review September 14, 2023 13:24

894dc5a addresses the respective suggestions.

Copy link
Copy Markdown

@manumonti manumonti left a comment

Choose a reason for hiding this comment

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

Great! LGTM ✌️

"value": Web3.to_wei("1", "ether"),
}
txhash = testerchain.w3.eth.send_transaction(tx)
_ = testerchain.wait_for_receipt(txhash)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I noticed that tx hashes are often assigned to a variable and then ignored (like _hash in a different file). Is this some sort of Pythonic idiom?

Copy link
Copy Markdown
Member

@derekpierre derekpierre Sep 14, 2023

Choose a reason for hiding this comment

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

The txhash is used to wait for an tx execution receipt, but the receipt is not needed hence the _- it just indicates that the tx was mined/completed.

Some/most of these are removed/replaced in #3227 by using ape functionality for tx execution which does not requiring waiting for a tx receipt - other than the txs for transferring eth to other accounts (haven't gotten around to figuring out the ape equivalent for that as yet, but something I'm looking into for #3227).

)
blockchain = pre_application_agent.blockchain
blockchain = taco_application_agent.blockchain
minimum_stake = (
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In some places it called min_authorization, would be great to have same names everywhere

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 - we can address in #3227 .

@derekpierre derekpierre merged commit 84d8344 into nucypher:contracts-alpha-13 Sep 14, 2023
derekpierre added a commit to derekpierre/nucypher that referenced this pull request Sep 20, 2023
KPrasch added a commit that referenced this pull request Nov 30, 2023
KPrasch pushed a commit that referenced this pull request Nov 30, 2023
KPrasch pushed a commit that referenced this pull request Nov 30, 2023
Update newsfragment for #3213.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

DKG Authorization Models Hookup allow logic contract call from stub Onchain enrico allow list

6 participants