did:cow, a proposal for an ID resolution method with most of the convenience of did:plc/did:web and the robustness of a public blockchain
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Deem that we drop the did: to save bytes

+22 -22
+12 -12
.gas-snapshot
··· 1 - CowRegistryUpdateTest:test_updateController_plc1() (gas: 101111) 2 - CowRegistryUpdateTest:test_updateController_plc2() (gas: 101154) 3 - CowRegistryUpdateTest:test_updateController_rejectsNonController() (gas: 95586) 1 + CowRegistryUpdateTest:test_updateController_plc1() (gas: 76855) 2 + CowRegistryUpdateTest:test_updateController_plc2() (gas: 76898) 3 + CowRegistryUpdateTest:test_updateController_rejectsNonController() (gas: 71387) 4 4 CowRegistryUpdateTest:test_updateController_web_long() (gas: 126007) 5 5 CowRegistryUpdateTest:test_updateController_web_medium() (gas: 76874) 6 6 CowRegistryUpdateTest:test_updateController_web_short() (gas: 76836) 7 - CowRegistryUpdateTest:test_updateController_web_verylong() (gas: 150809) 8 - CowRegistryUpdateTest:test_updateWrappedDID_plc1_to_plc2() (gas: 107611) 9 - CowRegistryUpdateTest:test_updateWrappedDID_plc2_to_plc1() (gas: 107566) 10 - CowRegistryUpdateTest:test_updateWrappedDID_rejectsAfterDeactivation() (gas: 79147) 11 - CowRegistryUpdateTest:test_updateWrappedDID_rejectsNonController() (gas: 100621) 12 - CowRegistryUpdateTest:test_updateWrappedDID_web_long() (gas: 132598) 13 - CowRegistryUpdateTest:test_updateWrappedDID_web_medium() (gas: 85910) 14 - CowRegistryUpdateTest:test_updateWrappedDID_web_short() (gas: 85956) 15 - CowRegistryUpdateTest:test_updateWrappedDID_web_verylong() (gas: 157556) 7 + CowRegistryUpdateTest:test_updateController_web_verylong() (gas: 150794) 8 + CowRegistryUpdateTest:test_updateWrappedDID_plc1_to_plc2() (gas: 80575) 9 + CowRegistryUpdateTest:test_updateWrappedDID_plc2_to_plc1() (gas: 80530) 10 + CowRegistryUpdateTest:test_updateWrappedDID_rejectsAfterDeactivation() (gas: 57084) 11 + CowRegistryUpdateTest:test_updateWrappedDID_rejectsNonController() (gas: 74148) 12 + CowRegistryUpdateTest:test_updateWrappedDID_web_long() (gas: 130099) 13 + CowRegistryUpdateTest:test_updateWrappedDID_web_medium() (gas: 80508) 14 + CowRegistryUpdateTest:test_updateWrappedDID_web_short() (gas: 80554) 15 + CowRegistryUpdateTest:test_updateWrappedDID_web_verylong() (gas: 155057)
+2 -2
src/CowRegistry.sol
··· 8 8 string wrappedDID; 9 9 } 10 10 11 - string constant DEACTIVATED = "did::"; 11 + string constant DEACTIVATED = ":"; 12 12 13 13 mapping(bytes32 => Cow) public cows; 14 14 ··· 19 19 20 20 function updateWrappedDIDByHash(bytes32 _cowHash, string memory _wrappedDID) public { 21 21 require(msg.sender == cows[_cowHash].controller); 22 - require(bytes(_wrappedDID).length > 5, "Use deactivate() to deactivate"); 22 + require(bytes(_wrappedDID).length > 1, "Use deactivate() to deactivate"); 23 23 24 24 cows[_cowHash].wrappedDID = _wrappedDID; 25 25 emit WrappedDIDUpdated(_cowHash, _wrappedDID);
+8 -8
test/CowRegistry.t.sol
··· 10 10 address controller1 = address(0x1111); 11 11 address controller2 = address(0x2222); 12 12 13 - // Two did:plc addresses (8 char prefix + 24 char base32 = 32 chars total) 14 - string plcDID1 = "did:plc:7qqsrnkn4moc2jgdxvh6aa3t"; 15 - string plcDID2 = "did:plc:abcdefghijklmnopqrstuvwx"; 13 + // Two did:plc addresses (did: prefix implied; 4 char prefix + 24 char base32 = 28 chars total) 14 + string plcDID1 = "plc:7qqsrnkn4moc2jgdxvh6aa3t"; 15 + string plcDID2 = "plc:abcdefghijklmnopqrstuvwx"; 16 16 17 - // did:web addresses of varying lengths 18 - string webDIDShort = "did:web:a.io"; 19 - string webDIDMedium = "did:web:example.com"; 20 - string webDIDLong = "did:web:subdomain.very-long-hostname.example.co.uk"; 21 - string webDIDVeryLong = "did:web:deep.nested.subdomain.with-a-quite-long-hostname.enterprise.example.com"; 17 + // did:web addresses of varying lengths (did: prefix implied) 18 + string webDIDShort = "web:a.io"; 19 + string webDIDMedium = "web:example.com"; 20 + string webDIDLong = "web:subdomain.very-long-hostname.example.co.uk"; 21 + string webDIDVeryLong = "web:deep.nested.subdomain.with-a-quite-long-hostname.enterprise.example.com"; 22 22 23 23 function setUp() public { 24 24 registry = new CowRegistry();