update specs-actors; update GetRandomness
This commit is contained in:
parent
af8c379ac8
commit
4ad63d9b63
@ -10,9 +10,11 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||
vmr "github.com/filecoin-project/specs-actors/actors/runtime"
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/minio/blake2b-simd"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
@ -103,13 +105,20 @@ func (rs *runtimeShim) GetActorCodeCID(addr address.Address) (ret cid.Cid, ok bo
|
||||
return act.Code, true
|
||||
}
|
||||
|
||||
func (rs *runtimeShim) GetRandomness(epoch abi.ChainEpoch) abi.RandomnessSeed {
|
||||
r, err := rs.vmctx.GetRandomness(epoch)
|
||||
func (rs *runtimeShim) GetRandomness(personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) abi.Randomness {
|
||||
r, err := rs.vmctx.GetRandomness(randEpoch)
|
||||
if err != nil {
|
||||
rs.Abortf(exitcode.SysErrInternal, "getting randomness: %v", err)
|
||||
}
|
||||
|
||||
return r
|
||||
h := blake2b.New256()
|
||||
if err := binary.Write(h, binary.BigEndian, int64(personalization)); err != nil {
|
||||
rs.Abortf(exitcode.SysErrInternal, "deriving randomness: %v", err)
|
||||
}
|
||||
h.Write(r)
|
||||
h.Write(entropy)
|
||||
|
||||
return h.Sum(nil)
|
||||
}
|
||||
|
||||
func (rs *runtimeShim) Store() vmr.Store {
|
||||
|
2
go.mod
2
go.mod
@ -23,7 +23,7 @@ require (
|
||||
github.com/filecoin-project/go-paramfetch v0.0.1
|
||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200210220012-eb75ec747d6b
|
||||
github.com/filecoin-project/go-statestore v0.1.0
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200214213304-f699edd41914
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200217084223-58b973dc2c1f
|
||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||
github.com/gorilla/mux v1.7.3
|
||||
|
4
go.sum
4
go.sum
@ -132,6 +132,10 @@ github.com/filecoin-project/specs-actors v0.0.0-20200214164743-74b45ccaaff9 h1:i
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200214164743-74b45ccaaff9/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200214213304-f699edd41914 h1:3AqKuA/ha8amt24Ya3l/45+PfFDlHcm4Jt1YWKuw6A0=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200214213304-f699edd41914/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200217082309-eacd01300b6d h1:6mllLyY8O/QZPrmDC3HWVo0AK6uecPWZxgjhx5ebA1I=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200217082309-eacd01300b6d/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200217084223-58b973dc2c1f h1:YGhskEZ/N8rKrU85BvUgRuubhykawibsNluzqZSosHE=
|
||||
github.com/filecoin-project/specs-actors v0.0.0-20200217084223-58b973dc2c1f/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 h1:EzDjxMg43q1tA2c0MV3tNbaontnHLplHyFF6M5KiVP0=
|
||||
|
Loading…
Reference in New Issue
Block a user