datacap and verifreg actors use ID addresses without protocol byte

This commit is contained in:
Geoff Stuart 2022-09-27 16:46:19 -04:00
parent d4db1bfacb
commit 4fdcc3dfc9
4 changed files with 12 additions and 5 deletions

View File

@ -28,7 +28,7 @@ func getDataCap(store adt.Store, ver actors.Version, root rootFunc, addr address
}
var dcap abi.StoragePower
if found, err := vh.Get(abi.AddrKey(addr), &dcap); err != nil {
if found, err := vh.Get(abi.IdAddrKey(addr), &dcap); err != nil {
return false, big.Zero(), xerrors.Errorf("looking up addr: %w", err)
} else if !found {
return false, big.Zero(), nil

View File

@ -28,8 +28,15 @@ 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(abi.AddrKey(addr), &dcap); err != nil {
if found, err := vh.Get(keyedAddr, &dcap); err != nil {
return false, big.Zero(), xerrors.Errorf("looking up addr: %w", err)
} else if !found {
return false, big.Zero(), nil

2
go.mod
View File

@ -42,7 +42,7 @@ require (
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
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220927193119-c1fd4fc0ad7f
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220927203826-2d77f55cee17
github.com/filecoin-project/go-statemachine v1.0.2
github.com/filecoin-project/go-statestore v0.2.0
github.com/filecoin-project/go-storedcounter v0.1.0

4
go.sum
View File

@ -343,8 +343,8 @@ github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psS
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220927193119-c1fd4fc0ad7f h1:rhTiLLttRsO0ulpChrOFDuZx0KXChdbfxllaDpx8Fac=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220927193119-c1fd4fc0ad7f/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220927203826-2d77f55cee17 h1:0cC8WvrqV/nKqqOvQBBxbHgFF/6oyhTTAYIuR9x7lQc=
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220927203826-2d77f55cee17/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc=
github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=