Skip to content
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

Merged
merged 8 commits into from
Jul 15, 2019

Conversation

whyrusleeping
Copy link
Member

No description provided.

chain/vm_test.go Outdated Show resolved Hide resolved
PeerID peer.ID
}

func (p *CreateStorageMinerParams) UnmarshalCBOR(b []byte) (int, error) {
Copy link
Member Author

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...

Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Member Author

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

}

func SupportedSectorSize(ssize types.BigInt) bool {
if ssize.Uint64() == 1024 {
Copy link
Contributor

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)

}

func (p *CreateStorageMinerParams) UnmarshalCBOR(b []byte) (int, error) {
if err := cbor.DecodeInto(b, p); err != nil {
Copy link
Contributor

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)
}

Copy link
Contributor

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) {
Copy link
Contributor

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).

Copy link
Contributor

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 ?

Copy link
Contributor

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

Copy link
Contributor

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>
Kubuxu and others added 2 commits July 15, 2019 17:51
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
@whyrusleeping whyrusleeping merged commit c4c571c into master Jul 15, 2019
@whyrusleeping whyrusleeping deleted the feat/storage-market-actor branch July 15, 2019 17:57
magik6k added a commit that referenced this pull request Aug 10, 2020
Fix a mistake in checkPrecommit
dumikau pushed a commit to protofire/lotus that referenced this pull request Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants