Commit Graph

168 Commits

Author SHA1 Message Date
Hector Sanjuan
a2475bca94 range-export: write files to lotus repo path 2023-02-14 21:08:10 +01:00
Hector Sanjuan
be1614a042 range-export: check serverside that head > tail 2023-02-14 21:08:10 +01:00
Hector Sanjuan
ec01036871 Ranged export: remove non-internal ranged export method
Additionally, per feedback:

* Set "admin" permissions
* Remove from v0api
2023-02-14 21:08:10 +01:00
Hector Sanjuan
1bb698619c Ranged-export: Remove CachingBlockstore
The improvements in the range-export code lead to avoid reading most blocks
twice, as well as to allowing some blocks to be written to disk multiple times.

The cache hit-rate went down from being close to 50% to a maximum of 12% at
the very end of the export. The reason is that most CIDs are never read twice
since they are correctly tracked in the CID set.

These numbers do not support the maintenance of the CachingBlockstore
code. Additional testing shows that removing it has similar memory-usage
behaviour and about 5 minute-faster execution (around 10%).

Less code to maintain and less options to mess up with.
2023-02-14 21:08:10 +01:00
Hector Sanjuan
fa93c23813 Chain ranged export: rework and address current shortcomings
This commit moderately refactors the ranged export code. It addresses several
problems:
  * Code does not finish cleanly and things hang on ctrl-c
  * Same block is read multiple times in a row (artificially increasing cached
    blockstore metrics to 50%)
  * It is unclear whether there are additional races (a single worker quits
    when reaching height 0)
  * CARs produced have duplicated blocks (~400k for an 80M-blocks CAR or
    so). Some blocks appear up to 5 times.
  * Using pointers for tasks where it is not necessary.

The changes:

  * Use a FIFO instead of stack: simpler implementation as its own type. This
has not proven to be much more memory-friendly, but it has not made things
worse either.
  * We avoid a probably not small amount of allocations by not using
    unnecessary pointers.
  * Fix duplicated blocks by atomically checking+adding to CID set.
  * Context-termination now works correctly. Worker lifetime is correctly tracked and all channels
  are closed, avoiding any memory leaks and deadlocks.
  * We ensure all work is finished before finishing, something that might have
  been broken in some edge cases previously. In practice, we would not have
  seen this except perhaps in very early snapshots close to genesis.

Initial testing shows the code is currently about 5% faster. Resulting
snapshots do not have duplicates so they are a bit smaller. We have manually
verified that no CID is lost versus previous results, with both old and recent
snapshots.
2023-02-14 21:08:10 +01:00
frrist
21efd481d8 First efficient ranged-export implementation by @frisst
This first commit contains the first and second implementation stabs (after
primary review by @hsanjuan), using a stack for task buffering.

Known issues: ctrl-c (context cancellation) results in the export code getting
deadlocked. Duplicate blocks in exports. Duplicate block reads from store.

Original commit messages:

works

works against mainnet and calibnet

feat: add internal export api method

- will hopfully make things faster by not streaming the export over the json rpc api

polish: better file nameing

fix: potential race in marking cids as seen

chore: improve logging

feat: front export with cache

fix: give hector a good channel buffer on this shit

docsgen
2023-02-14 15:41:10 +01:00
Phi
34f376eb23 chore: cli
Standarize cli/code functions similar to: https://github.com/filecoin-project/lotus/pull/9317

