Conversation
| fmt.Println(addr) | ||
| } | ||
|
|
||
| if expensiveLookup { |
There was a problem hiding this comment.
Not sure how frequently people are going to use this, my hope is if it's common enough someone will show up with a use case to determine how to handle it (e.g. if they're calling it repeatedly the type of cache that would be most useful). At the moment I don't do this more than occasionally for debugging so leaving it alone.
6f10072 to
96d8e31
Compare
96d8e31 to
727f420
Compare
| func init() { | ||
| latestInitCode := lbiinit.AllCodes()[len(lbiinit.AllCodes())-1] | ||
| if name, av, ok := actors.GetActorMetaByCode(latestInitCode); ok { | ||
| if name != manifest.InitKey { | ||
| panic(xerrors.Errorf("actor code is not init: %s", name)) | ||
| } | ||
|
|
||
| if av != actorstypes.Version13 { | ||
| panic(xerrors.Errorf( | ||
| "the application is out of date with the network, please update to a later version," + | ||
| " or if this is the latest version file an issue to update the init actor version")) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
@ribasushi is there a better way to do this? Ideally I'd be able to just use the latest version (or map a code/actor version to the init state struct), but looking for some alternative options here.
Some notes:
- This could probably be in a test (there should probably be a minimal testing setup 😅)
- More generally is the network version in the state tree somewhere such that it'd be easy enough to check that the code is out of date with the network and may/may not be accurate/safe until updated? (maybe existing code paths will already do this for me, but not sure if they all will/do now that we're not using the state manager code anymore)
There was a problem hiding this comment.
What you are doing here locks you into "latest upgrade interval" only: you won't be able to query stuff before a particular epoch this way. Not sure this is the right way to go about this at all..
Ideally you recreate something like this (or have filoz put it in go-state-types where it belongs)
https://github.com/filecoin-project/lotus/blob/master/chain/actors/builtin/init/init.go#L32-L90
There was a problem hiding this comment.
you won't be able to query stuff before a particular epoch this way. Not sure this is the right way to go about this at all
Ah, I see. So I probably still need to keep this code in place (or with a test) so as to force updating the code when a new version comes out, but I should handle the historical versions as well with some sort of large map. Not sure if this would require committing to too many abstractions from the filoz folks since I'm operating on the IPLD object so I can load it into a parallel traversing HAMT which is lower level than the abstractions they currently have.
There was a problem hiding this comment.
Afaik the HAMT never changed. I have a factored out code I will push tmrw, should make it cleaner...
There was a problem hiding this comment.
I have a factored out code I will push tmrw, should make it cleaner...
@aschmahmann ☝️ it took 2 months, but here it is: #20
|
@aschmahmann note that wip_f01dump contains all the pieces you need here, while also not making any of it expensive. Moreover - I managed to keep the versioned-imports at exactly zero, so once written this should need no further maintenance. For every For every |
This allows forcing a reverse lookup for an identity address if you really want to, it's of similar cost to
enumerate-actors.