Unclear error with TimeVault

We are working on deploy a simple TokenTimelock contract

The contract looks like :

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC20/utils/TokenTimelock.sol";


contract AskjaTokenTimelock is TokenTimelock {
    constructor(
        IERC20 token,
        address beneficiary,
        uint256 releaseTime
    ) TokenTimelock(token, beneficiary, releaseTime) {}
}

While running the tests through hardhat we get a error that is difficult to interpret.

We test transfert

  it("transfert 100 COIN to timeVault", async () => {
    var amount = ethers.utils.parseEther("100.0");
    const accounts = await hre.ethers.getSigners();
    await askjaCoin.connect(accounts[0]).transfer(timeVault.address, amount);
    //Time vault balance
    let balance = await getBalance(askjaCoin, timeVault.address);
    // no taxes on the vault
    expect(balance).to.equal("100.0");
  });

We want to test release

  it("does  allows release after time", async () => {
    let balance = await getBalance(coinAdress, timeVault.address);
    const second = 100 ;
    await ethers.provider.send("evm_increaseTime", [second]);
    await ethers.provider.send("evm_mine");
    await timeVault.release();
  });

The error:

  Error: VM Exception while processing transaction: reverted with reason string '1000000000000000000000000000'
    at AskjaTokenTimelock.verifyCallResult (@openzeppelin/contracts/utils/Address.sol:215)
    at AskjaTokenTimelock.functionCallWithValue (@openzeppelin/contracts/utils/Address.sol:138)
    at AskjaTokenTimelock.functionCall (@openzeppelin/contracts/utils/Address.sol:100)
    at AskjaTokenTimelock._callOptionalReturn (@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol:93)
    at AskjaTokenTimelock.safeTransfer (@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol:26)
    at AskjaTokenTimelock.release (@openzeppelin/contracts/token/ERC20/utils/TokenTimelock.sol:79)
    at HardhatNode._mineBlockWithPendingTxs (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:1772:23)
    at HardhatNode.mineBlock (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:466:16)
    at EthModule._sendTransactionAndReturnHash (node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:1496:18)
    at HardhatNetworkProvider.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:118:18)
    at EthersProviderWrapper.send (node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)

What is the origin of the error ?

:computer: Environment

Hardhat ^2.9.3
@openzeppelin/contracts ^4.5.0

This is strange. Can you share a repository where we can reproduce the issue?

I solved the issue by overriding the fuction :

function release() public virtual override {
        require(
            block.timestamp >= releaseTime(),
            "TokenTimelock: current time is before release time"
        );
        uint256 amount = token().balanceOf(address(this));
        require(amount > 0, "TokenTimelock: no tokens to release");
        token().safeApprove(address(this), amount);
        token().safeTransferFrom(address(this), beneficiary(), amount);
    }

I guess it is not the best solution.