iotaledger / entangled

enTangle'd is an amalgamation of all things Tangle
Apache License 2.0
113 stars 66 forks source link

can't execute cIRI with Local Snapshot #1436

Closed bernardoaraujor closed 4 years ago

bernardoaraujor commented 4 years ago

Describe the bug I'm trying to run cIRI with a Local Snapshot.

To Reproduce Steps to reproduce the behavior:

  1. Checkout entangled to 274caaaa34310a7b7beaf141f44301a35b6392c1

    bernardoaraujo@laptop0092:~/dev/entangled$ git checkout 274caaaa34310a7b7beaf141f44301a35b6392c1
    HEAD is now at 274caaa... common: remove deprecated flex_trit_t arrays (#1434)
  2. Build cIRI

    bernardoaraujo@laptop0092:~/dev/entangled$ bazel build ciri
  3. Download Local Snapshot from https://db.iota.partners/iri-mainnet-snapshot.tar.gz and create local-snapshots-base-dir with the contents:

    bernardoaraujo@laptop0092:~/dev$ mkdir local_snapshots/; cd local_snapshots/
    bernardoaraujo@laptop0092:~/dev/local_snapshots$ wget https://db.iota.partners/iri-mainnet-snapshot.tar.gz
    bernardoaraujo@laptop0092:~/dev/local_snapshots$ tar xvf iri-mainnet-snapshot.tar.gz
  4. Create configuration file:

    bernardoaraujo@laptop0092:~/dev/entangled$ cat ciri/conf.yml 
    log-level: info
    neighbors: "tcp://185.244.195.45:14265 tcp://5.189.141.225:14265"
    http-port: 14265
  5. Init database:

    $ sqlite3 ciri/db/tangle-testnet.db < common/storage/sql/sqlite3/tangle-schema.sql
    $ sqlite3 ciri/db/spent-addresses-testnet.db < common/storage/sql/sqlite3/spent-addresses-schema.sql
  6. Check local snapshots directory:

    bernardoaraujo@laptop0092:~/dev/entangled$ ls ~/dev/local_snapshots
    iri-mainnet-snapshot.tar.gz  mainnet.snapshot.meta  mainnet.snapshot.state  spent-addresses-db
  7. Run cIRI

    bernardoaraujo@laptop0092:~/dev/entangled$ ./bazel-bin/ciri/ciri ciri --config ciri/conf.yml --local-snapshots-enabled true --local-snapshots-base-dir=~/dev/local_snapshots --snapshot-signature-skip-validation true
    2019-09-23 18:04:15:           ciri:   INFO: Welcome to cIRI-mainnet v0.1.0-alpha
    2019-09-23 18:04:15:           ciri:   INFO: Initializing storage
    2019-09-23 18:04:15:           ciri:   INFO: Initializing cIRI
    2019-09-23 18:04:15:           ciri:   INFO: Initializing cIRI core
    2019-09-23 18:04:15:           core:   INFO: Initializing consensus
    2019-09-23 18:04:15:      consensus:   INFO: Initializing bundle validator
    2019-09-23 18:04:15:      consensus:   INFO: Initializing cumulative weight rating calculator
    2019-09-23 18:04:15:      consensus:   INFO: Initializing entry point selector
    2019-09-23 18:04:15:      consensus:   INFO: Initializing exit probability randomizer
    2019-09-23 18:04:15:      consensus:   INFO: Initializing snapshots provider
    2019-09-23 18:04:15:       snapshot:   CRIT: Initializing snapshot metadata failed
    2019-09-23 18:04:15:       snapshot:   CRIT: Initializing snapshot initial state failed
    2019-09-23 18:04:15:      consensus:   CRIT: Initializing snapshots provider failed
    2019-09-23 18:04:15:           core:   CRIT: Initializing consensus failed
    2019-09-23 18:04:15:           ciri:   CRIT: Initializing cIRI core failed
    2019-09-23 18:04:15:           ciri:   CRIT: Initializing cIRI failed

Expected behavior I need cIRI to synchronize the latest milestones correctly.

Desktop (please complete the following information):

bernardoaraujo@laptop0092:~/dev/local_snapshots$ uname -a
Linux laptop0092 4.15.0-54-generic #58~16.04.1-Ubuntu SMP Mon Jun 24 13:21:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
oopsmonk commented 4 years ago

do you initial database? see https://github.com/iotaledger/entangled/tree/develop/ciri#mainnet-node

bernardoaraujor commented 4 years ago

I did! I just forgot to document here in the issue, sorry about that. I updated the description with step 5 for init database.

tsvisabo commented 4 years ago

Hi @bernardoaraujor Could you share the output of ls on the local snapshots directory?

bernardoaraujor commented 4 years ago

Step 6.

tsvisabo commented 4 years ago

Right, i will continue looking at it tomorrow, but it seems like you got the correct file names btw, can you try to set local-snapshots-base-dir with an absolute path instead?

bernardoaraujor commented 4 years ago

Absolute path did the trick! Closing issue. Thanks @tsvisabo

tsvisabo commented 4 years ago

@bernardoaraujor your command: /bazel-bin/ciri/ciri ciri --config ciri/conf.yml --local-snapshots-enabled true --local-snapshots-base-dir=~/dev/local_snapshots --snapshot-signature-skip-validation true

--local-snapshots-base-dir=~/dev/local_snapshots is incorrect, you should instead try: --local-snapshots-base-dir ~/dev/local_snapshots

bernardoaraujor commented 4 years ago

This also worked. Many thanks again! :nerd_face:

tsvisabo commented 4 years ago

Also, if you want cIRI to prune transactions with every snapshot taken you should set: --local-snapshots-pruning-enabled true

bernardoaraujor commented 4 years ago

Is there any documentation on what pruning is?

tsvisabo commented 4 years ago

No actually :( But while snapshot is the periodical creation of the new state and metadata files, pruning is the removal of data that is no longer important to get into a consensus because you got these new files which are newer and inclusive to this data