Skip to content
This repository was archived by the owner on Jun 17, 2021. It is now read-only.

Commit 26bad87

Browse files
authored
Merge branch 'master' into enforce-hex-value-format
2 parents 78626a4 + 615d0c6 commit 26bad87

File tree

2 files changed

+1
-36
lines changed

2 files changed

+1
-36
lines changed

src/account.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const ethjsUtil = require('ethjs-util')
22
import * as assert from 'assert'
33
import * as secp256k1 from 'secp256k1'
44
import * as BN from 'bn.js'
5-
import { toBuffer, zeros, bufferToHex, unpad } from './bytes'
5+
import { toBuffer, zeros, bufferToHex } from './bytes'
66
import { keccak, keccak256, rlphash } from './hash'
77
import { assertIsHexString } from './helpers'
88

@@ -118,14 +118,6 @@ export const generateAddress2 = function(
118118
return address.slice(-20)
119119
}
120120

121-
/**
122-
* Returns true if the supplied address belongs to a precompiled account (Byzantium).
123-
*/
124-
export const isPrecompiled = function(address: Buffer | string): boolean {
125-
const a = unpad(address)
126-
return a.length === 1 && a[0] >= 1 && a[0] <= 8
127-
}
128-
129121
/**
130122
* Checks if the private key satisfies the rules of the curve secp256k1.
131123
*/

test/account.spec.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
generateAddress,
1111
generateAddress2,
1212
toBuffer,
13-
isPrecompiled,
1413
isValidChecksumAddress,
1514
isValidAddress,
1615
toChecksumAddress,
@@ -375,32 +374,6 @@ describe('generateAddress2: EIP-1014 testdata examples', function() {
375374
}
376375
})
377376

378-
describe('isPrecompiled', function() {
379-
it('should return true', function() {
380-
assert.equal(isPrecompiled('0000000000000000000000000000000000000001'), true)
381-
assert.equal(isPrecompiled('0000000000000000000000000000000000000002'), true)
382-
assert.equal(isPrecompiled('0000000000000000000000000000000000000003'), true)
383-
assert.equal(isPrecompiled('0000000000000000000000000000000000000004'), true)
384-
assert.equal(isPrecompiled('0000000000000000000000000000000000000005'), true)
385-
assert.equal(isPrecompiled('0000000000000000000000000000000000000006'), true)
386-
assert.equal(isPrecompiled('0000000000000000000000000000000000000007'), true)
387-
assert.equal(isPrecompiled('0000000000000000000000000000000000000008'), true)
388-
assert.equal(
389-
isPrecompiled(Buffer.from('0000000000000000000000000000000000000001', 'hex')),
390-
true,
391-
)
392-
})
393-
it('should return false', function() {
394-
assert.equal(isPrecompiled('0000000000000000000000000000000000000000'), false)
395-
assert.equal(isPrecompiled('0000000000000000000000000000000000000009'), false)
396-
assert.equal(isPrecompiled('1000000000000000000000000000000000000000'), false)
397-
assert.equal(
398-
isPrecompiled(Buffer.from('0000000000000000000000000000000000000000', 'hex')),
399-
false,
400-
)
401-
})
402-
})
403-
404377
const eip55ChecksumAddresses = [
405378
// All caps
406379
'0x52908400098527886E0F7030069857D2E4169EE7',

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy