zold 0.26.19 → 0.29.20

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: 6fa341a547ba1c83699a076f78886ea6cd3f28c2dca5b46675e214f4ee155fc3
4
- data.tar.gz: 4570c47941b0522ceebb915620c016c7aa239984d1510f2219631a35d76a655b
3
+ metadata.gz: 3a384987626036b4943acf7207bc6043b587d5de3c69468d1c17eb2f337cbae0
4
+ data.tar.gz: ad950bb71ec0e09858a0d10c6ba5baecc390648336cd766f12b79ae33388429c
5
5
  SHA512:
6
- metadata.gz: d818d6a9e3bbcc5ad446de965d70ffe72ecd9f78d9c04e49fe0d547a2be9c148cff3e5c9381ba37888bc6562e43e95b7c928b997622ace8a1dbaad9876438715
7
- data.tar.gz: 792d5b93d848ee5d8685a9f4242c99b5753abb21c5071684a98069ca5570adf61470ef9117fdb3a37f7df335b9d2ee9222821430043ac2490cd1733bbe262b56
6
+ metadata.gz: ca5b3e919cb7442d6944fe6d0b74f212cf8ac52a7762d8f1017fd812c5f535483cd5ca24fee592fa0a1d5b955bb801929b8da7698d7c2704487dec4d9ad99f85
7
+ data.tar.gz: d7b498c210aef31fe97b9216def70a89b7a0f39c5bc425ab2134f912fb8b56f3e3011446b1538cb89e85509a32ea85780616a4a2b88ebc5e1bb2dd71c86ce32b
@@ -21,6 +21,7 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  require 'slop'
24
+ require 'shellwords'
24
25
  require_relative 'thread_badge'
25
26
  require_relative 'args'
26
27
  require_relative '../log'
@@ -73,7 +74,8 @@ Available options:"
73
74
  unless @wallets.acq(id, &:exists?)
74
75
  require_relative 'pull'
75
76
  Pull.new(wallets: @wallets, remotes: @remotes, copies: @copies, log: @log).run(
76
- ['pull', id.to_s, "--network=#{opts['network']}", "--tolerate-quorum=#{opts['tolerate-quorum']}"] +
77
+ ['pull', id.to_s, "--network=#{Shellwords.escape(opts['network'])}"] +
78
+ ["--tolerate-quorum=#{Shellwords.escape(opts['tolerate-quorum'])}"] +
77
79
  (opts['tolerate-edges'] ? ['--tolerate-edges'] : [])
78
80
  )
79
81
  end
@@ -23,6 +23,7 @@
23
23
  require 'slop'
24
24
  require 'rainbow'
25
25
  require 'backtrace'
26
+ require 'shellwords'
26
27
  require_relative 'thread_badge'
27
28
  require_relative 'args'
28
29
  require_relative 'pull'
@@ -74,9 +75,12 @@ Available options:"
74
75
  o.string '--ledger',
75
76
  'The name of the file where all new negative transactions will be recorded (default: /dev/null)',
76
77
  default: '/dev/null'
77
- o.array '--trusted',
78
- 'List of wallet IDs we fully trust and won\'t pull',
79
- default: []
78
+ o.string '--trusted',
79
+ 'The name of the file with a list of wallet IDs we fully trust and won\'t pull',
80
+ default: '/dev/null'
81
+ o.integer '--trusted-max',
82
+ 'The maximum amount of trusted wallets we can see in the list',
83
+ default: 32
80
84
  o.string '--network',
81
85
  'The name of the network we work in',
82
86
  default: 'test'
@@ -154,11 +158,13 @@ into #{@wallets.acq(id, &:mnemo)} in #{Age.new(start, limit: 0.1 + cps.count * 0
154
158
  end
155
159
  else
156
160
  patch.join(wallet, ledger: opts['ledger']) do |txn|
157
- unless opts['trusted'].include?(txn.bnf.to_s) || opts['trusted'].count > 32
161
+ trusted = IO.read(opts['trusted']).split(',')
162
+ IO.write(opts['trusted'], (trusted + [txn.bnf.to_s]).join(','))
163
+ unless trusted.include?(txn.bnf.to_s) || trusted.count > opts['trusted-max']
158
164
  Pull.new(wallets: @wallets, remotes: @remotes, copies: @copies, log: @log).run(
159
- ['pull', txn.bnf.to_s, "--network=#{opts['network']}", '--quiet-if-absent'] +
165
+ ['pull', txn.bnf.to_s, "--network=#{Shellwords.escape(opts['network'])}", '--quiet-if-absent'] +
160
166
  (opts['deep'] ? ['--deep'] : ['--shallow']) +
161
- ['--trusted=' + (opts['trusted'] + [txn.bnf.to_s]).join(',')]
167
+ ["--trusted=#{Shellwords.escape(opts['trusted'])}"]
162
168
  )
163
169
  end
164
170
  true
@@ -22,6 +22,7 @@
22
22
 
23
23
  require 'open3'
24
24
  require 'slop'
25
+ require 'shellwords'
25
26
  require 'backtrace'
26
27
  require 'fileutils'
27
28
  require 'zache'
@@ -337,7 +338,8 @@ the node won\'t connect to the network like that; try to do "zold remote reset"
337
338
  unless invoice.include?('@')
338
339
  require_relative 'invoice'
339
340
  invoice = Invoice.new(wallets: @wallets, remotes: @remotes, copies: @copies, log: @log).run(
340
- ['invoice', invoice, "--network=#{opts['network']}", "--tolerate-quorum=#{opts['tolerate-quorum']}"] +
341
+ ['invoice', invoice, "--network=#{Shellwords.escape(opts['network'])}"] +
342
+ ["--tolerate-quorum=#{Shellwords.escape(opts['tolerate-quorum'])}"] +
341
343
  (opts['tolerate-edges'] ? ['--tolerate-edges'] : [])
342
344
  )
343
345
  end
@@ -22,6 +22,7 @@
22
22
 
23
23
  require 'slop'
24
24
  require 'rainbow'
25
+ require 'shellwords'
25
26
  require_relative 'thread_badge'
26
27
  require_relative 'args'
27
28
  require_relative '../id'
@@ -91,7 +92,8 @@ Available options:"
91
92
  unless invoice.include?('@')
92
93
  require_relative 'invoice'
93
94
  invoice = Invoice.new(wallets: @wallets, remotes: @remotes, copies: @copies, log: @log).run(
94
- ['invoice', invoice, "--tolerate-quorum=#{opts['tolerate-quorum']}", "--network=#{opts['network']}"] +
95
+ ['invoice', invoice, "--tolerate-quorum=#{Shellwords.escape(opts['tolerate-quorum'])}"] +
96
+ ["--network=#{Shellwords.escape(opts['network'])}"] +
95
97
  (opts['tolerate-edges'] ? ['--tolerate-edges'] : [])
96
98
  )
97
99
  end
@@ -123,7 +125,8 @@ Available options:"
123
125
  return unless debt
124
126
  require_relative 'taxes'
125
127
  Taxes.new(wallets: @wallets, remotes: @remotes, log: @log).run(
126
- ['taxes', 'pay', "--private-key=#{opts['private-key']}", id.to_s, "--keygap=#{opts['keygap']}"]
128
+ ['taxes', 'pay', "--private-key=#{Shellwords.escape(opts['private-key'])}"] +
129
+ [id.to_s, "--keygap=#{Shellwords.escape(opts['keygap'])}"]
127
130
  )
128
131
  end
129
132
 
@@ -138,6 +141,7 @@ the difference is #{(amount - from.balance).to_i} zents"
138
141
  end
139
142
  pem = IO.read(opts['private-key'])
140
143
  unless opts['keygap'].empty?
144
+ puts opts['keygap']
141
145
  pem = pem.sub('*' * opts['keygap'].length, opts['keygap'])
142
146
  @log.debug("Keygap \"#{'*' * opts['keygap'].length}\" injected into the RSA private key")
143
147
  end
@@ -20,6 +20,7 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
+ require 'shellwords'
23
24
  require_relative '../remote'
24
25
  require_relative '../../node/farm'
25
26
 
@@ -42,9 +43,9 @@ module Zold
42
43
  def exec(step = 0)
43
44
  sleep(60) unless @opts['routine-immediately']
44
45
  cmd = Remote.new(remotes: @remotes, log: @log, farm: @farm)
45
- args = ['remote', "--network=#{@opts['network']}", '--ignore-ping']
46
+ args = ['remote', "--network=#{Shellwords.escape(@opts['network'])}", '--ignore-ping']
46
47
  score = @farm.best[0]
47
- args << "--ignore-node=#{score.host}:#{score.port}" if score
48
+ args << "--ignore-node=#{Shellwords.escape("#{score.host}:#{score.port}")}" if score
48
49
  cmd.run(args + ['masters']) unless @opts['routine-immediately']
49
50
  all = @remotes.all
50
51
  return if @opts['routine-immediately'] && all.empty?
@@ -20,6 +20,7 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
+ require 'shellwords'
23
24
  require_relative '../../log'
24
25
  require_relative '../../id'
25
26
  require_relative '../../copies'
@@ -47,7 +48,7 @@ module Zold
47
48
  @wallets.all.sample(100).each do |id|
48
49
  next if Copies.new(File.join(@copies, id)).all.count < 2
49
50
  Push.new(wallets: @wallets, remotes: @remotes, log: @log).run(
50
- ['push', "--network=#{@opts['network']}", id.to_s]
51
+ ['push', "--network=#{Shellwords.escape(@opts['network'])}", id.to_s]
51
52
  )
52
53
  end
53
54
  end
@@ -22,6 +22,7 @@
22
22
 
23
23
  require 'delegate'
24
24
  require 'zache'
25
+ require 'shellwords'
25
26
  require_relative 'log'
26
27
  require_relative 'thread_pool'
27
28
  require_relative 'commands/pull'
@@ -88,7 +89,7 @@ module Zold
88
89
  end
89
90
  begin
90
91
  Pull.new(wallets: @wallets, remotes: @remotes, copies: @copies, log: @log).run(
91
- ['pull', id.to_s, "--network=#{@network}", '--tolerate-edges', '--tolerate-quorum=1']
92
+ ['pull', id.to_s, "--network=#{Shellwords.escape(@network)}", '--tolerate-edges', '--tolerate-quorum=1']
92
93
  )
93
94
  @missed.remove(id.to_s)
94
95
  rescue Fetch::Error => e
@@ -92,9 +92,9 @@ for #{after.host}:#{after.port} in #{Age.new(start)}: #{after.suffixes}")
92
92
  'ruby',
93
93
  Shellwords.escape(bin),
94
94
  '--skip-upgrades',
95
- "--info-tid=#{Thread.current.thread_variable_get(:tid)}",
95
+ "--info-tid=#{Shellwords.escape(Thread.current.thread_variable_get(:tid))}",
96
96
  "--info-thread=#{Shellwords.escape(Thread.current.name)}",
97
- "--info-start=#{Time.now.utc.iso8601}",
97
+ "--info-start=#{Shellwords.escape(Time.now.utc.iso8601)}",
98
98
  '--low-priority',
99
99
  'next',
100
100
  Shellwords.escape(score)
@@ -25,6 +25,7 @@ STDOUT.sync = true
25
25
  require 'get_process_mem'
26
26
  require 'thin'
27
27
  require 'haml'
28
+ require 'shellwords'
28
29
  require 'json'
29
30
  require 'sinatra/base'
30
31
  require 'concurrent'
@@ -590,7 +591,7 @@ time to stop; use --skip-oom to never quit")
590
591
  Remote.new(remotes: settings.remotes, log: settings.log).run(
591
592
  [
592
593
  'remote', 'add', score.host, score.port.to_s,
593
- "--network=#{settings.opts['network']}", '--ignore-if-exists'
594
+ "--network=#{Shellwords.escape(settings.opts['network'])}", '--ignore-if-exists'
594
595
  ] + (settings.opts['ignore-score-weakness'] ? ['--skip-ping'] : [])
595
596
  )
596
597
  rescue StandardError => e
@@ -21,6 +21,7 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  require 'tempfile'
24
+ require 'shellwords'
24
25
  require_relative '../log'
25
26
  require_relative '../remotes'
26
27
  require_relative '../copies'
@@ -85,9 +86,13 @@ module Zold
85
86
 
86
87
  def merge(id, copies, wallets, log)
87
88
  Tempfile.open do |f|
88
- modified = Merge.new(
89
- wallets: wallets, remotes: @remotes, copies: copies.root, log: log
90
- ).run(['merge', id.to_s, "--ledger=#{f.path}", "--network=#{@network}", '--deep'])
89
+ modified = Tempfile.open do |t|
90
+ Merge.new(wallets: wallets, remotes: @remotes, copies: copies.root, log: log).run(
91
+ ['merge', id.to_s, "--ledger=#{Shellwords.escape(f.path)}"] +
92
+ ["--trusted=#{Shellwords.escape(t.path)}", '--deep'] +
93
+ ["--network=#{Shellwords.escape(@network)}"]
94
+ )
95
+ end
91
96
  @mutex.synchronize do
92
97
  txns = File.exist?(@ledger) ? IO.read(@ledger).strip.split("\n") : []
93
98
  txns += IO.read(f.path).strip.split("\n")
