Skip to content

Commit

Permalink
decode returnData before return
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtanrikulu committed Aug 4, 2023
1 parent f888108 commit 61ab409
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion contracts/dnsregistrar/OffchainDNSResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ contract OffchainDNSResolver is IExtendedResolver {
);
uint256 size = LowLevelCallUtils.returnDataSize();
if (result) {
return LowLevelCallUtils.readReturnData(0, size);
bytes memory returnData = LowLevelCallUtils.readReturnData(
0,
size
);
return abi.decode(returnData, (bytes));
}
// Failure
if (size >= 4) {
Expand Down
6 changes: 3 additions & 3 deletions test/dnsregistrar/TestOffchainDNSResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ contract('OffchainDNSResolver', function (accounts) {
[`ENS1 ${resolver.address} foobie bletch`],
callData,
)
expect(
ethers.utils.defaultAbiCoder.decode(['bytes', 'string'], result)[1],
).to.equal('foobie bletch')
expect(ethers.utils.defaultAbiCoder.decode(['string'], result)[0]).to.equal(
'foobie bletch',
)
})

it('correctly resolves using legacy resolvers without resolve() support', async function () {
Expand Down

0 comments on commit 61ab409

Please sign in to comment.