-
Notifications
You must be signed in to change notification settings - Fork 1k
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
base: master
Are you sure you want to change the base?
Conversation
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 <[email protected]>
Port neo-project/neo#3175. Ref. neo-project/neo#2896. Signed-off-by: Anna Shaleva <[email protected]>
Port neo-project/neo#3175. Ref. neo-project/neo#2896. Signed-off-by: Anna Shaleva <[email protected]>
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? 😄 |
Hi @AnnaShaleva , we are trying to add as much comments in the core as possible, may you please add comments to explain |
…ribute Signed-off-by: Anna Shaleva <[email protected]>
Sure, fixed. |
There was a problem hiding this 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.
Transactions network fee should be split between Primary node and Notary nodes. Signed-off-by: Anna Shaleva <[email protected]>
Signed-off-by: Anna Shaleva <[email protected]>
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 <[email protected]>
Completely forgot about it, fixed. |
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? |
It goes step by step, @vncoelho. What this delay would buy us? The attribute logic is rather simple on its own. |
There was a problem hiding this 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
Signed-off-by: Anna Shaleva <[email protected]>
ae6ad54
to
ec4e3d6
Compare
Related to additional storage entries added by the previous changes. Signed-off-by: Anna Shaleva <[email protected]>
var notaryAssisted = tx.GetAttribute<NotaryAssisted>(); | ||
if (notaryAssisted is not null) | ||
{ | ||
totalNetworkFee -= (notaryAssisted.NKeys + 1) * Policy.GetAttributeFee(engine.SnapshotCache, (byte)notaryAssisted.Type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnnaShaleva AttributeFee
in memory pool can be 1, and during the block persistence can be changed to 2, this could underflow totalNetworkFee
and produce a denial of service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't happen. It's OnPersist and it's executed before any in-block transaction, the value is the same as was used when verifying the transaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, it's pretty similar to tx.Sender
having enough GAS on his account to pay for tx.SystemFee + tx.NetworkFee
, same guarantee level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shargon, do you still have any concern about this issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm agree with @roman-khimov, it will be the same as other attributes, and other fees, but i'm not sure if this is the best way to recollect fees, why not deposit the Gas in the contract as a fee during the execution of the contract (like a regular contract can do)?
Signed-off-by: Anna Shaleva <[email protected]>
var notaryAssisted = tx.GetAttribute<NotaryAssisted>(); | ||
if (notaryAssisted is not null) | ||
{ | ||
totalNetworkFee -= (notaryAssisted.NKeys + 1) * Policy.GetAttributeFee(engine, (byte)notaryAssisted.Type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm agree with @roman-khimov, it will be the same as other attributes, and other fees, but i'm not sure if this is the best way to recollect fees, why not deposit the Gas in the contract as a fee during the execution of the contract (like a regular contract can do)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean deducting this GAS from the user's balance in Notary? This doesn't work in a scenario when third party pays for execution or any other when user is not even signing (as in being a proper signer) the main transaction. Our FS chain transactions are routinely created with the following set of signers:
- proxy contract (holding a lot of GAS)
- alphabet (~validators) multisig
- (optionally) SN key
Transactions generated by IR have two signers, transactions generated by SNs can have three. Either way Proxy contract pays for execution and that's one of the core features for us (hi, #2577), if that wasn't the case we'd have a lot of problems with GAS distribution and spending between all parties (IR/SN). We do have some distribution still, but mostly that's just moving all GAS to proxy because normally IR and SN shouldn't spend any GAS at all from their accounts. Once they've deposited some to the Notary contract and if they're sending correct transactions (IR checks them before approval of course) everything is paid for by the Proxy contract.
So we want to get this fee from the network fee and not some notary account, it's not possible in some cases. We also have a concept of paid attributes now and this just redistributes this attribute fee in a bit more specific manner.
* EC Recover * Clean code * Fix ut * Fix ut * Unify hashing * Allow HashAlgorithm.None * Clean comment * Update src/Neo/Cryptography/Crypto.cs * Fix merge * Add None check * Fix GetHash * fix unit testing issues * Clean code * Update src/Neo/SmartContract/Native/CryptoLib.cs --------- Co-authored-by: Jimmy <[email protected]>
* tests: add UT for nested WitnessCondition This just works as the code works. Signed-off-by: Roman Khimov <[email protected]> * WitnessCondition: unify nesting checks, fix MaxNestingDepth 1. We have some duplication around "maxNestDepth <= 0" checks. 2. If we're to fix them by moving to DeserializeFrom() and thereby affecting all types of conditions we can discover a simple truth about conditions that was hidden previously: our real supported MaxNestingDepth is 3, not 2. 3. Test_WitnessCondition_Nesting works as before, check it there, we have And->And->Boolean and other nesting cases, 3-4 elements in the chain, not 2. Signed-off-by: Roman Khimov <[email protected]> * WitnessCondition: unify JSON parsing as well Signed-off-by: Roman Khimov <[email protected]> * tests: s/WitnessContition/WitnessCondition/ Fix typo. Signed-off-by: Roman Khimov <[email protected]> * Format header * Format arrays in UT_WitnessCondition.cs --------- Signed-off-by: Roman Khimov <[email protected]> Co-authored-by: Shargon <[email protected]> Co-authored-by: Christopher Schuchardt <[email protected]> Co-authored-by: NGD Admin <[email protected]>
* Add Support for plugin loading * Added @shargon request of changes --------- Co-authored-by: Shargon <[email protected]> Co-authored-by: NGD Admin <[email protected]>
* Optimize key builder * Optimize with GetSpan * Use Span * Clean * Rename * Update src/Neo/SmartContract/KeyBuilder.cs Co-authored-by: nan01ab <[email protected]> * Update KeyBuilder.cs * @cschuchardt88 feedback * Avoid ToArray in StorageKey constructor * Use sizeof * Optimize ECPoint * Optimize ECPoint * Add ISerializableSpan * Move to StorageKey * Use ReadOnlySpan --------- Co-authored-by: nan01ab <[email protected]> Co-authored-by: Christopher Schuchardt <[email protected]>
* Add some stuff to hope once and for all fix the linux workflows * update workflow * update nuget.yml * Change dig to detailed, log too big * Fix targets * revert main.yml * Update .github/workflows/main.yml * disable BuildInParallel --------- Co-authored-by: Jimmy <[email protected]> Co-authored-by: Shargon <[email protected]>
342a051
to
8af28d1
Compare
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
How Has This Been Tested?
Checklist: