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

InvokeTwice #746

Closed
wants to merge 9 commits into from
Closed
Changes from 6 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
7 changes: 7 additions & 0 deletions src/RpcServer/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Neo.SmartContract.Native;
using System;
using System.Collections.Generic;
using Neo.VM;

namespace Neo.Plugins
{
Expand All @@ -41,6 +42,12 @@ public Session(NeoSystem system, byte[] script, Signer[] signers, Witness[] witn
Witnesses = witnesses
};
Engine = ApplicationEngine.Run(script, Snapshot, container: tx, settings: system.Settings, gas: gas, diagnostic: diagnostic);
if (Engine.State == VMState.HALT && tx != null)
{
tx.SystemFee = Engine.GasConsumed;
erikzhang marked this conversation as resolved.
Show resolved Hide resolved
tx.NetworkFee = 1_00000000;
Engine = ApplicationEngine.Run(script, Snapshot, container: tx, settings: system.Settings, gas: Engine.GasConsumed, diagnostic: diagnostic);
Copy link
Contributor

Choose a reason for hiding this comment

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

So, what if it fails?

Copy link
Member

Choose a reason for hiding this comment

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

If it fails it will be a good change, because before it was HALT.
The flow looks like to be the same, @roman-khimov, nothing will change from the original flow, it just add a more precise gas limit

Copy link
Contributor

Choose a reason for hiding this comment

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

If it fails it will be a good change, because before it was HALT.

But what's good about it? Estimation failed? How do I send a transaction then?

I know these things are not likely to happen, but contracts checking fees shouldn't exist as well and yet they do.

it just add a more precise gas limit

For normal contracts it changes nothing (except for additional execution overhead), for strange contracts that care about fee values it can lead to any result --- some will work, some will fail.

}
ResetExpiration();
}

Expand Down