stellar-base 0.12.0 → 0.13.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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +9 -1
- data/generated/stellar-base-generated.rb +3 -0
- data/generated/stellar/crypto_key_type.rb +4 -4
- data/generated/stellar/ledger_upgrade.rb +4 -0
- data/generated/stellar/ledger_upgrade_type.rb +3 -1
- data/generated/stellar/signer_key.rb +11 -9
- data/generated/stellar/signer_key_type.rb +4 -4
- data/lib/stellar/base/version.rb +1 -1
- data/lib/stellar/key_pair.rb +4 -0
- data/spec/lib/stellar/key_pair_spec.rb +13 -0
- data/tasks/xdr.rake +1 -1
- data/xdr/Stellar-ledger-entries.x +10 -0
- data/xdr/Stellar-ledger.x +5 -1
- data/xdr/Stellar-types.x +7 -5
- metadata +2 -3
- data/.vscode/temp.sql +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2c8c890214d963a628202f239db08ba7bab26a5
|
4
|
+
data.tar.gz: b13f3cd18aaf12049b639eea8b0d5387f18d87d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89caa5c6ea3b10c767a149a00f5dc87bad11f102b459d7c713107cc3ace55d1c3a638354c56f8127f943f9388b8a8984102eaf91e83913c5d3edccc6cedbab2b
|
7
|
+
data.tar.gz: ecc7b38a19820743379fd2da53fcdc1fb38fdd4d6202aba4a25ffbc9b6577e2234084f2a9cddf731db1eb7ef876b7d48a576613dc4140f4ccbb4909588c63a39
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,7 +6,15 @@ file. This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
As this project is pre 1.0, breaking changes may happen for minor version
|
7
7
|
bumps. A breaking change will get clearly notified in this log.
|
8
8
|
|
9
|
-
## [unreleased](https://github.com/stellar/ruby-stellar-base/compare/v0.
|
9
|
+
## [unreleased](https://github.com/stellar/ruby-stellar-base/compare/v0.13.0...master)
|
10
|
+
|
11
|
+
## [0.13.0](https://github.com/stellar/ruby-stellar-base/compare/v0.12.0...v0.13.0)
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- Update XDR definitions for stellar-core 0.9.1 support
|
15
|
+
|
16
|
+
### Added
|
17
|
+
- Added `#signer_key` helper to `KeyPair`
|
10
18
|
|
11
19
|
## [0.12.0](https://github.com/stellar/ruby-stellar-base/compare/v0.11.0...v0.12.0)
|
12
20
|
|
@@ -41,10 +41,13 @@ module Stellar
|
|
41
41
|
autoload :LedgerEntryType
|
42
42
|
autoload :Signer
|
43
43
|
autoload :AccountFlags
|
44
|
+
MASK_ACCOUNT_FLAGS = 0x7
|
44
45
|
autoload :AccountEntry
|
45
46
|
autoload :TrustLineFlags
|
47
|
+
MASK_TRUSTLINE_FLAGS = 1
|
46
48
|
autoload :TrustLineEntry
|
47
49
|
autoload :OfferEntryFlags
|
50
|
+
MASK_OFFERENTRY_FLAGS = 1
|
48
51
|
autoload :OfferEntry
|
49
52
|
autoload :DataEntry
|
50
53
|
autoload :LedgerEntry
|
@@ -8,16 +8,16 @@ require 'xdr'
|
|
8
8
|
# enum CryptoKeyType
|
9
9
|
# {
|
10
10
|
# KEY_TYPE_ED25519 = 0,
|
11
|
-
#
|
11
|
+
# KEY_TYPE_PRE_AUTH_TX = 1,
|
12
12
|
# KEY_TYPE_HASH_X = 2
|
13
13
|
# };
|
14
14
|
#
|
15
15
|
# ===========================================================================
|
16
16
|
module Stellar
|
17
17
|
class CryptoKeyType < XDR::Enum
|
18
|
-
member :key_type_ed25519,
|
19
|
-
member :
|
20
|
-
member :key_type_hash_x,
|
18
|
+
member :key_type_ed25519, 0
|
19
|
+
member :key_type_pre_auth_tx, 1
|
20
|
+
member :key_type_hash_x, 2
|
21
21
|
|
22
22
|
seal
|
23
23
|
end
|
@@ -13,6 +13,8 @@ require 'xdr'
|
|
13
13
|
# uint32 newBaseFee; // update baseFee
|
14
14
|
# case LEDGER_UPGRADE_MAX_TX_SET_SIZE:
|
15
15
|
# uint32 newMaxTxSetSize; // update maxTxSetSize
|
16
|
+
# case LEDGER_UPGRADE_BASE_RESERVE:
|
17
|
+
# uint32 newBaseReserve; // update baseReserve
|
16
18
|
# };
|
17
19
|
#
|
18
20
|
# ===========================================================================
|
@@ -23,9 +25,11 @@ module Stellar
|
|
23
25
|
switch :ledger_upgrade_version, :new_ledger_version
|
24
26
|
switch :ledger_upgrade_base_fee, :new_base_fee
|
25
27
|
switch :ledger_upgrade_max_tx_set_size, :new_max_tx_set_size
|
28
|
+
switch :ledger_upgrade_base_reserve, :new_base_reserve
|
26
29
|
|
27
30
|
attribute :new_ledger_version, Uint32
|
28
31
|
attribute :new_base_fee, Uint32
|
29
32
|
attribute :new_max_tx_set_size, Uint32
|
33
|
+
attribute :new_base_reserve, Uint32
|
30
34
|
end
|
31
35
|
end
|
@@ -9,7 +9,8 @@ require 'xdr'
|
|
9
9
|
# {
|
10
10
|
# LEDGER_UPGRADE_VERSION = 1,
|
11
11
|
# LEDGER_UPGRADE_BASE_FEE = 2,
|
12
|
-
# LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3
|
12
|
+
# LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3,
|
13
|
+
# LEDGER_UPGRADE_BASE_RESERVE = 4
|
13
14
|
# };
|
14
15
|
#
|
15
16
|
# ===========================================================================
|
@@ -18,6 +19,7 @@ module Stellar
|
|
18
19
|
member :ledger_upgrade_version, 1
|
19
20
|
member :ledger_upgrade_base_fee, 2
|
20
21
|
member :ledger_upgrade_max_tx_set_size, 3
|
22
|
+
member :ledger_upgrade_base_reserve, 4
|
21
23
|
|
22
24
|
seal
|
23
25
|
end
|
@@ -9,10 +9,12 @@ require 'xdr'
|
|
9
9
|
# {
|
10
10
|
# case SIGNER_KEY_TYPE_ED25519:
|
11
11
|
# uint256 ed25519;
|
12
|
-
# case
|
13
|
-
# Hash
|
12
|
+
# case SIGNER_KEY_TYPE_PRE_AUTH_TX:
|
13
|
+
# /* Hash of Transaction structure */
|
14
|
+
# uint256 preAuthTx;
|
14
15
|
# case SIGNER_KEY_TYPE_HASH_X:
|
15
|
-
# Hash
|
16
|
+
# /* Hash of random 256 bit preimage X */
|
17
|
+
# uint256 hashX;
|
16
18
|
# };
|
17
19
|
#
|
18
20
|
# ===========================================================================
|
@@ -20,12 +22,12 @@ module Stellar
|
|
20
22
|
class SignerKey < XDR::Union
|
21
23
|
switch_on SignerKeyType, :type
|
22
24
|
|
23
|
-
switch :signer_key_type_ed25519,
|
24
|
-
switch :
|
25
|
-
switch :signer_key_type_hash_x,
|
25
|
+
switch :signer_key_type_ed25519, :ed25519
|
26
|
+
switch :signer_key_type_pre_auth_tx, :pre_auth_tx
|
27
|
+
switch :signer_key_type_hash_x, :hash_x
|
26
28
|
|
27
|
-
attribute :ed25519,
|
28
|
-
attribute :
|
29
|
-
attribute :hash_x,
|
29
|
+
attribute :ed25519, Uint256
|
30
|
+
attribute :pre_auth_tx, Uint256
|
31
|
+
attribute :hash_x, Uint256
|
30
32
|
end
|
31
33
|
end
|
@@ -8,16 +8,16 @@ require 'xdr'
|
|
8
8
|
# enum SignerKeyType
|
9
9
|
# {
|
10
10
|
# SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519,
|
11
|
-
#
|
11
|
+
# SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX,
|
12
12
|
# SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X
|
13
13
|
# };
|
14
14
|
#
|
15
15
|
# ===========================================================================
|
16
16
|
module Stellar
|
17
17
|
class SignerKeyType < XDR::Enum
|
18
|
-
member :signer_key_type_ed25519,
|
19
|
-
member :
|
20
|
-
member :signer_key_type_hash_x,
|
18
|
+
member :signer_key_type_ed25519, 0
|
19
|
+
member :signer_key_type_pre_auth_tx, 1
|
20
|
+
member :signer_key_type_hash_x, 2
|
21
21
|
|
22
22
|
seal
|
23
23
|
end
|
data/lib/stellar/base/version.rb
CHANGED
data/lib/stellar/key_pair.rb
CHANGED
@@ -135,6 +135,17 @@ describe Stellar::KeyPair do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
describe "#signer_key" do
|
139
|
+
let(:key_pair){ Stellar::KeyPair.random }
|
140
|
+
subject{ key_pair.signer_key }
|
141
|
+
|
142
|
+
it { should be_a(Stellar::SignerKey) }
|
143
|
+
|
144
|
+
it "contains the public key" do
|
145
|
+
expect(subject.ed25519!).to eql(key_pair.raw_public_key)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
138
149
|
describe "#raw_seed" do
|
139
150
|
let(:key_pair){ Stellar::KeyPair.random }
|
140
151
|
subject{ key_pair.raw_seed }
|
@@ -168,6 +179,8 @@ describe Stellar::KeyPair do
|
|
168
179
|
it{ should be_strkey(:seed)}
|
169
180
|
end
|
170
181
|
|
182
|
+
|
183
|
+
|
171
184
|
describe "#sign" do
|
172
185
|
let(:message) { "hello" }
|
173
186
|
subject{ key_pair.sign(message) }
|
data/tasks/xdr.rake
CHANGED
@@ -26,7 +26,7 @@ namespace :xdr do
|
|
26
26
|
|
27
27
|
HAYASHI_XDR.each do |src|
|
28
28
|
local_path = "xdr/" + File.basename(src)
|
29
|
-
encoded = client.contents("stellar/stellar-core", path: src, ref:"
|
29
|
+
encoded = client.contents("stellar/stellar-core", path: src, ref: "prod").content
|
30
30
|
decoded = Base64.decode64 encoded
|
31
31
|
|
32
32
|
IO.write(local_path, decoded)
|
@@ -88,6 +88,9 @@ enum AccountFlags
|
|
88
88
|
AUTH_IMMUTABLE_FLAG = 0x4
|
89
89
|
};
|
90
90
|
|
91
|
+
// mask for all valid flags
|
92
|
+
const MASK_ACCOUNT_FLAGS = 0x7;
|
93
|
+
|
91
94
|
/* AccountEntry
|
92
95
|
|
93
96
|
Main entry representing a user in Stellar. All transactions are
|
@@ -136,6 +139,10 @@ enum TrustLineFlags
|
|
136
139
|
AUTHORIZED_FLAG = 1
|
137
140
|
};
|
138
141
|
|
142
|
+
|
143
|
+
// mask for all trustline flags
|
144
|
+
const MASK_TRUSTLINE_FLAGS = 1;
|
145
|
+
|
139
146
|
struct TrustLineEntry
|
140
147
|
{
|
141
148
|
AccountID accountID; // account this trustline belongs to
|
@@ -161,6 +168,9 @@ enum OfferEntryFlags
|
|
161
168
|
PASSIVE_FLAG = 1
|
162
169
|
};
|
163
170
|
|
171
|
+
// Mask for OfferEntry flags
|
172
|
+
const MASK_OFFERENTRY_FLAGS = 1;
|
173
|
+
|
164
174
|
/* OfferEntry
|
165
175
|
An offer is the building block of the offer book, they are automatically
|
166
176
|
claimed by payments when the price set by the owner is met.
|
data/xdr/Stellar-ledger.x
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
// under the Apache License, Version 2.0. See the COPYING file at the root
|
3
3
|
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
|
4
4
|
|
5
|
+
%#include "xdr/Stellar-SCP.h"
|
5
6
|
%#include "xdr/Stellar-transaction.h"
|
6
7
|
|
7
8
|
namespace stellar
|
@@ -82,7 +83,8 @@ enum LedgerUpgradeType
|
|
82
83
|
{
|
83
84
|
LEDGER_UPGRADE_VERSION = 1,
|
84
85
|
LEDGER_UPGRADE_BASE_FEE = 2,
|
85
|
-
LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3
|
86
|
+
LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3,
|
87
|
+
LEDGER_UPGRADE_BASE_RESERVE = 4
|
86
88
|
};
|
87
89
|
|
88
90
|
union LedgerUpgrade switch (LedgerUpgradeType type)
|
@@ -93,6 +95,8 @@ case LEDGER_UPGRADE_BASE_FEE:
|
|
93
95
|
uint32 newBaseFee; // update baseFee
|
94
96
|
case LEDGER_UPGRADE_MAX_TX_SET_SIZE:
|
95
97
|
uint32 newMaxTxSetSize; // update maxTxSetSize
|
98
|
+
case LEDGER_UPGRADE_BASE_RESERVE:
|
99
|
+
uint32 newBaseReserve; // update baseReserve
|
96
100
|
};
|
97
101
|
|
98
102
|
/* Entries used to define the bucket list */
|
data/xdr/Stellar-types.x
CHANGED
@@ -17,7 +17,7 @@ typedef hyper int64;
|
|
17
17
|
enum CryptoKeyType
|
18
18
|
{
|
19
19
|
KEY_TYPE_ED25519 = 0,
|
20
|
-
|
20
|
+
KEY_TYPE_PRE_AUTH_TX = 1,
|
21
21
|
KEY_TYPE_HASH_X = 2
|
22
22
|
};
|
23
23
|
|
@@ -29,7 +29,7 @@ enum PublicKeyType
|
|
29
29
|
enum SignerKeyType
|
30
30
|
{
|
31
31
|
SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519,
|
32
|
-
|
32
|
+
SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX,
|
33
33
|
SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X
|
34
34
|
};
|
35
35
|
|
@@ -43,10 +43,12 @@ union SignerKey switch (SignerKeyType type)
|
|
43
43
|
{
|
44
44
|
case SIGNER_KEY_TYPE_ED25519:
|
45
45
|
uint256 ed25519;
|
46
|
-
case
|
47
|
-
Hash
|
46
|
+
case SIGNER_KEY_TYPE_PRE_AUTH_TX:
|
47
|
+
/* Hash of Transaction structure */
|
48
|
+
uint256 preAuthTx;
|
48
49
|
case SIGNER_KEY_TYPE_HASH_X:
|
49
|
-
Hash
|
50
|
+
/* Hash of random 256 bit preimage X */
|
51
|
+
uint256 hashX;
|
50
52
|
};
|
51
53
|
|
52
54
|
// variable size as the size depends on the signature scheme used
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stellar-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Fleckenstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xdr
|
@@ -229,7 +229,6 @@ extra_rdoc_files: []
|
|
229
229
|
files:
|
230
230
|
- ".gitignore"
|
231
231
|
- ".travis.yml"
|
232
|
-
- ".vscode/temp.sql"
|
233
232
|
- ".yardopts"
|
234
233
|
- CHANGELOG.md
|
235
234
|
- CONTRIBUTING.md
|
data/.vscode/temp.sql
DELETED
File without changes
|