Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(6/6) Clean up technical debt in P2PDataStorage and ProtectedStorageEntry objects #3747

Merged
merged 51 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5fcd18c
[TESTS] Add tests of requestData
julianknutsen Nov 20, 2019
1e814d9
[REFACTOR] Introduce buildGetDataRequest variants
julianknutsen Nov 20, 2019
a927ed4
[TESTS] Add tests of new RequestData APIs
julianknutsen Nov 20, 2019
daffe6d
[TESTS] Add tests of GetDataRequestHandler
julianknutsen Nov 21, 2019
944b3ff
[REFACTOR] Introduce buildGetDataResponse
julianknutsen Nov 21, 2019
8208f78
[REFACTOR] Extract connectionInfo String
julianknutsen Nov 21, 2019
5402155
[REFACTOR] Extract getDataResponse logging
julianknutsen Nov 21, 2019
a6e8868
[REFACTOR] Extract truncation logging
julianknutsen Nov 21, 2019
dafc762
[REFACTOR] Pass peerCapabilities into buildGetDataResponse
julianknutsen Nov 21, 2019
5630b35
[TESTS] Unit tests of buildGetDataResponse
julianknutsen Nov 21, 2019
caf946d
Remove redundant HashSet lookups in filter functions
julianknutsen Nov 21, 2019
703a9a0
[REFACTOR] Move required capabilities log
julianknutsen Nov 21, 2019
3aaf8a2
[REFACTOR] Inline capability check for ProtectedStorageEntries
julianknutsen Nov 21, 2019
4c5d818
[REFACTOR] Inline filtering functions
julianknutsen Nov 21, 2019
e767340
[REFACTOR] Remove duplication in filtering functions
julianknutsen Nov 21, 2019
00128d9
[BUGFIX] Fix off-by-one in truncation logic
julianknutsen Nov 21, 2019
c7bce9e
[TESTS] Add test of RequestDataHandler::onMessage
julianknutsen Nov 21, 2019
873271c
[REFACTOR] Introduce processGetDataResponse
julianknutsen Nov 21, 2019
690b980
[TESTS] Make verify() functions more flexible
julianknutsen Nov 21, 2019
a34488b
[TESTS] Add unit tests for processGetDataResponse
julianknutsen Nov 21, 2019
3d6e9fb
Remove static from initialRequestApplied
julianknutsen Nov 21, 2019
f92893b
[TESTS] Write synchronization integration tests
julianknutsen Nov 21, 2019
5db1285
[REFACTOR] Clean up processGetDataResponse
julianknutsen Nov 22, 2019
ecae31e
[RENAME] LazyProcessedPayload to ProcessOncePersistableNetworkPayload
julianknutsen Nov 22, 2019
a0fae12
Remove @Nullable around persistableNetworkPayloadSet
julianknutsen Nov 22, 2019
c503bcb
Remove @Nullable around supportedCapabilities in GetDataResponse
julianknutsen Nov 22, 2019
b1a06fe
Remove @Nullable around supportedCapabilities in PreliminaryGetDataRe…
julianknutsen Nov 22, 2019
4fe19ae
[DEADCODE] Remove old request handler tests
julianknutsen Nov 22, 2019
0649323
Make addPersistableNetworkPayloadFromInitialRequest private
julianknutsen Nov 23, 2019
56a7661
[REFACTOR] Clean up ClientAPI for addPersistableNetworkPayload
julianknutsen Nov 22, 2019
0e6b1a2
[REFACTOR] Clean up ClientAPI for addProtectedStorageEntry
julianknutsen Nov 22, 2019
77413c9
[REFACTOR] Clean up ClientAPI for remove
julianknutsen Nov 22, 2019
9f69134
[REFACTOR] Clean up ClientAPI for refreshTTL
julianknutsen Nov 22, 2019
bfdb8f5
Make isDataOwner a private policy decision in BroadcastHandler
julianknutsen Nov 23, 2019
4dc4532
Remove isDataOwner from P2PDataStorage
julianknutsen Nov 23, 2019
6ff8756
[REFACTOR] inline broadcast() private function
julianknutsen Nov 22, 2019
5a174d5
[REFACTOR] inline broadcastProtectedStorageEntry() private function
julianknutsen Nov 22, 2019
1bd450b
[REFACTOR] inline maybeAddToRemoveAddOncePayloads() private function
julianknutsen Nov 22, 2019
17f4b70
[TESTS] Clean up mockito never() and eq(null) usages
julianknutsen Nov 23, 2019
b6b0026
Remove ProtectedStorageEntry::updateSignature
julianknutsen Nov 23, 2019
24ecfc7
Remove ProtectedStorageEntry::maybeAdjustCreationTimeStamp
julianknutsen Nov 23, 2019
0c67608
@NotNull ProtectedStorageEntry::ownerPubKey
julianknutsen Nov 23, 2019
76e8c57
@NotNull ProtectedStorageEntry::protectedStoragePayload
julianknutsen Nov 23, 2019
104984c
@NotNull MailboxStoragePayload::senderPubKeyForAddOperation
julianknutsen Nov 23, 2019
01a7f79
Make CHECK_TTL_INTERVAL_SEC final
julianknutsen Dec 4, 2019
c38ff9b
s/networkPayload/protectedStoragePayload
julianknutsen Dec 5, 2019
688405b
[TESTS] Make onDisconnect tests more robust
julianknutsen Dec 5, 2019
df2e4cc
Refactor P2PDataStorage::onDisconnect
julianknutsen Dec 5, 2019
b166009
Remove expire optimization in onDisconnect
julianknutsen Dec 5, 2019
7b8d346
Remove filter for ExpirablePayload
julianknutsen Dec 5, 2019
e8c8225
[PR COMMENTS] Fix comment typo
julianknutsen Dec 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public boolean isValidForAddOperation() {
if (!result) {
String res1 = this.toString();
String res2 = "null";
if (mailboxStoragePayload != null && mailboxStoragePayload.getOwnerPubKey() != null)
if (mailboxStoragePayload.getOwnerPubKey() != null)
freimair marked this conversation as resolved.
Show resolved Hide resolved
res2 = Utilities.encodeToHex(mailboxStoragePayload.getSenderPubKeyForAddOperation().getEncoded(),true);

log.warn("ProtectedMailboxStorageEntry::isValidForAddOperation() failed. " +
Expand Down Expand Up @@ -141,7 +141,7 @@ public boolean isValidForRemoveOperation() {
if (!result) {
String res1 = this.toString();
String res2 = "null";
if (mailboxStoragePayload != null && mailboxStoragePayload.getOwnerPubKey() != null)
if (mailboxStoragePayload.getOwnerPubKey() != null)
res2 = Utilities.encodeToHex(mailboxStoragePayload.getOwnerPubKey().getEncoded(), true);

log.warn("ProtectedMailboxStorageEntry::isValidForRemoveOperation() failed. " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class ProtectedStorageEntry implements NetworkPayload, PersistablePayload
private final byte[] signature;
private long creationTimeStamp;

public ProtectedStorageEntry(ProtectedStoragePayload protectedStoragePayload,
public ProtectedStorageEntry(@NotNull ProtectedStoragePayload protectedStoragePayload,
@NotNull PublicKey ownerPubKey,
int sequenceNumber,
byte[] signature,
Expand All @@ -66,7 +66,7 @@ public ProtectedStorageEntry(ProtectedStoragePayload protectedStoragePayload,
clock);
}

protected ProtectedStorageEntry(ProtectedStoragePayload protectedStoragePayload,
protected ProtectedStorageEntry(@NotNull ProtectedStoragePayload protectedStoragePayload,
byte[] ownerPubKeyBytes,
@NotNull PublicKey ownerPubKey,
int sequenceNumber,
Expand All @@ -91,7 +91,7 @@ protected ProtectedStorageEntry(ProtectedStoragePayload protectedStoragePayload,
// PROTO BUFFER
///////////////////////////////////////////////////////////////////////////////////////////

private ProtectedStorageEntry(ProtectedStoragePayload protectedStoragePayload,
private ProtectedStorageEntry(@NotNull ProtectedStoragePayload protectedStoragePayload,
byte[] ownerPubKeyBytes,
int sequenceNumber,
byte[] signature,
Expand Down Expand Up @@ -162,13 +162,12 @@ public boolean isValidForAddOperation() {
mailboxStoragePayload.getSenderPubKeyForAddOperation().equals(this.getOwnerPubKey());

} else {
boolean result = this.protectedStoragePayload != null &&
this.ownerPubKey.equals(protectedStoragePayload.getOwnerPubKey());
boolean result = this.ownerPubKey.equals(protectedStoragePayload.getOwnerPubKey());

if (!result) {
String res1 = this.toString();
String res2 = "null";
if (protectedStoragePayload != null && protectedStoragePayload.getOwnerPubKey() != null)
if (protectedStoragePayload.getOwnerPubKey() != null)
res2 = Utilities.encodeToHex(protectedStoragePayload.getOwnerPubKey().getEncoded(), true);

log.warn("ProtectedStorageEntry::isValidForAddOperation() failed. Entry owner does not match Payload owner:\n" +
Expand All @@ -191,7 +190,7 @@ public boolean isValidForRemoveOperation() {
if (!result) {
String res1 = this.toString();
String res2 = "null";
if (protectedStoragePayload != null && protectedStoragePayload.getOwnerPubKey() != null)
if (protectedStoragePayload.getOwnerPubKey() != null)
res2 = Utilities.encodeToHex(protectedStoragePayload.getOwnerPubKey().getEncoded(), true);

log.warn("ProtectedStorageEntry::isValidForRemoveOperation() failed. Entry owner does not match Payload owner:\n" +
Expand Down