Closed dev-andreavendrame closed 1 year ago
The identity.forward(address(alastriaPublicKeyRegistry), 0, addPublicKeyCallData)
instruction refers to this part of the AlastriaProxy.sol
contract:
function forward(
address destination,
uint256 value,
bytes memory data
) public onlyOwner returns(bytes memory) {
(bool ret, bytes memory result) = destination.call.value(value)(data);
require(ret);
emit Forwarded(destination, value, data, result);
return result;
}
Paying attention to the official documentation of Solidity v0.5.17 when doing a call
to an address the .value(x)
tells the amount of ETHs you are sending (in this case 0 ETH) an then the data, that is, addPublicKeyCallData
in this case, the encoding of the method signature and the inputs for the method.
Thanks for your help! Have a good day,
Andrea.
Good afternoon. We were studying the implementation of the repository and reading the code we have found a point that we don't uderstand.
In the implementation of the AlastriaIdentityManager.sol there is this a line of code that calls the PublicKeyRegistry function addKey. We have understood the overall process, but we don't understand how it is possible for the forward to call the specific "addKey" function.
The function signature is the following
function addKey(string memory publicKey)
so we need to pass a string as a parameter. The forward is called into the following function of AlastriaIdentityManagerfunction createAlastriaIdentity(bytes memory addPublicKeyCallData) public validAddress(msg.sender) isPendingAndOnTime(msg.sender) { AlastriaProxy identity = new AlastriaProxy(); identityKeys[msg.sender] = address(identity); pendingIDs[msg.sender] = 0; identity.forward(address(alastriaPublicKeyRegistry), 0, addPublicKeyCallData);//must be alastria registry call }
So our question is: what are we effectively passing with the parameter
bytes memory addPublicKeyCallData
and what does the 0 mean in the callidentity.forward(address(alastriaPublicKeyRegistry), 0, addPublicKeyCallData)
? Is the 0 a selector for the first function in the smart contract declaration?Can you provide us a concrete example of what we are passing as the function parameter value?
Thanks in advance,
Andrea Vendrame.