11

I'm working on a puzzle where msg.sender != tx.origin, so the implication is that the caller needs to be a contract or at least something in between the calling account.

But extcodesize(caller) == 0 also needs to be true. So the caller needs to be an address or externally owned account.

How can both of these be true? Can the caller's codesize ever be 0 if not an address/EOA?

Joe Blow
  • 111
  • 3

1 Answers1

13

All things must have a beginning

I think you're getting called from a contract constructor before it's committed to the chain.

At this point, it will have a (theoretical) address but no code yet in the chain. It will only get code size after the transaction completes and the block is accepted.

supakaity
  • 1,468
  • 7
  • 16
  • 1
    If this answered your question, please mark it as the correct answer. If not let me know so I can further assist. – supakaity Apr 10 '18 at 09:41