universa 3.14.2.4 → 3.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45b80876f80d3a1d753ae95564492344a3949ed918cb74e4d76e039e5d9aa5bf
4
- data.tar.gz: 7a091a3cd7d7e107619d8ae47a9b39a8b5c3c0a81646d6feb863f3c8722e1d1b
3
+ metadata.gz: 73b364bddb0a494976ebf2cd0ebf2931cf69abfa9cb8d58479b8775c3e24b3f6
4
+ data.tar.gz: 9c4891a5a8d1a6eba04f61708edad2d449519aa6520c78cd0b19857f6e3736f6
5
5
  SHA512:
6
- metadata.gz: 3686641fdef17fa73cde3891352cea13ac73c7ef965e5fa63e4c087bfc100a9b266d71d0f70a446a9220e47dc88abfedeee52895de170087b33a820044393e16
7
- data.tar.gz: 7fa8bf49efbdd6f4339d54e0e2bca6c15db375f7052cad7474fc312e0d506eb0012cf76d6e3adf2d3084ecc40160637e75041ea0b55870d208f7cee655f28977
6
+ metadata.gz: 87a5e9e6b7711b7c5315cfacd98faf3bef3e45aaf6261e4daf1a6bc76befd8f0a39d3d65aa65ee146f297f9b94fa20eb5b7974bc372de0e745694e8873a9456e
7
+ data.tar.gz: e85a4b6306857ec5aef891302f645ba7973a3c963bad8b460cd25c04ebb2f9aa9de78093e848c9e57f79aa59e5a491a76f67d82a65c830f0cf1abca0d5d370f5
data/README.md CHANGED
@@ -5,6 +5,15 @@ Java library using Universa UMI protocol and Universa client services.
5
5
 
6
6
  ## News
7
7
 
