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

Add dispatcher components #66

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

AgusVelez5
Copy link
Contributor

No description provided.

solanoepalacio
solanoepalacio previously approved these changes Oct 23, 2024
@nonergodic nonergodic force-pushed the dispatcher-components branch from 0cf8677 to 69ec4b2 Compare November 15, 2024 23:07
@solanoepalacio solanoepalacio dismissed their stale review November 18, 2024 12:19

Not ready to review

Copy link
Collaborator

@nonergodic nonergodic left a comment

Choose a reason for hiding this comment

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

Leaving these comments primarily for documentation/feedback. About to push a commit that addresses everything here.

.gitmodules Outdated Show resolved Hide resolved
src/TransferUtils.sol Outdated Show resolved Hide resolved
Comment on lines 8 to 10
/**
* Payment to the target failed.
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant comment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The file name is awkward. I think it's good not to just pile all the code into a single util file, but having awkwardly named Utils.sol files next to a generic Utils.sol is not the answer. The answer that scales and is clean is to create a utils subdirectory and have the individual files live in there and then expose their totality through a Utils.sol in the root directory.

Comment on lines 13 to 15
/**
* Dispatch an execute function. Execute functions almost always modify contract state.
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant comment.


function cancelOwnershipTransfer() external {
AccessControlState storage state = accessControlState();
if (state.owner != msg.sender)
Copy link
Collaborator

Choose a reason for hiding this comment

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

unconventional order comparison. Should be msg.sender != state.owner to be consistent and match convention.


function senderHasAuth() view returns (Role) {
Role role = senderRole();
if (Role.None == role)
Copy link
Collaborator

Choose a reason for hiding this comment

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

unconventional order comparison. Should be role == Role.None to match expectation.


function _acquireOwnership() internal {
AccessControlState storage state = accessControlState();
if (state.pendingOwner != msg.sender)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Inconsistent order comparison.

/**
* Dispatch a query function. Query functions never modify contract state.
*/
function dispatchQueryAccessControl(bytes calldata data, uint256 offset, uint8 query) view internal returns (bool, bytes memory, uint256) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

inconsistent use of uint256 and uint.

/**
* Dispatch an execute function. Execute functions almost always modify contract state.
*/
function dispatchExecAccessControl(bytes calldata data, uint256 offset, uint8 command) internal returns (bool, uint256) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

inconsistent use of uint256 and uint. In the original code uint is used for essentially unbounded uint values, akin to size_t while uint256 puts an emphasis on the importance of the datatype (like in a wire format, or for a value that is defined to be 256 bit).

}

function _transferEth(address to, uint256 amount) {
if (amount == 0) return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was there a deliberate choice to short-circuit zero value native token transfers but allow them for ERC20s? Do we rely anywhere on an ERC20 Transfer event even for zero value transfers?

nonergodic
nonergodic previously approved these changes Nov 19, 2024
scnale
scnale previously requested changes Nov 19, 2024
Copy link
Contributor

@scnale scnale left a comment

Choose a reason for hiding this comment

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

I'm marking this as request changes because I'm making some adjustments but have to go away. Reach out to me if I leave this hanging for too long.

README.md Outdated Show resolved Hide resolved
@scnale scnale dismissed their stale review November 21, 2024 15:02

I finished with my changes

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