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

Remove old dao required capabilites #3222

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 11 additions & 8 deletions common/src/main/java/bisq/common/app/Capability.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ public enum Capability {
@Deprecated TRADE_STATISTICS, // Not required anymore as no old clients out there not having that support
@Deprecated TRADE_STATISTICS_2, // Not required anymore as no old clients out there not having that support
@Deprecated ACCOUNT_AGE_WITNESS, // Not required anymore as no old clients out there not having that support
SEED_NODE,
DAO_FULL_NODE,
PROPOSAL,
BLIND_VOTE,
SEED_NODE, // Node is a seed node
DAO_FULL_NODE, // DAO full node can deliver BSQ blocks
@Deprecated PROPOSAL, // Not required anymore as no old clients out there not having that support
@Deprecated BLIND_VOTE, // Not required anymore as no old clients out there not having that support
@Deprecated ACK_MSG, // Not required anymore as no old clients out there not having that support
RECEIVE_BSQ_BLOCK,
DAO_STATE,
BUNDLE_OF_ENVELOPES,
SIGNED_ACCOUNT_AGE_WITNESS
RECEIVE_BSQ_BLOCK, // Signaling that node which wants to receive BSQ blocks (DAO lite node)
@Deprecated DAO_STATE, // Not required anymore as no old clients out there not having that support

//TODO can be set deprecated after v1.1.6 as we enforce update there
BUNDLE_OF_ENVELOPES, // Supports bundling of messages if many messages are sent in short interval

SIGNED_ACCOUNT_AGE_WITNESS // Supports the signed account age witness feature
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
import bisq.core.dao.governance.ConsensusCritical;
import bisq.core.dao.governance.blindvote.BlindVote;

import bisq.network.p2p.storage.payload.CapabilityRequiringPayload;
import bisq.network.p2p.storage.payload.PersistableNetworkPayload;

import bisq.common.app.Capabilities;
import bisq.common.app.Capability;
import bisq.common.crypto.Hash;
import bisq.common.proto.persistable.PersistableEnvelope;
import bisq.common.util.Utilities;
Expand All @@ -46,8 +43,7 @@
@Slf4j
@Getter
@EqualsAndHashCode
public final class BlindVotePayload implements PersistableNetworkPayload, PersistableEnvelope,
CapabilityRequiringPayload, ConsensusCritical {
public final class BlindVotePayload implements PersistableNetworkPayload, PersistableEnvelope, ConsensusCritical {

private final BlindVote blindVote;
protected final byte[] hash; // 20 byte
Expand Down Expand Up @@ -101,16 +97,6 @@ public byte[] getHash() {
return hash;
}


///////////////////////////////////////////////////////////////////////////////////////////
// CapabilityRequiringPayload
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public Capabilities getRequiredCapabilities() {
return new Capabilities(Capability.BLIND_VOTE);
}

@Override
public String toString() {
return "BlindVotePayload{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
import bisq.core.dao.governance.ConsensusCritical;
import bisq.core.dao.state.model.governance.Proposal;

import bisq.network.p2p.storage.payload.CapabilityRequiringPayload;
import bisq.network.p2p.storage.payload.PersistableNetworkPayload;

import bisq.common.app.Capabilities;
import bisq.common.app.Capability;
import bisq.common.crypto.Hash;
import bisq.common.proto.persistable.PersistableEnvelope;
import bisq.common.util.Utilities;
Expand All @@ -43,8 +40,7 @@
@Immutable
@Slf4j
@Value
public class ProposalPayload implements PersistableNetworkPayload, PersistableEnvelope,
CapabilityRequiringPayload, ConsensusCritical {
public class ProposalPayload implements PersistableNetworkPayload, PersistableEnvelope, ConsensusCritical {
private final Proposal proposal;
protected final byte[] hash; // 20 byte

Expand Down Expand Up @@ -100,16 +96,6 @@ public byte[] getHash() {
return hash;
}


///////////////////////////////////////////////////////////////////////////////////////////
// CapabilityRequiringPayload
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public Capabilities getRequiredCapabilities() {
return new Capabilities(Capability.PROPOSAL);
}

@Override
public String toString() {
return "ProposalPayload{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@

import bisq.core.dao.state.model.governance.Proposal;

import bisq.network.p2p.storage.payload.CapabilityRequiringPayload;
import bisq.network.p2p.storage.payload.ExpirablePayload;
import bisq.network.p2p.storage.payload.LazyProcessedPayload;
import bisq.network.p2p.storage.payload.ProtectedStoragePayload;

import bisq.common.app.Capabilities;
import bisq.common.app.Capability;
import bisq.common.crypto.Sig;
import bisq.common.proto.persistable.PersistablePayload;
import bisq.common.util.ExtraDataMapValidator;
Expand Down Expand Up @@ -59,7 +56,7 @@
@EqualsAndHashCode
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
public class TempProposalPayload implements LazyProcessedPayload, ProtectedStoragePayload,
ExpirablePayload, CapabilityRequiringPayload, PersistablePayload {
ExpirablePayload, PersistablePayload {

protected final Proposal proposal;
protected final byte[] ownerPubKeyEncoded;
Expand Down Expand Up @@ -122,16 +119,6 @@ public PublicKey getOwnerPubKey() {
}


///////////////////////////////////////////////////////////////////////////////////////////
// CapabilityRequiringPayload
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public Capabilities getRequiredCapabilities() {
return new Capabilities(Capability.PROPOSAL);
}


///////////////////////////////////////////////////////////////////////////////////////////
// ExpirablePayload
///////////////////////////////////////////////////////////////////////////////////////////
Expand Down
10 changes: 4 additions & 6 deletions core/src/main/java/bisq/core/setup/CoreNetworkCapabilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,13 @@ public static void setSupportedCapabilities(BisqEnvironment bisqEnvironment) {
Capability.TRADE_STATISTICS_2,
Capability.ACCOUNT_AGE_WITNESS,
Capability.ACK_MSG,
Capability.PROPOSAL,
Capability.BLIND_VOTE,
Capability.DAO_STATE,
Capability.BUNDLE_OF_ENVELOPES
);

if (BisqEnvironment.isDaoActivated(bisqEnvironment)) {
Capabilities.app.addAll(
Capability.PROPOSAL,
Capability.BLIND_VOTE,
Capability.DAO_STATE
);

maybeApplyDaoFullMode(bisqEnvironment);
}
}
Expand All @@ -58,6 +55,7 @@ public static void maybeApplyDaoFullMode(BisqEnvironment bisqEnvironment) {
} else {
// A lite node has the capability to receive bsq blocks. We do not want to send BSQ blocks to full nodes
// as they ignore them anyway.
log.info("Set Capability.RECEIVE_BSQ_BLOCK");
Capabilities.app.addAll(Capability.RECEIVE_BSQ_BLOCK);
}
}
Expand Down
15 changes: 14 additions & 1 deletion p2p/src/main/java/bisq/network/p2p/BundleOfEnvelopes.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

package bisq.network.p2p;

import bisq.network.p2p.storage.payload.CapabilityRequiringPayload;

import bisq.common.app.Capabilities;
import bisq.common.app.Capability;
import bisq.common.app.Version;
import bisq.common.proto.ProtobufferException;
import bisq.common.proto.network.NetworkEnvelope;
Expand All @@ -32,7 +36,7 @@

@EqualsAndHashCode(callSuper = true)
@Value
public final class BundleOfEnvelopes extends NetworkEnvelope implements ExtendedDataSizePermission {
public final class BundleOfEnvelopes extends NetworkEnvelope implements ExtendedDataSizePermission, CapabilityRequiringPayload {

private final List<NetworkEnvelope> envelopes;

Expand Down Expand Up @@ -78,4 +82,13 @@ public static BundleOfEnvelopes fromProto(protobuf.BundleOfEnvelopes proto, Netw

return new BundleOfEnvelopes(envelopes, messageVersion);
}

///////////////////////////////////////////////////////////////////////////////////////////
// CapabilityRequiringPayload
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public Capabilities getRequiredCapabilities() {
return new Capabilities(Capability.BUNDLE_OF_ENVELOPES);
}
}