-
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
GAS price for CheckWitness is too cheap: cost 13 mins with 20GAS #2720
Comments
This opretion can slightly violate 10 seconds per GAS price standard (getExecFeeFactor is 3 instead of 30 for now). |
With 20 GAS for |
Notice that binary deserializer (readArrayOfConditions) does it correctly. Can be checked with neo-project/neo#2720 case.
Have you added the 256 witness rules to the test? |
I've just reproduced your testcase from https://gist.github.com/dusmart/f700d8f87256d61a12746bcb404f9c18 (but have found/fixed some minor JSON incompatibilites between implementations along the way). |
Maybe some improvement in C# such as adding the non-existing key into cache could accelarating this syscall. No fee change is needed. Neo-go maintained a contracts cache so that no real disk access appears and can do it quickly. |
@roman-khimov I found that the real conditions number can be Actually, if the |
And maybe in this case it's better to be slightly incompatible. |
kkkkkkkk |
I think that the problem could be huge if you use a 33 bytes public key, because it will need to create the scriptHash |
We can pay per rule |
That's a great idea. I didn't realize that. I only focused on cache-miss that time. |
Notice that binary deserializer (readArrayOfConditions) does it correctly. Can be checked with neo-project/neo#2720 case.
The syscall
System.Runtime.CheckWitness
can check witness by signer's rules.Although the rule itself is constrained to
MaxSubitems = 16
andMaxNestingDepth = 2
, the check could still be very slow due to cache miss.The max rules can be
MaxSubitems * MaxSubitems * MaxSubitems
theoretically. While the max size is actually limited by the transaction's maxsize (102400) which make theMaxSubitems
andMaxNestingDepth
useless.neo/src/neo/Network/P2P/Payloads/Conditions/CalledByGroupCondition.cs
Lines 38 to 43 in ed68274
POC: https://gist.github.com/dusmart/f700d8f87256d61a12746bcb404f9c18
Attacking Source Code:
The text was updated successfully, but these errors were encountered: