Integrate verifreg changes to lotus
This commit is contained in:
parent
4218612ccd
commit
bc4f9bb805
@ -19,6 +19,10 @@ import (
|
||||
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt"
|
||||
builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin"
|
||||
{{end}}
|
||||
{{if (ge .v 9)}}
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"golang.org/x/xerrors"
|
||||
{{end}}
|
||||
)
|
||||
|
||||
var _ State = (*state{{.v}})(nil)
|
||||
@ -62,7 +66,11 @@ func (s *state{{.v}}) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
{{if (le .v 8)}}
|
||||
return getDataCap(s.store, actors.Version{{.v}}, s.verifiedClients, addr)
|
||||
{{else}}
|
||||
return false, big.Zero(), xerrors.Errorf("unsupported in actors v{{.v}}")
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -78,11 +86,19 @@ func (s *state{{.v}}) ForEachVerifier(cb func(addr address.Address, dcap abi.Sto
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
{{if (le .v 8)}}
|
||||
return forEachCap(s.store, actors.Version{{.v}}, s.verifiedClients, cb)
|
||||
{{else}}
|
||||
return xerrors.Errorf("unsupported in actors v{{.v}}")
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) verifiedClients() (adt.Map, error) {
|
||||
{{if (le .v 8)}}
|
||||
return adt{{.v}}.AsMap(s.store, s.VerifiedClients{{if (ge .v 3)}}, builtin{{.v}}.DefaultHamtBitwidth{{end}})
|
||||
{{else}}
|
||||
return nil, xerrors.Errorf("unsupported in actors v{{.v}}")
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func (s *state{{.v}}) verifiers() (adt.Map, error) {
|
||||
|
@ -46,7 +46,9 @@ func (s *state0) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state0) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version0, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -62,11 +64,15 @@ func (s *state0) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state0) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version0, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt0.AsMap(s.store, s.VerifiedClients)
|
||||
|
||||
}
|
||||
|
||||
func (s *state0) verifiers() (adt.Map, error) {
|
||||
|
@ -46,7 +46,9 @@ func (s *state2) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state2) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version2, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -62,11 +64,15 @@ func (s *state2) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state2) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version2, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt2.AsMap(s.store, s.VerifiedClients)
|
||||
|
||||
}
|
||||
|
||||
func (s *state2) verifiers() (adt.Map, error) {
|
||||
|
@ -47,7 +47,9 @@ func (s *state3) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state3) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version3, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +65,15 @@ func (s *state3) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state3) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version3, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt3.AsMap(s.store, s.VerifiedClients, builtin3.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state3) verifiers() (adt.Map, error) {
|
||||
|
@ -47,7 +47,9 @@ func (s *state4) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state4) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version4, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +65,15 @@ func (s *state4) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state4) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version4, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt4.AsMap(s.store, s.VerifiedClients, builtin4.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state4) verifiers() (adt.Map, error) {
|
||||
|
@ -47,7 +47,9 @@ func (s *state5) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state5) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version5, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +65,15 @@ func (s *state5) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state5) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version5, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt5.AsMap(s.store, s.VerifiedClients, builtin5.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state5) verifiers() (adt.Map, error) {
|
||||
|
@ -47,7 +47,9 @@ func (s *state6) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state6) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version6, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state6) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +65,15 @@ func (s *state6) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state6) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version6, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state6) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt6.AsMap(s.store, s.VerifiedClients, builtin6.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state6) verifiers() (adt.Map, error) {
|
||||
|
@ -47,7 +47,9 @@ func (s *state7) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state7) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version7, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state7) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +65,15 @@ func (s *state7) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state7) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version7, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state7) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt7.AsMap(s.store, s.VerifiedClients, builtin7.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state7) verifiers() (adt.Map, error) {
|
||||
|
@ -47,7 +47,9 @@ func (s *state8) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state8) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
|
||||
return getDataCap(s.store, actors.Version8, s.verifiedClients, addr)
|
||||
|
||||
}
|
||||
|
||||
func (s *state8) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +65,15 @@ func (s *state8) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state8) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
|
||||
return forEachCap(s.store, actors.Version8, s.verifiedClients, cb)
|
||||
|
||||
}
|
||||
|
||||
func (s *state8) verifiedClients() (adt.Map, error) {
|
||||
|
||||
return adt8.AsMap(s.store, s.VerifiedClients, builtin8.DefaultHamtBitwidth)
|
||||
|
||||
}
|
||||
|
||||
func (s *state8) verifiers() (adt.Map, error) {
|
||||
|
@ -2,9 +2,11 @@ package verifreg
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
builtin9 "github.com/filecoin-project/go-state-types/builtin"
|
||||
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
|
||||
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
||||
@ -47,7 +49,9 @@ func (s *state9) RootKey() (address.Address, error) {
|
||||
}
|
||||
|
||||
func (s *state9) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
return getDataCap(s.store, actors.Version9, s.verifiedClients, addr)
|
||||
|
||||
return false, big.Zero(), xerrors.Errorf("unsupported in actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state9) VerifierDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
@ -63,11 +67,15 @@ func (s *state9) ForEachVerifier(cb func(addr address.Address, dcap abi.StorageP
|
||||
}
|
||||
|
||||
func (s *state9) ForEachClient(cb func(addr address.Address, dcap abi.StoragePower) error) error {
|
||||
return forEachCap(s.store, actors.Version9, s.verifiedClients, cb)
|
||||
|
||||
return xerrors.Errorf("unsupported in actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state9) verifiedClients() (adt.Map, error) {
|
||||
return adt9.AsMap(s.store, s.VerifiedClients, builtin9.DefaultHamtBitwidth)
|
||||
|
||||
return nil, xerrors.Errorf("unsupported in actors v9")
|
||||
|
||||
}
|
||||
|
||||
func (s *state9) verifiers() (adt.Map, error) {
|
||||
|
2
go.mod
2
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.20220921193302-60676bda3cb5
|
||||
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220921200345-ad0c1bea9940
|
||||
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
4
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.20220921193302-60676bda3cb5 h1:5FCdArFQ/nzsv2vBJ7ibLnocTf+pnnTVxcF0Ohe97O0=
|
||||
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220921193302-60676bda3cb5/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
|
||||
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220921200345-ad0c1bea9940 h1:BSr7qqJkxBJI66H9hd09tJNtYSEuEkSSH81/+5wbp2I=
|
||||
github.com/filecoin-project/go-state-types v0.1.12-beta.0.20220921200345-ad0c1bea9940/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=
|
||||
|
Loading…
Reference in New Issue
Block a user