Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update registrar to use expiration instead of insertion time #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 0 additions & 14 deletions README.md
Expand Up @@ -18,20 +18,6 @@ npm install '@ensdomains/dnsregistrar' --save
import '@ensdomains/dnsregistrar/contracts/dnsregistar.sol'
```

### Using js binding

In addition to `DNSRegistrar` Truffle based artifact which you can call the smart contract directly, we provide a javascript wrapper which looks up DNS record, extract a proof, submit the proof via DNSSec Oracle, and register to ENS via DNSRegistrar using the proof

```js
var DNSRegistrarJs = require('@ensdomains/dnsregistrar');
dnsregistrar = new DNSRegistrarJs(provider, dnsregistraraddress);
dnsregistrar.claim('foo.test').then(claim => {
claim.submit({ from: account });
});
```

For more detail, please [read the doc](https://dnsregistrar.readthedocs.io/en/latest/)

## Contribution guide

#### Setting up
Expand Down
6 changes: 3 additions & 3 deletions contracts/DNSClaimChecker.sol
Expand Up @@ -25,15 +25,15 @@ library DNSClaimChecker {
buf.append("\x04_ens");
buf.append(name);
bytes20 hash;
uint64 inserted;
uint32 expiration;
// Check the provided TXT record has been validated by the oracle
(, inserted, hash) = oracle.rrdata(TYPE_TXT, buf.buf);
(, expiration, hash) = oracle.rrdata(TYPE_TXT, buf.buf);
if (hash == bytes20(0) && proof.length == 0) return (address(0x0), false);

require(hash == bytes20(keccak256(proof)));

for (RRUtils.RRIterator memory iter = proof.iterateRRs(0); !iter.done(); iter.next()) {
require(inserted + iter.ttl >= block.timestamp, "DNS record is stale; refresh or delete it before proceeding.");
require(RRUtils.serialNumberGt(expiration + iter.ttl, block.timestamp), "DNS record is stale; refresh or delete it before proceeding.");

bool found;
address addr;
Expand Down
120 changes: 0 additions & 120 deletions lib/dnsregistrar.js

This file was deleted.