Giter Club home page Giter Club logo

ruby-stellar-base's People

Contributors

abuiles avatar bartekn avatar bekkibolthouse avatar graydon avatar jakeurban avatar matschaffer avatar nebolsin avatar nullstyle avatar prodoxx avatar ramontayag avatar tomerweller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-stellar-base's Issues

Rspec error: `attribute': Stellar::Asset does not convert to xdr (ArgumentError)

Steps to reproduce:

  • download rvm, rvm install 2.2.6, gem install bundler
  • git clone https://github.com/stellar/ruby-stellar-base
  • cd ruby-stellar-base
  • running bundler results in the following error:
Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    stellar-base was resolved to 0.11.0, which depends on
      xdr (~> 1.0.0) was resolved to 1.0.0, which depends on
        activemodel (~> 4) was resolved to 4.2.7.1, which depends on
          activesupport (= 4.2.7.1)

    stellar-base was resolved to 0.11.0, which depends on
      activesupport (~> 4)

    stellar-base was resolved to 0.11.0, which depends on
      activesupport (~> 4)

    xdrgen was resolved to 0.0.1, which depends on
      activesupport (~> 5)
  • change activesupport version of ruby-stellar-base to version 5 in ruby-stellar-base.gemspec
  • cd ..; git clone https://github.com/stellar/ruby-xdr
  • cd ruby-xdr
  • change activesupport and activemodel version for ruby-xdr from 4 to 5
  • run bundle
  • change to ruby-stellar-base folder and modify Gemfile to take local ruby-xdr and run bundle
  • run bundle exec rake and the following error shows:
ubuntu@me:~/sources/ruby-stellar-base$ bundle exec rake
/home/ubuntu/.rvm/rubies/ruby-2.2.6/bin/ruby -I/home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib:/home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-support-3.5.0/lib /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Coverage report generated for RSpec to /home/ubuntu/sources/ruby-stellar-base/coverage. 218 / 297 LOC (73.4%) covered.
/home/ubuntu/sources/ruby-xdr/lib/xdr/dsl/struct.rb:5:in `attribute': Stellar::Asset does not convert to xdr (ArgumentError)
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/trust_line_entry.rb:35:in `<class:TrustLineEntry>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/trust_line_entry.rb:29:in `<module:Stellar>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/trust_line_entry.rb:28:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry/data.rb:32:in `<class:Data>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry/data.rb:23:in `<class:LedgerEntry>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry/data.rb:22:in `<module:Stellar>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry/data.rb:21:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry.rb:43:in `<class:LedgerEntry>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry.rb:36:in `<module:Stellar>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry.rb:35:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry_change.rb:30:in `<class:LedgerEntryChange>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry_change.rb:22:in `<module:Stellar>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry_change.rb:21:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar-base-generated.rb:123:in `<module:Stellar>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar-base-generated.rb:100:in `<top (required)>'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require_with_backports'
        from /home/ubuntu/sources/ruby-stellar-base/lib/stellar-base.rb:11:in `block in <top (required)>'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/activesupport-5.0.1/lib/active_support/core_ext/kernel/reporting.rb:13:in `block in silence_warnings'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/activesupport-5.0.1/lib/active_support/core_ext/kernel/reporting.rb:26:in `with_warnings'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/activesupport-5.0.1/lib/active_support/core_ext/kernel/reporting.rb:13:in `silence_warnings'
        from /home/ubuntu/sources/ruby-stellar-base/lib/stellar-base.rb:10:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/spec/spec_helper.rb:8:in `require'
        from /home/ubuntu/sources/ruby-stellar-base/spec/spec_helper.rb:8:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/spec/lib/stellar/account_flags_spec.rb:1:in `require'
        from /home/ubuntu/sources/ruby-stellar-base/spec/lib/stellar/account_flags_spec.rb:1:in `<top (required)>'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `load'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `each'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `load_spec_files'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:100:in `setup'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/exe/rspec:4:in `<main>'
