Hello,
im trying to to use await time.latest(); but i get error
Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (node_modules/web3-core-helpers/lib/errors.js:43:16)
at XMLHttpRequest.request.onreadystatechange (node_modules/web3-providers-http/lib/index.js:95:32)
at XMLHttpRequestEventTarget.dispatchEvent (node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
at XMLHttpRequest._setReadyState (node_modules/xhr2-cookies/xml-http-request.ts:219:8)
at XMLHttpRequest._onHttpRequestError (node_modules/xhr2-cookies/xml-http-request.ts:379:8)
at ClientRequest. (node_modules/xhr2-cookies/xml-http-request.ts:266:37)
at Socket.socketErrorListener (_http_client.js:427:9)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
even with the most basic test.js:
const { expectRevert, time } = require('@openzeppelin/test-helpers');
contract('X', ([alice, bob, carol, dev, minter]) => {
beforeEach(async () => {
});
it('test', async () => {
await time.latest();
});
});
everything else in any test i did worked except im alwys getting that error with any function that uses time
im using truffle develop and:
"dependencies": {
"@openzeppelin/contracts": "^3.4.0",
"@openzeppelin/test-helpers": "^0.5.6",
"truffle": "^5.1.58",
"truffle-flattener": "^1.4.4"
},
EDIT:
i have noticed it works with a very simple Initial-migration:
Migrations = artifacts.require("Migrations");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};
but with the migration of my own which is:
with
`const Web3 = require('web3');
...
module.exports = async function(deployer, network, accounts) {
`
EDIT2:
probably the error was because i was importing const { expectRevert, time } = require('@openzeppelin/test-helpers');
also in the initial_migration
now its fixed, may i ask if there is an alternative to
time to use in the migration?
id need to do something like this
const eta = (await time.latest()).add(time.duration.hours(9));