Skip to content

Commit

Permalink
Merge pull request #515 from 0xPolygonHermez/fractasy_fix_full_tracer…
Browse files Browse the repository at this point in the history
…_getFromMemory_length

Fix FullTracer::getFromMemory() result length
  • Loading branch information
fractasy authored Aug 22, 2023
2 parents 873bd28 + b16e11b commit e092cc4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main_sm/fork_1/main/full_tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/main_sm/fork_2/main/full_tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/main_sm/fork_3/main/full_tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/main_sm/fork_4/main/full_tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions src/main_sm/fork_5/main/full_tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit e092cc4

Please sign in to comment.