nibbstack / erc721

The reference implementation of the ERC-721 non-fungible token standard.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add test cases around new EXTCODEHASH behavior

fulldecent opened this issue · comments

The behavior of this implementation was changed slightly with the switch to EXTCODEHASH. Let's document this using test cases.

Mocks:

  • Contract R
    • Has a token receive function which emits an event Received
  • Contract A is R
    • Has constructor
      1. Deploys NFToken
      2. Mints token id=1
      3. Transfers token id=1 to self
  • Contract B
    • Has constructor
      1. Deploys NFToken
      2. Deploys R
      3. Transfers token id=1 to R

Tests:

  1. Test 1
    1. Transaction 1 -- Deploy NFToken
    2. Transaction 2 -- Mint token id=1
    3. Transaction 3 -- Deploy Contract R
    4. Transaction 4 -- Transfer token id=1 to R
    5. Expect NO event on Constantinople
  2. Test 2
    1. Transaction 1 -- Deploy NFToken
    2. Transaction 2 -- Mint token id=1
    3. Transaction 3 -- Deploy Contract R
    4. Expect NO event on Constantinople
  3. Test 3
    1. Transaction 1 -- Deploy Contract B
    2. Expect event on Constantinople (but no event with same test using old version of implementation)

@fulldecent do you have time to add these? The rest of the team is overbooked at the moment.

You bet, I'm on it.

I think there should be another test for a transfer to a contract that has selfdestructed, since the result of extcodehash will be different.

Progress on a test is here #241

Requesting help with this line:

https://github.com/0xcert/ethereum-erc721/pull/241/files#diff-1eaa4a12fea6a0a32769fb056436a04aR408

I need to check logs from a deploy transaction.