/home/ubuntu/.rvm/rubies/ruby-2.2.6/bin/ruby -I/home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib:/home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-support-3.5.0/lib /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed

Stellar::Base::VERSION is returning error

hash["stellar_base_version"] = Stellar::Base::VERSION is returning error `version': uninitialized constant Stellar::Base (NameError). I note a missing line in ./lib/stellar-base.rb that I think should read: require_relative './stellar/base/version'. without this line the Base::VERSION is not linked. adding this line seems to fix the problem. This missing line is seen in all version ruby-stellar-base that I've looked at so far from very old 0.1.4 to 0.10.0

libsodium on ubuntu

Is there any special intructions on how to install libsodium on ubuntu 14.04 ?

~/ruby-stellar-base$ ruby examples/low_level_transaction_post.rb 
/home/fred/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/ffi-1.9.10/lib/ffi/library.rb:133:in `block in ffi_lib': Could not open library 'sodium': sodium: cannot open shared object file: No such file or directory. (LoadError)
Could not open library 'libsodium.so': libsodium.so: cannot open shared object file: No such file or directory

However, libsodium.so is present:

 ~/.rbenv$ find -name "libsodium.so"
./versions/2.2.0/lib/ruby/gems/2.2.0/gems/rbnacl-libsodium-1.0.3/vendor/libsodium/dist/lib/libsodium.so
./versions/2.2.0/lib/ruby/gems/2.2.0/gems/rbnacl-libsodium-1.0.3/vendor/libsodium/src/libsodium/.libs/libsodium.so

Unable to decode XDR using TransactionEnvelope.from_xdr

Observed Results

Got error:

#<NoMethodError: undefined method `attribute' for #<Stellar::Operation::Body:0x00007f9abc3f79e8>
Did you mean?  attribute!
               attributes=>

when trying to decode the xdr envelope (TEST NET):

AAAAANJteIJGpz3OLTWilkWVOKjR2rsQK+dcuqzzWz1AS6DGAAAAyAAA2SAAAACoAAAAAAAAAAAAAAABAAAAAQAAAADSbXiCRqc9zi01opZFlTio0dq7ECvnXLqs81s9QEugxgAAAAEAAAAAEaTP05j9C5+UnDTc4wWSs4iEkaLTv63g0ZJw+5swBkoAAAABQlpEAAAAAABjBOgwXkC5IsdOtj0ruglmu60KI5OtgAYVDrmLbAGI+wAAAAA7msoAAAAAAAAAAAA=

and trying to get data from it.
I'm not sure what I'm doing wrong but I think it might be because of the asset name.
Code used:

unwraped_envl = Horizon::Api.unwrap_xdr_envelope(envelope)
payment_op = unwraped_envl.tx.operations[0].body.payment_op

Expected Result

I should be able to get the data from the xdr envelope.

Can add account signers but can't delete them

Seems I can add account signers with no problem but just can't delete them when I set weight to zero they are still listed on the stellar-core db with a weight of 1. the function I run that works to add but fails to delete with weight set to 0 is:

def add_signer_public_key(account, key, weight)
set_options account, signer: Stellar::Signer.new({
pub_key: key,
weight: weight
})
end

but I also tried to delete a signer from the developer web interface https://www.stellar.org/developers/tools/client/#/accountmanager and find I can't delete it from there also but have no problem adding them there. so maybe the problem is at the stellar-core level or something else?
account I was using:

"address": "GDBGEVX7CD5AS3ECPPJMDUGXK25DFUM5JK5DHDSMNYND46SPC2OMDJZY",
"secret": "SBPXGA7EEX3Y6LSNNZW3OBXI5UBV2PLH65PTBNNOWCIVDJVSHUSBNJGS"
}

The transaction failed when submitted to the stellar network

What am I doing wrong? (Using version 0.11.0)

    hot_account_keypair = Stellar::KeyPair.from_raw_seed(raw_seed)
    recipient_keypair = Stellar::KeyPair.from_address(to) #random address here
    amount = [:native, amount.to_f]

    payment = Stellar::Transaction.payment({
      account:     hot_account_keypair,
      destination: recipient_keypair,
      sequence:    hot_account_next_sequence,
      amount:      amount,
      memo:        command.to_i
    })

    tx_blob = payment.to_envelope(hot_account_keypair).to_xdr(:base64)

    submit(tx_blob) # POST to https://horizon.stellar.org/transactions

