Skip to content

Commit

Permalink
Fix storage key format for eth_getProof (#4564)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-Trintinalia authored Dec 6, 2022
1 parent 27257e6 commit 64a5d74
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public StorageEntryProof(final UInt256 key, final UInt256 value, final List<Byte

@JsonGetter(value = "key")
public String getKey() {
return key.toShortHexString();
return key.trimLeadingZeros().toHexString();
}

@JsonGetter(value = "value")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ void getProof() {
assertThat(result).usingRecursiveComparison().isEqualTo(expectedResponse);
assertThat(result.getNonce()).isEqualTo("0xfffffffffffffffe");
assertThat(result.getStorageProof().size()).isGreaterThan(0);
assertThat(result.getStorageProof().get(0).getKey()).isEqualTo(storageKey.toShortHexString());
assertThat(result.getStorageProof().get(0).getKey())
.isEqualTo(storageKey.trimLeadingZeros().toHexString());
}

private JsonRpcRequestContext requestWithParams(final Object... params) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"nonce" : "0x0",
"storageHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"storageProof" : [ {
"key" : "0x347",
"key" : "0x0347",
"value" : "0x0",
"proof" : [ ]
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"nonce" : "0x0",
"storageHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"storageProof" : [ {
"key" : "0x347",
"key" : "0x0347",
"value" : "0x0",
"proof" : [ ]
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"nonce" : "0x0",
"storageHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"storageProof" : [ {
"key" : "0x347",
"key" : "0x0347",
"value" : "0x0",
"proof" : [ ]
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"nonce" : "0x0",
"storageHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"storageProof" : [ {
"key" : "0x347",
"key" : "0x0347",
"value" : "0x0",
"proof" : [ ]
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"nonce" : "0x0",
"storageHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"storageProof" : [ {
"key" : "0x347",
"key" : "0x0347",
"value" : "0x0",
"proof" : [ ]
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"nonce" : "0x0",
"storageHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"storageProof" : [ {
"key" : "0x347",
"key" : "0x0347",
"value" : "0x0",
"proof" : [ ]
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"nonce" : "0x0",
"storageHash" : "0xdd3fa56425f8195f314c22547243081293b3f5537cd98ed8f84d4fda3f9a515b",
"storageProof" : [ {
"key" : "0x347",
"key" : "0x0347",
"value" : "0x0",
"proof" : [ "0xf8b18080a0c7f91ee5ea67d593275fcc773a02a5e5fb37b0625ca5c5cdc783483d43f2d7c280a06672614c102b0f02e747250bae452ed105110e25761c15a2a459afbd9eb8cf2e808080a0f671e05fab19f512b16fdcbc938f5fbbfbbc2fa67fecb575bb7721c221f71cf78080a0ba2fc36b0235d7ea299126bd4d404cb38456f32a6c236b422a3868f98c69eda1a0d77552655c7b63916586a73350b1933836f2378789613b548b90fa0a44125df180808080"]
} ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"nonce" : "0x0",
"storageHash" : "0xdd3fa56425f8195f314c22547243081293b3f5537cd98ed8f84d4fda3f9a515b",
"storageProof" : [ {
"key" : "0x347",
"key" : "0x0347",
"value" : "0x0",
"proof" : [ "0xf8b18080a0c7f91ee5ea67d593275fcc773a02a5e5fb37b0625ca5c5cdc783483d43f2d7c280a06672614c102b0f02e747250bae452ed105110e25761c15a2a459afbd9eb8cf2e808080a0f671e05fab19f512b16fdcbc938f5fbbfbbc2fa67fecb575bb7721c221f71cf78080a0ba2fc36b0235d7ea299126bd4d404cb38456f32a6c236b422a3868f98c69eda1a0d77552655c7b63916586a73350b1933836f2378789613b548b90fa0a44125df180808080"]
} ]
Expand Down

0 comments on commit 64a5d74

Please sign in to comment.