diff --git a/ethstorage/miner/l1_mining_api.go b/ethstorage/miner/l1_mining_api.go index 48410f2b..d91f55f7 100644 --- a/ethstorage/miner/l1_mining_api.go +++ b/ethstorage/miner/l1_mining_api.go @@ -147,14 +147,14 @@ func (m *l1MiningAPI) SubmitMinedResult(ctx context.Context, contract common.Add return common.Hash{}, errDropped{reason: errMessage} } - estimatedGas, err := m.EstimateGas(ctx, ethereum.CallMsg{ + estimatedGas, err := m.EstimateGasAtBlock(ctx, ethereum.CallMsg{ From: cfg.SignerAddr, To: &contract, GasTipCap: tip, GasFeeCap: gasFeeCap, Value: common.Big0, Data: calldata, - }) + }, big.NewInt(rpc.PendingBlockNumber.Int64())) if err != nil { errMessage := parseErr(err) m.lg.Error("Estimate gas failed", "error", errMessage) diff --git a/ethstorage/miner/worker.go b/ethstorage/miner/worker.go index f3ae5fc0..caf7d0d8 100644 --- a/ethstorage/miner/worker.go +++ b/ethstorage/miner/worker.go @@ -426,13 +426,6 @@ func (w *worker) resultLoop() { continue } w.lg.Info("Mining result loop get result", "shard", result.startShardId, "block", result.blockNumber, "nonce", result.nonce) - - // Mining result comes within the same block time window - if tillNextSlot := int64(result.timestamp) + int64(w.config.Slot) - time.Now().Unix(); tillNextSlot > 0 { - // Wait until next block comes to avoid empty blockhash on gas estimation - w.lg.Info("Hold on submitting mining result till block+1", "block", result.blockNumber, "secondsToWait", tillNextSlot) - time.Sleep(time.Duration(tillNextSlot) * time.Second) - } txHash, err := w.l1API.SubmitMinedResult( context.Background(), w.storageMgr.ContractAddress(),