-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
integrating storage market actor, includes cross actor messaging #26
Conversation
98c050e
to
c5e9a8a
Compare
chain/actor_storagemarket.go
Outdated
PeerID peer.ID | ||
} | ||
|
||
func (p *CreateStorageMinerParams) UnmarshalCBOR(b []byte) (int, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having to define this on every struct kinda sucks...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I can probably call these functions on the object passed there. How does that sound?
@@ -1,9 +1,11 @@ | |||
package chain | |||
package actors_test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you name this package actors
you don't need dot import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do this because of import loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theres a circular import i think that won't work
chain/actors/actor_storagemarket.go
Outdated
} | ||
|
||
func SupportedSectorSize(ssize types.BigInt) bool { | ||
if ssize.Uint64() == 1024 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put it in a constant (possibly in the /build package for build-time constants)
chain/actors/actor_storagemarket.go
Outdated
} | ||
|
||
func (p *CreateStorageMinerParams) UnmarshalCBOR(b []byte) (int, error) { | ||
if err := cbor.DecodeInto(b, p); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically we could dedupe this bit of code across actors with tiny helper
func unmarshalCBOR(p interface{}, b []byte) (int, error) {
if err := cbor.DecodeInto(b, p); err != nil {
return 0, err
}
return len(b), nil
}
func (p *CreateStorageMinerParams) UnmarshalCBOR(b []byte) (int, error) {
return unmarshalCBOR(p, b)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made that code not needed with #29
PeerID peer.ID | ||
} | ||
|
||
func (sma StorageMinerActor) StorageMinerActor(act *types.Actor, vmctx types.VMContext, params *StorageMinerConstructorParams) (types.InvokeRet, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like we could use some reflection here (but probably shouldn't, doesn't seem worth it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean @magik6k ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could set tags on fields in StorageMinerActor
to generate params struct, and this constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constructors will frequently perform checks and so on so I would say generating this isn't really useful.
Now invoker is calling CBOR directly. License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Fix a mistake in checkPrecommit
No description provided.