-
Notifications
You must be signed in to change notification settings - Fork 45
Add methods description and update code metadata #587
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
Conversation
src/core/address.ts
Outdated
| } | ||
|
|
||
| /** | ||
| * Note that the first input parameter is received as an interface, but the return value is a concrete type (see guidelines). |
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.
Stale comment (no interface).
src/core/address.ts
Outdated
|
|
||
| /** | ||
| * The number of shards (necessary for computing the shard ID) would be received as a constructor parameter - constructor is not captured by specs. | ||
| */ |
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.
Comment refers to specs, should be adjusted.
src/core/codeMetadata.ts
Outdated
| /** | ||
| * Named constructor | ||
| * Creates a metadata object from a buffer. | ||
| * Should check that data has correct length (2 bytes) |
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.
"checks" (in the implementation) vs. "should check" (in the specs).
| if (bytes.length != CodeMetadataLength) { | ||
| throw new Error(`code metadata buffer has length ${bytes.length}, expected ${CodeMetadataLength}`); | ||
| } | ||
|
|
||
| const byteZero = bytes[0]; | ||
| const byteOne = bytes[1]; | ||
|
|
||
| const upgradeable = (byteZero & CodeMetadata.ByteZero.Upgradeable) !== 0; | ||
| const readable = (byteZero & CodeMetadata.ByteZero.Readable) !== 0; | ||
| const payable = (byteOne & CodeMetadata.ByteOne.Payable) !== 0; | ||
| const payableBySc = (byteOne & CodeMetadata.ByteOne.PayableBySc) !== 0; | ||
|
|
||
| return new CodeMetadata(upgradeable, readable, payable, payableBySc); |
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.
Somehow duplicated code. Maybe call this in the old newFromBuffer?
No description provided.