fix: remove network version and total fil

This commit is contained in:
Alan Shaw 2020-09-15 22:24:09 +01:00
parent ae326ce65d
commit ed4caac9bf
No known key found for this signature in database
GPG Key ID: 731D1C308A48A6B9
2 changed files with 14 additions and 67 deletions

View File

@ -254,14 +254,12 @@ func (a Actor) AbortWith(rt runtime.Runtime, args *AbortWithArgs) *abi.EmptyValu
// InspectRuntimeReturn is the return value for the Actor.InspectRuntime method. // InspectRuntimeReturn is the return value for the Actor.InspectRuntime method.
type InspectRuntimeReturn struct { type InspectRuntimeReturn struct {
NetworkVersion int64 Caller address.Address
Caller address.Address Receiver address.Address
Receiver address.Address ValueReceived abi.TokenAmount
ValueReceived abi.TokenAmount CurrEpoch abi.ChainEpoch
CurrEpoch abi.ChainEpoch CurrentBalance abi.TokenAmount
CurrentBalance abi.TokenAmount State State
State State
TotalFilCircSupply abi.TokenAmount
} }
// InspectRuntime returns a copy of the serializable values available in the Runtime. // InspectRuntime returns a copy of the serializable values available in the Runtime.
@ -270,12 +268,11 @@ func (a Actor) InspectRuntime(rt runtime.Runtime, _ *abi.EmptyValue) *InspectRun
var st State var st State
rt.StateReadonly(&st) rt.StateReadonly(&st)
return &InspectRuntimeReturn{ return &InspectRuntimeReturn{
NetworkVersion: int64(rt.NetworkVersion()), Caller: rt.Caller(),
Caller: rt.Caller(), Receiver: rt.Receiver(),
Receiver: rt.Receiver(), ValueReceived: rt.ValueReceived(),
ValueReceived: rt.ValueReceived(), CurrEpoch: rt.CurrEpoch(),
CurrentBalance: rt.CurrentBalance(), CurrentBalance: rt.CurrentBalance(),
State: st, State: st,
TotalFilCircSupply: rt.TotalFilCircSupply(),
} }
} }

View File

@ -731,7 +731,7 @@ func (t *AbortWithArgs) UnmarshalCBOR(r io.Reader) error {
return nil return nil
} }
var lengthBufInspectRuntimeReturn = []byte{136} var lengthBufInspectRuntimeReturn = []byte{134}
func (t *InspectRuntimeReturn) MarshalCBOR(w io.Writer) error { func (t *InspectRuntimeReturn) MarshalCBOR(w io.Writer) error {
if t == nil { if t == nil {
@ -744,17 +744,6 @@ func (t *InspectRuntimeReturn) MarshalCBOR(w io.Writer) error {
scratch := make([]byte, 9) scratch := make([]byte, 9)
// t.NetworkVersion (int64) (int64)
if t.NetworkVersion >= 0 {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.NetworkVersion)); err != nil {
return err
}
} else {
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.NetworkVersion-1)); err != nil {
return err
}
}
// t.Caller (address.Address) (struct) // t.Caller (address.Address) (struct)
if err := t.Caller.MarshalCBOR(w); err != nil { if err := t.Caller.MarshalCBOR(w); err != nil {
return err return err
@ -790,11 +779,6 @@ func (t *InspectRuntimeReturn) MarshalCBOR(w io.Writer) error {
if err := t.State.MarshalCBOR(w); err != nil { if err := t.State.MarshalCBOR(w); err != nil {
return err return err
} }
// t.TotalFilCircSupply (big.Int) (struct)
if err := t.TotalFilCircSupply.MarshalCBOR(w); err != nil {
return err
}
return nil return nil
} }
@ -812,35 +796,10 @@ func (t *InspectRuntimeReturn) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type array")
} }
if extra != 8 { if extra != 6 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.NetworkVersion (int64) (int64)
{
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
var extraI int64
if err != nil {
return err
}
switch maj {
case cbg.MajUnsignedInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 positive overflow")
}
case cbg.MajNegativeInt:
extraI = int64(extra)
if extraI < 0 {
return fmt.Errorf("int64 negative oveflow")
}
extraI = -1 - extraI
default:
return fmt.Errorf("wrong type for int64 field: %d", maj)
}
t.NetworkVersion = int64(extraI)
}
// t.Caller (address.Address) (struct) // t.Caller (address.Address) (struct)
{ {
@ -910,15 +869,6 @@ func (t *InspectRuntimeReturn) UnmarshalCBOR(r io.Reader) error {
return xerrors.Errorf("unmarshaling t.State: %w", err) return xerrors.Errorf("unmarshaling t.State: %w", err)
} }
}
// t.TotalFilCircSupply (big.Int) (struct)
{
if err := t.TotalFilCircSupply.UnmarshalCBOR(br); err != nil {
return xerrors.Errorf("unmarshaling t.TotalFilCircSupply: %w", err)
}
} }
return nil return nil
} }