I'm running a test on a very simple pool contract. I am using Mocha to write the tests, but Hardhat's network to run them. After firing up my Hardhat node I get the 10 test accounts per usual with their test ETH, and I then try to reference a handful of those accounts in the test using Mocha's contract() function. However, my terminal reads the following when running the test itself:
Error: This method only supports Buffer but input was: <private key>
...where <private key> was the private key of my first test account I was looking to reference. Whenever I have this exact same testing setup when working with Truffle/Ganache exclusively this never came up, so I'm wondering if there is something breaking because I am using both Hardhat & Truffle concurrently; does Hardhat pass back a different value than Truffle does? I was always under the impression that the conversion from the private key to the buffer happened under the hood when using Truffle/Hardhat. Is there an explanation and a workaround for this?
For reference, here is my test file as well:
const { assert } = require('chai');
const Pool = artifacts.require('Pool.sol');
contract('Pool', ([accounts]) => {
const [admin, user1, user2, user3, _] = accounts;
it('should accept deposits and read correct balances for contract and users', async () => {
const pool = await Pool.new('Pool', true);
await pool.makeDeposit({
from: user1,
value: web3.utils.toWei('1'),
});
await pool.makeDeposit({
from: user2,
value: web3.utils.toWei('1'),
});
await pool.makeDeposit({
from: user3,
value: web3.utils.toWei('2'),
});
await pool.getPoolBalance();
});
});
Thank you!