Horizon replies with:

tx_bad_auth

Discuss merging stellar-ruby-sdk and stellar-ruby-base

This issue is for discussing the pros and cons of keeping the separation of stellar-ruby-sdk and stellar-ruby-base (a.k.a. sdk, base). Currently, everything not related to horizon is kept in base, while the sdk has the horizon hyperclient, transaction paging, and SEP10 helper functions.

Why would we want to keep these separate?

  1. Change velocity
  • changes to the horizon/client code would likely outpace changes to the base code, which changes only when stellar-core changes. To me, This doesn't seem significant enough to merit keeping it separate.

Why would we want to merge them?

  1. Reduced time-to-release
  • Having two projects means the base project has to release changes before the client can update for the same thing
  1. Easier to reference code
  • Since both projects use the same Stellar module, its not always clear where the functionality is defined. For example, Stellar::Account is not in base, its in the sdk. This isn't a huge deal but its a bit annoying to have 2 projects open and figure out where a particular class is implemented.

I'll add more as I think of them.

@overcat I know the Python SDK was originally 2 separate projects, but everything was merged into py-stellar-base. Can you elaborate on what led to that decision?

Add set_source_account method to TransactionBuilder

While writing the examples for the sdk, I had to create a TransactionBuilder instance for every source account. It would be nice if I could just change the builder's source account.

We already provide set_ methods for the sequence number, timebounds, and memo. The only other attribute that doesn't have a set_ function is the base fee, which we can also add.

Gem file permissions are too strict

What version are you using?

0.21.0

What did you do?

When installing the gem with root inside a docker container and running the rails server with a non-root user. The user has no permissions to load or read the gem files.

What did you expect to see?

chmod 0655 on gem files

What did you see instead?

chmod 0600

Provide alternative parameters types for amount, asset

Originally discussed here, the following adjustments should be made to all Operation methods accepting amount or asset parameters:

  • Change the method's amount key value to accept the original type or a Numeric
    • the original type is an array of length 2 or 4 containing the asset type, code, issuer, and amount
  • Change/Add the method's asset key value to accepts the original type or a Stellar::Asset object
    • Many parameter accept an array of asset type, code, issuer

These changes are backwards compatible. All examples will be changed to use the new parameter types.

account signature present checked before needed in transaction creation

I'm getting this error:
stellar-base-0.6.1/lib/stellar/transaction.rb:97:in `for_account': Bad :account (ArgumentError)
this is coming from this line:
raise ArgumentError, "Bad :account" unless account.is_a?(KeyPair) && account.sign?
I'm not totaly sure I'm right about this but why do I need to have an account with a signature at this stage?
shouldn't this line be just:
raise ArgumentError, "Bad :account" unless account.is_a?(KeyPair)
there is no need for any signatures in the structure of a tx as far as I know. the signature seed should only be needed later to be present at the envelope creation event time.
I am presently creating transactions that are not yet going to be signed by the final sender of the transaction but I am adding a signature of one of the signers. the transaction will be later sent with the added signature of the target_account added to the envelope at a later time.
this check makes this not posible
sacarlson 5:38 PM with this change implemented in test, my transactions can now be created. I still see I will get errors at the stage of to_envelope stage so it looks like this works ok so far. I'll try it for a bit to make sure what other problems it might bring.

Provide a benchmark suitable for showing JRuby slowness

I was pointed to your readme today since it mentions that JRuby is slow due to BigDecimal performance, but I did not see any benchmarks or other means of exercising that behavior. If you can provide a benchmark that shows the JRuby performance issues, we might be able to do something to improve it.

Alternatively, we consider sub-par performance to be an issue, so if someone could file an issue at jruby/jruby with a reproducible benchmark, we'll have a look!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.