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

Add MaxVerificationGas #1745

Merged
merged 3 commits into from
Jul 3, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/neo/SmartContract/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace Neo.SmartContract
{
public static class Helper
{
private const long MaxVerificationGas = 0_50000000;
Copy link
Member

Choose a reason for hiding this comment

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

ConsensusPayload has 0_02000000 maybe we should unify these values.

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.


public static UInt160 GetScriptHash(this ExecutionContext context)
{
return context.GetState<ExecutionContextState>().ScriptHash;
Expand Down Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just verification.

Copy link
Contributor

Choose a reason for hiding this comment

The 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
Expand Down