zold 0.31.5 → 0.31.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codecov.yml +20 -0
  3. data/.github/workflows/pdd.yml +11 -0
  4. data/.github/workflows/rake.yml +23 -0
  5. data/.github/workflows/xcop.yml +11 -0
  6. data/.rubocop.yml +9 -5
  7. data/.ruby-version +1 -1
  8. data/.rultor.yml +4 -5
  9. data/.simplecov +15 -19
  10. data/Dockerfile +1 -1
  11. data/Gemfile +13 -13
  12. data/Guardfile +1 -1
  13. data/README.md +0 -5
  14. data/Rakefile +1 -1
  15. data/bin/zold +1 -1
  16. data/features/step_definitions/steps.rb +5 -5
  17. data/features/support/env.rb +1 -1
  18. data/fixtures/merge/asserts.rb +1 -1
  19. data/fixtures/merge/into_no_wallet/assert.rb +1 -1
  20. data/fixtures/merge/legacy_negatives_stay/assert.rb +2 -2
  21. data/fixtures/merge/missed_wallets/assert.rb +2 -2
  22. data/fixtures/merge/negative_overwriting/assert.rb +1 -1
  23. data/fixtures/merge/negatives_in_between/assert.rb +2 -2
  24. data/fixtures/merge/random_expenses/assert.rb +2 -2
  25. data/fixtures/merge/simple_case/assert.rb +1 -1
  26. data/fixtures/merge/unconfirmed_income/assert.rb +1 -1
  27. data/lib/zold/age.rb +1 -1
  28. data/lib/zold/amount.rb +3 -3
  29. data/lib/zold/cached_wallets.rb +1 -1
  30. data/lib/zold/commands/args.rb +1 -1
  31. data/lib/zold/commands/calculate.rb +2 -2
  32. data/lib/zold/commands/clean.rb +1 -1
  33. data/lib/zold/commands/create.rb +6 -2
  34. data/lib/zold/commands/diff.rb +3 -3
  35. data/lib/zold/commands/fetch.rb +3 -3
  36. data/lib/zold/commands/invoice.rb +1 -1
  37. data/lib/zold/commands/list.rb +1 -1
  38. data/lib/zold/commands/merge.rb +4 -4
  39. data/lib/zold/commands/next.rb +1 -1
  40. data/lib/zold/commands/node.rb +3 -3
  41. data/lib/zold/commands/pay.rb +2 -2
  42. data/lib/zold/commands/propagate.rb +2 -2
  43. data/lib/zold/commands/pull.rb +1 -1
  44. data/lib/zold/commands/push.rb +1 -1
  45. data/lib/zold/commands/remote.rb +1 -1
  46. data/lib/zold/commands/remove.rb +1 -1
  47. data/lib/zold/commands/routines/audit.rb +7 -8
  48. data/lib/zold/commands/routines/gc.rb +1 -1
  49. data/lib/zold/commands/routines/reconcile.rb +1 -1
  50. data/lib/zold/commands/routines/reconnect.rb +1 -1
  51. data/lib/zold/commands/routines/retire.rb +1 -1
  52. data/lib/zold/commands/routines.rb +1 -1
  53. data/lib/zold/commands/show.rb +5 -6
  54. data/lib/zold/commands/taxes.rb +2 -2
  55. data/lib/zold/commands/thread_badge.rb +1 -1
  56. data/lib/zold/copies.rb +4 -4
  57. data/lib/zold/dir_items.rb +2 -2
  58. data/lib/zold/endless.rb +3 -5
  59. data/lib/zold/gem.rb +1 -1
  60. data/lib/zold/hands.rb +4 -4
  61. data/lib/zold/head.rb +1 -1
  62. data/lib/zold/hexnum.rb +1 -1
  63. data/lib/zold/http.rb +5 -4
  64. data/lib/zold/hungry_wallets.rb +2 -2
  65. data/lib/zold/id.rb +3 -5
  66. data/lib/zold/json_page.rb +2 -2
  67. data/lib/zold/key.rb +5 -5
  68. data/lib/zold/log.rb +7 -7
  69. data/lib/zold/metronome.rb +2 -2
  70. data/lib/zold/node/async_entrance.rb +9 -9
  71. data/lib/zold/node/entrance.rb +5 -5
  72. data/lib/zold/node/farm.rb +4 -4
  73. data/lib/zold/node/farmers.rb +2 -4
  74. data/lib/zold/node/front.rb +23 -19
  75. data/lib/zold/node/journaled_pipeline.rb +6 -6
  76. data/lib/zold/node/nodup_entrance.rb +1 -1
  77. data/lib/zold/node/nospam_entrance.rb +2 -2
  78. data/lib/zold/node/pipeline.rb +6 -6
  79. data/lib/zold/node/safe_entrance.rb +2 -2
  80. data/lib/zold/node/soft_error.rb +1 -1
  81. data/lib/zold/node/spread_entrance.rb +3 -3
  82. data/lib/zold/node/sync_entrance.rb +1 -1
  83. data/lib/zold/node/trace.rb +1 -1
  84. data/lib/zold/patch.rb +14 -15
  85. data/lib/zold/prefixes.rb +1 -1
  86. data/lib/zold/remotes.rb +4 -6
  87. data/lib/zold/signature.rb +1 -1
  88. data/lib/zold/size.rb +1 -1
  89. data/lib/zold/sync_wallets.rb +1 -1
  90. data/lib/zold/tax.rb +6 -4
  91. data/lib/zold/thread_pool.rb +3 -3
  92. data/lib/zold/tree_wallets.rb +1 -1
  93. data/lib/zold/txn.rb +26 -19
  94. data/lib/zold/txns.rb +1 -1
  95. data/lib/zold/upgrades.rb +2 -2
  96. data/lib/zold/verbose_thread.rb +2 -2
  97. data/lib/zold/version.rb +2 -2
  98. data/lib/zold/version_file.rb +1 -1
  99. data/lib/zold/wallet.rb +3 -3
  100. data/lib/zold/wallets.rb +6 -1
  101. data/lib/zold.rb +1 -1
  102. data/renovate.json +6 -0
  103. data/test/commands/routines/test_audit.rb +2 -2
  104. data/test/commands/routines/test_gc.rb +2 -2
  105. data/test/commands/routines/test_reconcile.rb +2 -2
  106. data/test/commands/routines/test_reconnect.rb +2 -2
  107. data/test/commands/routines/test_retire.rb +2 -2
  108. data/test/commands/test_alias.rb +1 -1
  109. data/test/commands/test_calculate.rb +1 -1
  110. data/test/commands/test_clean.rb +4 -4
  111. data/test/commands/test_create.rb +1 -1
  112. data/test/commands/test_diff.rb +5 -5
  113. data/test/commands/test_fetch.rb +21 -21
  114. data/test/commands/test_invoice.rb +1 -1
  115. data/test/commands/test_list.rb +1 -1
  116. data/test/commands/test_merge.rb +11 -11
  117. data/test/commands/test_node.rb +1 -1
  118. data/test/commands/test_pay.rb +4 -4
  119. data/test/commands/test_propagate.rb +1 -1
  120. data/test/commands/test_pull.rb +1 -1
  121. data/test/commands/test_push.rb +1 -1
  122. data/test/commands/test_remote.rb +2 -2
  123. data/test/commands/test_remove.rb +1 -1
  124. data/test/commands/test_show.rb +1 -1
  125. data/test/commands/test_taxes.rb +2 -2
  126. data/test/fake_home.rb +4 -3
  127. data/test/node/fake_entrance.rb +1 -1
  128. data/test/node/fake_node.rb +2 -2
  129. data/test/node/test_async_entrance.rb +6 -4
  130. data/test/node/test_entrance.rb +4 -4
  131. data/test/node/test_farm.rb +2 -2
  132. data/test/node/test_farmers.rb +1 -1
  133. data/test/node/test_front.rb +4 -4
  134. data/test/node/test_nodup_entrance.rb +2 -2
  135. data/test/node/test_nospam_entrance.rb +1 -1
  136. data/test/node/test_safe_entrance.rb +3 -3
  137. data/test/node/test_spread_entrance.rb +2 -2
  138. data/test/node/test_sync_entrance.rb +1 -1
  139. data/test/node/test_trace.rb +1 -1
  140. data/test/test__helper.rb +5 -4
  141. data/test/test_age.rb +2 -2
  142. data/test/test_amount.rb +1 -1
  143. data/test/test_cached_wallets.rb +3 -3
  144. data/test/test_copies.rb +6 -6
  145. data/test/test_dir_items.rb +2 -4
  146. data/test/test_gem.rb +1 -1
  147. data/test/test_hands.rb +1 -1
  148. data/test/test_hexnum.rb +1 -1
  149. data/test/test_http.rb +5 -5
  150. data/test/test_hungry_wallets.rb +1 -1
  151. data/test/test_id.rb +1 -1
  152. data/test/test_json_page.rb +1 -1
  153. data/test/test_key.rb +5 -5
  154. data/test/test_log.rb +1 -1
  155. data/test/test_metronome.rb +2 -1
  156. data/test/test_patch.rb +9 -9
  157. data/test/test_prefixes.rb +1 -1
  158. data/test/test_remotes.rb +2 -2
  159. data/test/test_signature.rb +1 -1
  160. data/test/test_size.rb +1 -1
  161. data/test/test_sync_wallets.rb +1 -1
  162. data/test/test_tax.rb +4 -4
  163. data/test/test_thread_pool.rb +1 -1
  164. data/test/test_tree_wallets.rb +1 -1
  165. data/test/test_txn.rb +2 -2
  166. data/test/test_upgrades.rb +4 -4
  167. data/test/test_verbose_thread.rb +1 -1
  168. data/test/test_wallet.rb +14 -14
  169. data/test/test_wallets.rb +1 -1
  170. data/test/test_zold.rb +2 -2
  171. data/test/upgrades/test_delete_banned_wallets.rb +1 -1
  172. data/test/upgrades/test_protocol_up.rb +1 -1
  173. data/upgrades/2.rb +1 -1
  174. data/upgrades/delete_banned_wallets.rb +2 -2
  175. data/upgrades/move_wallets_into_tree.rb +1 -1
  176. data/upgrades/protocol_up.rb +3 -3
  177. data/upgrades/rename_foreign_wallets.rb +2 -2
  178. data/zold.gemspec +21 -24
  179. metadata +40 -117
  180. data/.github/CODE_OF_CONDUCT.md +0 -76
  181. data/.github/CONTRIBUTING.md +0 -11
  182. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  183. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
