Quiet down pending messages, fix GasLimit estimation, reduce fee cap

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-08-08 22:51:24 +02:00
parent b41a0ea197
commit 46fd9d5e80
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA
3 changed files with 20 additions and 8 deletions

View File

@ -254,12 +254,14 @@ tailLoop:
func (mp *MessagePool) getPendingMessages(curTs, ts *types.TipSet) (map[address.Address]map[uint64]*types.SignedMessage, error) {
start := time.Now()
defer func() {
log.Infow("get pending messages done", "took", time.Since(start))
}()
result := make(map[address.Address]map[uint64]*types.SignedMessage)
haveCids := make(map[cid.Cid]struct{})
defer func() {
if time.Since(start) > time.Millisecond {
log.Infow("get pending messages done", "took", time.Since(start))
}
}()
// are we in sync?
inSync := false

View File

@ -108,7 +108,7 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri
ts = sm.cs.GetHeaviestTipSet()
}
state := ts.ParentState()
state, _, err := sm.TipSetState(ctx, ts)
r := store.NewChainRand(sm.cs, ts.Cids(), ts.Height())
@ -122,7 +122,7 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri
vmopt := &vm.VMOpts{
StateBase: state,
Epoch: ts.Height(),
Epoch: ts.Height() + 1,
Rand: r,
Bstore: sm.cs.Blockstore(),
Syscalls: sm.cs.VMSys(),

View File

@ -113,18 +113,28 @@ func (a *MpoolAPI) MpoolPush(ctx context.Context, smsg *types.SignedMessage) (ci
func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message) (*types.SignedMessage, error) {
{
fromA, err := a.Stmgr.ResolveToKeyAddress(ctx, msg.From, nil)
if err != nil {
return nil, xerrors.Errorf("getting key address: %w", err)
}
a.PushLocks.Lock()
if a.PushLocks.m == nil {
a.PushLocks.m = make(map[address.Address]chan struct{})
}
lk, ok := a.PushLocks.m[msg.From]
lk, ok := a.PushLocks.m[fromA]
if !ok {
lk = make(chan struct{}, 1)
a.PushLocks.m[msg.From] = lk
}
a.PushLocks.Unlock()
lk <- struct{}{}
select {
case lk <- struct{}{}:
case <-ctx.Done():
return nil, ctx.Err()
}
defer func() {
<-lk
}()
@ -150,7 +160,7 @@ func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message) (*t
}
if msg.GasFeeCap == types.EmptyInt || types.BigCmp(msg.GasFeeCap, types.NewInt(0)) == 0 {
feeCap, err := a.GasEstimateFeeCap(ctx, msg, 20, types.EmptyTSK)
feeCap, err := a.GasEstimateFeeCap(ctx, msg, 10, types.EmptyTSK)
if err != nil {
return nil, xerrors.Errorf("estimating fee cap: %w", err)
}