update to monero-project v0.18.0.0, monero-java v0.7.2

This commit is contained in:
woodser 2022-08-06 18:36:09 -04:00
parent 4b46871cc3
commit 3753a42023
11 changed files with 93 additions and 71 deletions

View File

@ -68,7 +68,7 @@ monerod-local1:
--no-zmq \
--add-exclusive-node 127.0.0.1:28080 \
--rpc-access-control-origins http://localhost:8080 \
--fixed-difficulty 100
--fixed-difficulty 400
monerod-local2:
./.localnet/monerod \
@ -82,7 +82,7 @@ monerod-local2:
--confirm-external-bind \
--add-exclusive-node 127.0.0.1:48080 \
--rpc-access-control-origins http://localhost:8080 \
--fixed-difficulty 100
--fixed-difficulty 400
funding-wallet-local:
./.localnet/monero-wallet-rpc \

View File

@ -42,7 +42,7 @@ configure(subprojects) {
grpcVersion = '1.25.0'
gsonVersion = '2.8.5'
guavaVersion = '28.2-jre'
moneroJavaVersion = '0.7.0'
moneroJavaVersion = '0.7.2'
httpclient5Version = '5.0'
guiceVersion = '4.2.2'
hamcrestVersion = '1.3'

View File

@ -109,6 +109,7 @@ public abstract class Trade implements Tradable, Model {
PREPARATION(Phase.INIT),
MULTISIG_PREPARED(Phase.INIT),
MULTISIG_MADE(Phase.INIT),
MULTISIG_EXCHANGED(Phase.INIT),
MULTISIG_COMPLETED(Phase.INIT),
CONTRACT_SIGNATURE_REQUESTED(Phase.INIT),
CONTRACT_SIGNED(Phase.INIT),

View File

@ -42,6 +42,8 @@ public final class InitMultisigRequest extends TradeMessage implements DirectMes
private final String preparedMultisigHex;
@Nullable
private final String madeMultisigHex;
@Nullable
private final String exchangedMultisigHex;
public InitMultisigRequest(String tradeId,
NodeAddress senderNodeAddress,
@ -50,13 +52,15 @@ public final class InitMultisigRequest extends TradeMessage implements DirectMes
String messageVersion,
long currentDate,
String preparedMultisigHex,
String madeMultisigHex) {
String madeMultisigHex,
String exchangedMultisigHex) {
super(messageVersion, tradeId, uid);
this.senderNodeAddress = senderNodeAddress;
this.pubKeyRing = pubKeyRing;
this.currentDate = currentDate;
this.preparedMultisigHex = preparedMultisigHex;
this.madeMultisigHex = madeMultisigHex;
this.exchangedMultisigHex = exchangedMultisigHex;
}
@ -74,6 +78,7 @@ public final class InitMultisigRequest extends TradeMessage implements DirectMes
Optional.ofNullable(preparedMultisigHex).ifPresent(e -> builder.setPreparedMultisigHex(preparedMultisigHex));
Optional.ofNullable(madeMultisigHex).ifPresent(e -> builder.setMadeMultisigHex(madeMultisigHex));
Optional.ofNullable(exchangedMultisigHex).ifPresent(e -> builder.setExchangedMultisigHex(exchangedMultisigHex));
builder.setCurrentDate(currentDate);
@ -90,7 +95,8 @@ public final class InitMultisigRequest extends TradeMessage implements DirectMes
messageVersion,
proto.getCurrentDate(),
ProtoUtil.stringOrNullFromProto(proto.getPreparedMultisigHex()),
ProtoUtil.stringOrNullFromProto(proto.getMadeMultisigHex()));
ProtoUtil.stringOrNullFromProto(proto.getMadeMultisigHex()),
ProtoUtil.stringOrNullFromProto(proto.getExchangedMultisigHex()));
}
@Override
@ -101,6 +107,7 @@ public final class InitMultisigRequest extends TradeMessage implements DirectMes
",\n currentDate=" + currentDate +
",\n preparedMultisigHex='" + preparedMultisigHex +
",\n madeMultisigHex='" + madeMultisigHex +
",\n exchangedMultisigHex='" + exchangedMultisigHex +
"\n} " + super.toString();
}
}

View File

