Skip to content

Getting "Priority too low" error on OZ tests #463

@bee344

Description

@bee344

Component

Anvil

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

No response

What version of Foundryup are you on?

No response

What command(s) is the bug in?

No response

Operating System

Linux

Describe the bug

🔄 Reproduction Steps

  • git clone [email protected]:OpenZeppelin/openzeppelin-contracts.git
  • git checkout v5.5.0
  • npm i --save-dev @parity/hardhat-polkadot
  • Run cargo build -p anvil-polkadot from commit 6cfcc7b8a50cf4e92d0dedc9315f1bea4e92849f and place the binary in the OZ directory.
  • Update the hardhat.config file with :
/// ENVVAR
// - COMPILER:      compiler version (default: 0.8.27)
// - SRC:           contracts folder to compile (default: contracts)
// - RUNS:          number of optimization runs (default: 200)
// - IR:            enable IR compilation (default: false)
// - COVERAGE:      enable coverage report (default: false)
// - GAS:           enable gas report (default: false)
// - COINMARKETCAP: coinmarketcap api key for USD value in gas report
// - CI:            output gas report to file instead of stdout

const fs = require('fs');
const path = require('path');

const { argv } = require('yargs/yargs')()
  .env('')
  .options({
    // Compilation settings
    compiler: {
      alias: 'compileVersion',
      type: 'string',
      default: '0.8.27',
    },
    src: {
      alias: 'source',
      type: 'string',
      default: 'contracts',
    },
    runs: {
      alias: 'optimizationRuns',
      type: 'number',
      default: 200,
    },
    ir: {
      alias: 'enableIR',
      type: 'boolean',
      default: false,
    },
    evm: {
      alias: 'evmVersion',
      type: 'string',
      default: 'prague',
    },
    // Extra modules
    coverage: {
      type: 'boolean',
      default: false,
    },
    gas: {
      alias: 'enableGasReport',
      type: 'boolean',
      default: false,
    },
    coinmarketcap: {
      alias: 'coinmarketcapApiKey',
      type: 'string',
    },
  });

require('@parity/hardhat-polkadot');
require('@nomicfoundation/hardhat-chai-matchers');
require('@nomicfoundation/hardhat-ethers');
require('hardhat-exposed');
require('hardhat-gas-reporter');
require('hardhat-ignore-warnings');
require('hardhat-predeploy');
require('solidity-coverage');
require('solidity-docgen');

for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) {
  require(path.join(__dirname, 'hardhat', f));
}

/**
 * @type import('hardhat/config').HardhatUserConfig
 */
module.exports = {
  solidity: {
    version: argv.compiler,
    settings: {
      optimizer: {
        enabled: true,
        runs: argv.runs,
      },
      evmVersion: argv.evm,
      viaIR: argv.ir,
      outputSelection: { '*': { '*': ['storageLayout'] } },
    },
  },
  warnings: {
    'contracts-exposed/**/*': {
      'code-size': 'off',
      'initcode-size': 'off',
    },
    '*': {
      'unused-param': !argv.coverage, // coverage causes unused-param warnings
      'transient-storage': false,
      default: 'error',
    },
  },
  networks: {
    hardhat: {
      polkadot: {
        target: "evm"
      },
      nodeConfig: {
        useAnvil: true,
        nodeBinaryPath: './anvil-polkadot',
        dev: true,
        consensus: {
          seal: "instant-seal",
        },
        rpcPort: 8000,
      },
      adapterConfig: {
        adapterBinaryPath: './eth-rpc',
        dev: true,
      },
    },
    localNode: {
      polkadot: {
        target: "evm",
      },
      url: "http://127.0.0.1:8545"
    }
  },
  resolc: {
    version: "0.5.0",
  },
  exposed: {
    imports: true,
    initializers: true,
    exclude: ['vendor/**/*', '**/*WithInit.sol'],
  },
  gasReporter: {
    enabled: argv.gas,
    showMethodSig: true,
    includeBytecodeInJSON: true,
    currency: 'USD',
    coinmarketcap: argv.coinmarketcap,
  },
  paths: {
    sources: argv.src,
    artifacts: "artifacts-pvm",
    cache: "cache-pvm",
  },
  docgen: require('./docs/config'),
};
  • npm i
  • npx hardhat test > output.log

This results in around 202 tests failing with Priority is too low, which pass on the dirty-node

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions