Skip to content

Commit

Permalink
convert eip api test for 2537 to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanio committed Sep 18, 2020
1 parent 600588a commit a9f9b60
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
const BN = require('bn.js')
const tape = require('tape')
const Common = require('@ethereumjs/common').default
const VM = require('../../../dist/index').default
const { isRunningInKarma } = require('../../util')
import * as tape from 'tape'
import { BN } from 'ethereumjs-util'
import Common from '@ethereumjs/common'
import VM from '../../../dist'
import { isRunningInKarma } from '../../util'

const precompileAddressStart = 0x0a
const precompileAddressEnd = 0x12

const precompiles = []
const precompiles: string[] = []

for (let address = precompileAddressStart; address <= precompileAddressEnd; address++) {
precompiles.push(address.toString(16).padStart(40, '0'))
}

const dir = './tests/api/berlin/'

tape('EIP-2537 BLS tests', (t) => {
t.test('BLS precompiles should not be available if EIP not activated', async (st) => {
if (isRunningInKarma()) {
Expand All @@ -27,9 +25,9 @@ tape('EIP-2537 BLS tests', (t) => {
for (let address of precompiles) {
const result = await vm.runCall({
caller: Buffer.from('0000000000000000000000000000000000000000', 'hex'),
gasLimit: new BN(0xffffffffff),
gasLimit: new BN(0xffffffffff).toArrayLike(Buffer),
to: Buffer.from(address, 'hex'),
value: new BN(0),
value: new BN(0).toArrayLike(Buffer),
data: Buffer.alloc(0),
})

Expand Down Expand Up @@ -58,9 +56,9 @@ tape('EIP-2537 BLS tests', (t) => {
for (let address of precompiles) {
const result = await vm.runCall({
caller: Buffer.from('0000000000000000000000000000000000000000', 'hex'),
gasLimit: gasLimit,
gasLimit: gasLimit.toArrayLike(Buffer),
to: Buffer.from(address, 'hex'),
value: new BN(0),
value: new BN(0).toArrayLike(Buffer),
data: Buffer.alloc(0),
})

Expand Down

1 comment on commit a9f9b60

@github-actions
Copy link

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: a9f9b60 Previous: 601026b Ratio
Block 9422905 1891 ops/sec (±2.28%) 1951 ops/sec (±3.65%) 1.03
Block 9422906 1736 ops/sec (±7.58%) 1842 ops/sec (±7.02%) 1.06
Block 9422907 1870 ops/sec (±1.34%) 1928 ops/sec (±1.10%) 1.03
Block 9422908 1848 ops/sec (±1.44%) 1898 ops/sec (±1.29%) 1.03
Block 9422909 1743 ops/sec (±1.58%) 1848 ops/sec (±1.45%) 1.06
Block 9422910 1426 ops/sec (±14.48%) 1843 ops/sec (±1.44%) 1.29
Block 9422911 1775 ops/sec (±2.10%) 1556 ops/sec (±12.15%) 0.88
Block 9422912 1774 ops/sec (±1.11%) 1601 ops/sec (±9.54%) 0.90
Block 9422913 1707 ops/sec (±1.51%) 1826 ops/sec (±1.33%) 1.07
Block 9422914 1702 ops/sec (±1.67%) 1732 ops/sec (±1.70%) 1.02

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.