Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,29 @@ void trace(Trace.Blake2fmodexpdata trace, final int stamp) {
final UnsignedByte stampByte = UnsignedByte.of(stamp);

if (modexpMetaData.isPresent()) {
traceBase(trace, stampByte);
traceExponent(trace, stampByte);
traceModulus(trace, stampByte);
traceModexpResult(trace, stampByte);
traceBase(trace, stamp);
traceExponent(trace, stamp);
traceModulus(trace, stamp);
traceModexpResult(trace, stamp);
return;
}

if (blake2fComponents.isPresent()) {
traceData(trace, stampByte);
traceParameter(trace, stampByte);
traceBlakeResult(trace, stampByte);
traceData(trace, stamp);
traceParameter(trace, stamp);
traceBlakeResult(trace, stamp);
}
}

private void traceData(Trace.Blake2fmodexpdata trace, UnsignedByte stamp) {
private void traceData(Trace.Blake2fmodexpdata trace, int stamp) {
final Bytes input = blake2fComponents.get().getHashInput();
for (int index = 0; index <= INDEX_MAX_BLAKE_DATA; index++) {
commonTrace(trace, stamp, index, input, INDEX_MAX_BLAKE_DATA);
trace.phase(UnsignedByte.of(PHASE_BLAKE_DATA)).isBlakeData(true).fillAndValidateRow();
}
}

private void traceParameter(Trace.Blake2fmodexpdata trace, UnsignedByte stamp) {
private void traceParameter(Trace.Blake2fmodexpdata trace, int stamp) {
// r
commonTrace(
trace, stamp, 0, leftPadTo(blake2fComponents.get().r(), LLARGE), INDEX_MAX_BLAKE_PARAMS);
Expand All @@ -123,23 +123,23 @@ private void traceParameter(Trace.Blake2fmodexpdata trace, UnsignedByte stamp) {
trace.phase(UnsignedByte.of(PHASE_BLAKE_PARAMS)).isBlakeParams(true).fillAndValidateRow();
}

private void traceBlakeResult(Trace.Blake2fmodexpdata trace, UnsignedByte stamp) {
private void traceBlakeResult(Trace.Blake2fmodexpdata trace, int stamp) {
final Bytes hash = computeBlake2fResult();
for (int index = 0; index <= INDEX_MAX_BLAKE_RESULT; index++) {
commonTrace(trace, stamp, index, hash, INDEX_MAX_BLAKE_RESULT);
trace.phase(UnsignedByte.of(PHASE_BLAKE_RESULT)).isBlakeResult(true).fillAndValidateRow();
}
}

private void traceBase(Trace.Blake2fmodexpdata trace, final UnsignedByte stamp) {
private void traceBase(Trace.Blake2fmodexpdata trace, final int stamp) {
final Bytes input = leftPadTo(modexpMetaData.get().base(), MODEXP_COMPONENT_BYTE_SIZE);
for (int index = 0; index <= INDEX_MAX_MODEXP_BASE; index++) {
commonTrace(trace, stamp, index, input, INDEX_MAX_MODEXP_BASE);
trace.phase(UnsignedByte.of(PHASE_MODEXP_BASE)).isModexpBase(true).fillAndValidateRow();
}
}

private void traceExponent(Trace.Blake2fmodexpdata trace, final UnsignedByte stamp) {
private void traceExponent(Trace.Blake2fmodexpdata trace, final int stamp) {
final Bytes input = leftPadTo(modexpMetaData.get().exp(), MODEXP_COMPONENT_BYTE_SIZE);
for (int index = 0; index <= INDEX_MAX_MODEXP_EXPONENT; index++) {
commonTrace(trace, stamp, index, input, INDEX_MAX_MODEXP_EXPONENT);
Expand All @@ -150,15 +150,15 @@ private void traceExponent(Trace.Blake2fmodexpdata trace, final UnsignedByte sta
}
}

private void traceModulus(Trace.Blake2fmodexpdata trace, final UnsignedByte stamp) {
private void traceModulus(Trace.Blake2fmodexpdata trace, final int stamp) {
final Bytes input = leftPadTo(modexpMetaData.get().mod(), MODEXP_COMPONENT_BYTE_SIZE);
for (int index = 0; index <= INDEX_MAX_MODEXP_MODULUS; index++) {
commonTrace(trace, stamp, index, input, INDEX_MAX_MODEXP_MODULUS);
trace.phase(UnsignedByte.of(PHASE_MODEXP_MODULUS)).isModexpModulus(true).fillAndValidateRow();
}
}

private void traceModexpResult(Trace.Blake2fmodexpdata trace, final UnsignedByte stamp) {
private void traceModexpResult(Trace.Blake2fmodexpdata trace, final int stamp) {
final Bytes input = leftPadTo(modexpMetaData.get().rawResult(), MODEXP_COMPONENT_BYTE_SIZE);
for (int index = 0; index <= INDEX_MAX_MODEXP_RESULT; index++) {
commonTrace(trace, stamp, index, input, INDEX_MAX_MODEXP_RESULT);
Expand All @@ -167,9 +167,9 @@ private void traceModexpResult(Trace.Blake2fmodexpdata trace, final UnsignedByte
}

private void commonTrace(
Trace.Blake2fmodexpdata trace, UnsignedByte stamp, int index, Bytes input, int indexMax) {
Trace.Blake2fmodexpdata trace, int stamp, int index, Bytes input, int indexMax) {
trace
.stamp(stamp.toInteger())
.stamp(stamp)
.id(id)
.index(UnsignedByte.of(index))
.indexMax(UnsignedByte.of(indexMax))
Expand Down
2 changes: 1 addition & 1 deletion linea-constraints
Loading