-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Raft consensus for lotus nodes in a cluster #9294
Changes from 36 commits
8f1b1bb
a1f2fdb
4171be0
3441224
4be8861
81c729e
1fe4aa3
7470549
99e7c32
559c2c6
570f614
f89a682
b8060cd
986c5e3
dde204f
9848182
17a7722
139f877
b77ca54
900525f
674427a
15ed1ee
ad8b959
94bd4d8
09e9562
2fa21ff
2681c2a
8740fb4
b541cf9
800d9de
a66619f
ab1eeeb
f14a25a
b95d1a6
4b11b45
9451221
c0925ff
22f3fbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,7 @@ var ( | |
ErrRBFTooLowPremium = errors.New("replace by fee has too low GasPremium") | ||
ErrTooManyPendingMessages = errors.New("too many pending messages for actor") | ||
ErrNonceGap = errors.New("unfulfilled nonce gap") | ||
ErrExistingNonce = errors.New("message with nonce already exists") | ||
) | ||
|
||
const ( | ||
|
@@ -276,7 +277,7 @@ func (ms *msgSet) add(m *types.SignedMessage, mp *MessagePool, strict, untrusted | |
} | ||
} else { | ||
return false, xerrors.Errorf("message from %s with nonce %d already in mpool: %w", | ||
m.Message.From, m.Message.Nonce, ErrSoftValidationFailure) | ||
m.Message.From, m.Message.Nonce, ErrExistingNonce) | ||
} | ||
|
||
ms.requiredFunds.Sub(ms.requiredFunds, exms.Message.RequiredFunds().Int) | ||
|
@@ -667,7 +668,7 @@ func (mp *MessagePool) verifyMsgBeforeAdd(ctx context.Context, m *types.SignedMe | |
return publish, nil | ||
} | ||
|
||
func (mp *MessagePool) Push(ctx context.Context, m *types.SignedMessage) (cid.Cid, error) { | ||
func (mp *MessagePool) Push(ctx context.Context, m *types.SignedMessage, publish bool) (cid.Cid, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see a similar change for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, could you leave a clear comment on what exactly this bool does? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We shouldn't need it for PushUntrusted since its not used in syncing the message pool. I think this API should really be folded back into Push itself and add a untrusted param to it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I definitely agree :) |
||
done := metrics.Timer(ctx, metrics.MpoolPushDuration) | ||
defer done() | ||
|
||
|
@@ -683,14 +684,14 @@ func (mp *MessagePool) Push(ctx context.Context, m *types.SignedMessage) (cid.Ci | |
}() | ||
|
||
mp.curTsLk.Lock() | ||
publish, err := mp.addTs(ctx, m, mp.curTs, true, false) | ||
ok, err := mp.addTs(ctx, m, mp.curTs, true, false) | ||
if err != nil { | ||
mp.curTsLk.Unlock() | ||
return cid.Undef, err | ||
} | ||
mp.curTsLk.Unlock() | ||
|
||
if publish { | ||
if ok && publish { | ||
msgb, err := m.Serialize() | ||
if err != nil { | ||
return cid.Undef, xerrors.Errorf("error serializing message: %w", err) | ||
|
@@ -1583,3 +1584,8 @@ func getBaseFeeLowerBound(baseFee, factor types.BigInt) types.BigInt { | |
|
||
return baseFeeLowerBound | ||
} | ||
|
||
type MpoolNonceAPI interface { | ||
GetNonce(context.Context, address.Address, types.TipSetKey) (uint64, error) | ||
GetActor(context.Context, address.Address, types.TipSetKey) (*types.Actor, error) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed to land this PR, but if we wanted to be fancy, we could write a generic helper type for maps with typed keys.