zold 0.31.5 → 0.31.6
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 +4 -4
- data/.github/workflows/codecov.yml +20 -0
- data/.github/workflows/pdd.yml +11 -0
- data/.github/workflows/rake.yml +23 -0
- data/.github/workflows/xcop.yml +11 -0
- data/.rubocop.yml +9 -5
- data/.ruby-version +1 -1
- data/.rultor.yml +4 -5
- data/.simplecov +15 -19
- data/Dockerfile +1 -1
- data/Gemfile +13 -13
- data/Guardfile +1 -1
- data/README.md +0 -5
- data/Rakefile +1 -1
- data/bin/zold +1 -1
- data/features/step_definitions/steps.rb +5 -5
- data/features/support/env.rb +1 -1
- data/fixtures/merge/asserts.rb +1 -1
- data/fixtures/merge/into_no_wallet/assert.rb +1 -1
- data/fixtures/merge/legacy_negatives_stay/assert.rb +2 -2
- data/fixtures/merge/missed_wallets/assert.rb +2 -2
- data/fixtures/merge/negative_overwriting/assert.rb +1 -1
- data/fixtures/merge/negatives_in_between/assert.rb +2 -2
- data/fixtures/merge/random_expenses/assert.rb +2 -2
- data/fixtures/merge/simple_case/assert.rb +1 -1
- data/fixtures/merge/unconfirmed_income/assert.rb +1 -1
- data/lib/zold/age.rb +1 -1
- data/lib/zold/amount.rb +3 -3
- data/lib/zold/cached_wallets.rb +1 -1
- data/lib/zold/commands/args.rb +1 -1
- data/lib/zold/commands/calculate.rb +2 -2
- data/lib/zold/commands/clean.rb +1 -1
- data/lib/zold/commands/create.rb +6 -2
- data/lib/zold/commands/diff.rb +3 -3
- data/lib/zold/commands/fetch.rb +3 -3
- data/lib/zold/commands/invoice.rb +1 -1
- data/lib/zold/commands/list.rb +1 -1
- data/lib/zold/commands/merge.rb +4 -4
- data/lib/zold/commands/next.rb +1 -1
- data/lib/zold/commands/node.rb +3 -3
- data/lib/zold/commands/pay.rb +2 -2
- data/lib/zold/commands/propagate.rb +2 -2
- data/lib/zold/commands/pull.rb +1 -1
- data/lib/zold/commands/push.rb +1 -1
- data/lib/zold/commands/remote.rb +1 -1
- data/lib/zold/commands/remove.rb +1 -1
- data/lib/zold/commands/routines/audit.rb +7 -8
- data/lib/zold/commands/routines/gc.rb +1 -1
- data/lib/zold/commands/routines/reconcile.rb +1 -1
- data/lib/zold/commands/routines/reconnect.rb +1 -1
- data/lib/zold/commands/routines/retire.rb +1 -1
- data/lib/zold/commands/routines.rb +1 -1
- data/lib/zold/commands/show.rb +5 -6
- data/lib/zold/commands/taxes.rb +2 -2
- data/lib/zold/commands/thread_badge.rb +1 -1
- data/lib/zold/copies.rb +4 -4
- data/lib/zold/dir_items.rb +2 -2
- data/lib/zold/endless.rb +3 -5
- data/lib/zold/gem.rb +1 -1
- data/lib/zold/hands.rb +4 -4
- data/lib/zold/head.rb +1 -1
- data/lib/zold/hexnum.rb +1 -1
- data/lib/zold/http.rb +5 -4
- data/lib/zold/hungry_wallets.rb +2 -2
- data/lib/zold/id.rb +3 -5
- data/lib/zold/json_page.rb +2 -2
- data/lib/zold/key.rb +5 -5
- data/lib/zold/log.rb +7 -7
- data/lib/zold/metronome.rb +2 -2
- data/lib/zold/node/async_entrance.rb +9 -9
- data/lib/zold/node/entrance.rb +5 -5
- data/lib/zold/node/farm.rb +4 -4
- data/lib/zold/node/farmers.rb +2 -4
- data/lib/zold/node/front.rb +23 -19
- data/lib/zold/node/journaled_pipeline.rb +6 -6
- data/lib/zold/node/nodup_entrance.rb +1 -1
- data/lib/zold/node/nospam_entrance.rb +2 -2
- data/lib/zold/node/pipeline.rb +6 -6
- data/lib/zold/node/safe_entrance.rb +2 -2
- data/lib/zold/node/soft_error.rb +1 -1
- data/lib/zold/node/spread_entrance.rb +3 -3
- data/lib/zold/node/sync_entrance.rb +1 -1
- data/lib/zold/node/trace.rb +1 -1
- data/lib/zold/patch.rb +14 -15
- data/lib/zold/prefixes.rb +1 -1
- data/lib/zold/remotes.rb +4 -6
- data/lib/zold/signature.rb +1 -1
- data/lib/zold/size.rb +1 -1
- data/lib/zold/sync_wallets.rb +1 -1
- data/lib/zold/tax.rb +6 -4
- data/lib/zold/thread_pool.rb +3 -3
- data/lib/zold/tree_wallets.rb +1 -1
- data/lib/zold/txn.rb +26 -19
- data/lib/zold/txns.rb +1 -1
- data/lib/zold/upgrades.rb +2 -2
- data/lib/zold/verbose_thread.rb +2 -2
- data/lib/zold/version.rb +2 -2
- data/lib/zold/version_file.rb +1 -1
- data/lib/zold/wallet.rb +3 -3
- data/lib/zold/wallets.rb +6 -1
- data/lib/zold.rb +1 -1
- data/renovate.json +6 -0
- data/test/commands/routines/test_audit.rb +2 -2
- data/test/commands/routines/test_gc.rb +2 -2
- data/test/commands/routines/test_reconcile.rb +2 -2
- data/test/commands/routines/test_reconnect.rb +2 -2
- data/test/commands/routines/test_retire.rb +2 -2
- data/test/commands/test_alias.rb +1 -1
- data/test/commands/test_calculate.rb +1 -1
- data/test/commands/test_clean.rb +4 -4
- data/test/commands/test_create.rb +1 -1
- data/test/commands/test_diff.rb +5 -5
- data/test/commands/test_fetch.rb +21 -21
- data/test/commands/test_invoice.rb +1 -1
- data/test/commands/test_list.rb +1 -1
- data/test/commands/test_merge.rb +11 -11
- data/test/commands/test_node.rb +1 -1
- data/test/commands/test_pay.rb +4 -4
- data/test/commands/test_propagate.rb +1 -1
- data/test/commands/test_pull.rb +1 -1
- data/test/commands/test_push.rb +1 -1
- data/test/commands/test_remote.rb +2 -2
- data/test/commands/test_remove.rb +1 -1
- data/test/commands/test_show.rb +1 -1
- data/test/commands/test_taxes.rb +2 -2
- data/test/fake_home.rb +4 -3
- data/test/node/fake_entrance.rb +1 -1
- data/test/node/fake_node.rb +2 -2
- data/test/node/test_async_entrance.rb +6 -4
- data/test/node/test_entrance.rb +4 -4
- data/test/node/test_farm.rb +2 -2
- data/test/node/test_farmers.rb +1 -1
- data/test/node/test_front.rb +4 -4
- data/test/node/test_nodup_entrance.rb +2 -2
- data/test/node/test_nospam_entrance.rb +1 -1
- data/test/node/test_safe_entrance.rb +3 -3
- data/test/node/test_spread_entrance.rb +2 -2
- data/test/node/test_sync_entrance.rb +1 -1
- data/test/node/test_trace.rb +1 -1
- data/test/test__helper.rb +5 -4
- data/test/test_age.rb +2 -2
- data/test/test_amount.rb +1 -1
- data/test/test_cached_wallets.rb +3 -3
- data/test/test_copies.rb +6 -6
- data/test/test_dir_items.rb +2 -4
- data/test/test_gem.rb +1 -1
- data/test/test_hands.rb +1 -1
- data/test/test_hexnum.rb +1 -1
- data/test/test_http.rb +5 -5
- data/test/test_hungry_wallets.rb +1 -1
- data/test/test_id.rb +1 -1
- data/test/test_json_page.rb +1 -1
- data/test/test_key.rb +5 -5
- data/test/test_log.rb +1 -1
- data/test/test_metronome.rb +2 -1
- data/test/test_patch.rb +9 -9
- data/test/test_prefixes.rb +1 -1
- data/test/test_remotes.rb +2 -2
- data/test/test_signature.rb +1 -1
- data/test/test_size.rb +1 -1
- data/test/test_sync_wallets.rb +1 -1
- data/test/test_tax.rb +4 -4
- data/test/test_thread_pool.rb +1 -1
- data/test/test_tree_wallets.rb +1 -1
- data/test/test_txn.rb +2 -2
- data/test/test_upgrades.rb +4 -4
- data/test/test_verbose_thread.rb +1 -1
- data/test/test_wallet.rb +14 -14
- data/test/test_wallets.rb +1 -1
- data/test/test_zold.rb +2 -2
- data/test/upgrades/test_delete_banned_wallets.rb +1 -1
- data/test/upgrades/test_protocol_up.rb +1 -1
- data/upgrades/2.rb +1 -1
- data/upgrades/delete_banned_wallets.rb +2 -2
- data/upgrades/move_wallets_into_tree.rb +1 -1
- data/upgrades/protocol_up.rb +3 -3
- data/upgrades/rename_foreign_wallets.rb +2 -2
- data/zold.gemspec +21 -24
- metadata +40 -117
- data/.github/CODE_OF_CONDUCT.md +0 -76
- data/.github/CONTRIBUTING.md +0 -11
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 18c6e4f1386774fcd7a25433bd8211f5c2b0dc99fc61c97b82440148db58282c
|
|
4
|
+
data.tar.gz: f5d556bdff66fafbb6b0b831add370d90c2fd535fd41b23f404f8061e58ffc6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4dc26f43f869a10a4aaad3028241b3dbe7abe3323dde24252afad2ada84d82fc0de7ab70cf5862308eead9186f95954d6beb4a8fb62609bdec5cfb20856f8cce
|
|
7
|
+
data.tar.gz: 7f43aa3777ca221cf0b96941c8b1bece39950505d6ff8de7f43d5a0d971e66064378774020f469e160e8ea4dc396ba3302713b480308eef5bee5ebf020a6ff16
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codecov
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
jobs:
|
|
8
|
+
codecov:
|
|
9
|
+
runs-on: ubuntu-20.04
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: ruby/setup-ruby@v1
|
|
13
|
+
with:
|
|
14
|
+
ruby-version: 2.7
|
|
15
|
+
- run: bundle update
|
|
16
|
+
- run: bundle exec rake
|
|
17
|
+
- uses: codecov/codecov-action@v3
|
|
18
|
+
with:
|
|
19
|
+
file: coverage/.resultset.json
|
|
20
|
+
fail_ci_if_error: true
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rake
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- master
|
|
10
|
+
jobs:
|
|
11
|
+
rake:
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-22.04, macos-12]
|
|
15
|
+
ruby: [3.2]
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: ruby/setup-ruby@v1
|
|
20
|
+
with:
|
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
|
22
|
+
- run: bundle update
|
|
23
|
+
- run: bundle exec rake
|
data/.rubocop.yml
CHANGED
|
@@ -4,17 +4,21 @@ AllCops:
|
|
|
4
4
|
- 'assets/**/*'
|
|
5
5
|
DisplayCopNames: true
|
|
6
6
|
TargetRubyVersion: 2.5
|
|
7
|
+
NewCops: enable
|
|
8
|
+
SuggestExtensions: false
|
|
7
9
|
|
|
10
|
+
Gemspec/RequireMFA:
|
|
11
|
+
Enabled: false
|
|
8
12
|
Lint/ToJSON:
|
|
9
13
|
Enabled: false
|
|
10
|
-
Layout/
|
|
14
|
+
Layout/ArgumentAlignment:
|
|
11
15
|
Enabled: false
|
|
12
16
|
Style/ClassAndModuleChildren:
|
|
13
17
|
Enabled: false
|
|
14
18
|
Layout/EmptyLineAfterGuardClause:
|
|
15
19
|
Enabled: false
|
|
16
20
|
Metrics/CyclomaticComplexity:
|
|
17
|
-
Max:
|
|
21
|
+
Max: 45
|
|
18
22
|
Metrics/MethodLength:
|
|
19
23
|
Enabled: false
|
|
20
24
|
Layout/MultilineMethodCallIndentation:
|
|
@@ -31,15 +35,15 @@ Layout/EndOfLine:
|
|
|
31
35
|
EnforcedStyle: lf
|
|
32
36
|
Metrics/ParameterLists:
|
|
33
37
|
Max: 10
|
|
34
|
-
Layout/
|
|
38
|
+
Layout/ParameterAlignment:
|
|
35
39
|
Enabled: false
|
|
36
40
|
Metrics/PerceivedComplexity:
|
|
37
|
-
Max:
|
|
41
|
+
Max: 45
|
|
38
42
|
Metrics/LineLength:
|
|
39
43
|
Max: 120
|
|
40
44
|
Style/MultilineBlockChain:
|
|
41
45
|
Enabled: false
|
|
42
46
|
Layout/MultilineOperationIndentation:
|
|
43
47
|
Enabled: false
|
|
44
|
-
Naming/
|
|
48
|
+
Naming/MethodParameterName:
|
|
45
49
|
MinNameLength: 1
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.7.8
|
data/.rultor.yml
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
docker:
|
|
2
|
-
image: yegor256/rultor-image:1.
|
|
2
|
+
image: yegor256/rultor-image:1.22.0
|
|
3
3
|
architect:
|
|
4
4
|
- yegor256
|
|
5
5
|
- davvd
|
|
6
6
|
assets:
|
|
7
7
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
|
8
8
|
install: |
|
|
9
|
+
pdd -f /dev/null -v
|
|
9
10
|
sudo apt-get -y update
|
|
10
11
|
sudo apt-get -y install libcurl4-openssl-dev
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
bundle install --no-color
|
|
13
|
+
rm -rf "$(pwd)/Gemfile.lock"
|
|
13
14
|
release:
|
|
14
15
|
script: |-
|
|
15
16
|
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
|
|
16
|
-
|
|
17
17
|
export RUBYOPT="-W0"
|
|
18
18
|
sed -i "s/0\.0\.0/${tag}/g" lib/zold/version.rb
|
|
19
19
|
bundle exec rake --quiet
|
|
@@ -25,4 +25,3 @@ release:
|
|
|
25
25
|
merge:
|
|
26
26
|
script: |-
|
|
27
27
|
bundle exec rake --quiet
|
|
28
|
-
pdd -f /dev/null -v
|
data/.simplecov
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
#
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
4
|
+
# Copyright (c) 2018-2023 Zerocracy
|
|
4
5
|
#
|
|
5
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -20,21 +21,16 @@
|
|
|
20
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
22
|
# SOFTWARE.
|
|
22
23
|
|
|
23
|
-
if Gem.win_platform?
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
SimpleCov.start do
|
|
36
|
-
add_filter "/test/"
|
|
37
|
-
add_filter "/features/"
|
|
38
|
-
# minimum_coverage 30
|
|
39
|
-
end
|
|
24
|
+
SimpleCov.formatter = if Gem.win_platform?
|
|
25
|
+
SimpleCov::Formatter::MultiFormatter[
|
|
26
|
+
SimpleCov::Formatter::HTMLFormatter
|
|
27
|
+
]
|
|
28
|
+
else
|
|
29
|
+
SimpleCov::Formatter::MultiFormatter.new(
|
|
30
|
+
[SimpleCov::Formatter::HTMLFormatter]
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
SimpleCov.start do
|
|
34
|
+
add_filter '/test/'
|
|
35
|
+
add_filter '/features/'
|
|
40
36
|
end
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
source 'https://rubygems.org'
|
|
24
24
|
gemspec
|
|
25
25
|
|
|
26
|
-
gem 'cucumber', '
|
|
27
|
-
gem 'guard', '2.
|
|
26
|
+
gem 'cucumber', '9.1.0', require: false
|
|
27
|
+
gem 'guard', '2.18.1', require: false
|
|
28
28
|
gem 'guard-minitest', '2.4.6', require: false
|
|
29
|
-
gem 'minitest', '5.
|
|
29
|
+
gem 'minitest', '5.20.0', require: false
|
|
30
30
|
gem 'minitest-fail-fast', '0.1.0', require: false
|
|
31
|
-
gem 'minitest-hooks', '1.5.
|
|
32
|
-
gem 'minitest-reporters', '1.
|
|
33
|
-
gem 'rake', '
|
|
34
|
-
gem 'random-port', '0.
|
|
35
|
-
gem 'rdoc', '6.
|
|
36
|
-
gem 'rspec-rails', '
|
|
37
|
-
gem 'rubocop', '
|
|
38
|
-
gem 'rubocop-rspec', '
|
|
31
|
+
gem 'minitest-hooks', '1.5.1', require: false
|
|
32
|
+
gem 'minitest-reporters', '1.6.1', require: false
|
|
33
|
+
gem 'rake', '13.1.0', require: false
|
|
34
|
+
gem 'random-port', '0.6.0', require: false
|
|
35
|
+
gem 'rdoc', '6.6.0', require: false
|
|
36
|
+
gem 'rspec-rails', '6.1.0', require: false
|
|
37
|
+
gem 'rubocop', '1.57.2', require: false
|
|
38
|
+
gem 'rubocop-rspec', '2.25.0', require: false
|
|
39
39
|
gem 'simplecov', '0.22.0', require: false
|
|
40
|
-
gem 'webmock', '3.
|
|
40
|
+
gem 'webmock', '3.19.1', require: false
|
|
41
41
|
gem 'xcop', '>=0.6', require: false
|
data/Guardfile
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Guardfile for Zold
|
|
4
4
|
guard :minitest, all_after_pass: false, all_on_start: false do
|
|
5
5
|
# with Minitest::Unit
|
|
6
|
-
watch(%r{^test/(.*)
|
|
6
|
+
watch(%r{^test/(.*)/?test_(.*)\.rb$})
|
|
7
7
|
watch(%r{^lib/zold/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
|
8
8
|
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
|
9
9
|
end
|
data/README.md
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
<img src="http://www.zold.io/logo.svg" width="92px" height="92px"/>
|
|
2
2
|
|
|
3
|
-
[](https://www.0crat.com/contrib/CAZPZR9FS)
|
|
4
|
-
|
|
5
3
|
[](https://www.elegantobjects.org)
|
|
6
|
-
[](https://www.0crat.com/p/CAZPZR9FS)
|
|
7
4
|
[](http://www.rultor.com/p/yegor256/zold)
|
|
8
5
|
[](https://www.jetbrains.com/ruby/)
|
|
9
6
|
|
|
10
|
-
[](https://travis-ci.org/zold-io/zold)
|
|
11
7
|
[](http://www.0pdd.com/p?name=zold-io/zold)
|
|
12
8
|
[](http://badge.fury.io/rb/zold)
|
|
13
9
|
[](https://codecov.io/github/zold-io/zold?branch=master)
|
|
14
|
-
|
|
15
10
|
[](http://rubydoc.info/github/zold-io/zold/master/frames)
|
|
16
11
|
[](https://codeclimate.com/github/zold-io/zold/maintainability)
|
|
17
12
|
[](https://github.com/yegor256/takes/blob/master/LICENSE.txt)
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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/bin/zold
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# encoding: utf-8
|
|
3
3
|
#
|
|
4
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
4
|
+
# Copyright (c) 2018-2023 Zerocracy
|
|
5
5
|
#
|
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
# 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
|
|
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
|
|
@@ -30,13 +30,13 @@ Before do
|
|
|
30
30
|
@dir = Dir.mktmpdir('test')
|
|
31
31
|
FileUtils.copy('fixtures/id_rsa', @dir)
|
|
32
32
|
FileUtils.copy('fixtures/id_rsa.pub', @dir)
|
|
33
|
-
FileUtils.mkdir_p(@dir)
|
|
33
|
+
FileUtils.mkdir_p(@dir)
|
|
34
34
|
Dir.chdir(@dir)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
After do
|
|
38
38
|
Dir.chdir(@cwd)
|
|
39
|
-
FileUtils.rm_rf(@dir)
|
|
39
|
+
FileUtils.rm_rf(@dir)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
When(%r{^I run ([a-z/-]+) with "([^"]*)"$}) do |cmd, args|
|
|
@@ -47,7 +47,7 @@ end
|
|
|
47
47
|
|
|
48
48
|
When(/^I run bash with:$/) do |text|
|
|
49
49
|
FileUtils.copy_entry(@cwd, File.join(@dir, 'zold'))
|
|
50
|
-
|
|
50
|
+
File.write('run.sh', text)
|
|
51
51
|
@stdout = `/bin/bash run.sh 2>&1`
|
|
52
52
|
@exitstatus = $CHILD_STATUS.exitstatus
|
|
53
53
|
end
|
|
@@ -55,7 +55,7 @@ end
|
|
|
55
55
|
When(/^I have "([^"]*)" file with content:$/) do |file, text|
|
|
56
56
|
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file)
|
|
57
57
|
File.open(file, 'w:ASCII-8BIT') do |f|
|
|
58
|
-
f.write(text.gsub(
|
|
58
|
+
f.write(text.gsub('\\xFF', 0xFF.chr))
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
data/features/support/env.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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/fixtures/merge/asserts.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|
|
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
|
|
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
|
|
@@ -20,6 +20,6 @@
|
|
|
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_relative 'asserts
|
|
23
|
+
require_relative 'asserts'
|
|
24
24
|
wallet = Zold::Wallet.new('0123456789abcdef.z')
|
|
25
25
|
assert_equal(Zold::Amount.new(zld: -9.0), wallet.balance)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|
|
@@ -20,6 +20,6 @@
|
|
|
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_relative 'asserts
|
|
23
|
+
require_relative 'asserts'
|
|
24
24
|
wallet = Zold::Wallet.new('0123456789abcdef.z')
|
|
25
25
|
assert_equal(Zold::Amount.new(zld: 496.0), wallet.balance)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|
|
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
|
|
@@ -20,6 +20,6 @@
|
|
|
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_relative 'asserts
|
|
23
|
+
require_relative 'asserts'
|
|
24
24
|
wallet = Zold::Wallet.new('0123456789abcdef.z')
|
|
25
25
|
assert_equal(Zold::Amount.new(zld: 512.0 - 16 - 32), wallet.balance)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|
|
@@ -20,6 +20,6 @@
|
|
|
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_relative 'asserts
|
|
23
|
+
require_relative 'asserts'
|
|
24
24
|
wallet = Zold::Wallet.new('0123456789abcdef.z')
|
|
25
25
|
assert_equal(Zold::Amount.new(zld: 388.0), wallet.balance)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|
|
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/lib/zold/age.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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/lib/zold/amount.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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 @@ module Zold
|
|
|
42
42
|
@zents = zents
|
|
43
43
|
elsif !zld.nil?
|
|
44
44
|
raise "Float is required, while #{zld.class} provided: #{zld}" unless zld.is_a?(Float)
|
|
45
|
-
@zents = (zld * 2**FRACTION).to_i
|
|
45
|
+
@zents = (zld * (2**FRACTION)).to_i
|
|
46
46
|
else
|
|
47
47
|
raise 'You can\'t specify both coints and zld'
|
|
48
48
|
end
|
|
@@ -60,7 +60,7 @@ module Zold
|
|
|
60
60
|
|
|
61
61
|
# Convert to ZLD and return as a float.
|
|
62
62
|
def to_f
|
|
63
|
-
@zents.to_f / 2**FRACTION
|
|
63
|
+
@zents.to_f / (2**FRACTION)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
# Convert to ZLD and return as a string. If you need float, you should use <tt>to_f()</tt> later.
|
data/lib/zold/cached_wallets.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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/lib/zold/commands/args.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|
|
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
|
|
@@ -84,7 +84,7 @@ Available options:"
|
|
|
84
84
|
)
|
|
85
85
|
loop do
|
|
86
86
|
msg = score.to_s
|
|
87
|
-
msg += (score.value.positive? ?
|
|
87
|
+
msg += (score.value.positive? ? " #{score.hash}" : '') unless opts['hide-hash']
|
|
88
88
|
msg += " #{(Time.now - mstart).round(2)}s" unless opts['hide-time']
|
|
89
89
|
@log.info(msg)
|
|
90
90
|
break if score.value >= opts[:max].to_i
|
data/lib/zold/commands/clean.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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/lib/zold/commands/create.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|
|
@@ -70,7 +70,11 @@ Available options:"
|
|
|
70
70
|
loop do
|
|
71
71
|
id = Id.new
|
|
72
72
|
return id if opts['skip-test']
|
|
73
|
-
found =
|
|
73
|
+
found = @wallets.exists?(id)
|
|
74
|
+
if found
|
|
75
|
+
@log.debug("Wallet ID #{id} already exists locally, will try another one...")
|
|
76
|
+
next
|
|
77
|
+
end
|
|
74
78
|
@remotes.iterate(@log) do |r|
|
|
75
79
|
head = r.http("/wallet/#{id}/digest").get
|
|
76
80
|
found = true if head.status == 200
|
data/lib/zold/commands/diff.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|
|
@@ -70,12 +70,12 @@ Available options:"
|
|
|
70
70
|
patch.join(Wallet.new(c[:path]))
|
|
71
71
|
end
|
|
72
72
|
before = @wallets.acq(id) do |wallet|
|
|
73
|
-
|
|
73
|
+
File.read(wallet.path)
|
|
74
74
|
end
|
|
75
75
|
after = ''
|
|
76
76
|
Tempfile.open(['', Wallet::EXT]) do |f|
|
|
77
77
|
patch.save(f.path, overwrite: true)
|
|
78
|
-
after =
|
|
78
|
+
after = File.read(f)
|
|
79
79
|
end
|
|
80
80
|
diff = Diffy::Diff.new(before, after, context: 0).to_s(:color)
|
|
81
81
|
@log.info(diff)
|
data/lib/zold/commands/fetch.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|
|
@@ -170,7 +170,7 @@ run 'zold remote update' or use --tolerate-quorum=1"
|
|
|
170
170
|
if wallet.balance.negative? && !wallet.root?
|
|
171
171
|
raise FetchError, "The balance of #{id} is #{wallet.balance} and it's not a root wallet"
|
|
172
172
|
end
|
|
173
|
-
copy = cps.add(
|
|
173
|
+
copy = cps.add(File.read(f), score.host, score.port, score.value, master: r.master?)
|
|
174
174
|
@log.debug("#{r} returned #{wallet.mnemo} #{Age.new(json['mtime'])}/#{json['copies']}c \
|
|
175
175
|
as copy ##{copy}/#{cps.all.count} in #{Age.new(start, limit: 4)}: \
|
|
176
176
|
#{Rainbow(score.value).green} (#{json['version']})")
|
|
@@ -204,7 +204,7 @@ as copy ##{copy}/#{cps.all.count} in #{Age.new(start, limit: 4)}: \
|
|
|
204
204
|
cps.all.each do |c|
|
|
205
205
|
next unless json['digest'] == OpenSSL::Digest::SHA256.file(c[:path]).hexdigest &&
|
|
206
206
|
json['size'] == File.size(c[:path])
|
|
207
|
-
copy = cps.add(
|
|
207
|
+
copy = cps.add(File.read(c[:path]), score.host, score.port, score.value, master: r.master?)
|
|
208
208
|
@log.debug("No need to fetch #{id} from #{r}, it's the same content as copy ##{copy}")
|
|
209
209
|
return true
|
|
210
210
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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/lib/zold/commands/list.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-2023 Zerocracy
|
|
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
|