-
Notifications
You must be signed in to change notification settings - Fork 738
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
feat: add agent address for validators #568
Conversation
contracts/BC_fusion/StakeHub.sol
Outdated
@@ -1179,4 +1208,12 @@ contract StakeHub is System, Initializable, Protectable { | |||
uint256 bnbAmount = IStakeCredit(_validators[operatorAddress].creditContract).claim(msg.sender, requestNumber); | |||
emit Claimed(operatorAddress, msg.sender, bnbAmount); | |||
} | |||
|
|||
function _getMsgSender() internal view returns (address) { |
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.
It may be better use _getOperatorFromMsgSender
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.
_getOperatorFromMsgSender
may be inaccurate. In most cases, msg.sender
is returned directly, and in rare cases, the agent
can appear as a msg.sender
replacement for the operatorAddress
.
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.
_getOperatorByMsgSender?
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.
This method is not to get operator
address, it's to get the real msg.sender
for all address. Only in some scenarios, the agent can be the msg.sender
of the operatorAddress
.
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.
we can refer to the similar code here: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/05f218fb6617932e56bf5388c3b389c3028a7b73/contracts/metatx/ERC2771Context.sol#L55
_msgSender
is used to replace the msg.sender
and
_getMsgSender
is also used to replace the msg.sender
Description
add agent address for validators
Rationale
Agent can execute
editConsensusAddress
,editCommissionRate
,editDescription
,editVoteAddress
for his operator.Changes
Notable changes: