-
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
Add MaxVerificationGas #1745
Add MaxVerificationGas #1745
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ namespace Neo.SmartContract | |
{ | ||
public static class Helper | ||
{ | ||
private const long MaxVerificationGas = 0_50000000; | ||
|
||
public static UInt160 GetScriptHash(this ExecutionContext context) | ||
{ | ||
return context.GetState<ExecutionContextState>().ScriptHash; | ||
|
@@ -130,6 +132,7 @@ public static UInt160 ToScriptHash(this ReadOnlySpan<byte> script) | |
internal static bool VerifyWitnesses(this IVerifiable verifiable, StoreView snapshot, long gas) | ||
{ | ||
if (gas < 0) return false; | ||
if (gas > MaxVerificationGas) gas = MaxVerificationGas; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this small change already limits? Does it apply to all scripts or just verification? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just verification. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, I don't see how this prevents execution... perhaps this PR is just to add this Max variable, and then it is used in near future to halt executions, right? |
||
|
||
UInt160[] hashes; | ||
try | ||
|
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.
ConsensusPayload
has0_02000000
maybe we should unify these values.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.
ConsensusPayload
doesn't pay, and it only do the simple signature verification.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 think this value should be a part of the policy contract. We may see something on the mainnet that would suggest raising or lowering it, execution cost and GAS price could also change, so we're better be adaptive. And this value is a policy in its essence.
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 don't think it will be changed often.
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.
It's not a bad idea
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 think so as well,better to be in Policy.
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 don't think so. Even this value can be different for each node, it will not have much impact. Because it only effects verifications.
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 see,Erik.
But are there bad aspects in moving it to Policy? In summary,I imagine that it has been good to have been moving parameters to the Native Policy.
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.
We can't put everything into policy.
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.
If we can run large scale applications perhaps we can include many things on the Blockchain Governance Smart Contract, Erik.
I understand that everything may be too much...aheuaheuaea But I still think it is a good practice to move parameters towards there.