Quiet down pending messages, fix GasLimit estimation, reduce fee cap
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
b41a0ea197
commit
46fd9d5e80
@ -254,12 +254,14 @@ tailLoop:
|
|||||||
|
|
||||||
func (mp *MessagePool) getPendingMessages(curTs, ts *types.TipSet) (map[address.Address]map[uint64]*types.SignedMessage, error) {
|
func (mp *MessagePool) getPendingMessages(curTs, ts *types.TipSet) (map[address.Address]map[uint64]*types.SignedMessage, error) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
defer func() {
|
|
||||||
log.Infow("get pending messages done", "took", time.Since(start))
|
|
||||||
}()
|
|
||||||
|
|
||||||
result := make(map[address.Address]map[uint64]*types.SignedMessage)
|
result := make(map[address.Address]map[uint64]*types.SignedMessage)
|
||||||
haveCids := make(map[cid.Cid]struct{})
|
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?
|
// are we in sync?
|
||||||
inSync := false
|
inSync := false
|
||||||
|
@ -108,7 +108,7 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri
|
|||||||
ts = sm.cs.GetHeaviestTipSet()
|
ts = sm.cs.GetHeaviestTipSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
state := ts.ParentState()
|
state, _, err := sm.TipSetState(ctx, ts)
|
||||||
|
|
||||||
r := store.NewChainRand(sm.cs, ts.Cids(), ts.Height())
|
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{
|
vmopt := &vm.VMOpts{
|
||||||
StateBase: state,
|
StateBase: state,
|
||||||
Epoch: ts.Height(),
|
Epoch: ts.Height() + 1,
|
||||||
Rand: r,
|
Rand: r,
|
||||||
Bstore: sm.cs.Blockstore(),
|
Bstore: sm.cs.Blockstore(),
|
||||||
Syscalls: sm.cs.VMSys(),
|
Syscalls: sm.cs.VMSys(),
|
||||||
|
@ -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) {
|
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()
|
a.PushLocks.Lock()
|
||||||
if a.PushLocks.m == nil {
|
if a.PushLocks.m == nil {
|
||||||
a.PushLocks.m = make(map[address.Address]chan struct{})
|
a.PushLocks.m = make(map[address.Address]chan struct{})
|
||||||
}
|
}
|
||||||
lk, ok := a.PushLocks.m[msg.From]
|
lk, ok := a.PushLocks.m[fromA]
|
||||||
if !ok {
|
if !ok {
|
||||||
lk = make(chan struct{}, 1)
|
lk = make(chan struct{}, 1)
|
||||||
a.PushLocks.m[msg.From] = lk
|
a.PushLocks.m[msg.From] = lk
|
||||||
}
|
}
|
||||||
a.PushLocks.Unlock()
|
a.PushLocks.Unlock()
|
||||||
|
|
||||||
lk <- struct{}{}
|
select {
|
||||||
|
case lk <- struct{}{}:
|
||||||
|
case <-ctx.Done():
|
||||||
|
return nil, ctx.Err()
|
||||||
|
}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
<-lk
|
<-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 {
|
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 {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("estimating fee cap: %w", err)
|
return nil, xerrors.Errorf("estimating fee cap: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user