8
+ - fixed complex reference types integration
9
+ - upgraded to new UMI (universa core is updated)
10
+ - unikeys cli tool now show information about public keys too
11
+ - unikeys extracts public keys and export as files or unversa text objects
12
+ them as both univera binaries or universa text objects
13
+ - support to pack universa text objects, see [kb on universa text objects](https://kb.universablockchain.com/text_format_for_universa_objects/311).
14
+
15
+ ## Old News :)
16
+
8
17
  - production-tested in various universa projects
9
18
  - rewritten Client and Connection to use new consensus-based, dns-free Universa network topology discovery protocol
10
19
  - added syntax sugar for TransactionPack
data/bin/umi/bin/umi CHANGED
@@ -344,7 +344,7 @@ declare -r lib_dir="$(realpath "${app_home}/../lib")"
344
344
  declare -a app_mainclass=(com.icodici.farcallscala.Main)
345
345
 
346
346
  declare -r script_conf_file="${app_home}/../conf/application.ini"
347
- declare -r app_classpath="$lib_dir/com.icodici.umi-0.8.72.jar:$lib_dir/org.scala-lang.scala-library-2.12.7.jar:$lib_dir/com.icodici.universa_core-3.14.2.jar:$lib_dir/org.yaml.snakeyaml-1.18.jar:$lib_dir/com.icodici.nanohttpd-2.1.0.jar:$lib_dir/com.icodici.common_tools-3.14.2.jar:$lib_dir/com.eclipsesource.minimal-json.minimal-json-0.9.4.jar:$lib_dir/net.java.dev.jna.jna-4.5.1.jar:$lib_dir/org.checkerframework.checker-qual-2.3.2.jar:$lib_dir/com.icodici.crypto-3.14.2.jar:$lib_dir/org.bouncycastle.bcprov-jdk15on-1.62.jar:$lib_dir/com.squareup.jnagmp.jnagmp-2.0.0.jar:$lib_dir/org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar:$lib_dir/net.java.dev.jna.jna-platform-4.5.0.jar:$lib_dir/net.sf.jopt-simple.jopt-simple-4.9.jar"
347
+ declare -r app_classpath="$lib_dir/com.icodici.umi-0.8.79.jar:$lib_dir/org.scala-lang.scala-library-2.12.7.jar:$lib_dir/com.icodici.universa_core-3.14.5.jar:$lib_dir/org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar:$lib_dir/net.sf.jopt-simple.jopt-simple-4.9.jar:$lib_dir/org.yaml.snakeyaml-1.18.jar:$lib_dir/com.icodici.nanohttpd-2.1.0-20210921.jar:$lib_dir/com.icodici.common_tools-3.14.5.jar:$lib_dir/com.icodici.crypto-3.14.5.jar:$lib_dir/net.java.dev.jna.jna-4.5.1.jar:$lib_dir/net.java.dev.jna.jna-platform-4.5.0.jar:$lib_dir/com.eclipsesource.minimal-json.minimal-json-0.9.4.jar:$lib_dir/org.checkerframework.checker-qual-2.3.2.jar:$lib_dir/org.bouncycastle.bcprov-jdk15on-1.62.jar:$lib_dir/com.squareup.jnagmp.jnagmp-2.0.0.jar"
348
348
 
349
349
  # java_cmd is overrode in process_args when -java-home is used
350
350
  declare java_cmd=$(get_java_cmd)
data/bin/umi/bin/umi.bat CHANGED
@@ -80,7 +80,7 @@ rem "-J" is stripped, "-D" is left as is, and everything is appended to JAVA_OPT
80
80
  set _JAVA_PARAMS=
81
81
  set _APP_ARGS=
82
82
 
83
- set "APP_CLASSPATH=%APP_LIB_DIR%\com.icodici.umi-0.8.72.jar;%APP_LIB_DIR%\org.scala-lang.scala-library-2.12.7.jar;%APP_LIB_DIR%\com.icodici.universa_core-3.14.2.jar;%APP_LIB_DIR%\org.yaml.snakeyaml-1.18.jar;%APP_LIB_DIR%\com.icodici.nanohttpd-2.1.0.jar;%APP_LIB_DIR%\com.icodici.common_tools-3.14.2.jar;%APP_LIB_DIR%\com.eclipsesource.minimal-json.minimal-json-0.9.4.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-4.5.1.jar;%APP_LIB_DIR%\org.checkerframework.checker-qual-2.3.2.jar;%APP_LIB_DIR%\com.icodici.crypto-3.14.2.jar;%APP_LIB_DIR%\org.bouncycastle.bcprov-jdk15on-1.62.jar;%APP_LIB_DIR%\com.squareup.jnagmp.jnagmp-2.0.0.jar;%APP_LIB_DIR%\org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-platform-4.5.0.jar;%APP_LIB_DIR%\net.sf.jopt-simple.jopt-simple-4.9.jar"
83
+ set "APP_CLASSPATH=%APP_LIB_DIR%\com.icodici.umi-0.8.79.jar;%APP_LIB_DIR%\org.scala-lang.scala-library-2.12.7.jar;%APP_LIB_DIR%\com.icodici.universa_core-3.14.5.jar;%APP_LIB_DIR%\org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar;%APP_LIB_DIR%\net.sf.jopt-simple.jopt-simple-4.9.jar;%APP_LIB_DIR%\org.yaml.snakeyaml-1.18.jar;%APP_LIB_DIR%\com.icodici.nanohttpd-2.1.0-20210921.jar;%APP_LIB_DIR%\com.icodici.common_tools-3.14.5.jar;%APP_LIB_DIR%\com.icodici.crypto-3.14.5.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-4.5.1.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-platform-4.5.0.jar;%APP_LIB_DIR%\com.eclipsesource.minimal-json.minimal-json-0.9.4.jar;%APP_LIB_DIR%\org.checkerframework.checker-qual-2.3.2.jar;%APP_LIB_DIR%\org.bouncycastle.bcprov-jdk15on-1.62.jar;%APP_LIB_DIR%\com.squareup.jnagmp.jnagmp-2.0.0.jar"
84
84
  set "APP_MAIN_CLASS=com.icodici.farcallscala.Main"
85
85
  set "SCRIPT_CONF_FILE=%APP_HOME%\conf\application.ini"
86
86
 
@@ -10,7 +10,6 @@ module Universa
10
10
  remote_class "com.icodici.universa.node2.network.Client"
11
11
  end
12
12
 
13
-
14
13
  # The universa network client. Discover and connects to the universa network, provides consensus operations
15
14
  # and all other whole-network related functions.
16
15
  class Client
@@ -42,9 +41,9 @@ module Universa
42
41
  # @raise if network topology could not be checked/obtained.
43
42
  def initialize topology: "mainnet", private_key: PrivateKey.new(2048), cache_dir: nil
44
43
  @client = UmiClient.new topology, cache_dir, private_key
45
- @private_key = PrivateKey
44
+ @private_key = private_key
46
45
  @size = @client.size
47
- @connections = (0...@size).map {nil}
46
+ @connections = (0...@size).map { nil }
48
47
  end
49
48
 
50
49
  # Get the node connection by its index (0...size).
@@ -64,7 +63,7 @@ module Universa
64
63
  # @param [Numeric] number of connections to get
65
64
  # @return [Array(Connection)] array of connections to random (non repeating) nodes
66
65
  def random_connections number
67
- (0...size).to_a.sample(number).map {|n| self[n]}
66
+ (0...size).to_a.sample(number).map { |n| self[n] }
68
67
  end
69
68
 
70
69
  # Perform fast consensus state check with a given trust level, determining whether the item is approved or not.
@@ -90,33 +89,43 @@ module Universa
90
89
  end
91
90
  @client.isApprovedByNetwork(hash_id, trust.to_f, 60000)
92
91
  end
93
- # Perform fast consensus state check with a given trust level, as the fraction of the whole network size.
94
- # It checks the network nodes randomly until get enough positive or negative states. The lover the required
95
- # trust level is, the faster the answer will be found.
96
- #
97
- # @param [Contract | HashId] obj contract to check
98
- # @param [Object] trust level, should be between 0.1 (10% of network) and 0.9 (90% of the network)
99
- # @return [ContractState] of some final node check It does not calculates average time (yet)
100
- def get_state obj, trust: 0.3
101
- raise ArgumentError, "trusst must be in 0.1..0.9 range" if trust < 0.1 || trust > 0.9
92
+
93
+ # Perform fast consensus state check with a given trust level, as the fraction of the whole network size.
94
+ # It checks the network nodes randomly until get enough positive or negative states. The lover the required
95
+ # trust level is, the faster the answer will be found.
96
+ #
97
+ # @param [Contract | HashId] obj contract to check
98
+ # @param [Object] trust level, should be between 0.1 (10% of network) and 0.9 (90% of the network)
99
+ # @return [ContractState] of some final node check It does not calculates average time (yet)
100
+ # @raise Error if any of the queried nodes will cause an error.
101
+ def get_state obj, trust: 0.3
102
+ raise ArgumentError, "trust must be in 0.1..0.9 range" if trust < 0.1 || trust > 0.9
102
103
  result = Concurrent::IVar.new
104
+ found_error = nil
103
105
  negative_votes = Concurrent::AtomicFixnum.new((size * 0.1).round + 1)
104
106
  positive_votes = Concurrent::AtomicFixnum.new((size * trust).round)
105
107
 
106
108
  # consensus-finding conveyor: we chek connections in batches in parallel until get
107
109
  # some consensus. We do not wait until all of them will answer
108
- (0...size).to_a.shuffle.each {|index|
110
+ (0...size).to_a.shuffle.each { |index|
109
111
  Thread.start {
110
112
  if result.incomplete?
111
- if (state = self[index].get_state(obj)).approved?
112
- result.try_set(state) if positive_votes.decrement < 0
113
- else
114
- result.try_set(state) if negative_votes.decrement < 0
113
+ begin
114
+ if (state = self[index].get_state(obj)).approved?
115
+ result.try_set(state) if positive_votes.decrement < 0
116
+ else
117
+ result.try_set(state) if negative_votes.decrement < 0
118
+ end
119
+ rescue
120
+ found_error = $!
121
+ result.try_set(nil)
115
122
  end
116
123
  end
117
124
  }
118
125
  }
119
- result.value
126
+ r = result.value
127
+ found_error != nil and raise found_error
128
+ r
120
129
  end
121
130
 
122
131
  # Register a single contract (on private network or if you have white key allowing free operations)
@@ -139,7 +148,7 @@ module Universa
139
148
  # The connection to a single Universa node.
140
149
  class Connection
141
150
 
142
- # Do not create it direcly, use {Client#random_connection}, {Client#random_connections} or {Client#[]} instead
151
+ # Do not create it directly, use {Client#random_connection}, {Client#random_connections} or {Client#[]} instead
143
152
  def initialize umi_client
144
153
  @client = umi_client
145
154
  end
@@ -216,7 +225,7 @@ module Universa
216
225
 
217
226
  end
218
227
 
219
- # The state of some contract reported by thee network. It is a convenience wrapper around Universa
228
+ # The state of some contract reported by the network. It is a convenience wrapper around Universa
220
229
  # ItemState structure.
221
230
  class ContractState
222
231
  def initialize(universa_contract_state)
@@ -183,7 +183,8 @@ class KeyTool
183
183
  @rounds < 100000 and error "To few rounds, use at least 100000"
184
184
  }
185
185
 
186
- opts.on("-p FILE", "--public FILE", "extract public key") { |name|
186
+ opts.on("-p FILE", "--public FILE", "extract public key. If output file is not specified,",
187
+ "prints as universa text object to the standard output") { |name|
187
188
  task {
188
189
  key = load_key(name, true)
189
190
  if @output_file
@@ -1,4 +1,4 @@
1
1
  module Universa
2
2
  # Current gem version
3
- VERSION = "3.14.2.4"
3
+ VERSION = "3.14.5"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: universa
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.14.2.4
4
+ version: 3.14.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergeych
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-02 00:00:00.000000000 Z
11
+ date: 2022-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: farcall
@@ -144,11 +144,11 @@ files:
144
144
  - bin/umi/bin/umi
145
145
  - bin/umi/bin/umi.bat
146
146
  - bin/umi/lib/com.eclipsesource.minimal-json.minimal-json-0.9.4.jar
147
- - bin/umi/lib/com.icodici.common_tools-3.14.2.jar
148
- - bin/umi/lib/com.icodici.crypto-3.14.2.jar
149
- - bin/umi/lib/com.icodici.nanohttpd-2.1.0.jar
150
- - bin/umi/lib/com.icodici.umi-0.8.72.jar
151
- - bin/umi/lib/com.icodici.universa_core-3.14.2.jar
147
+ - bin/umi/lib/com.icodici.common_tools-3.14.5.jar
148
+ - bin/umi/lib/com.icodici.crypto-3.14.5.jar
149
+ - bin/umi/lib/com.icodici.nanohttpd-2.1.0-20210921.jar
150
+ - bin/umi/lib/com.icodici.umi-0.8.79.jar
151
+ - bin/umi/lib/com.icodici.universa_core-3.14.5.jar
152
152
  - bin/umi/lib/com.squareup.jnagmp.jnagmp-2.0.0.jar
153
153
  - bin/umi/lib/net.java.dev.jna.jna-4.5.1.jar
154
154
  - bin/umi/lib/net.java.dev.jna.jna-platform-4.5.0.jar
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  - !ruby/object:Gem::Version
206
206
  version: '0'
207
207
  requirements: []
208
- rubygems_version: 3.2.22
208
+ rubygems_version: 3.2.15
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Expose Universa Java API to ruby
Binary file