@ -173,14 +173,6 @@ public class ProcessModel implements Model, PersistablePayload {
@Nullable
@Getter
@Setter
private String preparedMultisigHex; // TODO (woodser): ProcessModel shares many fields with TradingPeer; switch to trade getMaker(), getTaker(), getArbitrator(), getSelf(), with common TradingPeer object?
@Nullable
@Getter
@Setter
private String madeMultisigHex;
@Nullable
@Getter
@Setter
private String multisigAddress;
@Nullable
@ -240,8 +232,6 @@ public class ProcessModel implements Model, PersistablePayload {
Optional.ofNullable(tempTradingPeerNodeAddress).ifPresent(e -> builder.setTempTradingPeerNodeAddress(tempTradingPeerNodeAddress.toProtoMessage()));
Optional.ofNullable(makerSignature).ifPresent(e -> builder.setMakerSignature(makerSignature));
Optional.ofNullable(backupArbitrator).ifPresent(e -> builder.setBackupArbitrator(backupArbitrator.toProtoMessage()));
Optional.ofNullable(preparedMultisigHex).ifPresent(e -> builder.setPreparedMultisigHex(preparedMultisigHex));
Optional.ofNullable(madeMultisigHex).ifPresent(e -> builder.setMadeMultisigHex(madeMultisigHex));
Optional.ofNullable(multisigAddress).ifPresent(e -> builder.setMultisigAddress(multisigAddress));
return builder.build();
}
@ -271,8 +261,6 @@ public class ProcessModel implements Model, PersistablePayload {
processModel.setMediatedPayoutTxSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getMediatedPayoutTxSignature()));
processModel.setMakerSignature(proto.getMakerSignature());
processModel.setBackupArbitrator(proto.hasBackupArbitrator() ? NodeAddress.fromProto(proto.getBackupArbitrator()) : null);
processModel.setPreparedMultisigHex(ProtoUtil.stringOrNullFromProto(proto.getPreparedMultisigHex()));
processModel.setMadeMultisigHex(ProtoUtil.stringOrNullFromProto(proto.getMadeMultisigHex()));
processModel.setMultisigAddress(ProtoUtil.stringOrNullFromProto(proto.getMultisigAddress()));
String paymentStartedMessageStateString = ProtoUtil.stringOrNullFromProto(proto.getPaymentStartedMessageState());

View File

@ -108,6 +108,8 @@ public final class TradingPeer implements PersistablePayload {
@Nullable
private String madeMultisigHex;
@Nullable
private String exchangedMultisigHex;
@Nullable
private String depositTxHash;
@Nullable
private String depositTxHex;
@ -150,6 +152,7 @@ public final class TradingPeer implements PersistablePayload {
Optional.ofNullable(reserveTxKey).ifPresent(e -> builder.setReserveTxKey(reserveTxKey));
Optional.ofNullable(preparedMultisigHex).ifPresent(e -> builder.setPreparedMultisigHex(preparedMultisigHex));
Optional.ofNullable(madeMultisigHex).ifPresent(e -> builder.setMadeMultisigHex(madeMultisigHex));
Optional.ofNullable(exchangedMultisigHex).ifPresent(e -> builder.setExchangedMultisigHex(exchangedMultisigHex));
Optional.ofNullable(payoutTxHex).ifPresent(e -> builder.setPayoutTxHex(payoutTxHex));
Optional.ofNullable(depositTxHash).ifPresent(e -> builder.setDepositTxHash(depositTxHash));
Optional.ofNullable(depositTxHex).ifPresent(e -> builder.setDepositTxHex(depositTxHex));
@ -194,6 +197,7 @@ public final class TradingPeer implements PersistablePayload {
tradingPeer.setReserveTxKeyImages(proto.getReserveTxKeyImagesList());
tradingPeer.setPreparedMultisigHex(ProtoUtil.stringOrNullFromProto(proto.getPreparedMultisigHex()));
tradingPeer.setMadeMultisigHex(ProtoUtil.stringOrNullFromProto(proto.getMadeMultisigHex()));
tradingPeer.setExchangedMultisigHex(ProtoUtil.stringOrNullFromProto(proto.getExchangedMultisigHex()));
tradingPeer.setDepositTxHash(ProtoUtil.stringOrNullFromProto(proto.getDepositTxHash()));
tradingPeer.setDepositTxHex(ProtoUtil.stringOrNullFromProto(proto.getDepositTxHex()));
tradingPeer.setDepositTxKey(ProtoUtil.stringOrNullFromProto(proto.getDepositTxKey()));

View File

@ -148,7 +148,7 @@ public class ArbitratorSendsInitTradeAndMultisigRequests extends TradeTask {
// prepare multisig
String preparedHex = multisigWallet.prepareMultisig();
processModel.setPreparedMultisigHex(preparedHex);
trade.getSelf().setPreparedMultisigHex(preparedHex);
// create message to initialize multisig
InitMultisigRequest initMultisigRequest = new InitMultisigRequest(
@ -159,6 +159,7 @@ public class ArbitratorSendsInitTradeAndMultisigRequests extends TradeTask {
Version.getP2PMessageVersion(),
new Date().getTime(),
preparedHex,
null,
null);
// send request to maker

View File

@ -83,13 +83,15 @@ public class ProcessInitMultisigRequest extends TradeTask {
else if (request.getPreparedMultisigHex() != null && !multisigParticipant.getPreparedMultisigHex().equals(request.getPreparedMultisigHex())) throw new RuntimeException("Message's prepared multisig differs from previous messages, previous: " + multisigParticipant.getPreparedMultisigHex() + ", message: " + request.getPreparedMultisigHex());
if (multisigParticipant.getMadeMultisigHex() == null) multisigParticipant.setMadeMultisigHex(request.getMadeMultisigHex());
else if (request.getMadeMultisigHex() != null && !multisigParticipant.getMadeMultisigHex().equals(request.getMadeMultisigHex())) throw new RuntimeException("Message's made multisig differs from previous messages: " + request.getMadeMultisigHex() + " versus " + multisigParticipant.getMadeMultisigHex());
if (multisigParticipant.getExchangedMultisigHex() == null) multisigParticipant.setExchangedMultisigHex(request.getExchangedMultisigHex());
else if (request.getExchangedMultisigHex() != null && !multisigParticipant.getExchangedMultisigHex().equals(request.getExchangedMultisigHex())) throw new RuntimeException("Message's exchanged multisig differs from previous messages: " + request.getExchangedMultisigHex() + " versus " + multisigParticipant.getExchangedMultisigHex());
// prepare multisig if applicable
boolean updateParticipants = false;
if (processModel.getPreparedMultisigHex() == null) {
if (trade.getSelf().getPreparedMultisigHex() == null) {
log.info("Preparing multisig wallet for trade {}", trade.getId());
multisigWallet = xmrWalletService.createMultisigWallet(trade.getId());
processModel.setPreparedMultisigHex(multisigWallet.prepareMultisig());
trade.getSelf().setPreparedMultisigHex(multisigWallet.prepareMultisig());
trade.setStateIfValidTransitionTo(Trade.State.MULTISIG_PREPARED);
updateParticipants = true;
} else if (processModel.getMultisigAddress() == null) {
@ -98,19 +100,28 @@ public class ProcessInitMultisigRequest extends TradeTask {
// make multisig if applicable
TradingPeer[] peers = getMultisigPeers();
if (processModel.getMadeMultisigHex() == null && peers[0].getPreparedMultisigHex() != null && peers[1].getPreparedMultisigHex() != null) {
if (trade.getSelf().getMadeMultisigHex() == null && peers[0].getPreparedMultisigHex() != null && peers[1].getPreparedMultisigHex() != null) {
log.info("Making multisig wallet for trade {}", trade.getId());
MoneroMultisigInitResult result = multisigWallet.makeMultisig(Arrays.asList(peers[0].getPreparedMultisigHex(), peers[1].getPreparedMultisigHex()), 2, xmrWalletService.getWalletPassword()); // TODO (woodser): xmrWalletService.makeMultisig(tradeId, multisigHexes, threshold)?
processModel.setMadeMultisigHex(result.getMultisigHex());
String multisigHex = multisigWallet.makeMultisig(Arrays.asList(peers[0].getPreparedMultisigHex(), peers[1].getPreparedMultisigHex()), 2, xmrWalletService.getWalletPassword()); // TODO (woodser): xmrWalletService.makeMultisig(tradeId, multisigHexes, threshold)?
trade.getSelf().setMadeMultisigHex(multisigHex);
trade.setStateIfValidTransitionTo(Trade.State.MULTISIG_MADE);
updateParticipants = true;
}
// exchange multisig keys if applicable
if (processModel.getMultisigAddress() == null && peers[0].getMadeMultisigHex() != null && peers[1].getMadeMultisigHex() != null) {
log.info("Exchanging multisig wallet keys for trade {}", trade.getId());
multisigWallet.exchangeMultisigKeys(Arrays.asList(peers[0].getMadeMultisigHex(), peers[1].getMadeMultisigHex()), xmrWalletService.getWalletPassword());
processModel.setMultisigAddress(multisigWallet.getPrimaryAddress());
// import made multisig keys if applicable
if (trade.getSelf().getExchangedMultisigHex() == null && peers[0].getMadeMultisigHex() != null && peers[1].getMadeMultisigHex() != null) {
log.info("Importing made multisig hex for trade {}", trade.getId());
MoneroMultisigInitResult result = multisigWallet.exchangeMultisigKeys(Arrays.asList(peers[0].getMadeMultisigHex(), peers[1].getMadeMultisigHex()), xmrWalletService.getWalletPassword());
trade.getSelf().setExchangedMultisigHex(result.getMultisigHex());
trade.setStateIfValidTransitionTo(Trade.State.MULTISIG_EXCHANGED);
updateParticipants = true;
}
// import exchanged multisig keys if applicable
if (processModel.getMultisigAddress() == null && peers[0].getExchangedMultisigHex() != null && peers[1].getExchangedMultisigHex() != null) {
log.info("Importing exchanged multisig hex for trade {}", trade.getId());
MoneroMultisigInitResult result = multisigWallet.exchangeMultisigKeys(Arrays.asList(peers[0].getExchangedMultisigHex(), peers[1].getExchangedMultisigHex()), xmrWalletService.getWalletPassword());
processModel.setMultisigAddress(result.getAddress());
trade.setStateIfValidTransitionTo(Trade.State.MULTISIG_COMPLETED);
processModel.getProvider().getXmrWalletService().closeMultisigWallet(trade.getId()); // save and close multisig wallet once it's created
}
@ -209,8 +220,9 @@ public class ProcessInitMultisigRequest extends TradeTask {
UUID.randomUUID().toString(),
Version.getP2PMessageVersion(),
new Date().getTime(),
processModel.getPreparedMultisigHex(),
processModel.getMadeMultisigHex());
trade.getSelf().getPreparedMultisigHex(),
trade.getSelf().getMadeMultisigHex(),
trade.getSelf().getExchangedMultisigHex());
log.info("Send {} with offerId {} and uid {} to peer {}", request.getClass().getSimpleName(), request.getTradeId(), request.getUid(), recipient);
processModel.getP2PService().sendEncryptedDirectMessage(recipient, pubKeyRing, request, listener);

View File

@ -306,7 +306,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
@NotNull
private String getPaymentUri() {
return xmrWalletService.getWallet().createPaymentUri(new MoneroTxConfig()
return xmrWalletService.getWallet().getPaymentUri(new MoneroTxConfig()
.setAddress(addressTextField.getAddress())
.setAmount(ParsingUtils.coinToAtomicUnits(getAmountAsCoin()))
.setNote(paymentLabelString));

View File

@ -853,6 +853,14 @@
<sha256 value="ead76a2facdfaa55fcc2bc4aa706e3c6eebd5df4b9dcb153a9ff01f8f0324596" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="io.github.monero-ecosystem" name="monero-java" version="0.7.2">
<artifact name="monero-java-0.7.2.jar">
<sha256 value="166903729f2f554f2c7a9c908bc79e5940a96510852d9f9673494d346cec3c82" origin="Generated by Gradle"/>
</artifact>
<artifact name="monero-java-0.7.2.pom">
<sha256 value="7a3e7af49228370cc10401fe98a598c36e64e9b9fcafd5f07689c5ebeac46508" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="io.github.resilience4j" name="resilience4j-all" version="1.7.0">
<artifact name="resilience4j-all-1.7.0.jar">
<sha256 value="46c17f491886c0152d957cd04b00b871f39df09d2bd01067d650e2bc89451b04" origin="Generated by Gradle"/>

View File

@ -307,6 +307,7 @@ message InitMultisigRequest {
int64 current_date = 5;
string prepared_multisig_hex = 6;
string made_multisig_hex = 7;
string exchanged_multisig_hex = 8;
}
message SignContractRequest {
@ -1626,36 +1627,37 @@ message Trade {
PREPARATION = 1;
MULTISIG_PREPARED = 2;
MULTISIG_MADE = 3;
MULTISIG_COMPLETED = 4;
CONTRACT_SIGNATURE_REQUESTED = 5;
CONTRACT_SIGNED = 6;
SENT_PUBLISH_DEPOSIT_TX_REQUEST = 7;
SAW_ARRIVED_PUBLISH_DEPOSIT_TX_REQUEST = 8;
STORED_IN_MAILBOX_PUBLISH_DEPOSIT_TX_REQUEST = 9;
SEND_FAILED_PUBLISH_DEPOSIT_TX_REQUEST = 10;
ARBITRATOR_PUBLISHED_DEPOSIT_TXS = 11;
SAW_DEPOSIT_TXS_IN_NETWORK = 12;
DEPOSIT_TXS_UNLOCKED_IN_BLOCKCHAIN = 13;
BUYER_CONFIRMED_IN_UI_PAYMENT_SENT = 14;
BUYER_SENT_PAYMENT_SENT_MSG = 15;
BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG = 16;
BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG = 17;
BUYER_SEND_FAILED_PAYMENT_SENT_MSG = 18;
SELLER_RECEIVED_PAYMENT_SENT_MSG = 19;
SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT = 20;
SELLER_SENT_PAYMENT_RECEIVED_MSG = 21;
SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG = 22;
SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG = 23;
SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG = 24;
SELLER_PUBLISHED_PAYOUT_TX = 25;
SELLER_SENT_PAYOUT_TX_PUBLISHED_MSG = 26;
SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG = 27;
SELLER_STORED_IN_MAILBOX_PAYOUT_TX_PUBLISHED_MSG = 28;
SELLER_SEND_FAILED_PAYOUT_TX_PUBLISHED_MSG = 29;
BUYER_RECEIVED_PAYOUT_TX_PUBLISHED_MSG = 30;
BUYER_SAW_PAYOUT_TX_IN_NETWORK = 31;
BUYER_PUBLISHED_PAYOUT_TX = 32;
WITHDRAW_COMPLETED = 33;
MULTISIG_EXCHANGED = 4;
MULTISIG_COMPLETED = 5;
CONTRACT_SIGNATURE_REQUESTED = 6;
CONTRACT_SIGNED = 7;
SENT_PUBLISH_DEPOSIT_TX_REQUEST = 8;
SAW_ARRIVED_PUBLISH_DEPOSIT_TX_REQUEST = 9;
STORED_IN_MAILBOX_PUBLISH_DEPOSIT_TX_REQUEST = 10;
SEND_FAILED_PUBLISH_DEPOSIT_TX_REQUEST = 11;
ARBITRATOR_PUBLISHED_DEPOSIT_TXS = 12;
SAW_DEPOSIT_TXS_IN_NETWORK = 13;
DEPOSIT_TXS_UNLOCKED_IN_BLOCKCHAIN = 14;
BUYER_CONFIRMED_IN_UI_PAYMENT_SENT = 15;
BUYER_SENT_PAYMENT_SENT_MSG = 16;
BUYER_SAW_ARRIVED_PAYMENT_SENT_MSG = 17;
BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG = 18;
BUYER_SEND_FAILED_PAYMENT_SENT_MSG = 19;
SELLER_RECEIVED_PAYMENT_SENT_MSG = 20;
SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT = 21;
SELLER_SENT_PAYMENT_RECEIVED_MSG = 22;
SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG = 23;
SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG = 24;
SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG = 25;
SELLER_PUBLISHED_PAYOUT_TX = 26;
SELLER_SENT_PAYOUT_TX_PUBLISHED_MSG = 27;
SELLER_SAW_ARRIVED_PAYOUT_TX_PUBLISHED_MSG = 28;
SELLER_STORED_IN_MAILBOX_PAYOUT_TX_PUBLISHED_MSG = 29;
SELLER_SEND_FAILED_PAYOUT_TX_PUBLISHED_MSG = 30;
BUYER_RECEIVED_PAYOUT_TX_PUBLISHED_MSG = 31;
BUYER_SAW_PAYOUT_TX_IN_NETWORK = 32;
BUYER_PUBLISHED_PAYOUT_TX = 33;
WITHDRAW_COMPLETED = 34;
}
enum Phase {
@ -1781,9 +1783,7 @@ message ProcessModel {
TradingPeer taker = 1004;
TradingPeer arbitrator = 1005;
NodeAddress temp_trading_peer_node_address = 1006;
string prepared_multisig_hex = 1007;
string made_multisig_hex = 1008;
string multisig_address = 1009;
string multisig_address = 1007;
}
message TradingPeer {
@ -1812,11 +1812,12 @@ message TradingPeer {
repeated string reserve_tx_key_images = 1004;
string prepared_multisig_hex = 1005;
string made_multisig_hex = 1006;
string payout_tx_hex = 1007;
string deposit_tx_hash = 1008;
string deposit_tx_hex = 1009;
string deposit_tx_key = 1010;
string updated_multisig_hex = 1011;
string exchanged_multisig_hex = 1007;
string payout_tx_hex = 1008;
string deposit_tx_hash = 1009;
string deposit_tx_hex = 1010;
string deposit_tx_key = 1011;
string updated_multisig_hex = 1012;
}
///////////////////////////////////////////////////////////////////////////////////////////