Handling OffchainLookup from a nested ENS resolver call
An ENS client sees an OffchainLookup revert during eth_call. Following the first URL in any such revert lets a nested contract redirect a lookup that the client intended to perform against its parent.
Check the sender encoded in the revert
Decode the error and compare its sender with the address actually called. The fixture uses labels for decoded addresses. If the error bubbled up from a different contract, the comparison fails. For an eligible lookup, follow the URL template with the specified call data and obtain the gateway response.
const called = "resolver-A";
for (const sender of ["resolver-A","nested-contract-B"])
console.log(sender === called ? "continue with this lookup" : "reject bubbled lookup");
Send the response back through the callback
Call the original contract with the returned callback selector, gateway response and original extraData. Use the result of that verification call as the record value. A gateway returning HTTP 200 only establishes transport success. Test a valid gateway reply, a modified reply, and a revert from a nested contract; they exercise three different parts of the lookup.