# Ethernaut Locked with Solidity 0.5

**URL:** <https://forum.openzeppelin.com/t/ethernaut-locked-with-solidity-0-5/1115>\
**Category:** Ethernaut\
**Created:** [July 29, 2019, 6:45am UTC](https://forum.openzeppelin.com/t/ethernaut-locked-with-solidity-0-5/1115 "2019-07-29T06:45:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [July 29, 2019, 6:45am UTC](https://forum.openzeppelin.com/t/ethernaut-locked-with-solidity-0-5/1115/1 "2019-07-29T06:45:39Z")

</div>

It doesn't look like the museum `Locked` level is still possible with Solidity 0.5 and may need to be removed/retired.

In Solidity 0.4.x we could declare `NameRecord newRecord;`, though we got the following warnings:

```auto
Warning: Variable is declared as a storage pointer. 
Use an explicit "storage" keyword to silence this warning.

```

```auto
Warning: Uninitialized storage pointer. Did you mean '\<type\> memory newRecord'?

```

Solidity 0.5 changed the warning for uninitialized storage pointers to an error:

> [https://solidity.readthedocs.io/en/latest/050-breaking-changes.html](https://solidity.readthedocs.io/en/latest/050-breaking-changes.html)  
> Uninitialized storage variables are now disallowed.

The following code now errors in compilation with: `DeclarationError: Uninitialized storage pointer.` This means that the contract with the vulnerability cannot be compiled in Solidity 0.5

```auto
    function register(bytes32 _name, address _mappedAddress) public {
        // set up the new NameRecord
        NameRecord storage newRecord;
        newRecord.name = _name;
        newRecord.mappedAddress = _mappedAddress; 

        resolve[_name] = _mappedAddress;
        registeredNameRecord[msg.sender] = newRecord; 

        require(unlocked); // only allow registrations if contract is unlocked
    }

```

The walkthrough explains the original vulnerability:

> **[Ethernaut Lvl 17 Locked Walkthrough: How to properly use (and abuse) structs...](https://medium.com/coinmonks/ethernaut-lvl-17-locked-walkthrough-how-to-properly-use-structs-in-solidity-f9900c8843e2)**
>
> This is a in-depth series around Zeppelin team’s smart contract security puzzles. I’ll give you the direct resources and key concepts…

---

<div class="post-metadata">

**Author:** ![paulinablaszk](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/paulinablaszk/32/233_2.png) [@paulinablaszk](https://forum.openzeppelin.com/u/paulinablaszk)\
**Post date:** [July 29, 2019, 8:57am UTC](https://forum.openzeppelin.com/t/ethernaut-locked-with-solidity-0-5/1115/2 "2019-07-29T08:57:19Z")

</div>

Great @abcoathup, thanks!

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [July 29, 2019, 10:16am UTC](https://forum.openzeppelin.com/t/ethernaut-locked-with-solidity-0-5/1115/3 "2019-07-29T10:16:14Z")

</div>

We can retire the level. Checked with the author:

> <https://twitter.com/agemanning/status/1155772027078230016?s=21>
