<commit_before>import * as tape from 'tape'
import { BN } from 'ethereumjs-util'
import VM from '../../../lib'
import Common from '@ethereumjs/common'
import { inspect } from 'util'

// Test cases source: https://gist.github.com/holiman/174548cad102096858583c6fbbb0649a
tape('EIP 2929: gas cost tests', (t) => {
  const initialGas = new BN(0xffffffffff)
  const address = Buffer.from('000000000000000000000000636F6E7472616374', 'hex')
  const common = new Common({ chain: 'mainnet', hardfork: 'berlin', eips: [2929] })

  const runTest = async function (test: any, st: tape.Test) {
    let i = 0
    let currentGas = initialGas
    const vm = new VM({ common })

    vm.on('step', function (step: any) {
      const gasUsed = currentGas.sub(step.gasLeft)
      currentGas = step.gasLeft

      if (test.steps.length) {
        st.equal(step.opcode.name, test.steps[i].expectedOpcode)

        // Validates the gas consumption of the (i - 1)th opcode
        // b/c the step event fires before gas is debited.
        // The first opcode of every test should be +/- irrelevant<commit_msg>Fix tape import (for config 2.0 rebase)<commit_after>import tape from 'tape'
import { BN } from 'ethereumjs-util'
import VM from '../../../lib'
import Common from '@ethereumjs/common'
import { inspect } from 'util'

// Test cases source: https://gist.github.com/holiman/174548cad102096858583c6fbbb0649a
tape('EIP 2929: gas cost tests', (t) => {
  const initialGas = new BN(0xffffffffff)
  const address = Buffer.from('000000000000000000000000636F6E7472616374', 'hex')
  const common = new Common({ chain: 'mainnet', hardfork: 'berlin', eips: [2929] })

  const runTest = async function (test: any, st: tape.Test) {
    let i = 0
    let currentGas = initialGas
    const vm = new VM({ common })

    vm.on('step', function (step: any) {
      const gasUsed = currentGas.sub(step.gasLeft)
      currentGas = step.gasLeft

      if (test.steps.length) {
        st.equal(step.opcode.name, test.steps[i].expectedOpcode)

        // Validates the gas consumption of the (i - 1)th opcode
        // b/c the step event fires before gas is debited.
        // The first opcode of every test should be +/- irrelevant
{'fraction_non_alphanumeric': 0.1266514806378132, 'fraction_numerical': 0.06651480637813212, 'mean_word_length': 3.2393822393822393, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4377162', 'n_tokens_mistral': 827, 'n_tokens_neox': 704, 'n_words': 220}