Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Fixed checktime to loosen execution time limit for debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjohnson5972 committed Jul 7, 2017
1 parent acca2df commit 06998dc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libraries/chain/wasm_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ namespace eos { namespace chain {

std::chrono::time_point<std::chrono::system_clock> checktimeStart;

#ifdef NDEBUG
const int CHECKTIME_LIMIT = 2000;
#else
const int CHECKTIME_LIMIT = 12000;
#endif

DEFINE_INTRINSIC_FUNCTION0(env,checktime,checktime,none) {
auto dur = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() - checktimeStart);
if (dur.count() > 1500) {
if (dur.count() > CHECKTIME_LIMIT) {
wlog("checktime called ${d}", ("d", dur.count()));
throw checktime_exceeded();
}
Expand Down Expand Up @@ -295,6 +301,8 @@ DEFINE_INTRINSIC_FUNCTION1(env,loopControl,loopControl,i32,i32,i) {
std::vector<Value> invokeArgs(1);
invokeArgs[0] = U32(bytes);

checktimeStart = std::chrono::system_clock::now();

auto result = Runtime::invokeFunction(alloc_function,invokeArgs);

return &memoryRef<char>( current_memory, result.i32 );
Expand Down

0 comments on commit 06998dc

Please sign in to comment.