Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Commit

Permalink
Update resolveRegistration return values in 404 case. (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilwade authored Aug 4, 2021
1 parent 5c945f0 commit d64f10b
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 68 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ The official DSNP interface and implementations.

## Overview

**Target DSNP Spec Version**: v0.9.1

### Installation

```console
Expand Down
2 changes: 1 addition & 1 deletion contracts/IRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ interface IRegistry {
* @dev Resolve a handle to a DSNP Id and contract address
* @param handle The handle to resolve
*
* rejects if not found
* Returns zeros if not found
* @return A tuple of the DSNP Id and the Address of the contract
*/
function resolveRegistration(string calldata handle) external view returns (uint64, address);
Expand Down
4 changes: 2 additions & 2 deletions contracts/Registry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ contract Registry is IRegistry {
* @dev Resolve a handle to a DSNP Id and contract address
* @param handle The handle to resolve
*
* rejects if not found
* Returns zeros if not found
* @return A tuple of the DSNP Id and the Address of the contract
*/
function resolveRegistration(string calldata handle)
Expand All @@ -271,7 +271,7 @@ contract Registry is IRegistry {
{
Registration memory reg = registrations[handle];

require(reg.id != 0, "Handle does not exist");
if (reg.id == 0) return (0, address(0));

return (reg.id, reg.identityAddress);
}
Expand Down
110 changes: 55 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@
"chai": "^4.3.4",
"dotenv": "10.0.0",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.4.1",
"ethers": "^5.4.3",
"hardhat": "^2.4.3",
"hardhat-gas-reporter": "^1.0.4",
"js-sha3": "^0.8.0",
"prettier": "^2.3.2",
"prettier-plugin-solidity": "^1.0.0-beta.14",
"prettier-plugin-solidity": "^1.0.0-beta.17",
"solhint": "^3.3.6",
"solhint-plugin-prettier": "0.0.5",
"ts-generator": "^0.1.1",
"ts-node": "^10.0.0",
"ts-node": "^10.1.0",
"typescript": "^4.3.5"
},
"dependencies": {
Expand Down
13 changes: 6 additions & 7 deletions test/Registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,9 @@ describe("Registry", () => {

it("clears old handle and frees it for registration", async () => {
await registry.connect(signer1).changeHandle(handle, newHandle);

await expect(registry.resolveRegistration(handle)).to.be.revertedWith(
"Handle does not exist"
);
const [id, addr] = await registry.resolveRegistration(handle);
expect(addr).to.equal("0x0000000000000000000000000000000000000000");
expect(id).to.equal("0x00");

await expect(registry.connect(signer2).register(delegate2.address, handle))
.to.emit(registry, "DSNPRegistryUpdate")
Expand Down Expand Up @@ -336,9 +335,9 @@ describe("Registry", () => {
const { v, r, s } = await signEIP712(signer1, registryDomain, handleChangeTypes, message);
await registry.connect(signer2).changeHandleByEIP712Sig(v, r, s, message);

await expect(registry.resolveRegistration(handle)).to.be.revertedWith(
"Handle does not exist"
);
const [id, addr] = await registry.resolveRegistration(handle);
expect(addr).to.equal("0x0000000000000000000000000000000000000000");
expect(id).to.equal("0x00");

await expect(registry.connect(signer2).register(delegate2.address, handle))
.to.emit(registry, "DSNPRegistryUpdate")
Expand Down

0 comments on commit d64f10b

Please sign in to comment.