Merge branch 'master' into raulk/fix/test-vector-runner
This commit is contained in:
commit
572114b8ba
@ -1,6 +1,7 @@
|
||||
package docgen
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"go/parser"
|
||||
@ -252,6 +253,7 @@ func init() {
|
||||
addExample(map[abi.SectorNumber]string{
|
||||
123: "can't acquire read lock",
|
||||
})
|
||||
addExample(json.RawMessage(`"json raw message"`))
|
||||
addExample(map[api.SectorState]int{
|
||||
api.SectorState(sealing.Proving): 120,
|
||||
})
|
||||
@ -348,7 +350,7 @@ func ExampleValue(method string, t, parent reflect.Type) interface{} {
|
||||
switch t.Kind() {
|
||||
case reflect.Slice:
|
||||
out := reflect.New(t).Elem()
|
||||
reflect.Append(out, reflect.ValueOf(ExampleValue(method, t.Elem(), t)))
|
||||
out = reflect.Append(out, reflect.ValueOf(ExampleValue(method, t.Elem(), t)))
|
||||
return out.Interface()
|
||||
case reflect.Chan:
|
||||
return ExampleValue(method, t.Elem(), nil)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -196,10 +196,10 @@ func ComputeMinRBF(curPrem abi.TokenAmount) abi.TokenAmount {
|
||||
return types.BigAdd(minPrice, types.NewInt(1))
|
||||
}
|
||||
|
||||
func CapGasFee(mff dtypes.DefaultMaxFeeFunc, msg *types.Message, sendSepc *api.MessageSendSpec) {
|
||||
func CapGasFee(mff dtypes.DefaultMaxFeeFunc, msg *types.Message, sendSpec *api.MessageSendSpec) {
|
||||
var maxFee abi.TokenAmount
|
||||
if sendSepc != nil {
|
||||
maxFee = sendSepc.MaxFee
|
||||
if sendSpec != nil {
|
||||
maxFee = sendSpec.MaxFee
|
||||
}
|
||||
if maxFee.Int == nil || maxFee.Equals(big.Zero()) {
|
||||
mf, err := mff()
|
||||
|
@ -65,6 +65,7 @@ func main() {
|
||||
fr32Cmd,
|
||||
chainCmd,
|
||||
balancerCmd,
|
||||
sendCsvCmd,
|
||||
terminationsCmd,
|
||||
}
|
||||
|
||||
|
152
cmd/lotus-shed/send-csv.go
Normal file
152
cmd/lotus-shed/send-csv.go
Normal file
@ -0,0 +1,152 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/urfave/cli/v2"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
)
|
||||
|
||||
var sendCsvCmd = &cli.Command{
|
||||
Name: "send-csv",
|
||||
Usage: "Utility for sending a batch of balance transfers",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "from",
|
||||
Usage: "specify the account to send funds from",
|
||||
Required: true,
|
||||
},
|
||||
},
|
||||
ArgsUsage: "[csvfile]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if cctx.NArg() != 1 {
|
||||
return xerrors.New("must supply path to csv file")
|
||||
}
|
||||
|
||||
api, closer, err := lcli.GetFullNodeAPIV1(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
srv, err := lcli.GetFullNodeServices(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer srv.Close() //nolint:errcheck
|
||||
|
||||
sender, err := address.NewFromString(cctx.String("from"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fileReader, err := os.Open(cctx.Args().First())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read csv: %w", err)
|
||||
}
|
||||
|
||||
defer fileReader.Close() //nolint:errcheck
|
||||
r := csv.NewReader(fileReader)
|
||||
records, err := r.ReadAll()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read csv: %w", err)
|
||||
}
|
||||
|
||||
if strings.TrimSpace(records[0][0]) != "Recipient" ||
|
||||
strings.TrimSpace(records[0][1]) != "FIL" ||
|
||||
strings.TrimSpace(records[0][2]) != "Method" ||
|
||||
strings.TrimSpace(records[0][3]) != "Params" {
|
||||
return xerrors.Errorf("expected header row to be \"Recipient, FIL, Method, Params\"")
|
||||
}
|
||||
|
||||
var msgs []*types.Message
|
||||
for i, e := range records[1:] {
|
||||
addr, err := address.NewFromString(e[0])
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to parse address in row %d: %w", i, err)
|
||||
}
|
||||
|
||||
value, err := types.ParseFIL(strings.TrimSpace(e[1]))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to parse value balance: %w", err)
|
||||
}
|
||||
|
||||
method, err := strconv.Atoi(strings.TrimSpace(e[2]))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to parse method number: %w", err)
|
||||
}
|
||||
|
||||
var params []byte
|
||||
if strings.TrimSpace(e[3]) != "nil" {
|
||||
params, err = hex.DecodeString(strings.TrimSpace(e[3]))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to parse hexparams: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
msgs = append(msgs, &types.Message{
|
||||
To: addr,
|
||||
From: sender,
|
||||
Value: abi.TokenAmount(value),
|
||||
Method: abi.MethodNum(method),
|
||||
Params: params,
|
||||
})
|
||||
}
|
||||
|
||||
if len(msgs) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var msgCids []cid.Cid
|
||||
for i, msg := range msgs {
|
||||
smsg, err := api.MpoolPushMessage(ctx, msg, nil)
|
||||
if err != nil {
|
||||
fmt.Printf("%d, ERROR %s\n", i, err)
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Printf("%d, %s\n", i, smsg.Cid())
|
||||
|
||||
if i > 0 && i%100 == 0 {
|
||||
fmt.Printf("catching up until latest message lands")
|
||||
_, err := api.StateWaitMsg(ctx, smsg.Cid(), 1, lapi.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
msgCids = append(msgCids, smsg.Cid())
|
||||
}
|
||||
|
||||
fmt.Println("waiting on messages...")
|
||||
|
||||
for _, msgCid := range msgCids {
|
||||
ml, err := api.StateWaitMsg(ctx, msgCid, 5, lapi.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if ml.Receipt.ExitCode != exitcode.Ok {
|
||||
fmt.Printf("MSG %s NON-ZERO EXITCODE: %s\n", msgCid, ml.Receipt.ExitCode)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("all sent messages succeeded")
|
||||
return nil
|
||||
},
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -103,7 +103,9 @@ Response:
|
||||
"MemSwap": 42,
|
||||
"MemSwapUsed": 42,
|
||||
"CPUs": 42,
|
||||
"GPUs": null,
|
||||
"GPUs": [
|
||||
"string value"
|
||||
],
|
||||
"Resources": {
|
||||
"seal/v0/addpiece": {
|
||||
"0": {
|
||||
@ -691,7 +693,18 @@ Perms: admin
|
||||
|
||||
Inputs: `null`
|
||||
|
||||
Response: `null`
|
||||
Response:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"ID": "76f1988b-ef30-4d7e-b3ec-9a627f4ba5a8",
|
||||
"Weight": 42,
|
||||
"LocalPath": "string value",
|
||||
"CanSeal": true,
|
||||
"CanStore": true
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Remove
|
||||
Storage / Other
|
||||
@ -749,7 +762,9 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null,
|
||||
[
|
||||
1024
|
||||
],
|
||||
1024,
|
||||
{}
|
||||
]
|
||||
@ -784,7 +799,12 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null
|
||||
[
|
||||
{
|
||||
"Offset": 1024,
|
||||
"Size": 1024
|
||||
}
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
@ -946,7 +966,9 @@ Inputs:
|
||||
{
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
},
|
||||
null
|
||||
[
|
||||
"Ynl0ZSBhcnJheQ=="
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
@ -979,7 +1001,12 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null
|
||||
[
|
||||
{
|
||||
"Offset": 1024,
|
||||
"Size": 1024
|
||||
}
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
@ -1012,7 +1039,14 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null
|
||||
[
|
||||
{
|
||||
"Size": 1032,
|
||||
"PieceCID": {
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
@ -1045,9 +1079,16 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"Bw==",
|
||||
"Bw==",
|
||||
[
|
||||
{
|
||||
"Size": 1032,
|
||||
"PieceCID": {
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
}
|
||||
],
|
||||
{
|
||||
"Unsealed": {
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
@ -1085,7 +1126,7 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null
|
||||
"Bw=="
|
||||
]
|
||||
```
|
||||
|
||||
@ -1115,8 +1156,15 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null,
|
||||
null
|
||||
"Bw==",
|
||||
[
|
||||
{
|
||||
"Size": 1032,
|
||||
"PieceCID": {
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
@ -1146,7 +1194,7 @@ Inputs:
|
||||
},
|
||||
"ProofType": 8
|
||||
},
|
||||
null
|
||||
"Bw=="
|
||||
]
|
||||
```
|
||||
|
||||
@ -1263,7 +1311,7 @@ Inputs:
|
||||
},
|
||||
1040384,
|
||||
1024,
|
||||
null,
|
||||
"Bw==",
|
||||
{
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,6 @@ description: |
|
||||
|
||||
https://github.com/filecoin-project/lotus
|
||||
|
||||
grade: devel
|
||||
confinement: strict
|
||||
|
||||
parts:
|
||||
|
@ -181,9 +181,10 @@ func (s *WindowPoStScheduler) runSubmitPoST(
|
||||
post.ChainCommitRand = commRand
|
||||
|
||||
// Submit PoST
|
||||
sm, submitErr := s.submitPoStMessage(ctx, post)
|
||||
if submitErr != nil {
|
||||
log.Errorf("submit window post failed: %+v", submitErr)
|
||||
sm, err := s.submitPoStMessage(ctx, post)
|
||||
if err != nil {
|
||||
log.Errorf("submit window post failed: %+v", err)
|
||||
submitErr = err
|
||||
} else {
|
||||
s.recordProofsEvent(post.Partitions, sm.Cid())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user