Skip to content

Commit 224018e

Browse files
committed
2 parents 166c230 + f838838 commit 224018e

File tree

83 files changed

+4894
-1037
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+4894
-1037
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ package-lock.json
6363

6464
http-client.env.json
6565
local
66+
local-*
6667

6768
# storage for state trie
6869
state-db
69-
fast_sync
70+
fast_sync
71+
72+
.vscode

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,4 @@ python start.py --env=local.env
265265
### shutdown application
266266
* METHOD: POST
267267
* URL: http://ip:port/wisdom/shutdown
268-
* HEADER: token (JWT TOKEN)
268+
* HEADER: token (JWT TOKEN)

build.gradle

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,13 @@ allprojects {
1010
}
1111
}
1212

13-
def gitCurBranch() {
14-
def branchName = System.getenv('TRAVIS_BRANCH')
15-
16-
if (branchName) return branchName
17-
def process = "git rev-parse --abbrev-ref HEAD".execute()
18-
return process.text.trim()
19-
}
20-
2113
subprojects {
2214
apply plugin: 'java'
2315
apply plugin: 'maven'
2416

25-
def config = new ConfigSlurper().parse(new File("$projectDir/src/main/resources/version.properties").toURI().toURL())
2617

2718
group = 'org.wisdom'
2819

29-
version = config.versionNumber + ("master" == gitCurBranch() ? "-RELEASE" : "-SNAPSHOT")
30-
31-
println("Building version: " + version + " (from branch " + gitCurBranch() + ")")
3220

3321
compileJava.options.encoding = 'UTF-8'
3422
compileJava.options.compilerArgs << '-XDignore.symbol.file'

gradlew

100644100755
File mode changed.

local.env.example

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ SERVER_PORT=19585
55
DATA_SOURCE_URL=jdbc:postgresql://localhost:5432/your-data-base
66

77
# 数据库用户名
8-
DB_USERNAME=
8+
DB_USERNAME=postgres
99

1010
# 数据库密码
11-
DB_PASSWORD=
11+
DB_PASSWORD=wangweilong0
1212

1313
# 矿工收益地址
14-
WDC_MINER_COINBASE=
14+
WDC_MINER_COINBASE=WX1DL55mQ6HsfXrnaCak9TdAHxdMYLNxdg3
1515

1616
# 是否开启挖矿
1717
ENABLE_MINING=true
1818

1919
# 验证者节点配置文件
20-
VALIDATORS=
20+
VALIDATORS='local/test-validators.json'
2121

2222
# 是否清除所有区块数据
23-
CLEAR_DATA=fale
23+
CLEAR_DATA=false
2424

transaction-test-example.jsonc

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
2-
// windows脚本 .\gradlew runTransactionTestTool -PappArgs="-c F:\java-wisdomcore\transaction-test-example.jsonc"
2+
// windows脚本 .\gradlew runTransactionTestTool -PappArgs="-c D:\IDEA\IdeaProjects\java-wisdomcore-master\transaction-test-example.jsonc"
33
// unix 脚本 ./gradlew runTransactionTestTool -PappArgs="-c ../java-wisdomcore/transaction-test-example.jsonc"
44
"host": "192.168.1.36", // 可以通过命令行 -h 参数 覆盖
55
"port": "19585", // 可以通过命令行 -p 参数 覆盖
6-
"privateKey": "b90a0e49b54e1f52a2234bb5490f15d97f39c40aeabc98dadd9a706ec0c8fddf", // 通过命令行 -k 参数覆盖 传递私钥
76
"nonce": 0, // 起始 nonce 可选,如果为 0 自动获取,通过命令行 -n 参数 传递
87
"protocol": "http", // 从 http 发事务是批量 http 请求,从 grpc 发是单次 http2 请求速度更快
98
"grpc.port": "9585", // 接收者节点的 grpc 监听端口, 如果节点的p2p地址是 wisdom://192.168.1.118:9585, 就填 9585
@@ -13,14 +12,6 @@
1312
{
1413
"amount": 100000, // 单位是 WDC,不可省略
1514
"type": "MORTGAGE", // 事务类型
16-
/*
17-
事务类型
18-
TRANSFER, VOTE,
19-
DEPOSIT, TRANSFER_MULTISIG_MULTISIG, TRANSFER_MULTISIG_NORMAL,
20-
TRANSFER_NORMAL_MULTISIG, ASSET_DEFINE, ATOMIC_EXCHANGE,
21-
INCUBATE, EXTRACT_INTEREST, EXTRACT_SHARING_PROFIT,
22-
EXTRACT_COST, EXIT_VOTE, MORTGAGE, EXIT_MORTGAGE
23-
*/
2415
"payload": "", // 可选,备注信息
2516
"to": "151bynoTGVJAaGrZDabDb2aYrTTEqw5vRx", // 接收者的 公钥,公钥哈希或者地址
2617
"times": 1, // 发送次数
@@ -34,7 +25,7 @@
3425
"times": 1, // 发送次数
3526
},
3627
//孵化
37-
{
28+
/*{
3829
"amount":"300",// 单位是 WDC
3930
"type": "INCUBATE",//事务类型
4031
"payload": "7d4d105a3fc6db71d35ed654b1b7aab73d8fa50d", // 孵化分享者 公钥,公钥哈希或者地址,非必填
@@ -68,8 +59,22 @@
6859
}*/
6960
]
7061
}
71-
7262
/*
63+
TRANSFER 转账
64+
VOTE 投票
65+
EXIT_VOTE 撤回投票
66+
INCUBATE 孵化
67+
EXTRACT_INTEREST 提取收益
68+
EXTRACT_SHARING_PROFIT 提取分享收益
69+
EXTRACT_COST 提取本金
70+
MORTGAGE 抵押
71+
EXIT_MORTGAGE 撤回抵押
72+
DEPOSIT 存证
73+
TRANSFER, VOTE,
74+
DEPOSIT, TRANSFER_MULTISIG_MULTISIG, TRANSFER_MULTISIG_NORMAL,
75+
TRANSFER_NORMAL_MULTISIG, ASSET_DEFINE, ATOMIC_EXCHANGE,
76+
INCUBATE, EXTRACT_INTEREST, EXTRACT_SHARING_PROFIT,
77+
EXTRACT_COST, EXIT_VOTE, MORTGAGE, EXIT_MORTGAGE
7378
存证事务的 payload 可以填文本了
7479
如果文本内容是合法的十六进制字符串则会被解析为字节数组 例如 "payload": "ff", 提交的是一个字节
7580
如果要强制提交文本用 `` 包含 例如 "payload": "`ff`", 提交的是两个字节,表示 f 这个字符的 utf8 编码

wisdom-core/build.gradle

Lines changed: 2 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import java.text.SimpleDateFormat
21

32
buildscript {
43
repositories {
@@ -17,7 +16,7 @@ buildscript {
1716
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
1817
}
1918
}
20-
maven { url "http://repo.springsource.org/plugins-release" }
19+
maven { url "https://repo.springsource.org/plugins-release" }
2120
jcenter()
2221
mavenCentral()
2322
}
@@ -196,35 +195,6 @@ task buildDockerPgsql(type: Docker) {
196195
}
197196
}
198197

199-
/**
200-
* Runs all tests
201-
* EthereumJ also runs common Ethereum clients tests
202-
* See {@link #prepareGithubTests()} if you want to use local repo
203-
* instead of downloading tests during test execution
204-
*/
205-
test {
206-
207-
beforeTest { descriptor ->
208-
logger.lifecycle("Running test: ${descriptor}")
209-
}
210-
211-
jvmArgs = ["-Xss8m", "-Xmx3G"]
212-
213-
prepareGithubTests()
214-
// If Github tests directory is provided, it's passed to test runner
215-
if (System.getProperty("GitHubTests.testPath") != null) {
216-
jvmArgs.add('-DGitHubTests.testPath' + '=' + System.getProperty("GitHubTests.testPath"))
217-
}
218-
219-
testLogging {
220-
events "failed"
221-
exceptionFormat "short"
222-
}
223-
224-
systemProperties System.properties
225-
systemProperty "user.dir", workingDir
226-
systemProperty "file.encoding", "UTF-8"
227-
}
228198