- cctx.NArg() instead of cctx.Args().xxx
- Add check for args and print help on functions that did not have it
2023-01-25 13:13:56 +01:00
Aayush
e715384173 Merge branch 'release/v1.20.0' into asr/merge-release-into-master 2023-01-16 10:51:22 -05:00
raulk
cdf3812e40
NV18: Filecoin EVM runtime + Actor Events + EthAccount + EAM + f4 addressing (#9998)
Co-authored-by: Steven Allen <steven@stebalien.com>
Co-authored-by: Raul Kripalani <raulk@users.noreply.github.com>
Co-authored-by: Kevin Li <ychiaoli18@users.noreply.github.com>
Co-authored-by: vyzo <vyzo@hackzen.org>
Co-authored-by: Ian Davis <nospam@iandavis.com>
Co-authored-by: Aayush Rajasekaran <arajasek94@gmail.com>
Co-authored-by: Jiaying Wang <42981373+jennijuju@users.noreply.github.com>
Co-authored-by: Jennifer Wang <jiayingw703@gmail.com>
Co-authored-by: Geoff Stuart <geoff.vball@gmail.com>
Co-authored-by: Shrenuj Bansal <shrenuj.bansal@protocol.ai>
Co-authored-by: Shrenuj Bansal <108157875+shrenujbansal@users.noreply.github.com>
Co-authored-by: Geoff Stuart <geoffrey.stuart@protocol.ai>
Co-authored-by: Aayush Rajasekaran <aayushrajasekaran@Aayushs-MacBook-Pro.local>
Co-authored-by: ZenGround0 <5515260+ZenGround0@users.noreply.github.com>
Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com>
2023-01-13 19:11:13 +00:00
Łukasz Magiera
9a46682d9d
Merge pull request #9481 from consensus-shipyard/adlrocha/cns-iface-master
IPC: Abstract common consensus functions and consensus interface
2023-01-11 14:49:27 +01:00
zenground0
e1a4cf02f4 Remove unused flag for clarity 2022-12-05 16:06:03 -07:00
Alfonso de la Rocha
0f92bced9d
Merge branch 'master' into adlrocha/cns-iface-master 2022-11-22 10:28:18 +01:00
Aayush
c0b7343e60 Merge branch 'release/v1.18.0' into asr/merge-release-into-master 2022-11-06 14:40:13 -05:00
Aayush
13b59c9c23 Invoker: Use MethodMeta from go-state-types 2022-10-19 15:53:26 -04:00
Alfonso de la Rocha
627d6e70a6 parametrized reward function for consensus 2022-10-13 16:30:14 +02:00
sectrgt
857c091576
Update chain.go 2022-09-25 21:01:08 -04:00
Geoff Stuart
4f75e2041c Add helper function to print usage when wrong number of arguments are supplied 2022-09-14 15:38:15 -04:00
Geoff Stuart
308cef950b cctx.Args().Len() to cctx.NArg() 2022-09-14 14:33:29 -04:00
Aayush
0efca4d266 introduce v9 actors and nv17 2022-09-09 21:40:15 -04:00
ZenGround0
0c91b0dc10
feat:chain:splitstore chain prune (#9056)
* Splitstore chain prune
* Protect on reification for simpler logic and sound cold compact protect
* Recovery from checkpoint during chain prune
* Splitstore (discard and universal mode) running in itests
* Add pause and restart functions to itest block miner
* Add config options to itest full nodes
* Add FsRepo support for itest full ndoes

Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com>
2022-08-05 16:34:16 -04:00
Łukasz Magiera
05cdeb80c3 chore: remove redundant import prefixes 2022-06-15 12:06:22 +02:00
Łukasz Magiera
e65fae28de chore: fix imports 2022-06-14 17:00:51 +02:00
Geoff Stuart
514c756570 Alias cli commands 2022-05-03 15:46:46 -04:00
Nikola Divic
e5ac8662c8 test: chain gas-price cli command
Contains some funny mocking logic, because estimate gas price is called
multiple times (for various nblocks) and I wanted to make it as flexible
as possible.
2022-02-10 21:55:09 +01:00
Nikola Divic
c0f89e5b2d test: chain export cli command
Modified ChainExportCmd to use io.WriterCloser instead of os.File so
it the file can be mocked in unit tests, without side effects to the FS.
2022-02-10 18:18:31 +01:00
Nikola Divic
b536dfa552 test: chain bisect cli command 2022-02-10 15:46:06 +01:00
Nikola Divic
6bc2ee2735 test: chain get cli command
Cover the essential function execution paths, no time for every -as-type
combination.
2022-02-10 14:49:38 +01:00
Nikola Divic
b3f7db7a15 test: chain list (love) cli command
Some "funky" string matching in this one, but I think that's ok.

Chain is love. ❤️
2022-02-10 00:36:38 +01:00
Nikola Divic
4e37131602 test: chain inspect-usage cli command 2022-02-09 23:47:40 +01:00
Nikola Divic
e797ec138d test: chain getmessage cli command
I also added some helper functions for mocking in the types/mock pkg
2022-02-09 17:29:29 +01:00
Nikola Divic
a923d7c884 test: chain stat-obj cli command
Test expected output with respect to the --base flag
2022-02-09 16:22:52 +01:00
Nikola Divic
c0f47e5eed test: chain delete-obj cli command
Contains two subtests, that check if the --really-do-it flag (force)
is respected, since removing wrong objects may lead to sync issues.
2022-02-09 15:56:13 +01:00
Nikola Divic
1cd590ace9 test: chain read-obj
Simple test that checks if this CLI method prints the IPLD node referenced
by the given CID encoded in hexadecimal.
2022-02-09 15:29:10 +01:00
Nikola Divic
78649d45b9 test: cli chain getblock command
Unit test for the cli `chain getblock` command.
Tests if output is JSON  in the expected format.
2022-02-08 18:24:45 +01:00
Nikola Divic
811bc62d65 test: cli test setup & test chain head
CLI actions lack unit tests. I decided to use the approach similar to
what I found in `send_test.go` using gomock, but I don't rely on custom
"service" implementations but mock the whole FullNode API.
This first commit validates the test setup by testing the simplest method
of the chain category, e.g. `chain head`.

This requires a minor refactor of the CLI action code:
- The constructor (`GetFullNodeAPI`) checks if there's an injected mock
API in the app Metadata and uses that in unit tests.
- Actions shouldn't use raw `fmt.*` but instead write to the `app.Writer`
so the CLI output is testable
2022-02-08 17:15:45 +01:00
Łukasz Magiera
727bb84592 stmgr: drop MethdosMap 2021-09-02 18:58:34 +02:00
Łukasz Magiera
1ac87279d7 Add --to-code to chain encode params 2021-08-20 18:13:05 +02:00
Aayush Rajasekaran
069fd0a244 Add helptext to lotus chain export 2021-07-03 12:41:43 -04:00
Rjan
932f3ce1d1
Update chain list with correct help instructions
Fixes #6293, changes the help text from (Default: 0) to (Default: current head)
2021-06-14 13:13:25 +02:00
Jakub Sztandera
5f638b4193
Print more details on test fail
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2021-05-07 15:30:05 +02:00
Jakub Sztandera
3d8f641310
Plug in InteractiveSend to all adopted commands
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2021-05-07 15:30:05 +02:00
Steven Allen
2857f6c0ed fix: use a consistent tipset in commands
It's very easy to write an incorrect command that operates over
different heads by using the "empty" tipset. This change makes the
`LoadTipSet` command helper get the latest head from the lotus daemon if
its unset.

The cost is an extra call to get the head. That should be trivial in
most cases.
2021-04-29 08:50:08 -07:00
Łukasz Magiera
1b32d7f52f cli: fix build with v1 api changes 2021-04-03 12:55:29 +02:00
frrist
8f6ea05d48 chore: export chain commands 2021-03-23 16:19:33 -07:00
Jakub Sztandera
10e1b26580
chain list --gas-stats display capacity
Add tipset capacity display to `chain list`

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2021-02-26 14:05:51 +01:00
Aayush Rajasekaran
29d3d746a3 Build a WindowPoSt disputer 2021-01-25 17:26:09 -05:00
Aayush Rajasekaran
23ce0645ed
Merge pull request #5342 from filecoin-project/asr/change-owner
Allow multisigs to be set as miner owner address
2021-01-20 21:30:37 -05:00
zgfzgf
29bdd94b12 add slash-consensus from flag 2021-01-19 14:18:46 +08:00
Aayush Rajasekaran
b33bf16f70 Add a command to encode JSON params 2021-01-13 02:40:06 -05:00
Łukasz Magiera
6328f9c879
Merge pull request #4577 from zgfzgf/fix-chain-consensusfault
delete slash-consensus miner
2021-01-11 15:53:42 +01:00