Skip to content

Conversation

@danielailie
Copy link
Contributor

No description provided.

@danielailie danielailie self-assigned this Mar 13, 2025
@danielailie danielailie changed the base branch from main to feat/next March 13, 2025 09:40
}

/**
* Note that the first input parameter is received as an interface, but the return value is a concrete type (see guidelines).
Copy link
Contributor

Choose a reason for hiding this comment

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

Stale comment (no interface).


/**
* The number of shards (necessary for computing the shard ID) would be received as a constructor parameter - constructor is not captured by specs.
*/
Copy link
Contributor

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.

/**
* Named constructor
* Creates a metadata object from a buffer.
* Should check that data has correct length (2 bytes)
Copy link
Contributor

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

Comment on lines 50 to 62
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);
Copy link
Contributor

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?

@danielailie danielailie merged commit 524ad09 into feat/next Mar 13, 2025
4 checks passed
@danielailie danielailie deleted the TOOL-512-add-methods-description branch March 13, 2025 11:30
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.

4 participants