chore: lint: address feedback from reviews
This commit is contained in:
parent
26d3fd2ecc
commit
1882525578
@ -141,7 +141,10 @@ func createRandomFile(rseed, size int) ([]byte, string, error) {
|
|||||||
size = 1600
|
size = 1600
|
||||||
}
|
}
|
||||||
data := make([]byte, size)
|
data := make([]byte, size)
|
||||||
_, _ = rand.New(rand.NewSource(int64(rseed))).Read(data)
|
_, err := rand.New(rand.NewSource(int64(rseed))).Read(data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, "", err
|
||||||
|
}
|
||||||
|
|
||||||
dir, err := os.MkdirTemp(os.TempDir(), "test-make-deal-")
|
dir, err := os.MkdirTemp(os.TempDir(), "test-make-deal-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -201,7 +201,5 @@ func (m *minerAPI) GetUnpaddedCARSize(ctx context.Context, pieceCid cid.Cid) (ui
|
|||||||
return 0, xerrors.Errorf("no storage deals found for piece %s", pieceCid)
|
return 0, xerrors.Errorf("no storage deals found for piece %s", pieceCid)
|
||||||
}
|
}
|
||||||
|
|
||||||
l := pieceInfo.Deals[0].Length
|
return uint64(pieceInfo.Deals[0].Length), nil
|
||||||
|
|
||||||
return uint64(l), nil
|
|
||||||
}
|
}
|
||||||
|
@ -396,19 +396,20 @@ func lookupEthAddress(addr address.Address, st *state.StateTree) (ethtypes.EthAd
|
|||||||
return ethtypes.EthAddress{}, err
|
return ethtypes.EthAddress{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// revive:disable:empty-block easier to grok when the cases are explicit
|
||||||
|
|
||||||
// Lookup on the target actor and try to get an f410 address.
|
// Lookup on the target actor and try to get an f410 address.
|
||||||
if actor, err := st.GetActor(idAddr); !errors.Is(err, types.ErrActorNotFound) {
|
if actor, err := st.GetActor(idAddr); errors.Is(err, types.ErrActorNotFound) {
|
||||||
if err != nil {
|
// Not found -> use a masked ID address
|
||||||
|
} else if err != nil {
|
||||||
// Any other error -> fail.
|
// Any other error -> fail.
|
||||||
return ethtypes.EthAddress{}, err
|
return ethtypes.EthAddress{}, err
|
||||||
}
|
} else if actor.Address == nil {
|
||||||
if actor.Address != nil {
|
// No delegated address -> use masked ID address.
|
||||||
if ethAddr, err := ethtypes.EthAddressFromFilecoinAddress(*actor.Address); err == nil && !ethAddr.IsMaskedID() {
|
} else if ethAddr, err := ethtypes.EthAddressFromFilecoinAddress(*actor.Address); err == nil && !ethAddr.IsMaskedID() {
|
||||||
// Conversable into an eth address, use it.
|
// Conversable into an eth address, use it.
|
||||||
return ethAddr, nil
|
return ethAddr, nil
|
||||||
}
|
}
|
||||||
} // else no delegated address -> use masked ID address.
|
|
||||||
} // else not found -> use a masked ID address
|
|
||||||
|
|
||||||
return ethtypes.EthAddressFromFilecoinAddress(idAddr)
|
return ethtypes.EthAddressFromFilecoinAddress(idAddr)
|
||||||
}
|
}
|
||||||
@ -816,8 +817,8 @@ func encodeAsABIHelper(param1 uint64, param2 uint64, data []byte) []byte {
|
|||||||
if len(data)%EVM_WORD_SIZE != 0 {
|
if len(data)%EVM_WORD_SIZE != 0 {
|
||||||
totalWords++
|
totalWords++
|
||||||
}
|
}
|
||||||
l := totalWords * EVM_WORD_SIZE
|
sz := totalWords * EVM_WORD_SIZE
|
||||||
buf := make([]byte, l)
|
buf := make([]byte, sz)
|
||||||
offset := 0
|
offset := 0
|
||||||
// Below, we use copy instead of "appending" to preserve all the zero padding.
|
// Below, we use copy instead of "appending" to preserve all the zero padding.
|
||||||
for _, arg := range staticArgs {
|
for _, arg := range staticArgs {
|
||||||
|
Loading…
Reference in New Issue
Block a user