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

Account Signing/NTP: More improvements and fixes #3436

Merged
merged 6 commits into from
Oct 22, 2019
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
7 changes: 4 additions & 3 deletions common/src/main/java/bisq/common/app/Capability.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ public enum Capability {
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
@Deprecated 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
MEDIATION // Supports mediation feature
MEDIATION, // Supports mediation feature
REFUND_AGENT // Supports refund agents
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ public boolean isSignedByArbitrator(AccountAgeWitness accountAgeWitness) {
}

// Arbitrators sign with EC key
public SignedWitness signAccountAgeWitness(Coin tradeAmount,
AccountAgeWitness accountAgeWitness,
ECKey key,
PublicKey peersPubKey) {
public void signAccountAgeWitness(Coin tradeAmount,
AccountAgeWitness accountAgeWitness,
ECKey key,
PublicKey peersPubKey) {
if (isSignedAccountAgeWitness(accountAgeWitness)) {
log.warn("Arbitrator trying to sign already signed accountagewitness {}", accountAgeWitness.toString());
return null;
return;
}

String accountAgeWitnessHashAsHex = Utilities.encodeToHex(accountAgeWitness.getHash());
Expand All @@ -158,16 +158,15 @@ public SignedWitness signAccountAgeWitness(Coin tradeAmount,
tradeAmount.value);
publishSignedWitness(signedWitness);
log.info("Arbitrator signed witness {}", signedWitness.toString());
return signedWitness;
}

// Any peer can sign with DSA key
public SignedWitness signAccountAgeWitness(Coin tradeAmount,
AccountAgeWitness accountAgeWitness,
PublicKey peersPubKey) throws CryptoException {
public void signAccountAgeWitness(Coin tradeAmount,
AccountAgeWitness accountAgeWitness,
PublicKey peersPubKey) throws CryptoException {
if (isSignedAccountAgeWitness(accountAgeWitness)) {
log.warn("Trader trying to sign already signed accountagewitness {}", accountAgeWitness.toString());
return null;
return;
}

byte[] signature = Sig.sign(keyRing.getSignatureKeyPair().getPrivate(), accountAgeWitness.getHash());
Expand All @@ -180,7 +179,6 @@ public SignedWitness signAccountAgeWitness(Coin tradeAmount,
tradeAmount.value);
publishSignedWitness(signedWitness);
log.info("Trader signed witness {}", signedWitness.toString());
return signedWitness;
}

public boolean verifySignature(SignedWitness signedWitness) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package bisq.core.account.witness;

import bisq.core.account.sign.SignedWitness;
import bisq.core.account.sign.SignedWitnessService;
import bisq.core.filter.FilterManager;
import bisq.core.filter.PaymentAccountFilter;
Expand Down Expand Up @@ -585,11 +584,11 @@ boolean verifySignature(PublicKey peersPublicKey,
// Witness signing
///////////////////////////////////////////////////////////////////////////////////////////

public SignedWitness arbitratorSignAccountAgeWitness(Coin tradeAmount,
AccountAgeWitness accountAgeWitness,
ECKey key,
PublicKey peersPubKey) {
return signedWitnessService.signAccountAgeWitness(tradeAmount, accountAgeWitness, key, peersPubKey);
public void arbitratorSignAccountAgeWitness(Coin tradeAmount,
AccountAgeWitness accountAgeWitness,
ECKey key,
PublicKey peersPubKey) {
signedWitnessService.signAccountAgeWitness(tradeAmount, accountAgeWitness, key, peersPubKey);
}

public void traderSignPeersAccountAgeWitness(Trade trade) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ static void setSupportedCapabilities(BisqEnvironment bisqEnvironment) {
Capability.DAO_STATE,
Capability.BUNDLE_OF_ENVELOPES,
Capability.MEDIATION,
Capability.SIGNED_ACCOUNT_AGE_WITNESS
Capability.SIGNED_ACCOUNT_AGE_WITNESS,
Capability.REFUND_AGENT
);

if (BisqEnvironment.isDaoActivated(bisqEnvironment)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
import bisq.core.support.dispute.agent.DisputeAgent;

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

import bisq.common.app.Capabilities;
import bisq.common.app.Capability;
import bisq.common.crypto.PubKeyRing;
import bisq.common.proto.ProtoUtil;

Expand All @@ -42,7 +45,7 @@
@EqualsAndHashCode(callSuper = true)
@Slf4j
@Getter
public final class RefundAgent extends DisputeAgent {
public final class RefundAgent extends DisputeAgent implements CapabilityRequiringPayload {

public RefundAgent(NodeAddress nodeAddress,
PubKeyRing pubKeyRing,
Expand Down Expand Up @@ -106,4 +109,9 @@ public static RefundAgent fromProto(protobuf.RefundAgent proto) {
public String toString() {
return "RefundAgent{} " + super.toString();
}

@Override
public Capabilities getRequiredCapabilities() {
return new Capabilities(Capability.REFUND_AGENT);
}
}
13 changes: 5 additions & 8 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2530,14 +2530,11 @@ popup.attention.forTradeWithId=Attention required for trade with ID {0}
popup.info.multiplePaymentAccounts.headline=Multiple payment accounts available
popup.info.multiplePaymentAccounts.msg=You have multiple payment accounts available for this offer. Please make sure you've picked the right one.

popup.dao.launch.headline=The complete vision, realized
popup.dao.launch.governance.title=Governance
popup.dao.launch.governance=Bisq’s trading network was already decentralized. \nWith the Bisq DAO, Bisq’s leadership is now decentralized too, making Bisq exceptionally resistant to censorship.
popup.dao.launch.trading.title=Trade
popup.dao.launch.trading=Trade BSQ (colored bitcoin) to participate in Bisq governance. You can buy and sell BSQ just like any other asset on Bisq.
popup.dao.launch.cheaperFees.title=Cheaper fees
# suppress inspection "TrailingSpacesInProperty"
popup.dao.launch.cheaperFees=Get a 90% discount on trading fees when you use BSQ. Save money and support the project at the same time!\n\n
popup.news.launch.headline=Two Critical Updates
popup.news.launch.accountSigning.headline=ACCOUNT SIGNING
popup.news.launch.accountSigning.description=Lift 0.01 BTC fiat trading limits by buying BTC from a signed peer.
popup.news.launch.ntp.headline=NEW TRADE PROTOCOL
popup.news.launch.ntp.description=Multisig escrows are now 2-of-2 with a new dispute resolution system.

popup.accountSigning.selectAccounts.headline=Select payment accounts
popup.accountSigning.selectAccounts.description=Based on the payment method and point of time all payment accounts that are connected to a dispute where a payout to the buyer occurred will be selected for you to sign.
Expand Down
70 changes: 24 additions & 46 deletions desktop/src/main/java/bisq/desktop/bisq.css
Original file line number Diff line number Diff line change
Expand Up @@ -1967,66 +1967,44 @@ textfield */
-fx-font-size: 0.923em;
}

.dao-launch-version {
.price-trend-up {
-fx-text-fill: -bs-color-primary;
-fx-padding: 2 0 0 0;
}

.price-trend-down {
-fx-text-fill: -bs-red;
-fx-padding: 2 0 0 0;
}

/********************************************************************************************************************
* *
* News *
* *
********************************************************************************************************************/

.news-version {
-fx-alignment: center;
-fx-font-size: 1.077em;
}

.dao-launch-headline {
.news-headline {
-fx-font-size: 2.154em;
-fx-text-fill: -bs-rd-font-dark-gray;
-fx-font-family: "IBM Plex Sans Light";
}

.dao-launch-description {
-fx-font-size: 1.538em;
.news-feature-headline {
-fx-font-size: 1.462em;
-fx-text-fill: -bs-rd-font-dark-gray;
-fx-font-family: "IBM Plex Sans Light";
}

.dao-launch-paging-button {
-fx-text-fill: -bs-rd-font-light;
-fx-fill: -bs-rd-font-light;
}

.dao-launch-tab-box {
-fx-border-style: solid;
-fx-border-width: 1 0 0 0;
-fx-border-color: -bs-rd-tab-border;
}

.slider-section-button {
-fx-cursor: hand;
-fx-background-color: transparent;
-fx-translate-y: -1;
-fx-padding: 11;
}

.slider-section-button .text {
-fx-font-size: 0.923em;
-fx-fill: -bs-rd-font-dark-gray;
.news-feature-description {
-fx-font-size: 1.231em;
-fx-text-fill: -bs-rd-font-dark-gray;
-fx-font-family: "IBM Plex Sans Light";
}

.slider-section-button:selected {
-fx-border-style: solid;
-fx-border-width: 1 0 0 0;
-fx-border-color: -bs-rd-green;
}

.slider-section-button:selected .text {
-fx-fill: -bs-rd-green;
}

.price-trend-up {
-fx-text-fill: -bs-color-primary;
-fx-padding: 2 0 0 0;
}

.price-trend-down {
-fx-text-fill: -bs-red;
-fx-padding: 2 0 0 0;
}

/********************************************************************************************************************
* *
* Notifications *
Expand Down
29 changes: 4 additions & 25 deletions desktop/src/main/java/bisq/desktop/images.css
Original file line number Diff line number Diff line change
Expand Up @@ -279,31 +279,10 @@
-fx-image: url("../../images/avatars/avatar_15.png");
}

#poloniex {
-fx-image: url("../../images/poloniex.png");
#image-account-signing-screenshot {
-fx-image: url("../../images/account_signing_screenshot.png");
}

#btcaverage {
-fx-image: url("../../images/btcaverage.png");
#image-new-trade-protocol-screenshot {
-fx-image: url("../../images/new_trade_protocol_screenshot.png");
}

#accepted {
-fx-image: url("../../images/accepted.png");
}

#rejected {
-fx-image: url("../../images/rejected.png");
}

#dao-screenshot-governance {
-fx-image: url("../../images/dao-screenshot-governance.png");
}

#dao-screenshot-trading {
-fx-image: url("../../images/dao-screenshot-trading.png");
}

#dao-screenshot-cheaper-fees {
-fx-image: url("../../images/dao-screenshot-cheaper-fees.png");
}

30 changes: 11 additions & 19 deletions desktop/src/main/java/bisq/desktop/main/MainViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import bisq.desktop.main.overlays.Overlay;
import bisq.desktop.main.overlays.notifications.NotificationCenter;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.DaoLaunchWindow;
import bisq.desktop.main.overlays.windows.DisplayAlertMessageWindow;
import bisq.desktop.main.overlays.windows.NewTradeProtocolLaunchWindow;
import bisq.desktop.main.overlays.windows.TacWindow;
import bisq.desktop.main.overlays.windows.TorNetworkSettingsWindow;
import bisq.desktop.main.overlays.windows.WalletPasswordWindow;
Expand Down Expand Up @@ -70,8 +70,6 @@

import com.google.inject.Inject;

import javafx.geometry.HPos;

import org.fxmisc.easybind.EasyBind;
import org.fxmisc.easybind.monadic.MonadicBinding;

Expand Down Expand Up @@ -268,7 +266,7 @@ void onSplashScreenRemoved() {
// in MainView showAppScreen handler
notificationCenter.onAllServicesAndViewsInitialized();

maybeAddDaoLaunchWindowToQueue();
maybeAddNewTradeProtocolLaunchWindowToQueue();
maybeShowPopupsFromQueue();
}

Expand Down Expand Up @@ -621,21 +619,15 @@ public BooleanProperty getShowAccountUpdatesNotification() {
return accountPresentation.getShowAccountUpdatesNotification();
}

private void maybeAddDaoLaunchWindowToQueue() {
if (DevEnv.isDaoActivated()) {
String daoLaunchPopupKey = "daoLaunchPopup";
if (DontShowAgainLookup.showAgain(daoLaunchPopupKey)) {
DaoLaunchWindow daoLaunchWindow = new DaoLaunchWindow()
.headLine(Res.get("popup.dao.launch.headline"))
.closeButtonText(Res.get("shared.dismiss"))
.actionButtonText(Res.get("shared.learnMore"))
.onAction(() -> GUIUtil.openWebPage("https://docs.bisq.network/dao.html"))
.buttonAlignment(HPos.CENTER);
daoLaunchWindow.setDisplayOrderPriority(1);
popupQueue.add(daoLaunchWindow);

DontShowAgainLookup.dontShowAgain(daoLaunchPopupKey, true);
}
private void maybeAddNewTradeProtocolLaunchWindowToQueue() {
String newTradeProtocolWithAccountSigningLaunchPopupKey = "newTradeProtocolWithAccountSigningLaunchPopup";
if (DontShowAgainLookup.showAgain(newTradeProtocolWithAccountSigningLaunchPopupKey)) {
NewTradeProtocolLaunchWindow newTradeProtocolLaunchWindow = new NewTradeProtocolLaunchWindow()
.headLine(Res.get("popup.news.launch.headline"));
newTradeProtocolLaunchWindow.setDisplayOrderPriority(1);
popupQueue.add(newTradeProtocolLaunchWindow);

DontShowAgainLookup.dontShowAgain(newTradeProtocolWithAccountSigningLaunchPopupKey, true);
}
}

Expand Down
Loading