I get this error on running the test function in my NEAR protocol:
[Stack]: RuntimeError: memory access out of bounds
Here is my test function:
describe("Main Flow", () => {
it('Tests the flow of the app', () => {
setContext('hamzatest.testnet', u128.from(0));
const service1 = contract.addService('gloriajeans.testnet', 'Gloria Jeans', 'Free Coffee', '2023-07-10T15:00:00.000');
}); });
Here is the function:
@mutateState()
addService(provider: string, title: string, description: string, expiryDate: string): Service {
let expiryDateTimestamp: u64 = Date.fromString(expiryDate).getTime();
let currentTime: u64 = this._toMillisecond(context.blockTimestamp);
assert(expiryDateTimestamp > currentTime, Constants.INVALID_EXPIRY_DATE);
let id = (provider + '/' + currentTime.toString()).toUpperCase();
let service = new Service(
id,
provider,
title,
description,
0,
currentTime,
expiryDateTimestamp
);
this.services.set(id, service);
this.services_ids.push(id);
return service;
}
Any idea why?