229199
ext {
230200
slf4jVersion = '1.7.7'
@@ -302,6 +272,7 @@ dependencies {
302272
compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.6.0'
303273
compile group: 'org.hibernate.validator', name: 'hibernate-validator', version: '6.0.17.Final'
304274
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.8'
275+
compile "org.springframework.boot:spring-boot-starter-websocket:${springbootVersion}"
305276

306277
compile group: 'io.netty', name: 'netty-all', version: '4.1.42.Final'
307278
compile "io.grpc:grpc-netty-shaded:${gRPCVersion}"
@@ -339,19 +310,6 @@ dependencies {
339310
compile group: 'com.h2database', name: 'h2', version: '1.4.200'
340311
}
341312

342-
343-
javadoc {
344-
options.author = true
345-
options.header = project.name
346-
options.addStringOption('-quiet')
347-
options.encoding = "UTF-8"
348-
options.links(
349-
"http://docs.oracle.com/javase/8/docs/api/",
350-
"http://netty.io/4.0/api/"
351-
)
352-
}
353-
354-
355313
task copyDependencies(type: Copy) {
356314
from configurations.runtime
357315
destinationDir = file('build/libs/lib')
@@ -364,151 +322,5 @@ jar {
364322
}
365323
}
366324

367-
// jar.dependsOn += copyDependencies
368-
369-
370-
//create a single Jar with all dependencies
371-
task fatJar(type: Jar) {
372-
classifier = 'all'
373-
manifest {
374-
attributes 'Main-Class': mainClassName
375-
attributes 'Class-Path': configurations.compile.collect { 'lib/' + it.getName() }.join(' ')
376-
}
377-
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
378-
with jar
379-
}
380-
381-
task sourcesJar(type: Jar, dependsOn: classes) {
382-
classifier = 'sources'
383-
from sourceSets.main.allSource
384-
}
385-
386-
task javadocJar(type: Jar) {
387-
classifier = "javadoc"
388-
from javadoc
389-
}
390-
391-
392-
artifacts {
393-
archives sourcesJar
394-
archives javadocJar
395-
}
396-
397-
//jacocoTestReport {
398-
// reports {
399-
// xml.enabled = true
400-
// html.enabled = true
401-
// }
402-
//}
403-
404-
def bintrayUsername = project.hasProperty('bintrayUser') ? project.bintrayUser : ''
405-
def bintrayPassword = project.hasProperty('bintrayKey') ? project.bintrayKey : ''
406-
def pullRequest = System.getenv('TRAVIS_PULL_REQUEST')
407-
def branchName = System.getenv('TRAVIS_BRANCH')
408-
409-
artifactory {
410-
contextUrl = 'http://oss.jfrog.org/artifactory'
411-
publish {
412-
repository {
413-
repoKey = 'oss-snapshot-local'
414-
username = bintrayUsername
415-
password = bintrayPassword
416-
}
417-
}
418-
resolve {
419-
repository {
420-
repoKey = 'libs-release'
421-
}
422-
}
423-
424-
}
425-
426-
artifactoryPublish.onlyIf {
427-
(branchName != null) &&
428-
(!pullRequest || pullRequest == 'false') &&
429-
project.version.endsWith('-SNAPSHOT') &&
430-
(branchName.startsWith('master') ||
431-
branchName.startsWith('develop') ||
432-
branchName.startsWith('stage'))
433-
}
434-
435-
bintrayUpload.onlyIf {
436-
// comment 'false' and uncomment the next line to publish next release
437-
(!pullRequest || pullRequest == 'false') && !project.version.endsWith('-SNAPSHOT')
438-
// false
439-
}
440-
441-
tasks.processResources.doLast() {
442-
println 'This will be printed after the build task even if something else calls the build task'
443-
444-
File versionfile = file(new File('build/resources/main/build-info.properties'))
445-
versionfile.text = 'build.hash=' + gitCommitHash() + '\n' + 'build.time=' + buildTime() + '\n' + 'build.branch=' + gitCurBranch() + '\n'
446-
}
447-
448-
task publish {
449-
450-
println "publishing if master || develop current branch: " + branchName
451-
description = "Publishes snapshots to oss.jfrog.org and releases to Bintray/JCenter"
452-
dependsOn artifactoryPublish, bintrayUpload
453-
}
454-
455-
def gitCommitHash() {
456-
def process = "git rev-parse --short HEAD".execute()
457-
return process.text.trim()
458-
}
459-
460-
def buildTime() {
461-
def df = new SimpleDateFormat("[dd/MMM/yyyy]-[HH:mm]")
462-
df.setTimeZone(TimeZone.getTimeZone("GMT"));
463-
return '[GMT]-' + df.format(new Date())
464-
}
465-
466-
def gitCurBranch() {
467-
def branchName = System.getenv('TRAVIS_BRANCH')
468-
if (branchName) return branchName
469-
def process = "git rev-parse --abbrev-ref HEAD".execute()
470-
return process.text.trim()
471-
}
472-
473-
474-
import org.ajoberstar.grgit.Grgit
475-
import com.typesafe.config.Config
476-
import com.typesafe.config.ConfigFactory
477-
478-
def prepareGithubTests() {
479-
String testsPathKey = "GitHubTests.testPath"
480-
String testsCommitKey = "GitHubTests.commit"
481-
String testUserConf = "wisdom-core/src/test/resources/test-user.conf"
482-
String githubTestsProp = "wisdom-core/src/test/resources/github-tests.prop"
483-
def repoPath = System.getProperty(testsPathKey)
484-
if (repoPath == null) {
485-
try {
486-
Config userTest = ConfigFactory.parseFile(new File(testUserConf))
487-
repoPath = userTest.getString(testsPathKey)
488-
} catch (Exception ex) {
489-
}
490-
}
491-
if (repoPath == null) return
492-
def commit = System.getProperty(testsCommitKey)
493-
if (commit == null) {
494-
Properties testProp = new Properties();
495-
testProp.load(new File(githubTestsProp).newDataInputStream());
496-
commit = testProp.getProperty(testsCommitKey)
497-
}
498-
if (repoPath != null && commit != null) {
499-
println "Tests: Checking out Ethereum Tests repo at " + repoPath + " to commit #" + commit
500-
try {
501-
def testsRepo = Grgit.open(dir: repoPath)
502-
testsRepo.fetch()
503-
testsRepo.checkout(branch: commit)
504-
} catch (Exception ex) {
505-
println "Error occurs while trying to checkout local Ethereum tests repo to specific commit"
506-
println "Either remove " + testsPathKey + " property to use remote repo in tests or fix the issue"
507-
println "Error: "
508-
println ex
509-
throw ex
510-
}
511-
}
512-
}
513325

514326
run.jvmArgs=['-Xms16g']
121 KB
Binary file not shown.

wisdom-core/libs/rlp-1.1.16.jar

-39.3 KB
Binary file not shown.

wisdom-core/libs/rlp-1.1.20.jar

60.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)