Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_test_scenarios fails #614

Closed
robertDurst opened this issue Aug 24, 2018 · 1 comment
Closed

build_test_scenarios fails #614

robertDurst opened this issue Aug 24, 2018 · 1 comment
Labels

Comments

@robertDurst
Copy link
Contributor

robertDurst commented Aug 24, 2018

As I was building the test schemas for #586 , running bash build_test_scenarios.bash (link) fails due to invalid transactions. I did not dig super deep yet, however my hunch is that it is related to the new v10 orderbook changes.

Failing recipes:

  • order_book.rb
  • order_book_301.rb
  • path.rb

To Reproduce

1. clone master
2. cd go
3. bash services/horizon/internal/scripts/build_test_scenarios.bash

Fails and then in the order_book-core.sql file I see:

running recipe

Error! (RuntimeError): transaction failed: +ThBuGS8TOPdzC4qtDeL/UQ+zW7uhbldY02lwAsM1mcAAAAAAAAAZP////8AAAABAAAAAAAAAAP////5AAAAAA==

/Users/robdurst/.rvm/gems/ruby-2.5.1/bundler/gems/stellar_core_commander-b54494191507/lib/stellar_core_commander/transactor.rb:450:in `validate_transaction'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bundler/gems/stellar_core_commander-b54494191507/lib/stellar_core_commander/transactor.rb:196:in `block (2 levels) in close_ledger'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bundler/gems/stellar_core_commander-b54494191507/lib/stellar_core_commander/transactor.rb:193:in `each'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bundler/gems/stellar_core_commander-b54494191507/lib/stellar_core_commander/transactor.rb:193:in `block in close_ledger'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bundler/gems/stellar_core_commander-b54494191507/lib/stellar_core_commander/transactor.rb:190:in `loop'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bundler/gems/stellar_core_commander-b54494191507/lib/stellar_core_commander/transactor.rb:190:in `close_ledger'
/Users/robdurst/go-workspace/src/github.com/stellar/go/services/horizon/internal/test/scenarios/order_books.rb:35:in `run_recipe'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bundler/gems/stellar_core_commander-b54494191507/lib/stellar_core_commander/transactor.rb:53:in `instance_eval'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bundler/gems/stellar_core_commander-b54494191507/lib/stellar_core_commander/transactor.rb:53:in `run_recipe'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bundler/gems/stellar_core_commander-b54494191507/bin/scc:89:in `run'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bundler/gems/stellar_core_commander-b54494191507/bin/scc:152:in `<top (required)>'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bin/scc:23:in `load'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bin/scc:23:in `<main>'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
/Users/robdurst/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
@bartekn
Copy link
Contributor

bartekn commented Aug 27, 2018

You are right, this is happening because of offer liabilities changes in V10: basically accounts trying to sell more assets than they have.

diff --git a/services/horizon/internal/test/scenarios/order_books.rb b/services/horizon/internal/test/scenarios/order_books.rb
index 04168c6..e24127d 100644
--- a/services/horizon/internal/test/scenarios/order_books.rb
+++ b/services/horizon/internal/test/scenarios/order_books.rb
@@ -3,8 +3,8 @@ run_recipe File.dirname(__FILE__) + "/_common_accounts.rb"
 use_manual_close
 
 create_account :usd_gateway
-create_account :scott, :master, "6000.0"
-create_account :andrew, :master, "6000.0"
+create_account :scott, :master, "10000.0"
+create_account :andrew, :master, "10000.0"
 
 close_ledger
 
@@ -19,14 +19,14 @@ close_ledger
 payment :usd_gateway, :scott,   ["USD", :usd_gateway, "5000.0"]
 payment :usd_gateway, :andrew,  ["USD", :usd_gateway, "5000.0"]
 
-payment :usd_gateway, :scott,   ["BTC", :usd_gateway, "5000.0"]
-payment :usd_gateway, :andrew,  ["BTC", :usd_gateway, "5000.0"]
+payment :usd_gateway, :scott,   ["BTC", :usd_gateway, "6000.0"]
+payment :usd_gateway, :andrew,  ["BTC", :usd_gateway, "6000.0"]
 
 close_ledger
 
-offer :scott, {buy:["USD", :usd_gateway], with: :native}, "10", "10.0"
-offer :scott, {buy:["USD", :usd_gateway], with: :native}, "100", "9.0"
-offer :scott, {buy:["USD", :usd_gateway], with: :native}, "1000", "5.0"
+offer :scott, {buy:["USD", :usd_gateway], with: :native}, "10", "10.0" # price = 1/10; amount = 10*10 = 100
+offer :scott, {buy:["USD", :usd_gateway], with: :native}, "100", "9.0" # price = 1/9; amount = 100*9 = 900
+offer :scott, {buy:["USD", :usd_gateway], with: :native}, "1000", "5.0" # price = 1/5; amount = 1000*5 = 5000
 
 offer :andrew, {sell:["USD", :usd_gateway], for: :native}, "10", "15.0"
 offer :andrew, {sell:["USD", :usd_gateway], for: :native}, "100", "20.0"
@@ -34,9 +34,9 @@ offer :andrew, {sell:["USD", :usd_gateway], for: :native}, "1000", "50.0"
 
 close_ledger
 
-offer :scott, {buy:["USD", :usd_gateway], with: ["BTC", :usd_gateway]}, 10, "10.0"
-offer :scott, {buy:["USD", :usd_gateway], with: ["BTC", :usd_gateway]}, 100, "9.0"
-offer :scott, {buy:["USD", :usd_gateway], with: ["BTC", :usd_gateway]}, 1000, "5.0"
+offer :scott, {buy:["USD", :usd_gateway], with: ["BTC", :usd_gateway]}, 10, "10.0" # price = 1/10; amount = 10*10 = 100
+offer :scott, {buy:["USD", :usd_gateway], with: ["BTC", :usd_gateway]}, 100, "9.0" # price = 1/9; amount = 100*9 = 900
+offer :scott, {buy:["USD", :usd_gateway], with: ["BTC", :usd_gateway]}, 1000, "5.0" # price = 1/5; amount = 1000*5 = 5000
 
 offer :andrew, {sell:["USD", :usd_gateway], for: ["BTC", :usd_gateway]}, 10, "15.0"
 offer :andrew, {sell:["USD", :usd_gateway], for: ["BTC", :usd_gateway]}, 100, "20.0"
diff --git a/services/horizon/internal/test/scenarios/order_books_310.rb b/services/horizon/internal/test/scenarios/order_books_310.rb
index 6973772..73a46f0 100644
--- a/services/horizon/internal/test/scenarios/order_books_310.rb
+++ b/services/horizon/internal/test/scenarios/order_books_310.rb
@@ -5,7 +5,7 @@ run_recipe File.dirname(__FILE__) + "/_common_accounts.rb"
 use_manual_close
 
 create_account :usd_gateway
-create_account :scott, :master, "6000.0"
+create_account :scott, :master, "1000000.0"
 create_account :andrew, :master, "6000.0"
 
 close_ledger
diff --git a/services/horizon/internal/test/scenarios/paths.rb b/services/horizon/internal/test/scenarios/paths.rb
index 86ad1ed..154c7c8 100644
--- a/services/horizon/internal/test/scenarios/paths.rb
+++ b/services/horizon/internal/test/scenarios/paths.rb
@@ -9,7 +9,7 @@ account :trader, Stellar::KeyPair.from_seed("SAAHOOTVIZJVXOEPCTNKYTYOTKZA3MFXJ3A
 
 use_manual_close
 
-create_account :gateway
+create_account :gateway, :master, 10000
 create_account :payer
 create_account :payee
 create_account :trader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants