From 4fdcc3dfc952bbecc0d843f389af37723d14d2b9 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 27 Sep 2022 16:46:19 -0400 Subject: [PATCH] datacap and verifreg actors use ID addresses without protocol byte --- chain/actors/builtin/datacap/util.go | 2 +- chain/actors/builtin/verifreg/util.go | 9 ++++++++- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/chain/actors/builtin/datacap/util.go b/chain/actors/builtin/datacap/util.go index 5d130d201..da997846d 100644 --- a/chain/actors/builtin/datacap/util.go +++ b/chain/actors/builtin/datacap/util.go @@ -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 diff --git a/chain/actors/builtin/verifreg/util.go b/chain/actors/builtin/verifreg/util.go index 09a7a132c..3e01709c4 100644 --- a/chain/actors/builtin/verifreg/util.go +++ b/chain/actors/builtin/verifreg/util.go @@ -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 diff --git a/go.mod b/go.mod index 89b94e9a5..3ba17303a 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 471730f49..2df778dbc 100644 --- a/go.sum +++ b/go.sum @@ -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=