-
Notifications
You must be signed in to change notification settings - Fork 3
/
spring-context.xml
executable file
·201 lines (183 loc) · 9.6 KB
/
spring-context.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?xml version = "1.0" encoding = "UTF-8"?>
<!--
~ Copyright D3 Ledger, Inc. All Rights Reserved.
~ SPDX-License-Identifier: Apache-2.0
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<!-- PATH TO THE PROPERTIES FILE -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
<property name="locations">
<list>
<value>classpath:application.properties</value>
<value>classpath:rmq.properties</value>
</list>
</property>
</bean>
<!-- BRVS PORT -->
<bean id="port" name="brvsPort" class="java.lang.String">
<constructor-arg name="original" value="${BRVS_PORT}"/>
</bean>
<!-- KEY PAIR DEFINITION -->
<bean id="brvsAccountKeyPair" class="jp.co.soramitsu.iroha.java.Utils"
factory-method="parseHexKeypair">
<constructor-arg name="hexPublicKey" value="${CREDENTIAL_PUBKEY}"/>
<constructor-arg name="hexPrivateKey" value="${CREDENTIAL_PRIVKEY}"/>
</bean>
<bean id="keysList" class="iroha.validation.utils.ValidationUtils"
factory-method="generateOrImportKeypairs">
<constructor-arg name="amount" value="${BRVS_USERKEYSCOUNT}"/>
<constructor-arg name="path" value="${BRVS_USERKEYSPATH}"/>
</bean>
<bean id="firstUserKey" class="iroha.validation.utils.ValidationUtils"
factory-method="generateOrImportFirstKeypair">
<constructor-arg name="path" value="${BRVS_USERKEYSPATH}"/>
</bean>
<!-- IROHA API IPJ CONFIG -->
<bean id="irohaAPI" class="jp.co.soramitsu.iroha.java.IrohaAPI">
<constructor-arg name="host" value="${IROHA_HOST}"/>
<constructor-arg name="port" value="${IROHA_PORT}"/>
</bean>
<bean id="queryAPI" class="jp.co.soramitsu.iroha.java.QueryAPI">
<constructor-arg name="api" ref="irohaAPI"/>
<constructor-arg name="accountId" value="${CREDENTIAL_ACCOUNTID}"/>
<constructor-arg name="keyPair" ref="brvsAccountKeyPair"/>
</bean>
<!-- STORAGE CONFIG -->
<bean id="mongoVerdictStorage"
class="iroha.validation.transactions.storage.impl.mongo.MongoTransactionVerdictStorage">
<constructor-arg name="mongoHost" value="${MONGO_HOST}"/>
<constructor-arg name="mongoPort" value="${MONGO_PORT}"/>
</bean>
<bean id="mongoBlockStorage"
class="iroha.validation.transactions.storage.impl.mongo.MongoBlockStorage">
<constructor-arg name="mongoHost" value="${MONGO_HOST}"/>
<constructor-arg name="mongoPort" value="${MONGO_PORT}"/>
</bean>
<!-- USER ACCOUNTS MANAGER CONFIG -->
<bean id="accountManager"
class="iroha.validation.transactions.provider.impl.AccountManager">
<constructor-arg name="queryAPI" ref="queryAPI"/>
<constructor-arg name="userSignatoriesAttribute" value="${USER_SIGNATORIES_KEY}"/>
<constructor-arg name="userDomains" value="${BRVS_USERDOMAINS}"/>
<constructor-arg name="userAccountsHolderAccount" value="${ACCOUNTS_HOLDER}"/>
<constructor-arg name="brvsInstancesHolderAccount" value="${CREDENTIAL_ACCOUNTID}"/>
<constructor-arg name="keyPairs" ref="keysList"/>
</bean>
<!-- PROVIDER CONFIG -->
<bean id="transactionProvider"
class="iroha.validation.transactions.provider.impl.BasicTransactionProvider">
<constructor-arg name="transactionVerdictStorage" ref="mongoVerdictStorage"/>
<constructor-arg name="cacheProvider" ref="cacheProvider"/>
<constructor-arg name="userQuorumProvider" ref="accountManager"/>
<constructor-arg name="registrationProvider" ref="accountManager"/>
<constructor-arg name="blockStorage" ref="mongoBlockStorage"/>
<constructor-arg name="irohaReliableChainListener" ref="irohaReliableChainListener"/>
<constructor-arg name="userDomains" value="${BRVS_USERDOMAINS}"/>
</bean>
<!-- CHAIN LISTENER CONFIG -->
<bean id="rmqConfig" class="iroha.validation.utils.ValidationUtils"
factory-method="loadLocalRmqConfig"/>
<bean id="irohaReliableChainListener"
class="iroha.validation.listener.BrvsIrohaChainListener">
<constructor-arg name="rmqConfig" ref="rmqConfig"/>
<constructor-arg name="queryAPI" ref="queryAPI"/>
<constructor-arg name="userKeyPair" ref="firstUserKey"/>
</bean>
<!-- SIGNER CONFIG -->
<bean id="transactionSigner"
class="iroha.validation.transactions.signatory.impl.TransactionSignerImpl">
<constructor-arg name="irohaAPI" ref="irohaAPI"/>
<constructor-arg name="brvsAccountId" value="${CREDENTIAL_ACCOUNTID}"/>
<constructor-arg name="brvsAccountKeyPair" ref="brvsAccountKeyPair"/>
<constructor-arg name="keyPairs" ref="keysList"/>
<constructor-arg name="transactionVerdictStorage" ref="mongoVerdictStorage"/>
<constructor-arg name="registrationProvider" ref="accountManager"/>
</bean>
<!-- CACHE CONFIG -->
<bean id="cacheProvider" class="iroha.validation.transactions.provider.impl.util.CacheProvider"/>
<!-- BRVS DATA CONFIG -->
<bean id="pubkey" class="java.lang.String">
<constructor-arg name="original" value="${CREDENTIAL_PUBKEY}"/>
</bean>
<bean id="brvsData" class="iroha.validation.transactions.provider.impl.util.BrvsData">
<constructor-arg name="hexPubKey" ref="pubkey"/>
<constructor-arg name="hostname" value="${BRVS_LOCALHOSTNAME}"/>
</bean>
<!-- RULE MONITOR -->
<bean id="ruleMonitor" class="iroha.validation.rules.RuleMonitor">
<constructor-arg name="queryAPI" ref="queryAPI"/>
<constructor-arg name="irohaChainListener" ref="irohaReliableChainListener"/>
<constructor-arg name="repositoryAccountId" value="${REPOSITORY_ACCOUNTID}"/>
<constructor-arg name="settingsAccountId" value="${SETTER_ACCOUNTID}"/>
<constructor-arg name="setterAccountId" value="${SETTINGS_ACCOUNTID}"/>
<constructor-arg name="validator" ref="simpleAggregationValidator"/>
</bean>
<!-- SERVICE CONFIG -->
<bean id="serviceContext" class="iroha.validation.config.ValidationServiceContext">
<constructor-arg name="validator" ref="simpleAggregationValidator"/>
<constructor-arg name="transactionProvider" ref="transactionProvider"/>
<constructor-arg name="transactionSigner" ref="transactionSigner"/>
<constructor-arg name="registrationProvider" ref="accountManager"/>
<constructor-arg name="brvsData" ref="brvsData"/>
<constructor-arg name="ruleMonitor" ref="ruleMonitor"/>
</bean>
<bean class="iroha.validation.service.impl.ValidationServiceImpl">
<constructor-arg name="validationServiceContext" ref="serviceContext"/>
</bean>
<!-- RULES DEFINITIONS -->
<bean id="updateWhitelistRule" class="iroha.validation.rules.impl.whitelist.UpdateWhitelistRule">
<constructor-arg name="queryAPI" ref="queryAPI"/>
<constructor-arg name="validationPeriod" value="${WHITELIST_VALIDATION}"/>
</bean>
<bean id="checkEthWhitelistRule" class="iroha.validation.rules.impl.whitelist.CheckWhitelistRule">
<constructor-arg name="queryAPI" ref="queryAPI"/>
<constructor-arg name="withdrawalAccount" value="${ETHCHECKWHITELIST_WITHDRAWALACCOUNT}"/>
<constructor-arg name="exceptionAssets" value="${WHITELIST_EXCEPTION_ASSETS}"/>
</bean>
<bean id="checkBtcWhitelistRule" class="iroha.validation.rules.impl.whitelist.CheckWhitelistRule">
<constructor-arg name="queryAPI" ref="queryAPI"/>
<constructor-arg name="withdrawalAccount" value="${BTCCHECKWHITELIST_WITHDRAWALACCOUNT}"/>
</bean>
<bean id="restrictedKeysRule" class="iroha.validation.rules.impl.core.RestrictedKeysRule">
<constructor-arg name="brvsAccountId" value="${CREDENTIAL_ACCOUNTID}"/>
<constructor-arg name="restrictedKeys" ref="keysList"/>
</bean>
<bean id="minKeysRule" class="iroha.validation.rules.impl.core.MinimumSignatoriesAmountRule">
<constructor-arg name="queryAPI" ref="queryAPI"/>
<constructor-arg name="amount" value="${MIN_SIGNATORIES_RULE_AMOUNT}"/>
</bean>
<bean id="billingRule" class="iroha.validation.rules.impl.billing.BillingRule">
<constructor-arg name="getBillingBaseURL" value="${BILLING_URL}"/>
<constructor-arg name="rmqHost" value="${rmq.host}"/>
<constructor-arg name="rmqPort" value="${rmq.port}"/>
<constructor-arg name="rmqExchange" value="${BILLING_RMQ_EXCHANGE}"/>
<constructor-arg name="rmqRoutingKey" value="${BILLING_RMQ_ROUTINGKEY}"/>
<constructor-arg name="userDomains" value="${BRVS_USERDOMAINS}"/>
<constructor-arg name="depositAccounts" value="${BILLING_DEPOSITACCOUNTS}"/>
<constructor-arg name="ethWithdrawalAccount" value="${BILLING_ETHWITHDRAWALACCOUNT}"/>
<constructor-arg name="btcWithdrawalAccount" value="${BILLING_BTCWITHDRAWALACCOUNT}"/>
</bean>
<bean id="quorumBanRule" class="iroha.validation.rules.impl.core.NoQuorumModificationsRule"/>
<util:map id="rules" map-class="java.util.HashMap">
<entry key="updateWhitelistRule" value-ref="updateWhitelistRule"/>
<entry key="checkEthWhitelistRule" value-ref="checkEthWhitelistRule"/>
<entry key="checkBtcWhitelistRule" value-ref="checkBtcWhitelistRule"/>
<entry key="restrictedKeysRule" value-ref="restrictedKeysRule"/>
<entry key="minKeysRule" value-ref="minKeysRule"/>
<entry key="billingRule" value-ref="billingRule"/>
<entry key="quorumBanRule" value-ref="quorumBanRule"/>
<!-- More can be added -->
</util:map>
<!-- VALIDATOR DEFINITION -->
<bean id="simpleAggregationValidator"
class="iroha.validation.validators.impl.SimpleAggregationValidator">
<constructor-arg ref="rules"/>
</bean>
</beans>