Challenge 8
tx.origin Misuse
LowState updates
Challenge
Review setName and determine why a nonempty name is not stored.
Starter code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HiddenName {
string public storedName;
function setName(string memory name) public {
bytes memory temp = bytes(name);
if (temp.length > 0) {
// Find the missing state assignment.
}
}
function getName() public view returns (string memory) {
return storedName;
}
}Show hint
Check whether the nonempty input is ever assigned to storedName.