data/test/test_patch.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -40,13 +40,13 @@ class TestPatch < Zold::Test
40
40
  first = home.create_wallet
41
41
  second = home.create_wallet
42
42
  third = home.create_wallet
43
- IO.write(second.path, IO.read(first.path))
43
+ File.write(second.path, File.read(first.path))
44
44
  key = Zold::Key.new(file: 'fixtures/id_rsa')
45
45
  first.sub(Zold::Amount.new(zld: 39.0), "NOPREFIX@#{Zold::Id.new}", key)
46
46
  first.sub(Zold::Amount.new(zld: 11.0), "NOPREFIX@#{Zold::Id.new}", key)
47
47
  first.sub(Zold::Amount.new(zld: 3.0), "NOPREFIX@#{Zold::Id.new}", key)
48
48
  second.sub(Zold::Amount.new(zld: 44.0), "NOPREFIX@#{Zold::Id.new}", key)
49
- IO.write(third.path, IO.read(first.path))
49
+ File.write(third.path, File.read(first.path))
50
50
  t = third.sub(Zold::Amount.new(zld: 10.0), "NOPREFIX@#{Zold::Id.new}", key)
51
51
  third.add(t.inverse(Zold::Id.new))
52
52
  patch = Zold::Patch.new(home.wallets, log: test_log)
@@ -62,7 +62,7 @@ class TestPatch < Zold::Test
62
62
  FakeHome.new(log: test_log).run do |home|
63
63
  first = home.create_wallet
64
64
  second = home.create_wallet
65
- IO.write(second.path, IO.read(first.path))
65
+ File.write(second.path, File.read(first.path))
66
66
  second.add(Zold::Txn.new(1, Time.now, Zold::Amount.new(zld: 11.0), 'NOPREFIX', Zold::Id.new, 'fake'))
67
67
  patch = Zold::Patch.new(home.wallets, log: test_log)
68
68
  patch.join(first) { false }
@@ -77,7 +77,7 @@ class TestPatch < Zold::Test
77
77
  FakeHome.new(log: test_log).run do |home|
78
78
  first = home.create_wallet(Zold::Id::ROOT)
79
79
  second = home.create_wallet
80
- IO.write(second.path, IO.read(first.path))
80
+ File.write(second.path, File.read(first.path))
81
81
  amount = Zold::Amount.new(zld: 333.0)
82
82
  key = Zold::Key.new(file: 'fixtures/id_rsa')
83
83
  second.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
@@ -94,7 +94,7 @@ class TestPatch < Zold::Test
94
94
  FakeHome.new(log: test_log).run do |home|
95
95
  first = home.create_wallet(Zold::Id::ROOT)
96
96
  second = home.create_wallet
97
- IO.write(second.path, IO.read(first.path))
97
+ File.write(second.path, File.read(first.path))
98
98
  key = Zold::Key.new(file: 'fixtures/id_rsa')
99
99
  second.sub(Zold::Amount.new(zld: 7.0), "NOPREFIX@#{Zold::Id.new}", key)
100
100
  first.add(
@@ -116,7 +116,7 @@ class TestPatch < Zold::Test
116
116
  FakeHome.new(log: test_log).run do |home|
117
117
  first = home.create_wallet(Zold::Id::ROOT)
118
118
  second = home.create_wallet
119
- IO.write(second.path, IO.read(first.path))
119
+ File.write(second.path, File.read(first.path))
120
120
  key = Zold::Key.new(file: 'fixtures/id_rsa')
121
121
  start = Time.parse('2017-07-19T21:24:51Z')
122
122
  first.add(
@@ -151,7 +151,7 @@ class TestPatch < Zold::Test
151
151
  FakeHome.new(log: test_log).run do |home|
152
152
  first = home.create_wallet(Zold::Id::ROOT)
153
153
  second = home.create_wallet
154
- IO.write(second.path, IO.read(first.path))
154
+ File.write(second.path, File.read(first.path))
155
155
  amount = Zold::Amount.new(zld: 333.0)
156
156
  key = Zold::Key.new(file: 'fixtures/id_rsa')
157
157
  target = Zold::Id.new
@@ -161,7 +161,7 @@ class TestPatch < Zold::Test
161
161
  patch.legacy(first)
162
162
  Tempfile.open do |f|
163
163
  patch.join(second, ledger: f.path) { false }
164
- lines = IO.read(f).split("\n")
164
+ lines = File.read(f).split("\n")
165
165
  assert_equal(2, lines.count)
166
166
  parts = lines[0].split(';')
167
167
  assert(!Zold::Txn.parse_time(parts[0]).nil?)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/test/test_remotes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -63,7 +63,7 @@ class TestRemotes < Zold::Test
63
63
  '',
64
64
  "\n\n\n\n"
65
65
  ].each do |t|
66
- IO.write(file, t)
66
+ File.write(file, t)
67
67
  remotes = Zold::Remotes.new(file: file)
68
68
  assert(remotes.all.empty?, remotes.all)
69
69
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/test/test_size.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/test/test_tax.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -49,7 +49,7 @@ class TestTax < Zold::Test
49
49
  wallet.add(
50
50
  Zold::Txn.new(
51
51
  1,
52
- Time.now - a * 60 * 60,
52
+ Time.now - (a * 60 * 60),
53
53
  Zold::Amount.new(zld: 19.99),
54
54
  'NOPREFIX', Zold::Id.new, '-'
55
55
  )
@@ -66,7 +66,7 @@ class TestTax < Zold::Test
66
66
  wallet.add(
67
67
  Zold::Txn.new(
68
68
  i + 1,
69
- Time.now - 24 * 60 * 60 * 365 * 10,
69
+ Time.now - (24 * 60 * 60 * 365 * 10),
70
70
  Zold::Amount.new(zld: i.to_f),
71
71
  'NOPREFIX', Zold::Id.new, '-'
72
72
  )
@@ -151,7 +151,7 @@ class TestTax < Zold::Test
151
151
  wallet.add(
152
152
  Zold::Txn.new(
153
153
  1,
154
- Time.now - 24 * 60 * 60 * 365,
154
+ Time.now - (24 * 60 * 60 * 365),
155
155
  Zold::Amount.new(zld: 19.99),
156
156
  'NOPREFIX', Zold::Id.new, '-'
157
157
  )
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/test/test_txn.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -81,7 +81,7 @@ class TestTxn < Zold::Test
81
81
 
82
82
  def test_prints_and_parses_time
83
83
  10.times do |i|
84
- time = Time.now + i * 12_345
84
+ time = Time.now + (i * 12_345)
85
85
  iso = time.utc.iso8601
86
86
  assert_equal(time.to_s, Zold::Txn.parse_time(iso).to_s)
87
87
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -75,7 +75,7 @@ class TestUpgrades < Zold::Test
75
75
  private
76
76
 
77
77
  def run_upgrades(dir)
78
- Zold::Upgrades.new(version_file(dir), dir, network: 'test').run
78
+ Zold::Upgrades.new(version_file(dir), dir, { network: 'test' }).run
79
79
  end
80
80
 
81
81
  def version_file(dir)
@@ -83,11 +83,11 @@ class TestUpgrades < Zold::Test
83
83
  end
84
84
 
85
85
  def create_version_file(dir, version)
86
- IO.write(File.join(dir, 'version'), version)
86
+ File.write(File.join(dir, 'version'), version)
87
87
  end
88
88
 
89
89
  def create_upgrade_file(dir, version)
90
- IO.write(
90
+ File.write(
91
91
  File.join(dir, "#{version}.rb"),
92
92
  "puts \"#{expected_upgrade_script_output(version)}\""
93
93
  )
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/test/test_wallet.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -119,21 +119,21 @@ class TestWallet < Zold::Test
119
119
  key = Zold::Key.new(file: 'fixtures/id_rsa')
120
120
  wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
121
121
  wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
122
- before = IO.read(wallet.path)
123
- IO.write(wallet.path, IO.read(wallet.path) + "\n\n\n")
122
+ before = File.read(wallet.path)
123
+ File.write(wallet.path, "#{File.read(wallet.path)}\n\n\n")
124
124
  wallet.refurbish
125
125
  assert_equal(amount * -2, wallet.balance)
126
- assert_equal(before, IO.read(wallet.path))
126
+ assert_equal(before, File.read(wallet.path))
127
127
  end
128
128
  end
129
129
 
130
130
  def test_refurbishes_empty_wallet
131
131
  FakeHome.new(log: test_log).run do |home|
132
132
  wallet = home.create_wallet
133
- before = IO.read(wallet.path)
134
- IO.write(wallet.path, IO.read(wallet.path) + "\n\n\n")
133
+ before = File.read(wallet.path)
134
+ File.write(wallet.path, "#{File.read(wallet.path)}\n\n\n")
135
135
  wallet.refurbish
136
- assert_equal(before, IO.read(wallet.path))
136
+ assert_equal(before, File.read(wallet.path))
137
137
  end
138
138
  end
139
139
 
@@ -179,7 +179,7 @@ class TestWallet < Zold::Test
179
179
  wallet.add(
180
180
  Zold::Txn.new(
181
181
  1,
182
- Time.now - 100 * 60 * 60,
182
+ Time.now - (100 * 60 * 60),
183
183
  Zold::Amount.new(zld: 1.99),
184
184
  'NOPREFIX', Zold::Id.new, '-'
185
185
  )
@@ -210,7 +210,7 @@ class TestWallet < Zold::Test
210
210
  def test_returns_modified_time
211
211
  FakeHome.new(log: test_log).run do |home|
212
212
  wallet = home.create_wallet
213
- assert(wallet.mtime > Time.now - 60 * 60)
213
+ assert(wallet.mtime > Time.now - (60 * 60))
214
214
  end
215
215
  end
216
216
 
@@ -224,7 +224,7 @@ class TestWallet < Zold::Test
224
224
  def test_raises_when_broken_format
225
225
  Dir.mktmpdir do |dir|
226
226
  file = File.join(dir, "0123456701234567#{Zold::Wallet::EXT}")
227
- IO.write(file, 'broken head')
227
+ File.write(file, 'broken head')
228
228
  assert_raises(Zold::Head::CantParse) do
229
229
  Zold::Wallet.new(file).id
230
230
  end
@@ -280,18 +280,18 @@ class TestWallet < Zold::Test
280
280
  )
281
281
  end
282
282
  wallet = home.create_wallet
283
- empty = IO.read(wallet.path)
283
+ empty = File.read(wallet.path)
284
284
  text = ''
285
285
  10.times do
286
- IO.write(wallet.path, empty)
286
+ File.write(wallet.path, empty)
287
287
  txns.shuffle!
288
288
  txns.each { |t| wallet.add(t) }
289
289
  wallet.refurbish
290
290
  if text.empty?
291
- text = IO.read(wallet.path)
291
+ text = File.read(wallet.path)
292
292
  next
293
293
  end
294
- assert_equal(text, IO.read(wallet.path))
294
+ assert_equal(text, File.read(wallet.path))
295
295
  end
296
296
  end
297
297
  end
data/test/test_wallets.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/test/test_zold.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -42,7 +42,7 @@ class TestZold < Zold::Test
42
42
  FileUtils.cp('fixtures/id_rsa.pub', dir)
43
43
  FileUtils.cp('fixtures/id_rsa', dir)
44
44
  script = File.join(dir, f)
45
- IO.write(script, IO.read('fixtures/scripts/_head.sh') + IO.read(File.join('fixtures/scripts', f)))
45
+ File.write(script, File.read('fixtures/scripts/_head.sh') + File.read(File.join('fixtures/scripts', f)))
46
46
  bin = File.join(Dir.pwd, 'bin/zold')
47
47
  out = []
48
48
  Dir.chdir(dir) do
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/upgrades/2.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -39,7 +39,7 @@ module Zold
39
39
  id = Id.new(name[0..15])
40
40
  next unless Id::BANNED.include?(id.to_s)
41
41
  path = File.join(@home, path)
42
- File.rename(path, path + '-banned')
42
+ File.rename(path, "#{path}-banned")
43
43
  @log.info("Wallet file #{path} renamed, since wallet #{id} is banned")
44
44
  end
45
45
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -35,10 +35,10 @@ module Zold
35
35
  Dir.new(@home).each do |path|
36
36
  next unless path =~ /^[a-f0-9]{16}#{Wallet::EXT}$/
37
37
  f = File.join(@home, path)
38
- lines = IO.read(f).split("\n")
38
+ lines = File.read(f).split("\n")
39
39
  next if lines[1].to_i == Zold::PROTOCOL
40
40
  lines[1] = Zold::PROTOCOL
41
- IO.write(f, lines.join("\n"))
41
+ File.write(f, lines.join("\n"))
42
42
  @log.info("Protocol set to #{Zold::PROTOCOL} in #{f}")
43
43
  end
44
44
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -41,7 +41,7 @@ module Zold
41
41
  next if wallet.network == @network
42
42
  @log.info("Wallet #{wallet.id} #{Rainbow('renamed').red}, \
43
43
  since it's in \"#{wallet.network}\", while we are in \"#{@network}\" network")
44
- File.rename(f, f + '-old')
44
+ File.rename(f, "#{f}-old")
45
45
  end
46
46
  end
47
47
  end
data/zold.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy, Inc.
3
+ # Copyright (c) 2018-2023 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,25 +27,23 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
27
27
  require_relative 'lib/zold/version'
28
28
 
29
29
  Gem::Specification.new do |s|
30
- s.specification_version = 2 if s.respond_to? :specification_version=
31
30
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
32
- s.rubygems_version = '2.2'
33
31
  s.required_ruby_version = '>=2.5'
34
32
  s.name = 'zold'
35
33
  s.version = Zold::VERSION
36
34
  s.license = 'MIT'
37
35
  s.summary = 'A fast cryptocurrency for micro payments'
38
- s.description = 'In the last few years digital currencies have successfully demonstrated
39
- their ability to become an alternative financial instrument in many
40
- different markets. Most of the technologies available at the moment are
41
- based on the principles of Blockchain architecture, including
42
- dominating currencies like Bitcoin and Ethereum. Despite its
43
- popularity, Blockchain is not the best possible solution for all scenarios.
44
- One such example is for fast micro-payments.
45
- Zold is an experimental alternative that enables distributed transactions between
46
- anonymous users, making micro-payments financially feasible.
47
- It borrows the proof-of-work principle from Bitcoin,
48
- and suggests a different architecture for digital wallet maintenance.'
36
+ s.description = "In the last few years digital currencies have successfully demonstrated \
37
+ their ability to become an alternative financial instrument in many \
38
+ different markets. Most of the technologies available at the moment are \
39
+ based on the principles of Blockchain architecture, including \
40
+ dominating currencies like Bitcoin and Ethereum. Despite its \
41
+ popularity, Blockchain is not the best possible solution for all scenarios. \
42
+ One such example is for fast micro-payments. \
43
+ Zold is an experimental alternative that enables distributed transactions between \
44
+ anonymous users, making micro-payments financially feasible. \
45
+ It borrows the proof-of-work principle from Bitcoin, \
46
+ and suggests a different architecture for digital wallet maintenance."
49
47
  s.authors = ['Yegor Bugayenko']
50
48
  s.email = 'yegor256@gmail.com'
51
49
  s.homepage = 'http://github.com/zold-io/zold'
@@ -58,29 +56,28 @@ and suggests a different architecture for digital wallet maintenance.'
58
56
  If you have any issues, report to our GitHub repo: https://github.com/zold-io/zold"
59
57
  s.files = `git ls-files`.split($RS)
60
58
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
61
- s.test_files = s.files.grep(%r{^(test|features)/})
62
59
  s.rdoc_options = ['--charset=UTF-8']
63
60
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
64
- s.add_runtime_dependency 'backtrace', '>=0.3'
61
+ s.add_runtime_dependency 'backtrace', '~>0.3'
65
62
  s.add_runtime_dependency 'concurrent-ruby', '~>1.1'
66
63
  s.add_runtime_dependency 'diffy', '~>3.3'
67
- s.add_runtime_dependency 'futex', '>=0.8.5'
64
+ s.add_runtime_dependency 'futex', '~>0.8'
68
65
  s.add_runtime_dependency 'get_process_mem', '~>0.2'
69
66
  s.add_runtime_dependency 'haml', '~>5.0'
70
67
  s.add_runtime_dependency 'json', '~>2.2'
71
- s.add_runtime_dependency 'memory_profiler', '~>0.9'
68
+ s.add_runtime_dependency 'memory_profiler', '~>1.0'
72
69
  s.add_runtime_dependency 'mimic', '~>0.4'
73
- s.add_runtime_dependency 'openssl', '~>2.1'
70
+ s.add_runtime_dependency 'openssl', '~>3.1'
74
71
  s.add_runtime_dependency 'rainbow', '~>3.0'
75
72
  s.add_runtime_dependency 'semantic', '~>1.6'
76
- s.add_runtime_dependency 'sinatra', '~>2.0'
73
+ s.add_runtime_dependency 'sinatra', '~>3.0'
77
74
  s.add_runtime_dependency 'slop', '~>4.6'
78
75
  s.add_runtime_dependency 'sys-proctable', '~>1.2'
79
76
  s.add_runtime_dependency 'thin', '~>1.7'
80
- s.add_runtime_dependency 'threads', '>=0.3'
81
- s.add_runtime_dependency 'total', '>=0.3'
77
+ s.add_runtime_dependency 'threads', '~>0.3'
78
+ s.add_runtime_dependency 'total', '~>0.3'
82
79
  s.add_runtime_dependency 'typhoeus', '~>1.3'
83
80
  s.add_runtime_dependency 'usagewatch_ext', '~>0.2'
84
- s.add_runtime_dependency 'zache', '>=0.12'
85
- s.add_runtime_dependency 'zold-score', '~>0.4'
81
+ s.add_runtime_dependency 'zache', '~>0.12'
82
+ s.add_runtime_dependency 'zold-score', '~>0.5'
86
83
  end