@@ -22,6 +22,7 @@
22
22
 
23
23
  require 'concurrent'
24
24
  require 'tempfile'
25
+ require 'shellwords'
25
26
  require_relative '../log'
26
27
  require_relative '../remotes'
27
28
  require_relative '../copies'
@@ -75,7 +76,7 @@ module Zold
75
76
  else
76
77
  Thread.current.thread_variable_set(:wallet, id.to_s)
77
78
  Push.new(wallets: @wallets, remotes: @remotes, log: @log).run(
78
- ['push', "--ignore-node=#{@address}", id.to_s, '--tolerate-quorum=1'] +
79
+ ['push', "--ignore-node=#{Shellwords.escape(@address)}", id.to_s, '--tolerate-quorum=1'] +
79
80
  (@ignore_score_weakeness ? ['--ignore-score-weakness'] : []) +
80
81
  (@tolerate_edges ? ['--tolerate-edges'] : [])
81
82
  )
@@ -25,7 +25,7 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.26.19'
28
+ VERSION = '0.29.20'
29
29
  PROTOCOL = 2
30
30
  REPO = 'zold-io/zold'
31
31
  end
@@ -23,6 +23,7 @@
23
23
  require 'minitest/autorun'
24
24
  require 'webmock/minitest'
25
25
  require 'threads'
26
+ require 'shellwords'
26
27
  require_relative '../test__helper'
27
28
  require_relative '../fake_home'
28
29
  require_relative '../../lib/zold/wallets'
@@ -92,7 +93,8 @@ class TestPay < Zold::Test
92
93
  IO.write(f, pem.gsub(keygap, '*' * keygap.length))
93
94
  Zold::Pay.new(wallets: home.wallets, copies: home.dir, remotes: home.remotes, log: test_log).run(
94
95
  [
95
- 'pay', '--force', "--private-key=#{f.path}", "--keygap=#{keygap}",
96
+ 'pay', '--force', "--private-key=#{Shellwords.escape(f.path)}",
97
+ "--keygap=#{Shellwords.escape(keygap)}",
96
98
  wallet.id.to_s, 'NOPREFIX@dddd0000dddd0000', amount.to_zld, '-'
97
99
  ]
98
100
  )
@@ -23,28 +23,30 @@
23
23
  %section
24
24
  %header
25
25
  %nav
26
- %li
27
- %a{href: '/'}
28
- %img.logo{src: '//www.zold.io/images/logo.svg', alt: 'Zold logo'}
26
+ %ul
27
+ %li
28
+ %a{href: '/'}
29
+ %img.logo{src: '//www.zold.io/images/logo.svg', alt: 'Zold logo'}
29
30
  %nav
30
- %li
31
- %a{href: '/'} Home
32
- %li
33
- %a{href: '/queue'} Queue
34
- %li
35
- %a{href: '/remotes'} Remotes
36
- %li
37
- %a{href: '/threads'} Threads
38
- %li
39
- %a{href: '/wallets'} Wallets
40
- %li
41
- %a{href: '/ledger'} Ledger
42
- %li
43
- %a{href: '/journal'} Journal
44
- %li
45
- %a{href: '/farm'} Farm
46
- %li
47
- %a{href: '/metronome'} Metronome
31
+ %ul
32
+ %li
33
+ %a{href: '/'} Home
34
+ %li
35
+ %a{href: '/queue'} Queue
36
+ %li
37
+ %a{href: '/remotes'} Remotes
38
+ %li
39
+ %a{href: '/threads'} Threads
40
+ %li
41
+ %a{href: '/wallets'} Wallets
42
+ %li
43
+ %a{href: '/ledger'} Ledger
44
+ %li
45
+ %a{href: '/journal'} Journal
46
+ %li
47
+ %a{href: '/farm'} Farm
48
+ %li
49
+ %a{href: '/metronome'} Metronome
48
50
  = yield
49
51
  %footer
50
52
  %p.footnotes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.19
4
+ version: 0.29.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-18 00:00:00.000000000 Z
11
+ date: 2019-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -798,7 +798,7 @@ licenses:
798
798
  - MIT
799
799
  metadata: {}
800
800
  post_install_message: |-
801
- Thanks for installing Zold 0.26.19!
801
+ Thanks for installing Zold 0.29.20!
802
802
  Study our White Paper: https://papers.zold.io/wp.pdf
803
803
  Read our blog posts: https://blog.zold.io
804
804
  Try ZLD online wallet at: https://wts.zold.io