-
Notifications
You must be signed in to change notification settings - Fork 861
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mark empty account storage range requests with an accompanying proof …
…as complete Signed-off-by: garyschulte <[email protected]>
- Loading branch information
1 parent
0f89356
commit 57312c8
Showing
6 changed files
with
77 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
.../org/hyperledger/besu/ethereum/eth/sync/snapsync/request/StorageRangeDataRequestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.hyperledger.besu.ethereum.eth.sync.snapsync.request; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.hyperledger.besu.datatypes.Hash; | ||
import org.hyperledger.besu.ethereum.proof.WorldStateProofProvider; | ||
import org.hyperledger.besu.ethereum.worldstate.WorldStateStorage; | ||
|
||
import java.util.Collections; | ||
|
||
import kotlin.collections.ArrayDeque; | ||
import org.apache.tuweni.bytes.Bytes; | ||
import org.apache.tuweni.bytes.Bytes32; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
public class StorageRangeDataRequestTest { | ||
private static final Hash HASH_LAST = Hash.fromHexString("F".repeat(64)); | ||
|
||
@Mock WorldStateStorage storage; | ||
|
||
@Test | ||
public void assertEmptySlotsWithProofOfExclusionCompletes() { | ||
var worldstateProofProvider = new WorldStateProofProvider(storage); | ||
|
||
var storageRangeRequest = | ||
new StorageRangeDataRequest( | ||
Hash.EMPTY_TRIE_HASH, Bytes32.ZERO, Hash.EMPTY_TRIE_HASH, Bytes32.ZERO, HASH_LAST); | ||
|
||
var proofs = new ArrayDeque<Bytes>(); | ||
proofs.add(0, Hash.EMPTY_TRIE_HASH); | ||
|
||
storageRangeRequest.addResponse( | ||
null, worldstateProofProvider, Collections.emptyNavigableMap(), proofs); | ||
assertThat(storageRangeRequest.isResponseReceived()).isTrue(); | ||
} | ||
} |