mirror of
https://github.com/fluencelabs/tendermint-demo
synced 2025-03-14 15:20:50 +00:00
License headers
This commit is contained in:
parent
b06c2fc5b2
commit
31507ffe76
19
bin/judge.py
19
bin/judge.py
@ -1,3 +1,19 @@
|
||||
#
|
||||
# Copyright 2018 Fluence Labs Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#!/usr/bin/python
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||
import json
|
||||
@ -35,9 +51,8 @@ try:
|
||||
|
||||
server = HTTPServer(("", PORT_NUMBER), JudgeHandler)
|
||||
print "the Judge server started on port", PORT_NUMBER
|
||||
|
||||
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print "^C received, shutting down the Judge"
|
||||
server.socket.close()
|
||||
|
@ -1,3 +1,19 @@
|
||||
#
|
||||
# Copyright 2018 Fluence Labs Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#!/usr/bin/python
|
||||
import sys, urllib, json, datetime, time
|
||||
import matplotlib.pyplot as plt
|
||||
@ -24,7 +40,7 @@ else:
|
||||
min_height = max_height
|
||||
while min_height >= 3 and get_num_txs(read_json(tmaddress + "/block?height=%d" % (min_height - 1))) > 0:
|
||||
min_height -= 1
|
||||
|
||||
|
||||
accsize = 0
|
||||
acclatency = 0
|
||||
minlatency = 1e20
|
||||
@ -41,7 +57,7 @@ txstat = []
|
||||
for height in range(min_height, max_height + 1):
|
||||
data = read_json(tmaddress + "/block?height=%d" % height)
|
||||
num_txs = get_num_txs(data)
|
||||
|
||||
|
||||
blocktimetxt = data["result"]["block"]["header"]["time"]
|
||||
blocktime = parse_utc(blocktimetxt)
|
||||
|
||||
@ -55,12 +71,12 @@ for height in range(min_height, max_height + 1):
|
||||
txs = data["result"]["block"]["data"]["txs"]
|
||||
if txs:
|
||||
for index, txhex in enumerate(txs):
|
||||
txbytes = bytearray.fromhex(txhex)# if re.fullmatch(r"^[0-9a-fA-F]$", txhex) is not None
|
||||
key = chr(txbytes[0]) if chr(txbytes[1]) == '=' else "*"
|
||||
txbytes = bytearray.fromhex(txhex)# if re.fullmatch(r"^[0-9a-fA-F]$", txhex) is not None
|
||||
key = chr(txbytes[0]) if chr(txbytes[1]) == '=' else "*"
|
||||
connindex = uvarint(txbytes[2:8])
|
||||
txnumber = uvarint(txbytes[8:16])
|
||||
hostnamehash = txhex[32:64]
|
||||
|
||||
|
||||
txtime = uvarint(txbytes[32:40]) / 1e6
|
||||
if txtime < 1e9:
|
||||
txtime *= 1e6 # legacy support
|
||||
@ -101,7 +117,7 @@ stepstat = []
|
||||
for i in range(steps + 1):
|
||||
t = firsttx + (lastblock - firsttx) / steps * i
|
||||
while curindex < len(txstat) and txstat[curindex][0] <= t:
|
||||
cursum += txstat[curindex][1]
|
||||
cursum += txstat[curindex][1]
|
||||
curindex += 1
|
||||
stepstat.append(cursum)
|
||||
f = plt.figure(figsize=(15, 5))
|
||||
@ -120,4 +136,4 @@ if report_name != "":
|
||||
(min_height, max_height, max_block_size, lasttx - firsttx, accsize / txcount, txcount / (lasttx - firsttx))
|
||||
#f.savefig(long_filename, bbox_inches='tight')
|
||||
f.savefig(report_name + ".png", bbox_inches='tight')
|
||||
plt.show(block=True)
|
||||
plt.show(block=True)
|
||||
|
@ -1,3 +1,19 @@
|
||||
#
|
||||
# Copyright 2018 Fluence Labs Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import sys, urllib, json, datetime, time
|
||||
|
||||
def uvarint(buf):
|
||||
@ -21,7 +37,7 @@ def parse_utc(utctxt):
|
||||
pure = int((datetime.datetime.strptime(dt, '%Y-%m-%dT%H:%M:%S') + offset).strftime("%s"))
|
||||
ns = int(tail.rstrip("Z").ljust(9, "0"), 10)
|
||||
return pure + ns / 1e9
|
||||
|
||||
|
||||
def format_bytes(value):
|
||||
if value < 1024:
|
||||
return "%.0f B" % value
|
||||
@ -43,4 +59,3 @@ def get_sync_info(tmaddress):
|
||||
|
||||
def get_max_height(tmaddress):
|
||||
return get_sync_info(tmaddress)["latest_block_height"]
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
#
|
||||
# Copyright 2018 Fluence Labs Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#!/usr/bin/python
|
||||
import sys, urllib, json, datetime, time
|
||||
from common_parse_utils import parse_utc, read_json, get_max_height
|
||||
|
16
cli/query.py
16
cli/query.py
@ -1,3 +1,19 @@
|
||||
#
|
||||
# Copyright 2018 Fluence Labs Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#!/usr/bin/python2.7
|
||||
import sys, urllib, json, datetime, time, hashlib, sha3
|
||||
from common_parse_utils import read_json, get_sync_info, get_max_height
|
||||
|
@ -1 +0,0 @@
|
||||
<mxfile userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36" version="8.8.6" editor="www.draw.io" type="device"><diagram id="2601f40a-c04a-d45e-4f1e-d157f2eb324b" name="Page-1">7Z1dc6JIFIZ/DTVXMwW0oF5GY7IXO1VbNVu1s5cgrbJB20VMzP76baBbPmwtMxFa8Z2bkUPTNOcQnvfgOYlBxsvdc+ytF99ZQCPDNoOdQR4N27asocn/Sy3vucUlwjCPw0AMKgw/wv+oMMph2zCgm8rAhLEoCddV45StVnSaVGxeHLO36rAZi6pnXXtzemD4MfWiQ+tfYZAscuvAMQv7bzScL+SZLVPs8b3pyzxm25U4n2GTWfYv37305Fxi/GbhBeytZCITg4xjxpL803I3plHqW+m2/LinI3v3647pKjnnAFcsI3mXl04D7gmxyeJkweZs5UWTw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NC40LjQuKUp0EkHFQwVfEEVXO+QU6vghlrkbBTOg/AgPAgvp0CL3A0jHC1yjX/N/inU16vp1KhvqEfORuE8UA/UA/Vl1AfdRL0elt2Ca9Ajpwf1PdJi5byNynmgHqgH6suoR4/cjaL+Dl/M94e+adbonb2Yp257L+YPsvV+mwjvA+FAOBAOhIsp/E7iG81vaH7TnarXy1AdS/FWvqnmNznv/RY9EvlXDEtFj0RnY8/dt1opI6KxDFVqbESkEhGN7YhyPchOkJ20sQBkJ1euVdH8dqvZyb4C6Cn9fUudzzUMmwxsn7iKst/AoYOgZ2jKOlxTVQtkN1MLJOe93+Y30lMoqvODeHlFRfRHRLPGVUVkoDEiKI2HxoXGhcYtTYHmt46rYOfJhgpuUQXXm9/UKrih5jeCingQHoQH4eUUaH67YYSj+e26v2avl9OpUd9Q8xtBRTxQD9QD9WXUB91EvR6W3YJr0PymB/V9q8XKeYLKeaAeqAfqy6jvZvOb03nSS24P3NH4Drh9Ne/lD5L1Nv/Eq3zfD4KD4CA4CI7et5vlN3rfrjtTr1eh9oct9r7JOUqc/5KLdfLofOE7HmkU8sv7c3eGW+vOybbFAcf+Ht6HFJFTVUSO6nf3WaqvLy7hqcN+m6qnxmy5DJMrdNNA9S3PhdzEN7MqrGLfc+ytF99ZQNMR/wM=</diagram></mxfile>
|
Binary file not shown.
Before Width: | Height: | Size: 136 KiB |
Binary file not shown.
Before Width: | Height: | Size: 128 KiB |
@ -4,8 +4,14 @@ version := "0.1"
|
||||
|
||||
scalaVersion := "2.12.6"
|
||||
|
||||
organizationName := "Fluence Labs Limited"
|
||||
|
||||
startYear := Some(2018)
|
||||
|
||||
licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt"))
|
||||
|
||||
libraryDependencies += "com.github.jtendermint" % "jabci" % "0.17.1"
|
||||
|
||||
libraryDependencies += "org.bouncycastle" % "bcpkix-jdk15on" % "1.56"
|
||||
|
||||
libraryDependencies += "com.google.code.gson" % "gson" % "2.8.5"
|
||||
libraryDependencies += "com.google.code.gson" % "gson" % "2.8.5"
|
||||
|
1
tmdemoapp/project/plugins.sbt
Normal file
1
tmdemoapp/project/plugins.sbt
Normal file
@ -0,0 +1 @@
|
||||
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.0.0")
|
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kvstore
|
||||
|
||||
import java.nio.ByteBuffer
|
||||
|
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kvstore
|
||||
|
||||
case class BlockchainState(
|
||||
|
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kvstore
|
||||
|
||||
object ClusterUtil {
|
||||
|
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kvstore
|
||||
|
||||
import org.bouncycastle.jcajce.provider.digest.SHA3
|
||||
|
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kvstore
|
||||
|
||||
import kvstore.MerkleUtil._
|
||||
|
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kvstore
|
||||
|
||||
trait Operation {
|
||||
|
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kvstore
|
||||
|
||||
import java.io.{DataOutputStream, InputStreamReader}
|
||||
|
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kvstore
|
||||
|
||||
import com.github.jtendermint.jabci.socket.TSocket
|
||||
|
@ -1,4 +1,18 @@
|
||||
|
||||
/*
|
||||
* Copyright 2018 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package object kvstore {
|
||||
type NodeStorage = Map[String, Node]
|
||||
|
Loading…
x
Reference in New Issue
Block a user