sigma_rb 0.1.5 → 0.2.0

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: 27abcc0ee21f1cd786abbc334c064d1feba557f7cae8974753a1239245385f72
4
- data.tar.gz: 6306470e77ae1df2f01bdd9a809e3b5b5abc2d865f58de60555911dbaf3d064d
3
+ metadata.gz: c92fe136337de8a807df096f11be91adc0adbbcdd3ec1954e1d709330f0923ce
4
+ data.tar.gz: 9b8e1184fbfb6b4bc3fac7f1ae17c9af6ff944b1fef162610a59c424115ddf35
5
5
  SHA512:
6
- metadata.gz: adba97a9449d7d4b071d83d07de427f386a03246e4b25fe24fe6d81314f990cbe4e851094ae488a125a6610d9f2823375d6c51826819dcece11b5d9ca0a4538c
7
- data.tar.gz: 458d6aa6f4ee1eab46fa28212059a9037681a15664415391df83acf1be04718fbe542ae70c7d3a8111da24ec10e9895edf7e5d64669dae4a186d0d5866380a7a
6
+ metadata.gz: 3f074423dd70b380e840e38a3c1a30569c019578e0e0cb57db8254f135ee8e8572ea8a9b4cf33fe10764c60ab968bd504a385532e74e963bacf8113b5ef18f9a
7
+ data.tar.gz: 9b22745d040d9ff79166bc8a14226ad6582796faf248b0d3a449d637c13a629387330564ac4a31af5af3f779f940117783447ab609ea083f92e7469fcae110ba
data/README.md CHANGED
@@ -6,6 +6,7 @@ This project wraps the C bindings of Sigma-Rust and so they are required for usi
6
6
 
7
7
  | Sigma_rb Version | Sigma-Rust Version |
8
8
  | ---------------- | -------------------|
9
+ | 0.2.0                   | 0.18.0             |
9
10
  | 0.1.3 - 0.1.5 | 0.16.0 |
10
11
 
11
12
 
@@ -25,7 +26,6 @@ cargo build --release -p ergo-lib-c
25
26
 
26
27
  This will build a release version of `libergo.a` located at `target/release/libergo.a` from the root directory. You will need to copy/move this to a C LIBRARY search path on your system. For my system I can use `/usr/local/lib` . This usually depends on OS.
27
28
 
28
- So I did this to copy `libergo.a` to `/usr/local/lib` :
29
29
  ```
30
30
  sudo cp ../../target/release/libergo.a /usr/local/lib/
31
31
  ```
@@ -36,7 +36,7 @@ While still in the `bindings/ergo-lib_c` directory you can generate the header f
36
36
  cbindgen --config cbindgen.toml --crate ergo-lib-c --output h/ergo_lib.h
37
37
  ```
38
38
 
39
- You will need to copy/move this header to a C INCLUDE search path. On my system I can use `/usr/local/include` . So I ran the following command to copy the header:
39
+ You will need to copy/move this header to a C INCLUDE search path. On my system I can use `/usr/local/include` .
40
40
  ```
41
41
  sudo cp h/ergo_lib.h /usr/local/include/
42
42
  ```
@@ -359,6 +359,10 @@ module Sigma
359
359
 
360
360
  attr_accessor :pointer
361
361
 
362
+ # Safe maximum number of tokens in the box
363
+ # Calculated from the max box size (4kb) limit and the size of the token (32 bytes)
364
+ MAX_TOKENS_COUNT = 100
365
+
362
366
  # Create a new box
363
367
  # @param box_value: [BoxValue] amount of money associated with box
364
368
  # @param creation_height: [Integer] height when a transaction containing the box is created
data/lib/sigma/token.rb CHANGED
@@ -262,7 +262,7 @@ module Sigma
262
262
  end
263
263
  end
264
264
 
265
- # Add to collection
265
+ # Add to collection. Max capacity of ErgoBox::MAX_TOKENS_COUNT tokens. Will throw error if adding more.
266
266
  # @param token [Token]
267
267
  def add(token)
268
268
  error = ergo_lib_tokens_add(token.pointer, self.pointer)
data/lib/sigma.rb CHANGED
@@ -26,7 +26,7 @@ module Sigma
26
26
  require_relative 'sigma/merkle_proof'
27
27
  require_relative 'sigma/nipopow'
28
28
 
29
- SIGMA_RUST_VERSION = '0.16.0'
29
+ SIGMA_RUST_VERSION = '0.18.0'
30
30
  end
31
31
 
32
32
 
data/sigma.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'sigma_rb'
3
- s.version = '0.1.5'
3
+ s.version = '0.2.0'
4
4
  s.summary = "Ruby bindings for Ergo types, abstractions, and interfaces provided by Sigma-Rust."
5
5
  s.description = "Ruby bindings for the Ergo-Lib crate of Sigma-Rust. Specifically for chain types and abstractions, json serialization, box selection for tx inputs, tx creation, and signing."
6
6
  s.authors = ["Dark Lord of Programming"]
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.add_dependency 'rake', '~> 13.0'
14
14
  s.add_development_dependency 'ffi', '1.15.5'
15
15
  s.add_development_dependency 'test-unit', '~> 3.5'
16
- s.add_development_dependency 'yard', '>= 0.9.20'
16
+ s.add_development_dependency 'yard', '~> 0.9.20'
17
17
  s.extensions << "ext/Rakefile"
18
18
  s.test_files = Dir["tests/**/*.rb"]
19
19
  s.require_paths = ["lib"]
@@ -73,13 +73,15 @@ class Sigma::Token::Test < Test::Unit::TestCase
73
73
  token_amount = Sigma::TokenAmount.with_i64(amount)
74
74
  token = Sigma::Token.create(token_id: token_id, token_amount: token_amount)
75
75
 
76
- 255.times do |i|
76
+ max_tokens_count = ErgoBox::MAX_TOKENS_COUNT
77
+
78
+ max_tokens_count.times do |i|
77
79
  tokens.add(token)
78
80
  end
79
- assert_equal(255, tokens.len)
80
- assert_equal(tokens.get(254), token)
81
+ assert_equal(max_tokens_count, tokens.len)
82
+ assert_equal(tokens.get(max_tokens_count - 1), token)
81
83
 
82
- # 256 raises error
84
+ # Next raises error
83
85
  assert_raise do
84
86
  tokens.add(token)
85
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sigma_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dark Lord of Programming
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-28 00:00:00.000000000 Z
11
+ date: 2022-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-compiler
@@ -70,14 +70,14 @@ dependencies:
70
70
  name: yard
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.9.20
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.9.20
83
83
  description: Ruby bindings for the Ergo-Lib crate of Sigma-Rust. Specifically for