Commit Graph

76 Commits

Author SHA1 Message Date
Steven Allen
53cc1f18d0 use bitswap sessions when fetching messages, and cancel them
1. Explicitly use a session when fetching messages for a block. Technically,
GetBlocks would use an internal session so we'd only end up with two, but one
per block is even better.
2. Actually cancel sessions after a timeout (threading through the context).

NOTE: We should seriously consider having a single session for all blocks, but
we can do that in a followup as it may have unintended consequences (e.g., leaks).
2020-10-02 10:49:35 -07:00
Aayush Rajasekaran
31ff5230bb Get State API almost working 2020-09-17 05:05:32 -04:00
Steven Allen
cc4d5306eb Progress 2020-09-14 15:43:12 -07:00
Steven Allen
d3594835c4 [WIP] Network upgrade support
This patch starts adding support for network upgrades.

* It adds an actors abstraction layer for loading abstract (cross-version) actors.
* It starts switching over to a shared deadline type.
* It adds an abstraction for ADTs (hamt/amt).
* It removes the callback-based API in the StateManager (difficult to abstract
across actor versions).
* It _does not_ actually add support for actors v2. We can do that in a followup
patch but that should be relatively easy.

This patch is heavily WIP and does not compile. Feel free to push changes
directly to this branch.

Notes:

* State tree access now needs a network version, because the HAMT type will change.
* I haven't figured out a nice way to abstract over changes to the _message_
types. However, many of them will be type aliased to actors v0 in actors v2 so
we can likely continue using the v0 versions (or use the v2 versions
everywhere). I've been renaming imports to `v0*` to make it clear that we're
importing types from a _specific_ actors version.

TODO:

* Consider merging incremental improvements? We'd have to get this compiling
again first but we could merge in the new abstractions, and slowly switch over.
* Finish migrating to the new abstractions.
* Remove all actor state types from the public API. See `miner.State.Info()` for
the planned approach here.
* Fix the tests. This is likely going to be a massive pain.
2020-09-11 20:16:29 -07:00
vyzo
37ec1a978e nicer check using Time objects 2020-09-08 10:47:41 +03:00
vyzo
27fa9969f3 fix isChainNearSync check in block validator 2020-09-08 10:26:27 +03:00
vyzo
d76a3b87c5 ignore messages with large nonce gaps 2020-09-03 15:28:44 +03:00
Łukasz Magiera
84a632787c
Merge pull request #3313 from filecoin-project/feat/mpool-balance-tracking
Message Pool Rudimentary Spam Protection Measures
2020-08-28 22:35:30 +02:00
lanzafame
64768f093d rename local recordFailure func 2020-08-28 17:15:11 +10:00
lanzafame
a24db6c584 refactor block validate recordFailure func 2020-08-28 17:11:59 +10:00
lanzafame
050a0ec5e4 further reduce code duplication 2020-08-28 17:01:45 +10:00
lanzafame
0254e4b365 reduce code duplication 2020-08-28 16:53:59 +10:00
lanzafame
094baf8aa9 distinguish local message validation failures from remote 2020-08-28 16:11:24 +10:00
vyzo
6c3d8ec1de ignore, don't reject block if we can't determine power 2020-08-27 16:53:53 +03:00
vyzo
82ef0529d8 named error for too many pending messages 2020-08-26 22:48:03 +03:00
vyzo
c473d3c682 rename ErrValidationFailure to ErrSoftValidationFailure
to make it clear to readers that this failure is soft; we might be out of sync.
2020-08-26 15:16:04 +03:00
vyzo
78876947a4 ErrBroadcastAnyway is now ErrValidationFailure 2020-08-26 15:03:13 +03:00
Steven Allen
5733c71c50 Lint everything
We were ignoring quite a few error cases, and had one case where we weren't
actually updating state where we wanted to. Unfortunately, if the linter doesn't
pass, nobody has any reason to actually check lint failures in CI.

