Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check that spilling and limits file contain all counted modules #592

Merged
merged 2 commits into from
Feb 14, 2024
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 @@ -27,6 +27,7 @@
import com.google.common.annotations.VisibleForTesting;
import lombok.extern.slf4j.Slf4j;
import net.consensys.linea.zktracer.ZkTracer;
import net.consensys.linea.zktracer.module.Module;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.PendingTransaction;
import org.hyperledger.besu.datatypes.Transaction;
Expand Down Expand Up @@ -62,6 +63,12 @@ public TraceLineLimitTransactionSelector(
final int overLimitCacheSize) {
this.moduleLimits = moduleLimits;
zkTracer = new ZkTracerWithLog();
for (Module m : zkTracer.getHub().getModulesToCount()) {
if (!moduleLimits.containsKey(m.moduleKey())) {
throw new IllegalStateException(
"Limit for module %s not defined in %s".formatted(m.moduleKey(), limitFilePath));
}
}
zkTracer.traceStartConflation(1L);
this.limitFilePath = limitFilePath;
this.overLimitCacheSize = overLimitCacheSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ public ZkTracer() {
Toml.parse(getClass().getClassLoader().getResourceAsStream("spillings.toml"))
.getTable("spillings");
table.toMap().keySet().forEach(k -> spillings.put(k, Math.toIntExact(table.getLong(k))));

for (Module m : this.hub.getModulesToCount()) {
if (!this.spillings.containsKey(m.moduleKey())) {
throw new IllegalStateException(
"Spilling for module " + m.moduleKey() + " not defined in spillings.toml");
}
}
} catch (final Exception e) {
throw new RuntimeException(e);
}
Expand Down
Loading