There is another interesting post annotating a contract example
. I wanted to add another one of those, because I don't quite understand the contract example in Vitalik's latest blog post
Here is a description of the contract: A simple example of a contract would be a basic name registration system, allowing users to register their name with their address. This contract would not send transactions; its sole purpose is to build up a database which other nodes can then query.
The contract has the following code:
if tx.value < block.basefee * 200:
if contract.storage[tx.data] or tx.data < 100:
contract.storage[tx.data] = tx.data
I don't understand the middle if condition here. Shouldn't it just be this:
Assuming tx.data returns the address of the user, then contract.storage[tx.data] would return something if the address has been registered already. So the if statement would return true and the process would stop.
What's the point of tx.data<100? Does that check for invalid addresses?
Am I missing something else here?