There are three remaining XXXs marked in the code for lint.
2020-08-20 20:46:36 -07:00
vyzo
c7a6e32c96 ignore, don't reject messages with nonce that is too low
we seem to have a problem with this leading to many rejected messages and negative scores for
potentially innocent peers.
2020-08-19 13:20:16 +03:00
vyzo
ca552cf83b deduplicate some block validation logic 2020-08-17 21:03:08 +03:00
vyzo
ae88a99c84 add some lightweight validation of local messages 2020-08-17 09:04:22 +03:00
vyzo
884d4ad9df fix clown shoes pubsub validation: we always accept our own self-published messages 2020-08-16 20:46:19 +03:00
Jakub Sztandera
3710f33e14
Don't reject messages that don't pass RBF, ignore them
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-08-09 03:17:40 +02:00
Łukasz Magiera
051be61452 gofmt 2020-08-07 15:04:10 +02:00
Lucas Molas
76d40ec408 first pass, ready for review 2020-08-03 12:20:04 -03:00
Lucas Molas
595de3fccb fix: block validator: check against heaviest tipset 2020-07-30 18:05:28 -03:00
Aayush Rajasekaran
b51e2a868b
Merge branch 'next' into feat/cid-builder 2020-07-28 21:02:30 -04:00
Aayush Rajasekaran
859168015a Use specs actor's MinerNominalPowerMeetsConsensusMinimum 2020-07-28 17:21:05 -04:00
Steven Allen
b7a4dbb07f Support inline CIDs
And use the new CidBuilder from the spec actors.

This patch does not switch over to inline CIDs by default, but paves the way.
2020-07-23 23:12:32 -07:00
Steven Allen
5fc83f4d05 Refactor to use actor adt types instead of directly using HAMTs and AMTs
This way there's a single source of truth. Preparation for fixing
https://github.com/filecoin-project/specs-actors/issues/517 (requires changing
HAMT parameters).
2020-07-23 09:34:57 -07:00
Raúl Kripalani
13de81b3b2 introduce the ability to mock time. 2020-07-10 15:51:45 +01:00
Łukasz Magiera
4c422c2d50 specs-actors v0.7.1 2020-07-01 13:47:40 +02:00
Jakub Sztandera
156a14eeeb
Integrate Poisson Sortition into chain sync
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-06-23 16:59:44 +02:00
Jeromy
512270593b clean up some of the more spammy logs 2020-06-11 12:31:29 +02:00
Jakub Sztandera
5605aae269
Fix even more lint warnings
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-06-02 16:29:39 +02:00
vyzo
cc98117df2 log block validation time 2020-05-22 17:21:37 +03:00
vyzo
50e05ae1ba use sigs.CheckBlockSignature 2020-05-14 20:48:40 +03:00
vyzo
432c69c616 update message validator to provide rejection signal 2020-05-14 20:48:40 +03:00
vyzo
e714294273 initialize map 2020-05-14 20:48:19 +03:00
vyzo
c3a144bcb6 flesh out signature validation logic 2020-05-14 20:48:19 +03:00
vyzo
dd86a289ce cache miner worker keys 2020-05-14 20:48:19 +03:00
vyzo
6e0dac06f4 utility to retrieve miner worker key from the chain 2020-05-14 20:48:19 +03:00
vyzo
5bd0e92068 remove source flagging from bogus CID blocks
it's ineffective.
2020-05-14 20:48:19 +03:00
vyzo
eb24baa70c use go-libp2p-core/peer instead of the deprecated alias, try to pacify the silly linter 2020-05-05 17:26:59 +03:00
vyzo
4e5179557d flag block source when messages cannot be retrieved 2020-05-05 16:49:43 +03:00
vyzo
5824714cdc use extended validator interface 2020-05-05 16:35:03 +03:00
Jeromy
417d434973 several fixes and improvements while debugging interop 2020-03-31 18:35:23 -07:00
Aayush Rajasekaran
6fda3c877e Re: #1302: Refine invalid message filtering
- This commit slightly weakens the current invalid message check
- The behaviour is that if you can't add a message to your pool, you *probably* won't broadcast it to your peers
- The exceptions are that you will broadcast a message if you fail to validate it because nonce / balance lookup fails
- This commit also lowers the invalid message log to debug (to lessen the annoyance of several invalid messages coming in, and hopefully to prevent confusion among node operators)
2020-03-18 03:14:18 -04:00
Adrian Lanzafame
d0c748460e remove high cardinality tags from metrics 2020-03-05 19:47:20 +10:00
Nate Walck
8283bb994a Add block metrics to incoming pubsub validate funcs 2020-03-01 19:57:16 -05:00