Merge remote-tracking branch 'origin/next' into feat/dyn-base-fee

This commit is contained in:
Łukasz Magiera
2020-08-07 04:15:42 +02:00
7 changed files with 121 additions and 49 deletions
+8
View File
@@ -107,6 +107,14 @@ type FullNode interface {
// ChainExport returns a stream of bytes with CAR dump of chain data.
ChainExport(context.Context, types.TipSetKey) (<-chan []byte, error)
// MethodGroup: Beacon
// The Beacon method group contains methods for interacting with the random beacon (DRAND)
// BeaconGetEntry returns the beacon entry for the given filecoin epoch. If
// the entry has not yet been produced, the call will block until the entry
// becomes available
BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error)
// GasEstimateFeeCap estimates gas fee cap
GasEstimateFeeCap(context.Context, int64, types.TipSetKey) (types.BigInt, error)
+6
View File
@@ -85,6 +85,8 @@ type FullNodeStruct struct {
ChainGetPath func(context.Context, types.TipSetKey, types.TipSetKey) ([]*api.HeadChange, error) `perm:"read"`
ChainExport func(context.Context, types.TipSetKey) (<-chan []byte, error) `perm:"read"`
BeaconGetEntry func(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error) `perm:"read"`
GasEsitmateGasPremium func(context.Context, uint64, address.Address, int64, types.TipSetKey) (types.BigInt, error) `perm:"read"`
GasEstimateGasLimit func(context.Context, *types.Message, types.TipSetKey) (int64, error) `perm:"read"`
GasEstimateFeeCap func(context.Context, int64, types.TipSetKey) (types.BigInt, error) `perm:"read"`
@@ -599,6 +601,10 @@ func (c *FullNodeStruct) ChainExport(ctx context.Context, tsk types.TipSetKey) (
return c.Internal.ChainExport(ctx, tsk)
}
func (c *FullNodeStruct) BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error) {
return c.Internal.BeaconGetEntry(ctx, epoch)
}
func (c *FullNodeStruct) SyncState(ctx context.Context) (*api.SyncState, error) {
return c.Internal.SyncState(ctx)
}
+27 -30
View File
@@ -132,21 +132,23 @@ func TestDealMining(t *testing.T, b APIBuilder, blocktime time.Duration, carExpo
done := make(chan struct{})
minedTwo := make(chan struct{})
m2addr, err := sn[1].ActorAddress(context.TODO())
if err != nil {
t.Fatal(err)
}
go func() {
doneMinedTwo := false
defer close(done)
prevExpect := 0
complChan := minedTwo
for atomic.LoadInt32(&mine) != 0 {
wait := make(chan int, 2)
wait := make(chan int)
mdone := func(mined bool, err error) {
go func() {
n := 0
if mined {
n = 1
}
wait <- n
}()
n := 0
if mined {
n = 1
}
wait <- n
}
if err := sn[0].MineOne(ctx, miner.MineReq{Done: mdone}); err != nil {
@@ -166,33 +168,28 @@ func TestDealMining(t *testing.T, b APIBuilder, blocktime time.Duration, carExpo
continue
}
for {
n := 0
for i, node := range sn {
mb, err := node.MiningBase(ctx)
if err != nil {
t.Error(err)
return
}
var nodeOneMined bool
for _, node := range sn {
mb, err := node.MiningBase(ctx)
if err != nil {
t.Error(err)
return
}
if len(mb.Cids()) != expect {
log.Warnf("node %d mining base not complete (%d, want %d)", i, len(mb.Cids()), expect)
continue
for _, b := range mb.Blocks() {
if b.Miner == m2addr {
nodeOneMined = true
break
}
n++
}
if n == len(sn) {
break
}
time.Sleep(blocktime)
}
if prevExpect == 2 && expect == 2 && !doneMinedTwo {
close(minedTwo)
doneMinedTwo = true
if nodeOneMined && complChan != nil {
close(complChan)
complChan = nil
}
prevExpect = expect
}
}()