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

blockchain/vm: bn256 gas cost change (eip1108) #987

Merged
merged 3 commits into from
Jun 24, 2021

Conversation

yoomee1313
Copy link
Contributor

@yoomee1313 yoomee1313 commented Jun 2, 2021

Proposed changes

  • This PR contains istanbul hardfork item. It is not activated yet since istanbulCompatible block number is set nil.
  • This PR is derived from ethereum/go-ethereum@beff5fa, and core/vm/contracts.go and params/protocol_params.go are referenced.
  • Unlike ethereum, klaytn has computationCost concept, so bn256 computationCost need to be revised too. However, eip1108's purpose is to reflect the performance improvement by adopting cloudflare library, but klaytn already have this library before computationCost concept is introduced. So, computationCost is not revised at here.
  • Main change
    • Bn256AddGas: 500 -> 150
    • Bn256ScalarMulGas: 40000 -> 6000
    • Bn256PairingBaseGas: 100000 -> 45000, Bn256PairingPerPointGas: 80000 -> 34000

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

aidan-kwon
aidan-kwon previously approved these changes Jun 3, 2021
Copy link
Member

@aidan-kwon aidan-kwon left a comment

Choose a reason for hiding this comment

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

LGTM

ehnuje
ehnuje previously approved these changes Jun 4, 2021
KimKyungup
KimKyungup previously approved these changes Jun 4, 2021
Copy link
Contributor

@KimKyungup KimKyungup left a comment

Choose a reason for hiding this comment

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

LGTM .

I think you can make some unit test for checking used gas. @yoomee1313

@yoomee1313 yoomee1313 dismissed stale reviews from KimKyungup, ehnuje, and aidan-kwon via 1a921ad June 8, 2021 04:41
@yoomee1313
Copy link
Contributor Author

yoomee1313 commented Jun 8, 2021

@KimKyungup TestBn256GasCost test function is added at 121ea5d for checking bn256 used gas cost! Also, evm_test.go is refactored a bit due to duplication.

@yoomee1313 yoomee1313 force-pushed the bn128-gascost-change-eip1108 branch from 1a921ad to 121ea5d Compare June 8, 2021 08:28
@yoomee1313 yoomee1313 removed the request for review from hyochan-brown June 11, 2021 00:19
@yoomee1313
Copy link
Contributor Author

@KimKyungup @ehnuje please take a look when you have a time

@aidan-kwon
Copy link
Member

@yoomee1313 Let's merge this PR.

@yoomee1313 yoomee1313 merged commit 170f637 into klaytn:dev Jun 24, 2021
@yoomee1313 yoomee1313 deleted the bn128-gascost-change-eip1108 branch June 24, 2021 07:52
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.

None yet

4 participants