Merge pull request #9482 from filecoin-project/gstuart/fix-grant-datacap
fix: actors: fix verifreg checking notary balance
This commit is contained in:
commit
e549a3fb4a
@ -28,15 +28,8 @@ func getDataCap(store adt.Store, ver actors.Version, root rootFunc, addr address
|
||||
return false, big.Zero(), xerrors.Errorf("loading verifreg: %w", err)
|
||||
}
|
||||
|
||||
var keyedAddr abi.Keyer
|
||||
if ver <= 8 {
|
||||
keyedAddr = abi.AddrKey(addr)
|
||||
} else {
|
||||
keyedAddr = abi.IdAddrKey(addr)
|
||||
}
|
||||
|
||||
var dcap abi.StoragePower
|
||||
if found, err := vh.Get(keyedAddr, &dcap); err != nil {
|
||||
if found, err := vh.Get(abi.AddrKey(addr), &dcap); err != nil {
|
||||
return false, big.Zero(), xerrors.Errorf("looking up addr: %w", err)
|
||||
} else if !found {
|
||||
return false, big.Zero(), nil
|
||||
|
@ -226,7 +226,8 @@ func TestRemoveDataCap(t *testing.T) {
|
||||
// make the 2 verifiers
|
||||
|
||||
makeVerifier := func(addr address.Address) error {
|
||||
params, aerr := actors.SerializeParams(&verifregst.AddVerifierParams{Address: addr, Allowance: big.NewInt(100000000000)})
|
||||
allowance := big.NewInt(100000000000)
|
||||
params, aerr := actors.SerializeParams(&verifregst.AddVerifierParams{Address: addr, Allowance: allowance})
|
||||
require.NoError(t, aerr)
|
||||
|
||||
msg := &types.Message{
|
||||
@ -245,6 +246,10 @@ func TestRemoveDataCap(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, 0, res.Receipt.ExitCode)
|
||||
|
||||
verifierAllowance, err := api.StateVerifierStatus(ctx, addr, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, allowance, *verifierAllowance)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user