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

Creating a new token crashes the daemon #5724

Closed
MartinMinkov opened this issue Aug 20, 2020 · 5 comments
Closed

Creating a new token crashes the daemon #5724

MartinMinkov opened this issue Aug 20, 2020 · 5 comments
Assignees

Comments

@MartinMinkov
Copy link
Contributor

I am using the rosetta container to build a local network to test the new CLI. I am building off the #5710 branch (it's now been merged.)

To start the network I'm running:
coda/src/app/rosetta/start.sh CURL

The daemon crashes when I issue:
./coda.exe client create-token -sender $CODA_PUBLIC_KEY1

coda_crash_report_2020-08-20_22-45-51.056911.tar.gz

@MartinMinkov MartinMinkov changed the title Creating a new token crashes the daemon CLI Creating a new token crashes the daemon Aug 20, 2020
@aneesharaines
Copy link
Contributor

{"timestamp":"2020-08-20 22:45:51.054030Z","level":"Fatal","source":{"module":"Init__Coda_run","location":"File \"src/app/cli/src/init/coda_run.ml\", line 575, characters 2-26"},"message":"Unhandled top-level exception: $exn\nGenerating crash report","metadata":{"exn":"(monitor.ml.Error\n \"Staged_ledger.scan_statement: Bad base statement\\\n \\n: \\\"Bad base statement expected: ((source\\\\\\\n \\n\\\\n 27569722784048436353627904438709908340870193461131082252408608577886872053683)\\\\\\\n \\n\\\\n (target\\\\\\\n \\n\\\\n 25781499621050309730463194956789933892397986272546751647829485247023890815005)\\\\\\\n \\n\\\\n (supply_increase 0)\\\\\\\n \\n\\\\n (pending_coinbase_stack_state\\\\\\\n \\n\\\\n ((source\\\\\\\n \\n\\\\n ((data\\\\\\\n \\n\\\\n 6515988788168624102790655614706346691575033826573873164161198567220001406870)\\\\\\\n \\n\\\\n (state\\\\\\\n \\n\\\\n ((init\\\\\\\n \\n\\\\n 23212476137095925772766017125005428459409175562040454655286359923282765013538)\\\\\\\n \\n\\\\n (curr\\\\\\\n \\n\\\\n 13493963859629408851501466818175093082658943338251207586353005103371188878168)))))\\\\\\\n \\n\\\\n (target\\\\\\\n \\n\\\\n ((data\\\\\\\n \\n\\\\n 6515988788168624102790655614706346691575033826573873164161198567220001406870)\\\\\\\n \\n\\\\n (state\\\\\\\n \\n\\\\n ((init\\\\\\\n \\n\\\\n 23212476137095925772766017125005428459409175562040454655286359923282765013538)\\\\\\\n \\n\\\\n (curr\\\\\\\n \\n\\\\n 6715320058813210816049930900135216426289161424144608123735723668657270646613)))))))\\\\\\\n \\n\\\\n (fee_excess\\\\\\\n \\n\\\\n ((fee_token_l 1) (fee_excess_l ((magnitude 5000000000) (sgn Pos)))\\\\\\\n \\n\\\\n (fee_token_r 1) (fee_excess_r ((magnitude 0) (sgn Pos)))))\\\\\\\n \\n\\\\n (next_available_token_before 2) (next_available_token_after 3)\\\\\\\n \\n\\\\n (sok_digest ())) got: ((source\\\\\\\n \\n\\\\n 27569722784048436353627904438709908340870193461131082252408608577886872053683)\\\\\\\n \\n\\\\n (target\\\\\\\n \\n\\\\n 4522694228337987505488341519799028921242733986730699387569977167396154153528)\\\\\\\n \\n\\\\n (supply_increase 0)\\\\\\\n \\n\\\\n (pending_coinbase_stack_state\\\\\\\n \\n\\\\n ((source\\\\\\\n \\n\\\\n ((data\\\\\\\n \\n\\\\n 6515988788168624102790655614706346691575033826573873164161198567220001406870)\\\\\\\n \\n\\\\n (state\\\\\\\n \\n\\\\n ((init\\\\\\\n \\n\\\\n 23212476137095925772766017125005428459409175562040454655286359923282765013538)\\\\\\\n \\n\\\\n (curr\\\\\\\n \\n\\\\n 13493963859629408851501466818175093082658943338251207586353005103371188878168)))))\\\\\\\n \\n\\\\n (target\\\\\\\n \\n\\\\n ((data\\\\\\\n \\n\\\\n 6515988788168624102790655614706346691575033826573873164161198567220001406870)\\\\\\\n \\n\\\\n (state\\\\\\\n \\n\\\\n ((init\\\\\\\n \\n\\\\n 23212476137095925772766017125005428459409175562040454655286359923282765013538)\\\\\\\n \\n\\\\n (curr\\\\\\\n \\n\\\\n 6715320058813210816049930900135216426289161424144608123735723668657270646613)))))))\\\\\\\n \\n\\\\n (fee_excess\\\\\\\n \\n\\\\n ((fee_token_l 1) (fee_excess_l ((magnitude 5000000000) (sgn Pos)))\\\\\\\n \\n\\\\n (fee_token_r 1) (fee_excess_r ((magnitude 0) (sgn Pos)))))\\\\\\\n \\n\\\\n (next_available_token_before 2) (next_available_token_after 3)\\\\\\\n \\n\\\\n (sok_digest ()))\\\"\"\n (\"Raised at file \\\"src/lib/block_producer/block_producer.ml\\\", line 160, characters 10-32\"\n \"Called from file \\\"src/deferred1.ml\\\", line 17, characters 40-45\"\n \"Called from file \\\"src/job_queue.ml\\\" (inlined), line 131, characters 2-5\"\n \"Called from file \\\"src/job_queue.ml\\\", line 171, characters 6-47\"\n \"Caught by monitor coda\"))","host":"127.0.0.1","peer_id":"12D3KooWFbkBRNUtbN7uQSUXrMjf6azfZrDJjD7F3Z2q72ZpUUno","pid":19680,"port":8302}}

@mrmr1993
Copy link
Member

mrmr1993 commented Aug 21, 2020

I think this should fix it, although not sure why the stagedsparse ledger implementation wasn't getting checked by the unit tests.. Running a test build now.

diff --git a/src/lib/coda_base/sparse_ledger.ml b/src/lib/coda_base/sparse_ledger.ml
index e5e937d7a..171c901e1 100644
--- a/src/lib/coda_base/sparse_ledger.ml
+++ b/src/lib/coda_base/sparse_ledger.ml
@@ -134,9 +134,14 @@ let get_or_initialize_exn account_id t idx =
   let account = get_exn t idx in
   if Public_key.Compressed.(equal empty account.public_key) then
     let public_key = Account_id.public_key account_id in
+    let delegate =
+      if Token_id.(equal default) (Account_id.token_id account_id) then
+        public_key
+      else Public_key.Compressed.empty
+    in
     ( `Added
     , { account with
-        delegate= public_key
+        delegate
       ; public_key
       ; token_id= Account_id.token_id account_id } )
   else (`Existed, account)

@deepthiskumar
Copy link
Member

I don't think staged ledger tests include any of the token commands

This was referenced Aug 24, 2020
@aneesharaines
Copy link
Contributor

@MartinMinkov can you recheck this by running the tokens challenge when the new release branch is available?

@MartinMinkov
Copy link
Contributor Author

@aneesharaines I checked the tokens challenge yesterday while writing new token docs and I can confirm that the tokens challenge is successful and works as expected!

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

Successfully merging a pull request may close this issue.

5 participants