revert change to verifreg util

This commit is contained in:
Geoff Stuart 2022-10-13 13:33:22 -04:00
parent b96a2343ac
commit 8d162267e8
2 changed files with 7 additions and 9 deletions

View File

@ -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) 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 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) return false, big.Zero(), xerrors.Errorf("looking up addr: %w", err)
} else if !found { } else if !found {
return false, big.Zero(), nil return false, big.Zero(), nil

View File

@ -226,7 +226,8 @@ func TestRemoveDataCap(t *testing.T) {
// make the 2 verifiers // make the 2 verifiers
makeVerifier := func(addr address.Address) error { 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) require.NoError(t, aerr)
msg := &types.Message{ msg := &types.Message{
@ -245,6 +246,10 @@ func TestRemoveDataCap(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, 0, res.Receipt.ExitCode) 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 return nil
} }