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

Should adjust some opcode price #1863

Closed
Qiao-Jin opened this issue Aug 21, 2020 · 5 comments
Closed

Should adjust some opcode price #1863

Qiao-Jin opened this issue Aug 21, 2020 · 5 comments
Labels
Discussion Initial issue state - proposed but not yet accepted

Comments

@Qiao-Jin
Copy link
Contributor

Qiao-Jin commented Aug 21, 2020

Summary or problem description

Price of some opcodes should be adjusted to prevent DoS attack as shown below:

(1) EQUAL

Opcode EQUAL can be severely time exhausting for ByteString. Detailed info can be seen in #1855 .

(2) REVERSEN & REVERSEITEMS

Currently price of Opcode.REVERSEN is 400 GasFactor. After testing, it shows running EvaluationStack.Reverse(2048) on a 2048-sized context for 250,000 times (which means 1 GAS) will assume 1 second, which is somehow too long for 1 Gas.

(3) NEWBUFFER

Currently the maximum size of a buffer is defined to be 1Mb. As the MaxStackSize = 2048, that means by NEWBUFFER as much as 2GB's RAM can be exhausted with merely 1.64 GAS.

(4) NEWARRAY & NEWARRAY_T

Similiar with NEWBUFFER, here as much as 2GB's RAM can be exhausted with merely 0.3 GAS.

Neo Version

  • Neo 3

Where in the software does this update applies to?

  • SDK
  • VM
@Qiao-Jin Qiao-Jin added the Discussion Initial issue state - proposed but not yet accepted label Aug 21, 2020
@erikzhang
Copy link
Member

We charge for CPU time and storage only. Memory usage is limited, but not charging.

@Qiao-Jin
Copy link
Contributor Author

Is 1 second per GAS price standard by design? Maybe this is somehow too cheap to prevent attack by malfactors.

@erikzhang
Copy link
Member

Is 1 second per GAS price standard by design?

Yes.

@Qiao-Jin
Copy link
Contributor Author

Closed as these are by design

@roman-khimov
Copy link
Contributor

Is 1 second per GAS price standard by design?

Yes.

Then 1 GAS should cost something close to 0.0000166667 USD?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Initial issue state - proposed but not yet accepted
Projects
None yet
Development

No branches or pull requests

3 participants