Skip to content

Commit fdf2da8

Browse files
authored
revert zkTrielogPlugin changes for older versions of shomei (#60)
* revert zkTrielogPlugin changes for older versions of shomei Signed-off-by: garyschulte <[email protected]>
1 parent 8f88cf1 commit fdf2da8

File tree

10 files changed

+20
-390
lines changed

10 files changed

+20
-390
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## unreleased
4+
5+
## version 0.7.7
6+
* revert trielog metadata changes for trielogs until a new shomei release is tested [#60](https://github.com/Consensys/besu-shomei-plugin/pull/60)
7+
38
## version 0.7.6
49
* update tracer to rc18, besu to 25.11.0-RC1-linea2 [#59](https://github.com/Consensys/besu-shomei-plugin/pull/59)
510
* safe tracer for the besu-shomei-plugin by matkt [#58](https://github.com/Consensys/besu-shomei-plugin/pull/58)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
releaseVersion=0.7.6-SNAPSHOT
1+
releaseVersion=0.7.7-SNAPSHOT
22
besuVersion=25.10.0-RC1-linea2
33
arithmetizationVersion=beta-v4.0-rc18

src/main/java/net/consensys/shomei/rpc/BesuShomeiRpcPlugin.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import net.consensys.shomei.context.ShomeiContext;
1818
import net.consensys.shomei.context.ShomeiContext.ShomeiContextImpl;
1919
import net.consensys.shomei.rpc.methods.ShomeiGetTrieLog;
20-
import net.consensys.shomei.rpc.methods.ShomeiGetTrieLogMetadata;
2120
import net.consensys.shomei.rpc.methods.ShomeiGetTrieLogsByRange;
2221

2322
import java.util.List;
@@ -37,11 +36,7 @@ public class BesuShomeiRpcPlugin implements BesuPlugin {
3736
@Override
3837
public void register(final ServiceManager serviceManager) {
3938
LOG.debug("Registering RPC plugins");
40-
var methods =
41-
List.of(
42-
new ShomeiGetTrieLogsByRange(ctx),
43-
new ShomeiGetTrieLog(ctx),
44-
new ShomeiGetTrieLogMetadata(ctx));
39+
var methods = List.of(new ShomeiGetTrieLogsByRange(ctx), new ShomeiGetTrieLog(ctx));
4540
serviceManager
4641
.getService(RpcEndpointService.class)
4742
.ifPresent(

src/main/java/net/consensys/shomei/rpc/methods/ShomeiGetTrieLogMetadata.java

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/main/java/net/consensys/shomei/trielog/PluginTrieLogLayer.java

Lines changed: 7 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,11 @@
1414
*/
1515
package net.consensys.shomei.trielog;
1616

17-
import net.consensys.shomei.cli.ShomeiCliOptions.ZkTraceComparisonFeature;
18-
1917
import java.util.HashMap;
20-
import java.util.List;
2118
import java.util.Map;
2219
import java.util.Objects;
2320
import java.util.Optional;
24-
import java.util.stream.Collectors;
2521

26-
import com.fasterxml.jackson.annotation.JsonGetter;
27-
import com.fasterxml.jackson.annotation.JsonIgnore;
28-
import com.fasterxml.jackson.annotation.JsonInclude;
2922
import org.apache.commons.lang3.builder.EqualsBuilder;
3023
import org.apache.commons.lang3.builder.HashCodeBuilder;
3124
import org.apache.tuweni.bytes.Bytes;
@@ -44,27 +37,18 @@
4437
* trie changes as well.
4538
*/
4639
@SuppressWarnings("unchecked")
47-
@JsonInclude(JsonInclude.Include.NON_ABSENT)
4840
public record PluginTrieLogLayer(
49-
@JsonIgnore Hash blockHash,
50-
@JsonIgnore Optional<Long> blockNumber,
51-
@JsonIgnore Map<Address, TrieLog.LogTuple<AccountValue>> accounts,
52-
@JsonIgnore Map<Address, TrieLog.LogTuple<Bytes>> code,
53-
@JsonIgnore Map<Address, Map<StorageSlotKey, LogTuple<UInt256>>> storage,
54-
@JsonIgnore boolean frozen,
55-
@JsonIgnore Optional<Integer> zkTraceComparisonFeature)
41+
Hash blockHash,
42+
Optional<Long> blockNumber,
43+
Map<Address, TrieLog.LogTuple<AccountValue>> accounts,
44+
Map<Address, TrieLog.LogTuple<Bytes>> code,
45+
Map<Address, Map<StorageSlotKey, LogTuple<UInt256>>> storage,
46+
boolean frozen)
5647
implements TrieLog {
5748

5849
/** Creates a new PluginTrieLogLayer with blockhash and empty maps to deserialize into. */
5950
public PluginTrieLogLayer(final Hash blockHash) {
60-
this(
61-
blockHash,
62-
Optional.empty(),
63-
new HashMap<>(),
64-
new HashMap<>(),
65-
new HashMap<>(),
66-
true,
67-
Optional.empty());
51+
this(blockHash, Optional.empty(), new HashMap<>(), new HashMap<>(), new HashMap<>(), true);
6852
}
6953

7054
/** Locks the layer so no new changes can be added; */
@@ -144,45 +128,6 @@ public Optional<AccountValue> getAccount(final Address address) {
144128
return Optional.ofNullable(accounts.get(address)).map(LogTuple::getUpdated);
145129
}
146130

147-
// JSON serialization methods for metadata
148-
@JsonGetter("blockHash")
149-
public String getBlockHashHex() {
150-
return blockHash.toHexString();
151-
}
152-
153-
@JsonGetter("blockNumber")
154-
public Long getBlockNumberValue() {
155-
return blockNumber.orElse(null);
156-
}
157-
158-
@JsonGetter("zkTraceComparisonFeatures")
159-
public List<String> getZkTraceComparisonFeatures() {
160-
return zkTraceComparisonFeature
161-
.map(ZkTraceComparisonFeature::fromMask)
162-
.map(enumSet -> enumSet.stream().map(Enum::name).collect(Collectors.toList()))
163-
.orElse(null);
164-
}
165-
166-
@JsonGetter("zkTraceComparisonFeatureMask")
167-
public Integer getZkTraceComparisonFeatureMask() {
168-
return zkTraceComparisonFeature.orElse(null);
169-
}
170-
171-
@JsonGetter("accountChangesCount")
172-
public int getAccountChangesCount() {
173-
return accounts.size();
174-
}
175-
176-
@JsonGetter("codeChangesCount")
177-
public int getCodeChangesCount() {
178-
return code.size();
179-
}
180-
181-
@JsonGetter("storageChangesCount")
182-
public int getStorageChangesCount() {
183-
return storage.values().stream().mapToInt(Map::size).sum();
184-
}
185-
186131
public String dump() {
187132
final StringBuilder sb = new StringBuilder();
188133
sb.append("TrieLog{" + "blockHash=").append(blockHash).append(frozen).append('}');

src/main/java/net/consensys/shomei/trielog/ZkTrieLogFactory.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ public TrieLog create(final TrieLogAccumulator accumulator, final BlockHeader bl
109109
(Map<Address, LogTuple<AccountValue>>) accountsToUpdate,
110110
(Map<Address, LogTuple<Bytes>>) codeToUpdate,
111111
(Map<Address, Map<StorageSlotKey, LogTuple<UInt256>>>) storageToUpdate,
112-
true,
113-
Optional.of(comparisonFeatureMask.get()));
112+
true);
114113
} finally {
115114
ctx.getBlockImportTraceProvider().clear();
116115
}
@@ -282,6 +281,7 @@ public static void writeTo(final TrieLog layer, final RLPOutput output) {
282281
output.writeBytes(layer.getBlockHash());
283282
// optionally write block number
284283
layer.getBlockNumber().ifPresent(output::writeLongScalar);
284+
285285
for (final Address address : addresses) {
286286
output.startList(); // this change
287287
output.writeBytes(address);
@@ -327,10 +327,6 @@ public static void writeTo(final TrieLog layer, final RLPOutput output) {
327327
output.endList(); // this change
328328
}
329329

330-
// optionally write zkTraceComparisonFeature
331-
if (layer instanceof PluginTrieLogLayer pluginLayer) {
332-
pluginLayer.zkTraceComparisonFeature().ifPresent(output::writeInt);
333-
}
334330
output.endList(); // container
335331
}
336332

@@ -416,17 +412,9 @@ public static PluginTrieLogLayer readFrom(final RLPInput input) {
416412
// lenient leave list for forward compatible additions.
417413
input.leaveListLenient();
418414
}
419-
420-
// zkTraceComparisonFeature is optional (read as last element in container, before leaving)
421-
Optional<Integer> zkTraceComparisonFeature =
422-
Optional.of(!input.isEndOfCurrentList())
423-
.filter(isPresent -> isPresent)
424-
.map(__ -> input.readInt());
425-
426415
input.leaveListLenient();
427416

428-
return new PluginTrieLogLayer(
429-
blockHash, blockNumber, accounts, code, storage, true, zkTraceComparisonFeature);
417+
return new PluginTrieLogLayer(blockHash, blockNumber, accounts, code, storage, true);
430418
}
431419

432420
protected static <T> T nullOrValue(final RLPInput input, final Function<RLPInput, T> reader) {

0 commit comments

Comments
 (0)