Merge branch 'feat/nv18-events' into feat/nv18-ethevents

This commit is contained in:
Raúl Kripalani 2022-11-14 11:46:08 +00:00
commit a915c703a5
20 changed files with 337 additions and 124 deletions

View File

@ -68,6 +68,7 @@ func init() {
}
ExampleValues[reflect.TypeOf(c)] = c
ExampleValues[reflect.TypeOf(&c)] = &c
c2, err := cid.Decode("bafy2bzacebp3shtrn43k7g3unredz7fxn4gj533d3o43tqn2p2ipxxhrvchve")
if err != nil {

View File

@ -120,13 +120,12 @@ func (tx *EthTxArgs) ToSignedMessage() (*types.SignedMessage, error) {
var to address.Address
var params []byte
if tx.To == nil && tx.Input == nil {
if len(tx.To) == 0 && len(tx.Input) == 0 {
return nil, fmt.Errorf("to and input cannot both be empty")
}
var method abi.MethodNum
if tx.To == nil {
// TODO https://github.com/filecoin-project/ref-fvm/issues/992
// TODO unify with applyEvmMsg
// this is a contract creation
@ -248,9 +247,6 @@ func (tx *EthTxArgs) OriginalRlpMsg() ([]byte, error) {
}
func (tx *EthTxArgs) Signature() (*typescrypto.Signature, error) {
if tx.V == nil || tx.R == nil || tx.S == nil {
return nil, fmt.Errorf("one of V, R, or S is nil")
}
sig := append([]byte{}, tx.R...)
sig = append(sig, tx.S...)
sig = append(sig, tx.V...)
@ -396,16 +392,25 @@ func parseEip1559Tx(data []byte) (*EthTxArgs, error) {
}
func ParseEthTxArgs(data []byte) (*EthTxArgs, error) {
if len(data) == 0 {
return nil, fmt.Errorf("empty data")
}
if data[0] > 0x7f {
// legacy transaction
return nil, fmt.Errorf("legacy transaction is not supported")
} else if data[0] == 1 {
}
if data[0] == 1 {
// EIP-2930
return nil, fmt.Errorf("EIP-2930 transaction is not supported")
} else if data[0] == Eip1559TxType {
}
if data[0] == Eip1559TxType {
// EIP-1559
return parseEip1559Tx(data)
}
return nil, fmt.Errorf("unsupported transaction type")
}
@ -497,7 +502,7 @@ func parseEthAddr(v interface{}) (*EthAddress, error) {
if err != nil {
return nil, err
}
if b == nil || len(b) == 0 {
if len(b) == 0 {
return nil, nil
}
addr, err := EthAddressFromBytes(b)

View File

@ -40,21 +40,21 @@ func TestTxArgs(t *testing.T) {
// parse txargs
txArgs, err := ParseEthTxArgs(tc.Input)
require.Nil(t, err, comment)
require.NoError(t, err)
msgRecovered, err := txArgs.OriginalRlpMsg()
require.Nil(t, err, comment)
require.NoError(t, err)
require.Equal(t, tc.NosigTx, "0x"+hex.EncodeToString(msgRecovered), comment)
// verify signatures
from, err := txArgs.Sender()
require.Nil(t, err, comment)
require.NoError(t, err)
smsg, err := txArgs.ToSignedMessage()
require.Nil(t, err, comment)
require.NoError(t, err)
err = sigs.Verify(&smsg.Signature, from, msgRecovered)
require.Nil(t, err, comment)
require.NoError(t, err)
// verify data
require.Equal(t, tc.Output.ChainID, txArgs.ChainID)

View File

@ -8,6 +8,9 @@ import (
"golang.org/x/xerrors"
)
// set a limit to make sure it doesn't loop infinitely
const maxListElements = 500
func EncodeRLP(val interface{}) ([]byte, error) {
return encodeRLP(val)
}
@ -48,7 +51,8 @@ func encodeLength(length int) (lenInBytes []byte, err error) {
}
func encodeRLP(val interface{}) ([]byte, error) {
if data, ok := val.([]byte); ok {
switch data := val.(type) {
case []byte:
if len(data) == 1 && data[0] <= 0x7f {
return data, nil
} else if len(data) <= 55 {
@ -65,7 +69,7 @@ func encodeRLP(val interface{}) ([]byte, error) {
append(lenInBytes, data...)...,
), nil
}
} else if data, ok := val.([]interface{}); ok {
case []interface{}:
encodedList, err := encodeRLPListItems(data)
if err != nil {
return nil, err
@ -86,8 +90,9 @@ func encodeRLP(val interface{}) ([]byte, error) {
[]byte{prefix},
append(lenInBytes, encodedList...)...,
), nil
}
default:
return nil, fmt.Errorf("input data should either be a list or a byte array")
}
}
func DecodeRLP(data []byte) (interface{}, error) {
@ -160,8 +165,7 @@ func decodeListElems(data []byte, length int) (res []interface{}, err error) {
totalConsumed := 0
result := []interface{}{}
// set a limit to make sure it doesn't loop infinitely
for i := 0; totalConsumed < length && i < 5000; i++ {
for i := 0; totalConsumed < length && i < maxListElements; i++ {
elem, consumed, err := decodeRLP(data[totalConsumed:])
if err != nil {
return nil, xerrors.Errorf("invalid rlp data: cannot decode list element: %w", err)

View File

@ -22,7 +22,7 @@ var ActorDebugging = true
const BootstrappersFile = "wallabynet.pi"
const GenesisFile = "wallabynet.car"
const GenesisNetworkVersion = network.Version16
const GenesisNetworkVersion = network.Version18
var UpgradeBreezeHeight = abi.ChainEpoch(-1)

View File

@ -8,9 +8,5 @@ import (
func IsEmbryo(c cid.Cid) bool {
name, _, ok := actors.GetActorMetaByCode(c)
if ok {
return name == "embryo"
}
return false
return ok && name == "embryo"
}

View File

@ -1559,6 +1559,7 @@ func UpgradeActorsV10(ctx context.Context, sm *stmgr.StateManager, cache stmgr.M
// TODO migration
// - state tree migration to v5; must set predictable addresses for all account actors
// - create EAM actor
// - create ETH address 0x00..., defined by spec.
return cid.Undef, fmt.Errorf("IMPLEMENTME: v10 migration")
}

View File

@ -459,6 +459,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
paramBytes = mustEnc(confirmParams)
}
_, err = doExecValue(ctx, genesisVm, minerInfos[i].maddr, power.Address, big.Zero(), builtintypes.MethodsMiner.ConfirmSectorProofsValid, paramBytes)
if err != nil {
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)
@ -470,6 +471,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
RawByteDelta: types.NewInt(uint64(m.SectorSize)),
QualityAdjustedDelta: sectorWeight,
}
_, err = doExecValue(ctx, genesisVm, power.Address, minerInfos[i].maddr, big.Zero(), power.Methods.UpdateClaimedPower, mustEnc(claimParams))
if err != nil {
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)

View File

@ -647,14 +647,20 @@ func (cs *ChainStore) takeHeaviestTipSet(ctx context.Context, ts *types.TipSet)
if err := cs.writeHead(ctx, ts); err != nil {
log.Errorf("failed to write chain head: %s", err)
return nil
return err
}
tskBlk, err := ts.Key().ToStorageBlock()
if err != nil {
log.Errorf("failed to create a block from tsk: %s", ts.Key())
return err
}
err = cs.chainLocalBlockstore.Put(ctx, tskBlk)
if err != nil {
log.Errorf("failed to put block for tsk: %s", ts.Key())
return err
}
_ = cs.chainLocalBlockstore.Put(ctx, tskBlk)
return nil
}

View File

@ -1340,9 +1340,15 @@ func (t *MessageReceipt) MarshalCBOR(w io.Writer) error {
// t.EventsRoot (cid.Cid) (struct)
if err := cbg.WriteCid(cw, t.EventsRoot); err != nil {
if t.EventsRoot == nil {
if _, err := cw.Write(cbg.CborNull); err != nil {
return err
}
} else {
if err := cbg.WriteCid(cw, *t.EventsRoot); err != nil {
return xerrors.Errorf("failed to write cid field t.EventsRoot: %w", err)
}
}
return nil
}
@ -1445,12 +1451,22 @@ func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) (err error) {
{
b, err := cr.ReadByte()
if err != nil {
return err
}
if b != cbg.CborNull[0] {
if err := cr.UnreadByte(); err != nil {
return err
}
c, err := cbg.ReadCid(cr)
if err != nil {
return xerrors.Errorf("failed to read cid field t.EventsRoot: %w", err)
}
t.EventsRoot = c
t.EventsRoot = &c
}
}
return nil

View File

@ -12,9 +12,10 @@ type MessageReceipt struct {
ExitCode exitcode.ExitCode
Return []byte
GasUsed int64
EventsRoot cid.Cid // Root of Event AMT
EventsRoot *cid.Cid // Root of Event AMT
}
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool {
return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed && mr.EventsRoot == o.EventsRoot
return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed &&
(mr.EventsRoot == o.EventsRoot || (mr.EventsRoot != nil && o.EventsRoot != nil && *mr.EventsRoot == *o.EventsRoot))
}

View File

@ -58,7 +58,7 @@ func ResolveToKeyAddr(state types.StateTree, cst cbor.IpldStore, addr address.Ad
if state.Version() >= types.StateTreeVersion5 {
if act.Address == nil {
return address.Undef, xerrors.Errorf("actor doesn't have expected address: %s", addr)
return address.Undef, xerrors.Errorf("actor at %s doesn't have a predictable address", addr)
}
return *act.Address, nil
}

View File

@ -1518,6 +1518,9 @@ var ChainPruneCmd = &cli.Command{
// TODO: Find a home for this.
func isNativeEthereumAddress(addr address.Address) bool {
if addr.Protocol() != address.ID {
return false
}
id, _, err := varint.FromUvarint(addr.Payload())
return err == nil && id == builtintypes.EthereumAddressManagerActorID
}
@ -1590,6 +1593,7 @@ var ChainExecEVMCmd = &cli.Command{
}
method = builtintypes.MethodsEAM.Create
} else {
// TODO this should be able to use Create now; needs new bundle
var salt [32]byte
binary.BigEndian.PutUint64(salt[:], nonce)

View File

@ -465,7 +465,9 @@ Inputs:
{
"SealProof": 8,
"SectorNumber": 9,
"SectorKey": null,
"SectorKey": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SealedCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
@ -1280,8 +1282,12 @@ Response:
"ProposalCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"AddFundsCid": null,
"PublishCid": null,
"AddFundsCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PublishCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Miner": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"Client": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"State": 42,
@ -1296,7 +1302,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -1458,8 +1466,12 @@ Response:
"ProposalCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"AddFundsCid": null,
"PublishCid": null,
"AddFundsCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PublishCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Miner": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"Client": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"State": 42,
@ -1474,7 +1486,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -1510,7 +1524,9 @@ Response:
"Selector": {
"Raw": "Ynl0ZSBhcnJheQ=="
},
"PieceCID": null,
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PricePerByte": "0",
"PaymentInterval": 42,
"PaymentIntervalIncrease": 42,
@ -2909,7 +2925,9 @@ Inputs:
1024,
{},
{
"PublishCid": null,
"PublishCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"DealID": 5432,
"DealProposal": {
"PieceCID": {
@ -2963,7 +2981,9 @@ Response:
"FailedSectors": {
"123": "can't acquire read lock"
},
"Msg": null,
"Msg": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Error": "string value"
}
]
@ -3157,7 +3177,9 @@ Response:
123,
124
],
"Msg": null,
"Msg": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Error": "string value"
}
]
@ -3205,7 +3227,9 @@ Inputs:
}
},
"DealInfo": {
"PublishCid": null,
"PublishCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"DealID": 5432,
"DealProposal": {
"PieceCID": {
@ -3233,8 +3257,12 @@ Inputs:
"TicketValue": "Bw==",
"TicketEpoch": 10101,
"PreCommit1Out": "Bw==",
"CommD": null,
"CommR": null,
"CommD": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"CommR": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PreCommitInfo": {
"SealProof": 8,
"SectorNumber": 9,
@ -3246,10 +3274,14 @@ Inputs:
5432
],
"Expiration": 10101,
"UnsealedCid": null
"UnsealedCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
},
"PreCommitDeposit": "0",
"PreCommitMessage": null,
"PreCommitMessage": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PreCommitTipSet": [
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
@ -3261,7 +3293,9 @@ Inputs:
"SeedValue": "Bw==",
"SeedEpoch": 10101,
"CommitProof": "Ynl0ZSBhcnJheQ==",
"CommitMessage": null,
"CommitMessage": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Log": [
{
"Kind": "string value",
@ -3397,7 +3431,12 @@ Perms: admin
Inputs: `null`
Response: `null`
Response:
```json
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
```
### SectorTerminatePending
SectorTerminatePending returns a list of pending sector terminations to be sent in the next batch message
@ -3498,8 +3537,12 @@ Response:
{
"SectorID": 9,
"State": "Proving",
"CommD": null,
"CommR": null,
"CommD": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"CommR": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Proof": "Ynl0ZSBhcnJheQ==",
"Deals": [
5432
@ -3513,7 +3556,9 @@ Response:
}
},
"DealInfo": {
"PublishCid": null,
"PublishCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"DealID": 5432,
"DealProposal": {
"PieceCID": {
@ -3546,11 +3591,17 @@ Response:
"Value": "Bw==",
"Epoch": 10101
},
"PreCommitMsg": null,
"CommitMsg": null,
"PreCommitMsg": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"CommitMsg": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Retries": 42,
"ToUpgrade": true,
"ReplicaUpdateMessage": null,
"ReplicaUpdateMessage": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"LastErr": "string value",
"Log": [
{
@ -3604,7 +3655,9 @@ Inputs:
1040384,
1024,
"Bw==",
null
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
]
```

View File

@ -1250,7 +1250,9 @@ Inputs:
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
null
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
]
```
@ -1262,7 +1264,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Piece": null,
"Piece": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Size": 42,
"MinPrice": "0",
"UnsealPrice": "0",
@ -1273,7 +1277,9 @@ Response:
"MinerPeer": {
"Address": "f01234",
"ID": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"PieceCID": null
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
}
]
@ -1344,7 +1350,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -1448,7 +1456,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -1513,7 +1523,9 @@ Response:
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"ID": 5,
"PieceCID": null,
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PricePerByte": "0",
"UnsealPrice": "0",
"Status": 0,
@ -1686,7 +1698,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -1751,7 +1765,9 @@ Response:
{
"Key": 50,
"Err": "string value",
"Root": null,
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Source": "string value",
"FilePath": "string value",
"CARPath": "string value"
@ -1776,7 +1792,9 @@ Response:
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"ID": 5,
"PieceCID": null,
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PricePerByte": "0",
"UnsealPrice": "0",
"Status": 0,
@ -1837,7 +1855,9 @@ Inputs:
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
null
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
]
```
@ -1848,7 +1868,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Piece": null,
"Piece": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Size": 42,
"MinPrice": "0",
"UnsealPrice": "0",
@ -1859,7 +1881,9 @@ Response:
"MinerPeer": {
"Address": "f01234",
"ID": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"PieceCID": null
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
}
```
@ -1936,7 +1960,9 @@ Inputs:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Piece": null,
"Piece": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"DatamodelPathSelector": "Links/21/Hash/Links/42/Hash",
"Size": 42,
"FromLocalCAR": "string value",
@ -1949,7 +1975,9 @@ Inputs:
"MinerPeer": {
"Address": "f01234",
"ID": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"PieceCID": null
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
},
{
@ -1991,7 +2019,9 @@ Inputs:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Piece": null,
"Piece": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"DatamodelPathSelector": "Links/21/Hash/Links/42/Hash",
"Size": 42,
"FromLocalCAR": "string value",
@ -2004,7 +2034,9 @@ Inputs:
"MinerPeer": {
"Address": "f01234",
"ID": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"PieceCID": null
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
},
{
@ -2040,7 +2072,9 @@ Inputs:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -2056,7 +2090,12 @@ Inputs:
]
```
Response: `null`
Response:
```json
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
```
### ClientStatelessDeal
ClientStatelessDeal fire-and-forget-proposes an offline deal to a miner without subsequent tracking.
@ -2073,7 +2112,9 @@ Inputs:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -2089,7 +2130,12 @@ Inputs:
]
```
Response: `null`
Response:
```json
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
```
## Create
@ -2616,7 +2662,9 @@ Response:
{
"SealProof": 8,
"SectorNumber": 9,
"SectorKey": null,
"SectorKey": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SealedCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
@ -4159,7 +4207,9 @@ Response:
"PendingAmt": "0",
"NonReservedAmt": "0",
"PendingAvailableAmt": "0",
"PendingWaitSentinel": null,
"PendingWaitSentinel": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"QueuedAmt": "0",
"VoucherReedeemedAmt": "0"
}
@ -4188,7 +4238,9 @@ Response:
"PendingAmt": "0",
"NonReservedAmt": "0",
"PendingAvailableAmt": "0",
"PendingWaitSentinel": null,
"PendingWaitSentinel": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"QueuedAmt": "0",
"VoucherReedeemedAmt": "0"
}
@ -5888,7 +5940,9 @@ Response:
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": null,
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
}
]
@ -6056,7 +6110,9 @@ Inputs:
5432
],
"Expiration": 10101,
"UnsealedCid": null
"UnsealedCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
},
[
{
@ -6178,7 +6234,9 @@ Inputs:
5432
],
"Expiration": 10101,
"UnsealedCid": null
"UnsealedCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
},
[
{
@ -6361,7 +6419,9 @@ Response:
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": null,
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
}
]
@ -6800,7 +6860,9 @@ Response:
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": null,
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
}
```
@ -6871,7 +6933,9 @@ Response:
5432
],
"Expiration": 10101,
"UnsealedCid": null
"UnsealedCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
},
"PreCommitDeposit": "0",
"PreCommitEpoch": 10101

View File

@ -1325,7 +1325,9 @@ Inputs:
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
null
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
]
```
@ -1337,7 +1339,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Piece": null,
"Piece": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Size": 42,
"MinPrice": "0",
"UnsealPrice": "0",
@ -1348,7 +1352,9 @@ Response:
"MinerPeer": {
"Address": "f01234",
"ID": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"PieceCID": null
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
}
]
@ -1419,7 +1425,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -1523,7 +1531,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -1588,7 +1598,9 @@ Response:
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"ID": 5,
"PieceCID": null,
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PricePerByte": "0",
"UnsealPrice": "0",
"Status": 0,
@ -1761,7 +1773,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -1826,7 +1840,9 @@ Response:
{
"Key": 50,
"Err": "string value",
"Root": null,
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Source": "string value",
"FilePath": "string value",
"CARPath": "string value"
@ -1850,7 +1866,9 @@ Response:
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"ID": 5,
"PieceCID": null,
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PricePerByte": "0",
"UnsealPrice": "0",
"Status": 0,
@ -1911,7 +1929,9 @@ Inputs:
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
null
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
]
```
@ -1922,7 +1942,9 @@ Response:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Piece": null,
"Piece": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Size": 42,
"MinPrice": "0",
"UnsealPrice": "0",
@ -1933,7 +1955,9 @@ Response:
"MinerPeer": {
"Address": "f01234",
"ID": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"PieceCID": null
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
}
```
@ -2016,7 +2040,9 @@ Inputs:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"Piece": null,
"Piece": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"DataSelector": "Links/21/Hash/Links/42/Hash",
"Size": 42,
"Total": "0",
@ -2028,7 +2054,9 @@ Inputs:
"MinerPeer": {
"Address": "f01234",
"ID": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf",
"PieceCID": null
"PieceCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
}
}
]
@ -2087,7 +2115,9 @@ Inputs:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -2103,7 +2133,12 @@ Inputs:
]
```
Response: `null`
Response:
```json
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
```
### ClientStatelessDeal
ClientStatelessDeal fire-and-forget-proposes an offline deal to a miner without subsequent tracking.
@ -2120,7 +2155,9 @@ Inputs:
"Root": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceCid": null,
"PieceCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"PieceSize": 1024,
"RawBlockSize": 42
},
@ -2136,7 +2173,12 @@ Inputs:
]
```
Response: `null`
Response:
```json
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
```
## Create
@ -3308,7 +3350,9 @@ Response:
{
"SealProof": 8,
"SectorNumber": 9,
"SectorKey": null,
"SectorKey": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SealedCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
@ -5252,7 +5296,9 @@ Response:
"PendingAmt": "0",
"NonReservedAmt": "0",
"PendingAvailableAmt": "0",
"PendingWaitSentinel": null,
"PendingWaitSentinel": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"QueuedAmt": "0",
"VoucherReedeemedAmt": "0"
}
@ -5281,7 +5327,9 @@ Response:
"PendingAmt": "0",
"NonReservedAmt": "0",
"PendingAvailableAmt": "0",
"PendingWaitSentinel": null,
"PendingWaitSentinel": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"QueuedAmt": "0",
"VoucherReedeemedAmt": "0"
}
@ -7072,7 +7120,9 @@ Response:
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": null,
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
}
]
@ -7268,7 +7318,9 @@ Inputs:
5432
],
"Expiration": 10101,
"UnsealedCid": null
"UnsealedCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
},
[
{
@ -7390,7 +7442,9 @@ Inputs:
5432
],
"Expiration": 10101,
"UnsealedCid": null
"UnsealedCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
},
[
{
@ -7573,7 +7627,9 @@ Response:
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": null,
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
}
]
@ -7966,7 +8022,9 @@ Response:
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": null,
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
}
```
@ -8042,7 +8100,9 @@ Response:
5432
],
"Expiration": 10101,
"UnsealedCid": null
"UnsealedCid": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
},
"PreCommitDeposit": "0",
"PreCommitEpoch": 10101

2
extern/filecoin-ffi vendored

@ -1 +1 @@
Subproject commit c6c2320adc177d4e57745595e6a69831176073c1
Subproject commit 2e788b5a50b600670a88f5397cbe856c2755fe4a

2
go.mod
View File

@ -38,7 +38,7 @@ require (
github.com/filecoin-project/go-fil-commcid v0.1.0
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0
github.com/filecoin-project/go-fil-markets v1.24.0-v17
github.com/filecoin-project/go-jsonrpc v0.1.8
github.com/filecoin-project/go-jsonrpc v0.1.9
github.com/filecoin-project/go-legs v0.4.4
github.com/filecoin-project/go-padreader v0.0.1
github.com/filecoin-project/go-paramfetch v0.0.4

4
go.sum
View File

@ -327,8 +327,8 @@ github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0/go.mod h1:7aWZdaQ1b16BVoQUYR+
github.com/filecoin-project/go-hamt-ipld/v3 v3.0.1/go.mod h1:gXpNmr3oQx8l3o7qkGyDjJjYSRX7hp/FGOStdqrWyDI=
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 h1:rVVNq0x6RGQIzCo1iiJlGFm9AGIZzeifggxtKMU7zmI=
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0/go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g=
github.com/filecoin-project/go-jsonrpc v0.1.8 h1:uXX/ikAk3Q4f/k8DRd9Zw+fWnfiYb5I+UI1tzlQgHog=
github.com/filecoin-project/go-jsonrpc v0.1.8/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
github.com/filecoin-project/go-jsonrpc v0.1.9 h1:HRWLxo7HAWzI3xZGeFG4LZJoYpms+Q+8kwmMTLnyS3A=
github.com/filecoin-project/go-jsonrpc v0.1.9/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
github.com/filecoin-project/go-legs v0.4.4 h1:mpMmAOOnamaz0CV9rgeKhEWA8j9kMC+f+UGCGrxKaZo=
github.com/filecoin-project/go-legs v0.4.4/go.mod h1:JQ3hA6xpJdbR8euZ2rO0jkxaMxeidXf0LDnVuqPAe9s=
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.mod h1:mPn+LRRd5gEKNAtc+r3ScpW2JRU/pj4NBKdADYWHiak=

View File

@ -6,7 +6,7 @@ import (
"github.com/minio/blake2b-simd"
"github.com/filecoin-project/go-address"
gocrypto "github.com/filecoin-project/go-crypto"
"github.com/filecoin-project/go-crypto"
crypto2 "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/lotus/lib/sigs"
@ -15,7 +15,7 @@ import (
type secpSigner struct{}
func (secpSigner) GenPrivate() ([]byte, error) {
priv, err := gocrypto.GenerateKey()
priv, err := crypto.GenerateKey()
if err != nil {
return nil, err
}
@ -23,12 +23,12 @@ func (secpSigner) GenPrivate() ([]byte, error) {
}
func (secpSigner) ToPublic(pk []byte) ([]byte, error) {
return gocrypto.PublicKey(pk), nil
return crypto.PublicKey(pk), nil
}
func (secpSigner) Sign(pk []byte, msg []byte) ([]byte, error) {
b2sum := blake2b.Sum256(msg)
sig, err := gocrypto.Sign(pk, b2sum[:])
sig, err := crypto.Sign(pk, b2sum[:])
if err != nil {
return nil, err
}
@ -38,7 +38,7 @@ func (secpSigner) Sign(pk []byte, msg []byte) ([]byte, error) {
func (secpSigner) Verify(sig []byte, a address.Address, msg []byte) error {
b2sum := blake2b.Sum256(msg)
pubk, err := gocrypto.EcRecover(b2sum[:], sig)
pubk, err := crypto.EcRecover(b2sum[:], sig)
if err != nil {
return err
}