Skip to content

Commit 090e1d2

Browse files
Prevent type case exception in OpcodeActionTracer
Signed-off-by: Bilyana Gospodinova <[email protected]>
1 parent 41fdbe8 commit 090e1d2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

web3/src/main/java/org/hiero/mirror/web3/evm/contracts/execution/traceability/OpcodeActionTracer.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,14 @@ private Map<Bytes, Bytes> captureStorage(final MessageFrame frame, final OpcodeT
8888
while (worldUpdater.parentUpdater().isPresent()) {
8989
worldUpdater = worldUpdater.parentUpdater().get();
9090
}
91-
var rootProxyWorldUpdater = (RootProxyWorldUpdater) worldUpdater;
91+
92+
if (!(worldUpdater instanceof RootProxyWorldUpdater rootProxyWorldUpdater)) {
93+
// The storage updates are kept only in the RootProxyWorldUpdater.
94+
// If we don't have one -> something unexpected happened and an attempt to
95+
// get the storage changes from a ProxyWorldUpdater would result in a
96+
// NullPointerException, so in this case just return an empty map.
97+
return Map.of();
98+
}
9299
final var updates = rootProxyWorldUpdater
93100
.getEvmFrameState()
94101
.getTxStorageUsage(true)

0 commit comments

Comments
 (0)