Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@tomusdrw
Copy link
Contributor

@tomusdrw tomusdrw commented Aug 7, 2018

@tomusdrw tomusdrw added A0-please_review Pull request needs code review. M4-core labels Aug 7, 2018
}
},
// NOTE [ToDr] we currently don't use unions at all.
Data::Union(_) => unimplemented!(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't imagine how to implement unions at all. For example we have a type union { a: A, b: B } (where A and B are Encodable). To encode it we need to call either A::encode or B::encode, and there is no way to know which variant a particular union contains. To alleviate that, we could use some sort of tag which gives us essentially a enum : ) So I guess it's to panic with message like unions are not supported rather than not yet implemented.

},
},
Data::Enum(ref data) => {
assert!(data.variants.len() < 256, "Currently only enums with less than 255 variants are encodable.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

less than 256 / less than or equal 255?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to at most 256 :)

/// Remote method call response.
RemoteCallResponse(RemoteCallResponse),
/// Chain-specific message
#[codec(index = "15")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be 255?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, don't know where I took 15 from.

Copy link
Contributor

@pepyakin pepyakin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's awesome! Merging as soon as CI is green

@pepyakin pepyakin added A8-looksgood and removed A0-please_review Pull request needs code review. labels Aug 8, 2018
@pepyakin pepyakin merged commit 4af260f into master Aug 8, 2018
@pepyakin pepyakin deleted the td-codecderive branch August 8, 2018 15:47
@arkpar
Copy link
Member

arkpar commented Aug 8, 2018

Does this maintain runtime compatibility?

@tomusdrw
Copy link
Contributor Author

tomusdrw commented Aug 9, 2018

@arkpar yes, it should. All the enums are encoded/decoded the same way as previously.

@pepyakin
Copy link
Contributor

pepyakin commented Aug 9, 2018

That's a good question. I assumed that it is and checked that it actually maintains compatibility.

(oops, hit submit without refreshing the page)

dvdplm added a commit that referenced this pull request Aug 9, 2018
* master:
  README: fixed typo in docker run command (#518)
  Merge *_at methods. (#515)
  New flags to listen to all interfaces (#495)
  If contract reaches max depth, return Err (#503)
  Some networking cleanups (#504)
  Derivable Encode & Decode (#509)
  substrate: return Option in all storage related RPC methods (#510)
  Build with locked Cargo.lock on CI (#514)
  Place call data into a newly allocated pages (#502)
@gavofyork
Copy link
Member

just saw this: definitely deserving of buythatmanabeer!

liuchengxu added a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
More trace log

Finish logger refine

Nit

.
liuchengxu pushed a commit to autonomys/substrate that referenced this pull request Jun 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants