Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement NotaryAssisted transaction attribute #3175

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

AnnaShaleva
Copy link
Member

@AnnaShaleva AnnaShaleva commented Mar 6, 2024

Description

Close #2896. Use a stub for native Notary contract hash since this contract is not implemented yet. Thus, technically, NotaryAssisted attribute verification will always fail on real network until native Notary is implemented.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • A group of unit tests for NotaryAssisted attribute.

Checklist:

Close neo-project#2896. Use a stub for native Notary contract hash since this
contract is not implemented yet. Thus, technically, NotaryAssisted
attribute verification will always fail on real network until native
Notary is implemented.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
AnnaShaleva added a commit to AnnaShaleva/neo-devpack-dotnet that referenced this pull request Mar 6, 2024
Port neo-project/neo#3175.
Ref. neo-project/neo#2896.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
AnnaShaleva added a commit to AnnaShaleva/neo-modules that referenced this pull request Mar 6, 2024
Port neo-project/neo#3175.
Ref. neo-project/neo#2896.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@AnnaShaleva
Copy link
Member Author

I'm not allowed to request review, set labels or resolve conversations. Maybe someone from neo-project with access rights can allow me at least to request review?

@shargon
Copy link
Member

shargon commented Mar 6, 2024

I'm not allowed to request review, set labels or resolve conversations. Maybe someone from neo-project with access rights can allow me at least to request review?

You didn't accept your role xD, I sent you an invitation time ago... Time to review your email? 😄

@Jim8y
Copy link
Contributor

Jim8y commented Mar 6, 2024

Hi @AnnaShaleva , we are trying to add as much comments in the core as possible, may you please add comments to explain CalculateNetworkFee.

…ribute

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@AnnaShaleva
Copy link
Member Author

may you please add comments to explain CalculateNetworkFee.

Sure, fixed.

Copy link
Contributor

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

GAS.OnPersist change is missing for the attribute.

src/Neo/Network/P2P/Payloads/TransactionAttributeType.cs Outdated Show resolved Hide resolved
Transactions network fee should be split between Primary node and Notary
nodes.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Once Notary contract is implemented, this hash will be replaced by a
proper Notary contract hash. The exact value won't be changed since
Notary contract has constant hash as any other native contract.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@AnnaShaleva
Copy link
Member Author

GAS.OnPersist change is missing for the attribute.

Completely forgot about it, fixed.

@vncoelho
Copy link
Member

vncoelho commented Mar 7, 2024

Maybe this PR we merge after next release.

@AnnaShaleva
Copy link
Member Author

Maybe this PR we merge after next release.

This PR doesn't hurt because currently in real network NotaryAssisted attribute is always invalid since transaction must have Notary contract as a signer, and Notary contract is not implemented yet.

Thus, I vote to merge it before 3.7. What do you think?

@roman-khimov
Copy link
Contributor

It goes step by step, @vncoelho. What this delay would buy us? The attribute logic is rather simple on its own.

roman-khimov
roman-khimov previously approved these changes Mar 7, 2024
Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

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

I need more time to review the notary proposal, honestly, I didn't expect it to be merged in 3.7 and it is already beginning to produce changes in the core

@AnnaShaleva AnnaShaleva requested review from roman-khimov and removed request for roman-khimov April 10, 2024 20:48
@vncoelho
Copy link
Member

For me is good if this was implemented

@shargon, the test is added, it works as expected. Please, check out the 6705469.

@Jim8y @vncoelho @cschuchardt88 and everyone interested, we need to move on with this PR. Please, consider reviewing it.

I am aligned with @vang1ong7ang and I will wait until his recommendations are all clarified.

@AnnaShaleva
Copy link
Member Author

I am aligned with @vang1ong7ang and I will wait until his recommendations are all clarified.

@vncoelho, @vang1ong7ang There are replies (#3175 (comment), #3175 (comment)), so could you please specify the exact questions/issues/possible vector of attack that you have in mind right now? So that we can answer properly.

@AnnaShaleva
Copy link
Member Author

AnnaShaleva commented May 23, 2024

@neo-project/core, let's try to review one more time, if you have any specific test cases or a possible vector of attack on your mind, then please, comment. This PR is ready for review and may be included into 3.8.0.

@roman-khimov
Copy link
Contributor

@AnnaShaleva, now with neo-modules integrated we also need changes from neo-project/neo-modules#884 here.

@AnnaShaleva
Copy link
Member Author

need changes from neo-project/neo-modules#884 here.

Sure, will port it ASAP.

Port the neo-project/neo-modules#884.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@AnnaShaleva
Copy link
Member Author

Also need to move Policy update under Domovoi hardfork to keep our states unchanged, depends on #3290.

Copy link
Member

@cschuchardt88 cschuchardt88 left a comment

Choose a reason for hiding this comment

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

Fix all the warning please

XML comment has badly formed XML -- 'Missing equals sign between attribute and attribute value.'

@AnnaShaleva
Copy link
Member Author

We've checked that NeoFS networks are 100% compatible with both Notary contract and NotaryAssisted attribute enabled starting from D hardfork (see the nspcc-dev/neo-go#3465). It means that Notary contract and NotaryAssisted attribute implementation won't change the existing node state. In the last commit I've moved NotaryAssisted attribute under D hardfork.

Fix all the warning please

Thank you, fixed!

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
D hardfork was occupied by 3.7.5, thus use the next available one.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@AnnaShaleva
Copy link
Member Author

UPD: we're aware of the Technical Committee decision to postpone the Notary subsystem implementation. However, we think that it's good to keep this code up-to-date wrt the current master so that it'll be easier for us to review and merge it once the time comes. Hence, I've updated the code to the latest master and moved the NotaryAssisted attribute under the next available hardfork (HF_Echidna).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a NotaryAssisted transaction attribute
7 participants