Skip to content

Commit

Permalink
Change submitRRSets to use an array of structs instead of our homebre…
Browse files Browse the repository at this point in the history
…wed struct
  • Loading branch information
Arachnid committed May 14, 2021
1 parent 6b0f0f0 commit 253e6d4
Show file tree
Hide file tree
Showing 3 changed files with 1,103 additions and 283 deletions.
2 changes: 1 addition & 1 deletion contracts/DNSSEC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract contract DNSSEC {
event NSEC3DigestUpdated(uint8 id, address addr);
event RRSetUpdated(bytes name, bytes rrset);

function submitRRSets(bytes calldata data, bytes calldata proof) public virtual returns (bytes memory);
function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);
function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);
function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;
function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;
Expand Down
17 changes: 5 additions & 12 deletions contracts/DNSSECImpl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,16 @@ contract DNSSECImpl is DNSSEC, Owned {

/**
* @dev Submits multiple RRSets
* @param data The data to submit, as a series of chunks. Each chunk is
* in the format <uint16 length><bytes input><uint16 length><bytes sig>
* @param input A list of RRSets and signatures forming a chain of trust from an existing known-good record.
* @param _proof The DNSKEY or DS to validate the first signature against.
* @return The last RRSET submitted.
*/
function submitRRSets(bytes memory data, bytes memory _proof) public override returns (bytes memory) {
uint offset = 0;
function submitRRSets(RRSetWithSignature[] memory input, bytes calldata _proof) public override returns (bytes memory) {
bytes memory proof = _proof;
while(offset < data.length) {
RRSetWithSignature memory input;
input.rrset = data.substring(offset + 2, data.readUint16(offset));
offset += input.rrset.length + 2;
input.sig = data.substring(offset + 2, data.readUint16(offset));
offset += input.sig.length + 2;
proof = _submitRRSet(input, proof);
for(uint i = 0; i < input.length; i++) {
proof = _submitRRSet(input[i], proof);
}
return proof;
return _proof;
}

/**
Expand Down
Loading

0 comments on commit 253e6d4

Please sign in to comment.