Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Sep 9, 2022
1 parent 89821b1 commit 1922ca0
Show file tree
Hide file tree
Showing 14 changed files with 240 additions and 26 deletions.
7 changes: 4 additions & 3 deletions api/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

140 changes: 140 additions & 0 deletions chain/actors/builtin/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,27 @@ import (

actorstypes "github.com/filecoin-project/go-state-types/actors"
account8 "github.com/filecoin-project/go-state-types/builtin/v8/account"
cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron"
_init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
paych8 "github.com/filecoin-project/go-state-types/builtin/v8/paych"
power8 "github.com/filecoin-project/go-state-types/builtin/v8/power"
reward8 "github.com/filecoin-project/go-state-types/builtin/v8/reward"
system8 "github.com/filecoin-project/go-state-types/builtin/v8/system"
verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg"
account9 "github.com/filecoin-project/go-state-types/builtin/v9/account"
cron9 "github.com/filecoin-project/go-state-types/builtin/v9/cron"
_init9 "github.com/filecoin-project/go-state-types/builtin/v9/init"
market9 "github.com/filecoin-project/go-state-types/builtin/v9/market"
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
multisig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig"
paych9 "github.com/filecoin-project/go-state-types/builtin/v9/paych"
power9 "github.com/filecoin-project/go-state-types/builtin/v9/power"
reward9 "github.com/filecoin-project/go-state-types/builtin/v9/reward"
system9 "github.com/filecoin-project/go-state-types/builtin/v9/system"
verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
"github.com/filecoin-project/go-state-types/cbor"
rtt "github.com/filecoin-project/go-state-types/rt"

Expand Down Expand Up @@ -54,6 +74,66 @@ func MakeRegistry(av actorstypes.Version) []rtt.VMActor {
methods: account8.Methods,
state: new(account8.State),
})
case actors.CronKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: cron8.Methods,
state: new(cron8.State),
})
case actors.InitKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: _init8.Methods,
state: new(_init8.State),
})
case actors.MarketKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: market8.Methods,
state: new(market8.State),
})
case actors.MinerKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: miner8.Methods,
state: new(miner8.State),
})
case actors.MultisigKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: multisig8.Methods,
state: new(multisig8.State),
})
case actors.PaychKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: paych8.Methods,
state: new(paych8.State),
})
case actors.PowerKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: power8.Methods,
state: new(power8.State),
})
case actors.RewardKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: reward8.Methods,
state: new(reward8.State),
})
case actors.SystemKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: system8.Methods,
state: new(system8.State),
})
case actors.VerifregKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: verifreg8.Methods,
state: new(verifreg8.State),
})
}
}

Expand All @@ -66,6 +146,66 @@ func MakeRegistry(av actorstypes.Version) []rtt.VMActor {
methods: account9.Methods,
state: new(account9.State),
})
case actors.CronKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: cron9.Methods,
state: new(cron9.State),
})
case actors.InitKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: _init9.Methods,
state: new(_init9.State),
})
case actors.MarketKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: market9.Methods,
state: new(market9.State),
})
case actors.MinerKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: miner9.Methods,
state: new(miner9.State),
})
case actors.MultisigKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: multisig9.Methods,
state: new(multisig9.State),
})
case actors.PaychKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: paych9.Methods,
state: new(paych9.State),
})
case actors.PowerKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: power9.Methods,
state: new(power9.State),
})
case actors.RewardKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: reward9.Methods,
state: new(reward9.State),
})
case actors.SystemKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: system9.Methods,
state: new(system9.State),
})
case actors.VerifregKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: verifreg9.Methods,
state: new(verifreg9.State),
})
}
}

Expand Down
70 changes: 70 additions & 0 deletions chain/actors/builtin/registry.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ import (
{{range .versions}}
{{if (ge . 8)}}
account{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/account"
cron{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/cron"
_init{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/init"
multisig{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/multisig"
miner{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/miner"
market{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/market"
reward{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/reward"
paych{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/paych"
power{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/power"
system{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/system"
verifreg{{.}} "github.com/filecoin-project/go-state-types/builtin/v{{.}}/verifreg"
{{end}}
{{end}}
"github.com/filecoin-project/go-state-types/cbor"
Expand Down Expand Up @@ -56,6 +66,66 @@ func MakeRegistry(av actorstypes.Version) []rtt.VMActor {
methods: account{{.}}.Methods,
state: new(account{{.}}.State),
})
case actors.CronKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: cron{{.}}.Methods,
state: new(cron{{.}}.State),
})
case actors.InitKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: _init{{.}}.Methods,
state: new(_init{{.}}.State),
})
case actors.MarketKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: market{{.}}.Methods,
state: new(market{{.}}.State),
})
case actors.MinerKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: miner{{.}}.Methods,
state: new(miner{{.}}.State),
})
case actors.MultisigKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: multisig{{.}}.Methods,
state: new(multisig{{.}}.State),
})
case actors.PaychKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: paych{{.}}.Methods,
state: new(paych{{.}}.State),
})
case actors.PowerKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: power{{.}}.Methods,
state: new(power{{.}}.State),
})
case actors.RewardKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: reward{{.}}.Methods,
state: new(reward{{.}}.State),
})
case actors.SystemKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: system{{.}}.Methods,
state: new(system{{.}}.State),
})
case actors.VerifregKey:
registry = append(registry, RegistryEntry{
code: codeID,
methods: verifreg{{.}}.Methods,
state: new(verifreg{{.}}.State),
})
}
}
{{end}}
Expand Down
3 changes: 2 additions & 1 deletion chain/exchange/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions chain/gen/genesis/miners.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import (
"fmt"
"math/rand"

smoothing9 "github.com/filecoin-project/go-state-types/builtin/v9/util/smoothing"

miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"

market9 "github.com/filecoin-project/go-state-types/builtin/v9/market"

"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
cbg "github.com/whyrusleeping/cbor-gen"
Expand All @@ -25,6 +19,9 @@ import (
builtintypes "github.com/filecoin-project/go-state-types/builtin"
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
market9 "github.com/filecoin-project/go-state-types/builtin/v9/market"
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
smoothing9 "github.com/filecoin-project/go-state-types/builtin/v9/util/smoothing"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/network"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
Expand Down Expand Up @@ -280,6 +277,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
}
}

{
nh, err := genesisVm.Flush(ctx)
if err != nil {
return cid.Undef, xerrors.Errorf("flushing vm: %w", err)
Expand Down
4 changes: 3 additions & 1 deletion chain/stmgr/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ import (
func GetReturnType(ctx context.Context, sm *StateManager, to address.Address, method abi.MethodNum, ts *types.TipSet) (cbg.CBORUnmarshaler, error) {
act, err := sm.LoadActor(ctx, to, ts)
if err != nil {
return nil, xerrors.Errorf("(get sset) failed to load miner actor: %w", err)
return nil, xerrors.Errorf("(get sset) failed to load actor: %w", err)
}

m, found := sm.tsExec.NewActorRegistry().Methods[act.Code][method]
if !found {
return nil, fmt.Errorf("unknown method %d for actor %s", method, act.Code)
}

fmt.Println("found ", m.Ret, " and ", m.Params, " for ", m.Num)
return reflect.New(m.Ret.Elem()).Interface().(cbg.CBORUnmarshaler), nil
}

Expand Down
7 changes: 4 additions & 3 deletions chain/types/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chain/vm/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions chain/vm/invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func (*ActorRegistry) transform(instance invokee) (nativeCode, error) {
exports := instance.Exports()
runtimeType := reflect.TypeOf((*vmr.Runtime)(nil)).Elem()
for i, m := range exports {
fmt.Println("it's number ", i)
i := i
newErr := func(format string, args ...interface{}) error {
str := fmt.Sprintf(format, args...)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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-0.20220909195146-6740cdd9390d
github.com/filecoin-project/go-state-types v0.1.12-0.20220909210634-916a5a14a31b
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
Expand Down
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +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-0.20220909165003-f4ad1a59d916 h1:30E8Wwpe17E816LVRZeeN4QLklGpVO2v+1tGXuQx1Ps=
github.com/filecoin-project/go-state-types v0.1.12-0.20220909165003-f4ad1a59d916/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
github.com/filecoin-project/go-state-types v0.1.12-0.20220909170026-395c37ab732c h1:+QMHpDZ0Zhc1K1nAUg+S2Cm1muEJhGa8N8Nx2tL2Rcc=
github.com/filecoin-project/go-state-types v0.1.12-0.20220909170026-395c37ab732c/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
github.com/filecoin-project/go-state-types v0.1.12-0.20220909195146-6740cdd9390d h1:r1uMayyVGBNZv2WPWEG6Qy7PUmjX8H+tFQnHjCOjwmM=
github.com/filecoin-project/go-state-types v0.1.12-0.20220909195146-6740cdd9390d/go.mod h1:n/kujdC9JphvYTrmaD1+vJpvDPy/DwzckoMzP0nBKWI=
github.com/filecoin-project/go-state-types v0.1.12-0.20220909210634-916a5a14a31b h1:Dd7R2JHJaXrNc1kZ+Z3PIUTEy5SRbQdw8YwGyWLLZn4=
github.com/filecoin-project/go-state-types v0.1.12-0.20220909210634-916a5a14a31b/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=
Expand Down
3 changes: 2 additions & 1 deletion node/hello/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1922ca0

Please sign in to comment.