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

Allow setting Additional GAS to be used in RpcInvoke for RpcServer. Expose overloaded ApplicationEngine.Run allowing a passed Snapshot. #397

Merged
merged 11 commits into from
Oct 17, 2018

Conversation

jsolman
Copy link
Contributor

@jsolman jsolman commented Sep 25, 2018

It was reported (#396) that invoke calls prior to 2.9.0 supported more than 10 GAS limit. There should be some limit, but not 10 since it helps batch results coming back to clients. This raises the limit to 300 GAS.

Note: It was reported Neon wallet currently makes invokes that use between 40 and 50 GAS.

Also, some users of neo core want to run against a snapshot that may not be the current block. I'm exposing a mechanism to do this with the overloaded ApplicationEngine.Run method.

Close #396

@jsolman jsolman changed the title Allow up to 300 GAS to be used in RpcInvoke. Expose overloaded ApplicationEngine.Run allowing a passed Snapshot. Allow up to 1000 GAS to be used in RpcInvoke. Expose overloaded ApplicationEngine.Run allowing a passed Snapshot. Sep 26, 2018
@jsolman
Copy link
Contributor Author

jsolman commented Sep 26, 2018

In case someone wants to test to see how much invoking a contract will cost -- decided to increase the limit to 1000

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

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

The GAS limit, could be configured on the settings?

@jsolman
Copy link
Contributor Author

jsolman commented Sep 26, 2018

Ok, but shouldn’t it still be allowed to be overridden when calling ApplicationEngine.Run
Want to add it to the settings as a separate PR after this?

@shargon
Copy link
Member

shargon commented Sep 26, 2018

Just for RPC

@jsolman
Copy link
Contributor Author

jsolman commented Sep 26, 2018

There are potentially other uses of ApplicationEngine.Run outside of the core that will want to override it. As for ways to proceed related to adding a setting for RPC here are options:

  1. approve it now and add a setting as a separate PR
  2. wait a few days for my priorities to die down and I'll add it to this PR myself
  3. add the setting yourself and commit it on this branch and then you can approve

@jsolman
Copy link
Contributor Author

jsolman commented Sep 27, 2018

Thank you, looks good

@erikzhang
Copy link
Member

I am afraid that 1000 gas is not enough for an exchange with millions of addresses.

I feel that the invoke* series API must be run without the gas limit.

For dos attacks, the RPC server operator should turn on the firewall to block external access; the public server should use the RpcDisabled plugin to block these dangerous APIs.

@jsolman
Copy link
Contributor Author

jsolman commented Sep 28, 2018

Then let an exchange increase it for their nodes only. People run public Rpc nodes, right? Or are you discouraging that?

@shargon
Copy link
Member

shargon commented Sep 29, 2018

We can set by default 100.000 of GAS or more, but the feature is good for me

@erikzhang
Copy link
Member

https://github.com/neo-project/neo-cli/blob/13773f78ae7f7ccc78ae0aca1c7ff2f86a499f40/neo-cli/config.json#L11-L15

Do you mean that the exchange can modify the maximum allowed gas by setting the config.json file?

@jsolman
Copy link
Contributor Author

jsolman commented Sep 30, 2018

Yes, a configuration setting such as that seems appropriate. The StartRpc method of NeoSystem should pass the parameter along so it can be configured properly from neo-cli or whatever top level package is being used with the NEO core. I’ll adjust the PR for that sometime in the next couple days.

@shargon
Copy link
Member

shargon commented Sep 30, 2018

Exactly this @erikzhang , the idea is set this max on config.json, anyone could set his max according to his necessities

{
using (Snapshot snapshot = Blockchain.Singleton.GetSnapshot())
snapshot.PersistingBlock = persistingBlock ?? new Block
Copy link
Member

Choose a reason for hiding this comment

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

If snapshot.PersistingBlock is not null and persistentBlock is null, should we keep the original value instead of creating a new block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. I’ll make that change.

@comountainclimber
Copy link

comountainclimber commented Oct 11, 2018

Do we have an estimate of when we will be able get this work merged in?

@jsolman
Copy link
Contributor Author

jsolman commented Oct 12, 2018 via email

@jsolman
Copy link
Contributor Author

jsolman commented Oct 13, 2018

It's ready for review again, and can be merged if @erikzhang doesn't have any further concerns.

@jsolman jsolman changed the title Allow up to 1000 GAS to be used in RpcInvoke. Expose overloaded ApplicationEngine.Run allowing a passed Snapshot. Allow setting Additional GAS to be used in RpcInvoke for RpcServer. Expose overloaded ApplicationEngine.Run allowing a passed Snapshot. Oct 17, 2018
@jsolman
Copy link
Contributor Author

jsolman commented Oct 17, 2018

Lol, I think it is finally ready now.

@erikzhang erikzhang merged commit fbb273e into master Oct 17, 2018
@erikzhang erikzhang deleted the MoreGasForRpcInvoke branch October 17, 2018 08:53
Thacryba pushed a commit to simplitech/neo that referenced this pull request Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants