Skip to content

Commit

Permalink
Ignore unknown objects in allocations
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
  • Loading branch information
fab-10 committed Apr 24, 2024
1 parent fb1f568 commit 0889ee4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -21,7 +21,6 @@

import java.io.IOException;
import java.math.BigInteger;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
Expand Down Expand Up @@ -168,8 +167,7 @@ private static URL jsonConfigSource(final String resourceName) {
*/
public static String jsonConfig(final NetworkName network) {
try {
return Resources.toString(
network.getGenesisFileResource(), StandardCharsets.UTF_8);
return Resources.toString(network.getGenesisFileResource(), StandardCharsets.UTF_8);
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
Expand Up @@ -163,6 +163,7 @@ public GenesisAccount next() {
Bytes code = null;
Map<UInt256, UInt256> storage = Map.of();
Bytes32 privateKey = null;
parser.nextToken(); // consume start object
while (parser.nextToken() != JsonToken.END_OBJECT) {
switch (normalizeKey(parser.currentName())) {
case "nonce":
Expand Down Expand Up @@ -192,6 +193,10 @@ public GenesisAccount next() {
}
break;
}
if (parser.currentToken() == JsonToken.START_OBJECT) {
// ignore any unknown nested object
parser.skipChildren();
}
}
parser.nextToken();
return new GenesisAccount(address, nonce, balance, code, storage, privateKey);
Expand Down

0 comments on commit 0889ee4

Please sign in to comment.