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

core/vm: metropolis precompiles #14959

Merged
merged 4 commits into from Aug 15, 2017

Conversation

Projects
None yet
4 participants
@karalabe
Member

karalabe commented Aug 10, 2017

  • EIP 197: Precompiled contracts for pairing function check.
  • EIP 198: Precompiled contract for bigint modular exponentiation.
  • EIP 213 (196): Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128.

@karalabe karalabe added the metropolis label Aug 10, 2017

@karalabe karalabe referenced this pull request Aug 10, 2017

Closed

Metropolis aggregate PR #14726

7 of 8 tasks complete

@karalabe karalabe changed the title from [WIP] Metropolis precompiles to Metropolis precompiles Aug 11, 2017

@fjl fjl changed the title from Metropolis precompiles to core/vm: metropolis precompiles Aug 11, 2017

@karalabe

This comment has been minimized.

Show comment
Hide comment
@karalabe

karalabe Aug 11, 2017

Member

@fjl PTAL

Member

karalabe commented Aug 11, 2017

@fjl PTAL

@karalabe

This comment has been minimized.

Show comment
Hide comment
@karalabe
Member

karalabe commented Aug 11, 2017

@holiman PTAL

Show outdated Hide outdated core/vm/contracts.go
Show outdated Hide outdated core/vm/contracts.go
@karalabe

This comment has been minimized.

Show comment
Hide comment
@karalabe

karalabe Aug 14, 2017

Member

@holiman PTAL, last commit addresses your brought up issues.

Member

karalabe commented Aug 14, 2017

@holiman PTAL, last commit addresses your brought up issues.

Show outdated Hide outdated crypto/bn256/util.go
Show outdated Hide outdated core/vm/contracts.go
@fjl

fjl approved these changes Aug 14, 2017

karalabe and others added some commits Aug 10, 2017

core/vm: polish precompile contract code, add tests and benches
 * Update modexp gas calculation to new version
 * Fix modexp modulo 0 special case to return zero

@karalabe karalabe added this to the 1.7.0 milestone Aug 14, 2017

@@ -34,7 +34,21 @@ func calcMemSize(off, l *big.Int) *big.Int {
// getData returns a slice from the data based on the start and size and pads
// up to size with zero's. This function is overflow safe.
func getData(data []byte, start, size *big.Int) []byte {
func getData(data []byte, start uint64, size uint64) []byte {

This comment has been minimized.

@holiman

holiman Aug 14, 2017

Contributor

Comment says this function is overflow safe. It's not..

@holiman

holiman Aug 14, 2017

Contributor

Comment says this function is overflow safe. It's not..

This comment has been minimized.

@karalabe

karalabe Aug 14, 2017

Member

Overflow safe as in you can index outside of the bounds.

@karalabe

karalabe Aug 14, 2017

Member

Overflow safe as in you can index outside of the bounds.

if start > length {
start = length
}
end := start + size

This comment has been minimized.

@holiman

holiman Aug 14, 2017

Contributor

Though, I guess it would be overflow safe if you ensured that end >= start ?

@holiman

holiman Aug 14, 2017

Contributor

Though, I guess it would be overflow safe if you ensured that end >= start ?

This comment has been minimized.

@karalabe

karalabe Aug 14, 2017

Member

Well, if start + size can overflow a uint64, the big version of this method should be used.

@karalabe

karalabe Aug 14, 2017

Member

Well, if start + size can overflow a uint64, the big version of this method should be used.

@karalabe karalabe merged commit 9facf64 into ethereum:master Aug 15, 2017

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
commit-message-check/gitcop All commit messages are valid
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment