From fa3f7e7fa67e77d22ccd3fde859069ab3f455160 Mon Sep 17 00:00:00 2001 From: Andrius Dagys Date: Tue, 12 Apr 2016 17:30:13 +0100 Subject: [PATCH] Added a basic Notary service with protocol for signing transactions --- .idea/runConfigurations/Node__seller.xml | 2 +- .../kotlin/contracts/AnotherDummyContract.kt | 13 +- .../kotlin/core/node/DummyContractBackdoor.kt | 4 +- .../java/contracts/JavaCommercialPaper.java | 54 +++++--- contracts/src/main/kotlin/contracts/Cash.kt | 16 ++- .../main/kotlin/contracts/CommercialPaper.kt | 9 +- .../src/main/kotlin/contracts/CrowdFund.kt | 8 +- .../main/kotlin/contracts/DummyContract.kt | 9 +- contracts/src/main/kotlin/contracts/IRS.kt | 12 +- core/src/main/kotlin/core/Structures.kt | 7 +- .../main/kotlin/core/TransactionBuilder.kt | 48 ++----- .../kotlin/core/TransactionVerification.kt | 44 ++++-- core/src/main/kotlin/core/Transactions.kt | 33 +++-- core/src/main/kotlin/core/node/ServiceHub.kt | 10 ++ .../core/node/services/TimestamperService.kt | 45 ------ .../core/node/subsystems/NetworkMapCache.kt | 31 +++-- .../kotlin/protocols/TimestampingProtocol.kt | 53 -------- .../kotlin/protocols/TwoPartyDealProtocol.kt | 61 ++++----- scripts/example-irs-trade.json | 3 +- scripts/irs-demo.sh | 2 +- src/main/kotlin/core/node/AbstractNode.kt | 19 ++- .../node/services/NodeTimestamperService.kt | 78 ----------- .../core/node/services/NotaryService.kt | 115 ++++++++++++++++ .../core/node/services/TimestampChecker.kt | 26 ++++ .../core/node/services/UniquenessProvider.kt | 64 +++++++++ .../subsystems/InMemoryNetworkMapCache.kt | 7 +- .../core/node/subsystems/NodeWalletService.kt | 6 +- src/main/kotlin/core/testing/IRSSimulation.kt | 9 +- .../core/testing/InMemoryMessagingNetwork.kt | 17 --- src/main/kotlin/core/testing/MockNode.kt | 38 +++--- src/main/kotlin/core/testing/Simulation.kt | 47 +++---- .../kotlin/core/testing/TradeSimulation.kt | 14 +- src/main/kotlin/demos/IRSDemo.kt | 13 +- src/main/kotlin/demos/RateFixDemo.kt | 6 +- src/main/kotlin/demos/TraderDemo.kt | 52 +++---- .../demos/protocols/AutoOfferProtocol.kt | 12 +- .../protocols/UpdateBusinessDayProtocol.kt | 8 +- src/main/kotlin/protocols/NotaryProtocol.kt | 94 +++++++++++++ .../kotlin/protocols/TwoPartyTradeProtocol.kt | 53 ++++---- src/test/kotlin/contracts/CashTests.kt | 24 ++-- .../kotlin/contracts/CommercialPaperTests.kt | 64 +++------ src/test/kotlin/contracts/CrowdFundTests.kt | 43 +++--- src/test/kotlin/contracts/IRSTests.kt | 28 ++-- src/test/kotlin/core/MockServices.kt | 32 +---- src/test/kotlin/core/TransactionGroupTests.kt | 29 ++-- .../kotlin/core/messaging/AttachmentTests.kt | 9 +- .../messaging/TwoPartyTradeProtocolTests.kt | 100 ++++++++------ .../core/node/AttachmentClassLoaderTests.kt | 9 +- .../node/services/NodeInterestRatesTest.kt | 6 +- .../core/node/services/NotaryServiceTests.kt | 88 ++++++++++++ .../node/services/TimestampCheckerTests.kt | 33 +++++ .../services/TimestamperNodeServiceTest.kt | 128 ------------------ .../node/services/UniquenessProviderTests.kt | 35 +++++ .../ArtemisMessagingServiceTests.kt | 3 +- .../node/subsystems/NodeWalletServiceTest.kt | 11 +- .../TransactionSerializationTests.kt | 28 ++-- src/test/kotlin/core/testutils/TestUtils.kt | 31 ++++- src/test/resources/core/node/isolated.jar | Bin 6455 -> 6912 bytes 58 files changed, 1003 insertions(+), 840 deletions(-) delete mode 100644 core/src/main/kotlin/core/node/services/TimestamperService.kt delete mode 100644 core/src/main/kotlin/protocols/TimestampingProtocol.kt delete mode 100644 src/main/kotlin/core/node/services/NodeTimestamperService.kt create mode 100644 src/main/kotlin/core/node/services/NotaryService.kt create mode 100644 src/main/kotlin/core/node/services/TimestampChecker.kt create mode 100644 src/main/kotlin/core/node/services/UniquenessProvider.kt create mode 100644 src/main/kotlin/protocols/NotaryProtocol.kt create mode 100644 src/test/kotlin/core/node/services/NotaryServiceTests.kt create mode 100644 src/test/kotlin/core/node/services/TimestampCheckerTests.kt delete mode 100644 src/test/kotlin/core/node/services/TimestamperNodeServiceTest.kt create mode 100644 src/test/kotlin/core/node/services/UniquenessProviderTests.kt diff --git a/.idea/runConfigurations/Node__seller.xml b/.idea/runConfigurations/Node__seller.xml index 30b7a8462d..13fc845c8a 100644 --- a/.idea/runConfigurations/Node__seller.xml +++ b/.idea/runConfigurations/Node__seller.xml @@ -3,7 +3,7 @@