diff --git a/src/main_sm/fork_1/main/full_tracer.cpp b/src/main_sm/fork_1/main/full_tracer.cpp index 8f53e33d2..78d0ba5c8 100644 --- a/src/main_sm/fork_1/main/full_tracer.cpp +++ b/src/main_sm/fork_1/main/full_tracer.cpp @@ -127,6 +127,9 @@ inline void getFromMemory(Context &ctx, mpz_class &offset, mpz_class &length, st uint64_t bytesToRetrieve = (end - double(endFloor)) * 32; result += hexStringEnd.substr(0, bytesToRetrieve * 2); } + + // Limit result memory length in case it is a chunk contained in one single slot + result = result.substr(0, length.get_ui()*2); } // Get a global or context variable diff --git a/src/main_sm/fork_2/main/full_tracer.cpp b/src/main_sm/fork_2/main/full_tracer.cpp index c9c79fa07..572bc3eaa 100644 --- a/src/main_sm/fork_2/main/full_tracer.cpp +++ b/src/main_sm/fork_2/main/full_tracer.cpp @@ -127,6 +127,9 @@ inline void getFromMemory(Context &ctx, mpz_class &offset, mpz_class &length, st uint64_t bytesToRetrieve = (end - double(endFloor)) * 32; result += hexStringEnd.substr(0, bytesToRetrieve * 2); } + + // Limit result memory length in case it is a chunk contained in one single slot + result = result.substr(0, length.get_ui()*2); } // Get a global or context variable diff --git a/src/main_sm/fork_3/main/full_tracer.cpp b/src/main_sm/fork_3/main/full_tracer.cpp index 2844b17ff..0cb85539d 100644 --- a/src/main_sm/fork_3/main/full_tracer.cpp +++ b/src/main_sm/fork_3/main/full_tracer.cpp @@ -127,6 +127,9 @@ inline void getFromMemory(Context &ctx, mpz_class &offset, mpz_class &length, st uint64_t bytesToRetrieve = (end - double(endFloor)) * 32; result += hexStringEnd.substr(0, bytesToRetrieve * 2); } + + // Limit result memory length in case it is a chunk contained in one single slot + result = result.substr(0, length.get_ui()*2); } // Get a global or context variable diff --git a/src/main_sm/fork_4/main/full_tracer.cpp b/src/main_sm/fork_4/main/full_tracer.cpp index acc8a60ab..94e42d558 100644 --- a/src/main_sm/fork_4/main/full_tracer.cpp +++ b/src/main_sm/fork_4/main/full_tracer.cpp @@ -140,6 +140,9 @@ inline zkresult getFromMemory(Context &ctx, mpz_class &offset, mpz_class &length result += hexStringEnd.substr(0, bytesToRetrieve * 2); } + // Limit result memory length in case it is a chunk contained in one single slot + result = result.substr(0, length.get_ui()*2); + return ZKR_SUCCESS; } diff --git a/src/main_sm/fork_5/main/full_tracer.cpp b/src/main_sm/fork_5/main/full_tracer.cpp index 342cf867c..671fe498c 100644 --- a/src/main_sm/fork_5/main/full_tracer.cpp +++ b/src/main_sm/fork_5/main/full_tracer.cpp @@ -141,6 +141,9 @@ inline zkresult getFromMemory(Context &ctx, mpz_class &offset, mpz_class &length result += hexStringEnd.substr(0, bytesToRetrieve * 2); } + // Limit result memory length in case it is a chunk contained in one single slot + result = result.substr(0, length.get_ui()*2); + return ZKR_SUCCESS; }