-
Notifications
You must be signed in to change notification settings - Fork 100
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
InvokeTwice #746
Conversation
Won't this negate the use of |
It depends. It may happens even without this changes. |
If both invocations end up the same way, then why do we do the second one? If the result of two invocations is different, then which is the correct one and what should be returned to the user? BTW, network fee can probably be roughly estimated (not precisely, but still). |
The second one is the correct one. |
If we suppose different execution results, then the second run can easily end up in FAULT state just because of insufficient GAS ( |
Why? |
If contract's logic depends on fees it might take some longer branch on the second execution, so the GAS amount from the first execution won't be enough. I'd suggest using I don't see any perfect solution to this, setting some semi-random value or using statistical data to set fees for executions is wrong as well. And code can always check |
The idea is that if a contract's logic depends on fees, it checks if |
While that's the most likely scenario, it's not the only one that can happen. And zero vs non-zero fee can already lead to any kind of change between two invocations, including those that will require more GAS to finish successfully. |
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.
Looks go to me, I just need to test.
{ | ||
tx.SystemFee = Engine.GasConsumed; | ||
tx.NetworkFee = 1_00000000; | ||
Engine = ApplicationEngine.Run(script, Snapshot, container: tx, settings: system.Settings, gas: Engine.GasConsumed, diagnostic: diagnostic); |
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.
So, what if it fails?
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 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
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 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.
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 it can be merged.
Can you verify @superboyiii
@shargon, you have approved in the past, are you in agreement still?
I think that the project should use GasLeft, it's a very specific case that can be solved in this specific smart contract |
So, @shargon, you mean make another change that set GasLeft as default? |
As I understand it's a problem that can be solved by the smart contract |
I think the problem here is more related to the simulation when we invoke RPC, no? |
close as not planed and author agree to close |
Relate #743