stellar-deprecated / horizon-importer

DEPRECATED
Apache License 2.0
17 stars 11 forks source link

success is not the set arm #55

Closed FredericHeem closed 9 years ago

FredericHeem commented 9 years ago

Here is the error message after updating to the latest code:

XDR::ArmNotSetError: success is not the set arm
    /Users/heemfre/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/xdr-0.1.0/lib/xdr/union.rb:101:in `attribute!'
    /Users/heemfre/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activemodel-4.2.3/lib/active_model/attribute_methods.rb:385:in `success!'
    /Users/heemfre/horizon/app/jobs/history/ledger_importer_job.rb:389:in `import_history_effects_for_operation'
    /Users/heemfre/horizon/app/jobs/history/ledger_importer_job.rb:338:in `block in import_history_effects'
    /Users/heemfre/horizon/app/jobs/history/ledger_importer_job.rb:334:in `each'
    /Users/heemfre/horizon/app/jobs/history/ledger_importer_job.rb:334:in `each_with_index'
    /Users/heemfre/horizon/app/jobs/history/ledger_importer_job.rb:334:in `import_history_effects'
    /Users/heemfre/horizon/app/jobs/history/ledger_importer_job.rb:62:in `block (3 levels) in perform'
    /Users/heemfre/horizon/app/jobs/history/ledger_importer_job.rb:58:in `each'
    /Users/heemfre/horizon/app/jobs/history/ledger_importer_job.rb:58:in `block (2 levels) in perform'
nullstyle commented 9 years ago

Is this running against the test network? If so, what was the last ledger your instance imported?

The importer should never run into this situation, since transactions that have failed should be filtered out prior to this function being executed. That seems indicative of a stellar-core issue.

Are you running on a custom fork that tries to import failed transactions?

FredericHeem commented 9 years ago

Indeed, it is running on my own fork with the imported failed transaction. The vanilla ruby horizon is not affected. I'm wondering if the line make_trades effects, source_account, scresult.offers_claimed gets ever called. How can we generate code coverage ?

nullstyle commented 9 years ago

I don't have code coverage integrated into the test suite. If you would like to do it, I recommend https://github.com/colszowka/simplecov.

I doubt you'd hit those lines in the test suite... once we decided that this codebase's lifetime is limited, I've relied on simple manual testing to confirm behaviour.

To do, so, run: RAILS_ENV=test ./bin/rake db:build_scenarios. This command will play all of the scc scenario files at spec/fixtures/scenarios/*.rb and then re-import the resulting ledger data. The sql files at spec/fixtures/scenarios/*-horizon.sql will be updated and you can verify that the history_effects table is properly populated.

I'm postive the line you are wondering about is being hit for normal manage offers, but looking over the scenarios, I have not specifically tested it with passive offers. Should be trivial to work up.