From 814f5649921d5b99edc2369d67fba4fceb65d393 Mon Sep 17 00:00:00 2001 From: "artem.ivanov" Date: Mon, 19 Feb 2024 17:20:33 +0400 Subject: [PATCH] Corrected legacy DID mapping storage Signed-off-by: artem.ivanov --- examples/migration/src/ledger.rs | 2 +- network/config/besu/genesis.json | 6 +- network/config/nodes/validator5/key | 2 +- .../contracts-ts/LegacyMappingRegistry.ts | 21 +++++-- .../migration/LegacyMappingErrors.sol | 6 ++ .../migration/LegacyMappingRegistry.sol | 55 +++++++++++++------ .../LegacyMappingRegistryInterface.sol | 26 +++++---- .../migration/LegacyMappingRegistry.spec.ts | 49 +++++++++++++---- smart_contracts/test/utils/errors.ts | 1 + vdr/src/contracts/did/types/did.rs | 10 +++- .../migration/legacy_mapping_registry.rs | 7 ++- 11 files changed, 133 insertions(+), 52 deletions(-) diff --git a/examples/migration/src/ledger.rs b/examples/migration/src/ledger.rs index 53611c3b..fa32f4c0 100644 --- a/examples/migration/src/ledger.rs +++ b/examples/migration/src/ledger.rs @@ -26,7 +26,7 @@ use indy_vdr::{ utils::did::DidValue, }; use serde::{Deserialize, Serialize}; -use serde_json::{json, Value}; +use serde_json::json; use std::{env, fs, str::FromStr, time::Duration}; pub enum Ledgers { diff --git a/network/config/besu/genesis.json b/network/config/besu/genesis.json index 2c3f90b4..2caff197 100644 --- a/network/config/besu/genesis.json +++ b/network/config/besu/genesis.json @@ -226,8 +226,12 @@ "0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000019999", "0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000006666", "f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00": "0x0000000000000000000000000000000000000000000000000000000000000001", - "360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000001260ced660d8d3c81c029f3615205db7c5028cb0" + "360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000eef1c6eb20009bd29be8a4349a056a98805e37d5" } + }, + "0xeef1c6eb20009bd29be8a4349a056a98805e37d5": { + "comment": "Implementation: Smart contract to store mapping of legacy identifiers to new one", + "code": "0x6080604052600436106100915760003560e01c80639a3265d9116100595780639a3265d914610140578063ad3cb1cc14610160578063c0c53b8b14610191578063c612ab58146101b1578063d924aedb146101d157600080fd5b80634f1ef2861461009657806352d1902d146100ab57806353aac465146100d35780637223460a146100f357806393a8c74214610113575b600080fd5b6100a96100a4366004612326565b6101f1565b005b3480156100b757600080fd5b506100c0610210565b6040519081526020015b60405180910390f35b3480156100df57600080fd5b506100a96100ee3660046123d9565b61022d565b3480156100ff57600080fd5b506100a961010e3660046124b7565b6102ee565b34801561011f57600080fd5b5061013361012e366004612587565b6103a8565b6040516100ca919061261f565b34801561014c57600080fd5b506100a961015b366004612632565b61044d565b34801561016c57600080fd5b50610133604051806040016040528060058152602001640352e302e360dc1b81525081565b34801561019d57600080fd5b506100a96101ac3660046126e5565b610468565b3480156101bd57600080fd5b506101336101cc366004612587565b61057c565b3480156101dd57600080fd5b506100a96101ec366004612728565b6105a0565b6101f96105b9565b61020282610660565b61020c82826106c6565b5050565b600061021a61078d565b50600080516020612c4f83398151915290565b6000601960f81b600060f81b308e8b8b8b8b8b8b8b60405160200161025c9b9a999897969594939291906127d2565b60408051601f1981840301815282825280516020918201206000845290830180835281905260ff8e1691830191909152606082018c9052608082018b905291506102e0908d9060019060a0016020604051602081039080840390855afa1580156102ca573d6000803e3d6000fd5b505050602060405103518a8a8a8a8a8a8a6107d6565b505050505050505050505050565b60405160009061031890601960f81b90839030908f908c908c908c908c908c908c90602001612864565b60408051601f1981840301815282825280516020918201206000845290830180835281905260ff8d1691830191909152606082018b9052608082018a9052915061039b908c9060019060a0016020604051602081039080840390855afa158015610386573d6000803e3d6000fd5b50505060206040510351898989898989610ad5565b5050505050505050505050565b8051602081830181018051600382529282019190930120915280546103cc906128fa565b80601f01602080910402602001604051908101604052809291908181526020018280546103f8906128fa565b80156104455780601f1061041a57610100808354040283529160200191610445565b820191906000526020600020905b81548152906001019060200180831161042857829003601f168201915b505050505081565b61045e8833898989898989896107d6565b5050505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460019190600160401b900460ff16806104b1575080546001600160401b03808416911610155b156104cf5760405163f92ee8a960e01b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b03831617600160401b1781556104f985610e0e565b600180546001600160a01b038681166001600160a01b0319928316179092556002805492861692909116919091179055805468ff0000000000000000191681556040516001600160401b03831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050565b8051602081830181018051600482529282019190930120915280546103cc906128fa565b6105b08733888888888888610ad5565b50505050505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061064057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610634600080516020612c4f833981519152546001600160a01b031690565b6001600160a01b031614155b1561065e5760405163703e46dd60e11b815260040160405180910390fd5b565b60005460405163574a81d760e01b81523060048201526001600160a01b0383811660248301529091169063574a81d79060440160006040518083038186803b1580156106ab57600080fd5b505afa1580156106bf573d6000803e3d6000fd5b5050505050565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610720575060408051601f3d908101601f1916820190925261071d9181019061292e565b60015b61074d57604051634c9c8ce360e01b81526001600160a01b03831660048201526024015b60405180910390fd5b600080516020612c4f833981519152811461077e57604051632a87526960e21b815260048101829052602401610744565b6107888383610e38565b505050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461065e5760405163703e46dd60e11b815260040160405180910390fd5b8888806001600160a01b0316826001600160a01b03161461081d576040516316343f1760e31b81526001600160a01b03808316600483015283166024820152604401610744565b6002546040516301daf29b60e21b81523360048201526001600160a01b039091169063076bca6c9060240160006040518083038186803b15801561086057600080fd5b505afa158015610874573d6000803e3d6000fd5b5050505061093961092c60038b8b604051610890929190612947565b908152602001604051809103902080546108a9906128fa565b80601f01602080910402602001604051908101604052809291908181526020018280546108d5906128fa565b80156109225780601f106108f757610100808354040283529160200191610922565b820191906000526020600020905b81548152906001019060200180831161090557829003601f168201915b5050505050610e8e565b6001600160801b03161590565b61095a578888604051630ab7bdc760e21b8152600401610744929190612980565b846001600160801b0319166109a48a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e9f92505050565b6109ad90612994565b6001600160801b031916146109db57848989604051630876c99d60e21b8152600401610744939291906129cb565b610a26610a1d88888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610eaa92505050565b60200151610ff5565b6001600160a01b03168b6001600160a01b031614610a5b578686604051631859e3bb60e11b8152600401610744929190612980565b868660038b8b604051610a6f929190612947565b90815260200160405180910390209182610a8a929190612a35565b507ff214be33ffacf63cd5f2d1636bef433e47c400b94d565c786049bfa836c20e1989898989604051610ac09493929190612af4565b60405180910390a15050505050505050505050565b8787806001600160a01b0316826001600160a01b031614610b1c576040516316343f1760e31b81526001600160a01b03808316600483015283166024820152604401610744565b6002546040516301daf29b60e21b81523360048201526001600160a01b039091169063076bca6c9060240160006040518083038186803b158015610b5f57600080fd5b505afa158015610b73573d6000803e3d6000fd5b5050505060048686604051610b89929190612947565b90815260200160405180910390208054610ba2906128fa565b159050610bc65785856040516327ef3c3d60e01b8152600401610744929190612980565b610bde61092c60038a8a604051610890929190612947565b15610c0057858560405163a54e9cfb60e01b8152600401610744929190612980565b6000610cb6610a1d60038b8b604051610c1a929190612947565b90815260200160405180910390208054610c33906128fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610c5f906128fa565b8015610cac5780601f10610c8157610100808354040283529160200191610cac565b820191906000526020600020905b815481529060010190602001808311610c8f57829003601f168201915b5050505050610eaa565b9050806001600160a01b03168b6001600160a01b031614610cfd576040516316343f1760e31b81526001600160a01b03808d16600483015282166024820152604401610744565b610d84610d3f8a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e8e92505050565b610d7e89898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e8e92505050565b9061102e565b610da95786868a8a60405163998f70a160e01b81526004016107449493929190612af4565b848460048989604051610dbd929190612947565b90815260200160405180910390209182610dd8929190612a35565b507f87526cc0385862de920bf8b05560b5c9eb58f8af45be9f917801198166655f8887878787604051610ac09493929190612af4565b610e16611041565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b610e418261108a565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115610e865761078882826110ef565b61020c611165565b6000610e9982611184565b92915050565b6060610e9982611198565b60408051808201909152606080825260208201526000610ec983610e8e565b90506000610eef604051806040016040528060018152602001601d60f91b815250610e8e565b9050600080610efe84846114be565b955092509050801580610f3c5750610f3a610f3360405180604001604052806003815260200162191a5960ea1b815250610e8e565b839061150c565b155b15610f5c5785604051631859e3bb60e11b8152600401610744919061261f565b610f6684846114be565b95509250905080610f8c5785604051631859e3bb60e11b8152600401610744919061261f565b6040805180820190915260608082526020820152610fa983611518565b81526040805180820190915260018152601d60f91b6020820152610fd790610fd090610e8e565b8690611523565b9450610fe69150849050611518565b60208201529695505050505050565b60006016611001835190565b0361100e57506000919050565b60006110198361154d565b905061102481612b26565b60601c9392505050565b600061103a838361173f565b9392505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661065e57604051631afcd79f60e31b815260040160405180910390fd5b806001600160a01b03163b6000036110c057604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610744565b600080516020612c4f83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b03168460405161110c9190612b59565b600060405180830381855af49150503d8060008114611147576040519150601f19603f3d011682016040523d82523d6000602084013e61114c565b606091505b509150915061115c858383611757565b95945050505050565b341561065e5760405163b398979f60e01b815260040160405180910390fd5b60008060208301905061103a8184516117b3565b80516060906031906000805b82811080156111cb5750838682815181106111c1576111c1612b75565b016020015160f81c145b156111dc57600191820191016111a4565b5060008080806117e361209f8702046001016002026001600160401b038111156112085761120861229b565b6040519080825280601f01601f191660200182016040528015611232576020820181803683370190505b5090506000600460038801046001600160401b038111156112555761125561229b565b60405190808252806020026020018201604052801561127e578160200160208202803683370190505b50905060005b8a5181101561137c5760008b82815181106112a1576112a1612b75565b602001015160f81c60f81b90506112d06040518060600160405280603a8152602001612c8f603a9139826117bf565b9096509450846112f5578b604051634cb9e47360e11b8152600401610744919061261f565b8251600019015b60008112611372578684828151811061131757611317612b75565b602002602001015163ffffffff16603a026001600160401b0316019750602088901c96508763ffffffff1684828151811061135457611354612b75565b63ffffffff90921660209283029190910190910152600019016112fc565b5050600101611284565b50600860038816026001600160401b038116600003611399575060205b600719016000805b8351811015611443575b6020836001600160401b0316101561143757826001600160401b03168482815181106113d9576113d9612b75565b602002602001015163ffffffff16901c60f81b8583815181106113fe576113fe612b75565b60200101906001600160f81b031916908160001a90535060019091019060086001600160401b03841610611437576008830392506113ab565b601892506001016113a1565b50875b84518110156114a157600060f81b85828151811061146657611466612b75565b01602001516001600160f81b031916111561149957611488858a830384611822565b9d9c50505050505050505050505050565b600101611446565b506114ae84600083611822565b9c9b505050505050505050505050565b60008080806114cd86866118d3565b905060001981036114e957600086600093509350935050611505565b6114fd86826001600160801b0388166119de565b935093509350505b9250925092565b600061103a8383611a4b565b6060610e9982611a95565b60008080806115328686611b0c565b905060001981036114e9576000808793509350935050611505565b6060600061155a83610e8e565b9050600061158160405180604001604052806002815260200161060f60f31b815250610e8e565b90506115b06115a960405180604001604052806002815260200161060f60f31b815250610e8e565b8390611bfe565b6115cb57505060408051602081019091526000815292915050565b6115dd6115d88383611c0a565b611518565b935060008490506000600282516115f49190612ba1565b6001600160401b0381111561160b5761160b61229b565b6040519080825280601f01601f191660200182016040528015611635576020820181803683370190505b50905060005b81518110156117355760008061167a85611656856002612bc3565b8151811061166657611666612b75565b01602001516001600160f81b031916611c16565b915091508061169f575050604080516020810190915260008152979650505050505050565b6000806116bc876116b1876002612bc3565b611656906001612bda565b91509150806116e35750506040805160208101909152600081529998505050505050505050565b816116ef856010612bed565b6116f99190612c09565b60f81b86868151811061170e5761170e612b75565b60200101906001600160f81b031916908160001a905350506001909301925061163b915050565b5095945050505050565b600060001961174e84846118d3565b14159392505050565b60608261176c5761176782611cfc565b61103a565b815115801561178357506001600160a01b0384163b155b156117ac57604051639996b31560e01b81526001600160a01b0385166004820152602401610744565b5092915050565b600061103a8383611d25565b60008060005b845181101561181257836001600160f81b0319168582815181106117eb576117eb612b75565b01602001516001600160f81b0319160361180a5791506001905061181b565b6001016117c5565b50600080915091505b9250929050565b606060008383036001600160401b038111156118405761184061229b565b6040519080825280601f01601f19166020018201604052801561186a576020820181803683370190505b50905060005b8484038110156118ca57858582018151811061188e5761188e612b75565b602001015160f81c60f81b8282815181106118ab576118ab612b75565b60200101906001600160f81b031916908160001a905350600101611870565b50949350505050565b60006001600160801b038381169083168083036118f557600092505050610e99565b81158061190157508181115b156119125760001992505050610e99565b600061191e8660801c90565b9050600061192c8660801c90565b9050600061193b825160001a90565b90505b600061194b848784611d31565b90506000198103611966576000199650505050505050610e99565b94859003949283019285851115611987576000199650505050505050610e99565b848320858520036119b35761199c8960801c90565b6119a69085612c22565b9650505050505050610e99565b856001036119cb576000199650505050505050610e99565b600019909501946001909301925061193e565b6000806000806119ee8760801c90565b90506001600160801b03871685870181811115611a1e576040516365f4e9df60e01b815260040160405180910390fd5b6001996001600160801b03988916608085811b919091179a50928290039098169201901b17949350505050565b60006001600160801b038381169083168114611a6b576000915050610e99565b611a8d611a788560801c90565b611a828560801c90565b839081902091201490565b949350505050565b60606001600160801b0382166001600160401b03811115611ab857611ab861229b565b6040519080825280601f01601f191660200182016040528015611ae2576020820181803683370190505b50905060208101611b0681611af78560801c90565b6001600160801b038616611df8565b50919050565b60006001600160801b03838116908316808303611b2e57600092505050610e99565b811580611b3a57508181115b15611b4b5760001992505050610e99565b6000611b578660801c90565b90506000611b658660801c90565b90506000611b7287611e06565b905060001984015b6000611b87858885611e4b565b90506000198103611ba357600019975050505050505050610e99565b80821115611bbc57600019975050505050505050610e99565b858420828203868101889020909103611bde579750610e999650505050505050565b8115611bec57509550611b7a565b60001998505050505050505050610e99565b600061103a8383611eff565b600061103a8383611f4c565b600080600360fc1b6001600160f81b0319841610801590611c455750603960f81b6001600160f81b0319841611155b15611c6357611c59603060f885901c612c35565b9360019350915050565b604160f81b6001600160f81b0319841610801590611c8f5750602360f91b6001600160f81b0319841611155b15611caf576041611ca560f885901c600a612c09565b611c599190612c35565b606160f81b6001600160f81b0319841610801590611cdb5750603360f91b6001600160f81b0319841611155b15611cf1576061611ca560f885901c600a612c09565b506000928392509050565b805115611d0c5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b600061103a8383611fa6565b600060208311611d4d57611d4684848461200c565b905061103a565b83601f8416808503820160ff8516600080516020612c6f833981519152025b81881015611dae5787518118611d818161211d565b15611da257848903611d958a60208a61200c565b019550505050505061103a565b60208901985050611d6c565b82600003611dc45760001994505050505061103a565b611dcf82848861200c565b94506000198503611de85760001994505050505061103a565b838203850194505050505061103a565b8083828460045afa50505050565b60006001600160801b038216808203611e32576040516365f4e9df60e01b815260040160405180910390fd5b61103a60018203611e438560801c90565b015160001a90565b600060208311611e6057611d46848484612168565b601f83168484018115611e98578190036000611e7d828487612168565b90506000198114611e96579086900301915061103a9050565b505b60ff8416600080516020612c6f833981519152025b86821115611ef157601f1990910180519091908118611ecb8161211d565b15611eeb57878303611edf84602089612168565b0194505050505061103a565b50611ead565b506000199695505050505050565b60006001600160801b0383811690831680821015611f2257600092505050610e99565b8481831115611f3857611f3586836121b1565b90505b611f428186611a4b565b9695505050505050565b60006001600160801b0383811690831681811115611f6e578492505050610e99565b600080611f7b87846121fc565b9092509050611f8a8287611a4b565b15611f9a579350610e9992505050565b86945050505050610e99565b60006001600160801b03831115611fd05760405163fee7506f60e01b815260040160405180910390fd5b6001600160801b03821115611ff857604051633b6b098d60e01b815260040160405180910390fd5b506001600160801b031660809190911b1790565b825160009081602085111561202057602094505b601285106120aa5760ff8416600080516020612c6f8339815191520282186120506001600160801b03821761211d565b6000036120865760109150601a8610612081576120756001600160401b03821761211d565b60000361208157601891505b6120a4565b6120986001600160c01b03821761211d565b6000036120a457600891505b506120e8565b600a85106120e85760ff8416600080516020612c6f8339815191520282186120da6001600160c01b03821761211d565b6000036120e657600891505b505b848110156121105781811a60ff851681036121075750915061103a9050565b506001016120e8565b5060001995945050505050565b7ffefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefeff81019019167f80808080808080808080808080808080808080808080808080808080808080801690565b6000602083111561217857602092505b83515b83156121a5576000199093019280841a60ff8416810361219f57849250505061103a565b5061217b565b50600019949350505050565b60006001600160801b038316808311156121de576040516365f4e9df60e01b815260040160405180910390fd5b611a8d6121eb8560801c90565b60801b6001600160801b0385161790565b600080600061220b8560801c90565b90506001600160801b03851680851115612238576040516365f4e9df60e01b815260040160405180910390fd5b608082901b6001600160801b038616176122726122558785612bda565b61225f8885612c22565b6001600160801b031660809190911b1790565b9350935050509250929050565b80356001600160a01b038116811461229657600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b03808411156122cb576122cb61229b565b604051601f8501601f19908116603f011681019082821181831017156122f3576122f361229b565b8160405280935085815286868601111561230c57600080fd5b858560208301376000602087830101525050509392505050565b6000806040838503121561233957600080fd5b6123428361227f565b915060208301356001600160401b0381111561235d57600080fd5b8301601f8101851361236e57600080fd5b61237d858235602084016122b1565b9150509250929050565b803560ff8116811461229657600080fd5b60008083601f8401126123aa57600080fd5b5081356001600160401b038111156123c157600080fd5b60208301915083602082850101111561181b57600080fd5b60008060008060008060008060008060006101008c8e0312156123fb57600080fd5b6124048c61227f565b9a5061241260208d01612387565b995060408c0135985060608c013597506001600160401b038060808e0135111561243b57600080fd5b61244b8e60808f01358f01612398565b909850965060a08d013581101561246157600080fd5b6124718e60a08f01358f01612398565b909650945060c08d0135935060e08d013581101561248e57600080fd5b5061249f8d60e08e01358e01612398565b81935080925050509295989b509295989b9093969950565b60008060008060008060008060008060e08b8d0312156124d657600080fd5b6124df8b61227f565b99506124ed60208c01612387565b985060408b0135975060608b0135965060808b01356001600160401b038082111561251757600080fd5b6125238e838f01612398565b909850965060a08d013591508082111561253c57600080fd5b6125488e838f01612398565b909650945060c08d013591508082111561256157600080fd5b5061256e8d828e01612398565b915080935050809150509295989b9194979a5092959850565b60006020828403121561259957600080fd5b81356001600160401b038111156125af57600080fd5b8201601f810184136125c057600080fd5b611a8d848235602084016122b1565b60005b838110156125ea5781810151838201526020016125d2565b50506000910152565b6000815180845261260b8160208601602086016125cf565b601f01601f19169290920160200192915050565b60208152600061103a60208301846125f3565b60008060008060008060008060a0898b03121561264e57600080fd5b6126578961227f565b975060208901356001600160401b038082111561267357600080fd5b61267f8c838d01612398565b909950975060408b013591508082111561269857600080fd5b6126a48c838d01612398565b909750955060608b0135945060808b01359150808211156126c457600080fd5b506126d18b828c01612398565b999c989b5096995094979396929594505050565b6000806000606084860312156126fa57600080fd5b6127038461227f565b92506127116020850161227f565b915061271f6040850161227f565b90509250925092565b60008060008060008060006080888a03121561274357600080fd5b61274c8861227f565b965060208801356001600160401b038082111561276857600080fd5b6127748b838c01612398565b909850965060408a013591508082111561278d57600080fd5b6127998b838c01612398565b909650945060608a01359150808211156127b257600080fd5b506127bf8a828b01612398565b989b979a50959850939692959293505050565b6001600160f81b03198c811682528b1660018201526001600160601b031960608b811b821660028401528a901b1660168201526f6372656174654469644d617070696e6760801b602a82015260008789603a840137878201603a8101600081528789823750868101905085603a8201528385605a83013760009301605a0192835250909b9a5050505050505050505050565b6001600160f81b03198b811682528a1660018201526001600160601b031960608a811b8216600284015289901b166016820152746372656174655265736f757263654d617070696e6760581b602a82015260008688603f840137868201603f81016000815286888237508581019050603f810160008152848682375060009301603f0192835250909a9950505050505050505050565b600181811c9082168061290e57607f821691505b602082108103611b0657634e487b7160e01b600052602260045260246000fd5b60006020828403121561294057600080fd5b5051919050565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000611a8d602083018486612957565b805160208201516001600160801b031980821692919060108310156129c35780818460100360031b1b83161693505b505050919050565b83815260406020820152600061115c604083018486612957565b601f821115610788576000816000526020600020601f850160051c81016020861015612a0e5750805b601f850160051c820191505b81811015612a2d57828155600101612a1a565b505050505050565b6001600160401b03831115612a4c57612a4c61229b565b612a6083612a5a83546128fa565b836129e5565b6000601f841160018114612a945760008515612a7c5750838201355b600019600387901b1c1916600186901b1783556106bf565b600083815260209020601f19861690835b82811015612ac55786850135825560209485019460019092019101612aa5565b5086821015612ae25760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b604081526000612b08604083018688612957565b8281036020840152612b1b818587612957565b979650505050505050565b805160208201516001600160601b031980821692919060148310156129c35760149290920360031b82901b161692915050565b60008251612b6b8184602087016125cf565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082612bbe57634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610e9957610e99612b8b565b80820180821115610e9957610e99612b8b565b60ff81811683821602908116908181146117ac576117ac612b8b565b60ff8181168382160190811115610e9957610e99612b8b565b81810381811115610e9957610e99612b8b565b60ff8281168282160390811115610e9957610e99612b8b56fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc010101010101010101010101010101010101010101010101010101010101010131323334353637383941424344454647484a4b4c4d4e505152535455565758595a6162636465666768696a6b6d6e6f707172737475767778797aa2646970667358221220a1a77c06017df881782bb0eed54642eef1257622f07541acbf4f3fdc02dd06d064736f6c63430008170033" } } } diff --git a/network/config/nodes/validator5/key b/network/config/nodes/validator5/key index d7c75beb..ab007754 100644 --- a/network/config/nodes/validator5/key +++ b/network/config/nodes/validator5/key @@ -1 +1 @@ -0x07ea290d6bbf126219bdc300a3297528833af27e0e10355e2d2d8a76f04045af \ No newline at end of file +0x93945e32f8cb4afb4275cb014b363ccc794b0991eeab810ceadcaedf400d8c28 \ No newline at end of file diff --git a/smart_contracts/contracts-ts/LegacyMappingRegistry.ts b/smart_contracts/contracts-ts/LegacyMappingRegistry.ts index d46645c8..1c5fd875 100644 --- a/smart_contracts/contracts-ts/LegacyMappingRegistry.ts +++ b/smart_contracts/contracts-ts/LegacyMappingRegistry.ts @@ -8,17 +8,19 @@ export class LegacyMappingRegistry extends Contract { public async createDidMapping( identity: string, - identifier: string, + legacyIdentifier: string, + newDid: string, ed25519Key: Uint8Array, ed25519Signature: Uint8Array, ) { - const tx = await this.instance.createDidMapping(identity, identifier, ed25519Key, ed25519Signature) + const tx = await this.instance.createDidMapping(identity, legacyIdentifier, newDid, ed25519Key, ed25519Signature) return tx.wait() } public async createDidMappingSigned( identity: string, - identifier: string, + legacyIdentifier: string, + newDid: string, ed25519Key: Uint8Array, ed25519Signature: Uint8Array, signature: Signature, @@ -28,7 +30,8 @@ export class LegacyMappingRegistry extends Contract { signature.v, signature.r, signature.s, - identifier, + legacyIdentifier, + newDid, ed25519Key, ed25519Signature, ) @@ -82,12 +85,20 @@ export class LegacyMappingRegistry extends Contract { identity: string, privateKey: Uint8Array, identifier: string, + issuerDid: string, ed25519Key: Uint8Array, ed25519Signature: Uint8Array, ) { return this.signEndorsementData( privateKey, - concat([identity, toUtf8Bytes('createDidMapping'), toUtf8Bytes(identifier), ed25519Key, ed25519Signature]), + concat([ + identity, + toUtf8Bytes('createDidMapping'), + toUtf8Bytes(identifier), + toUtf8Bytes(issuerDid), + ed25519Key, + ed25519Signature, + ]), ) } diff --git a/smart_contracts/contracts/migration/LegacyMappingErrors.sol b/smart_contracts/contracts/migration/LegacyMappingErrors.sol index 74f03d3f..898a46df 100644 --- a/smart_contracts/contracts/migration/LegacyMappingErrors.sol +++ b/smart_contracts/contracts/migration/LegacyMappingErrors.sol @@ -7,6 +7,12 @@ pragma solidity ^0.8.20; */ error DidMappingAlreadyExist(string identifier); +/** + * @notice Error that occurs when DID mapping does not exist. + * @param identifier Legacy DID identifier. + */ +error DidMappingDoesNotExist(string identifier); + /** * @notice Error that occurs when trying to add a duplicating mapping for a legacy resource identifier. * @param identifier Legacy Schema/CredDef identifier. diff --git a/smart_contracts/contracts/migration/LegacyMappingRegistry.sol b/smart_contracts/contracts/migration/LegacyMappingRegistry.sol index c5fd1ec5..a0a299fb 100644 --- a/smart_contracts/contracts/migration/LegacyMappingRegistry.sol +++ b/smart_contracts/contracts/migration/LegacyMappingRegistry.sol @@ -2,14 +2,15 @@ pragma solidity ^0.8.20; import { ControlledUpgradeable } from "../upgrade/ControlledUpgradeable.sol"; -import { DidMappingAlreadyExist, ResourceMappingAlreadyExist, InvalidEd25519Key, InvalidResourceId } from "./LegacyMappingErrors.sol"; -import { NotIdentityOwner } from "../did/DidErrors.sol"; +import { DidMappingAlreadyExist, ResourceMappingAlreadyExist, InvalidEd25519Key, InvalidResourceId, DidMappingDoesNotExist } from "./LegacyMappingErrors.sol"; +import { NotIdentityOwner, IncorrectDid } from "../did/DidErrors.sol"; import { UniversalDidResolverInterface } from "../did/UniversalDidResolverInterface.sol"; import { LegacyMappingRegistryInterface } from "./LegacyMappingRegistryInterface.sol"; import { RoleControlInterface } from "../auth/RoleControl.sol"; +import { DidUtils } from "../did/DidUtils.sol"; import { Base58 } from "../utils/Base58.sol"; -import { toSlice } from "@dk1a/solidity-stringutils/src/StrSlice.sol"; +import { toSlice, isEmpty } from "@dk1a/solidity-stringutils/src/StrSlice.sol"; using { toSlice } for string; @@ -21,11 +22,10 @@ contract LegacyMappingRegistry is LegacyMappingRegistryInterface, ControlledUpgr RoleControlInterface internal _roleControl; - // FIXME: Now, since we have `indybesu` and `ethr` DID methods having account as identifier we need to change value of `didMapping` /* * Mapping storing indy/sov DID identifiers to the corresponding account address */ - mapping(string legacyDid => address account) public didMapping; + mapping(string legacyDid => string did) public didMapping; /* * Mapping storing indy/sov formatted identifiers of schema/credential-definition to the corresponding new form @@ -61,11 +61,12 @@ contract LegacyMappingRegistry is LegacyMappingRegistryInterface, ControlledUpgr /// @inheritdoc LegacyMappingRegistryInterface function createDidMapping( address identity, - string calldata identifier, + string calldata legacyIdentifier, + string calldata newDid, bytes32 ed25519Key, bytes calldata ed25519Signature ) public virtual { - _createDidMapping(identity, msg.sender, identifier, ed25519Key, ed25519Signature); + _createDidMapping(identity, msg.sender, legacyIdentifier, newDid, ed25519Key, ed25519Signature); } /// @inheritdoc LegacyMappingRegistryInterface @@ -74,7 +75,8 @@ contract LegacyMappingRegistry is LegacyMappingRegistryInterface, ControlledUpgr uint8 sigV, bytes32 sigR, bytes32 sigS, - string calldata identifier, + string calldata legacyIdentifier, + string calldata newDid, bytes32 ed25519Key, bytes calldata ed25518Signature ) public virtual { @@ -85,12 +87,20 @@ contract LegacyMappingRegistry is LegacyMappingRegistryInterface, ControlledUpgr address(this), identity, "createDidMapping", - identifier, + legacyIdentifier, + newDid, ed25519Key, ed25518Signature ) ); - _createDidMapping(identity, ecrecover(hash, sigV, sigR, sigS), identifier, ed25519Key, ed25518Signature); + _createDidMapping( + identity, + ecrecover(hash, sigV, sigR, sigS), + legacyIdentifier, + newDid, + ed25519Key, + ed25518Signature + ); } /// @inheritdoc LegacyMappingRegistryInterface @@ -137,20 +147,24 @@ contract LegacyMappingRegistry is LegacyMappingRegistryInterface, ControlledUpgr function _createDidMapping( address identity, address actor, - string calldata identifier, + string calldata legacyIdentifier, + string calldata newDid, bytes32 ed25519Key, bytes calldata ed25518Signature ) internal _identityOwner(identity, actor) _senderIsTrusteeOrEndorserOrSteward { // Checks the uniqueness of the DID mapping - if (didMapping[identifier] != address(0x00)) revert DidMappingAlreadyExist(identifier); + if (!isEmpty(didMapping[legacyIdentifier].toSlice())) revert DidMappingAlreadyExist(legacyIdentifier); // Checks that Ed25519 key matches to the legacy DID identifier - if (bytes16(Base58.decodeFromString(identifier)) != bytes16(ed25519Key)) - revert InvalidEd25519Key(ed25519Key, identifier); + if (bytes16(Base58.decodeFromString(legacyIdentifier)) != bytes16(ed25519Key)) + revert InvalidEd25519Key(ed25519Key, legacyIdentifier); + + if (identity != DidUtils.convertEthereumIdentifierToAddress(DidUtils.parseDid(newDid).identifier)) + revert IncorrectDid(newDid); // TODO: check ed25519 signature validity - didMapping[identifier] = identity; - emit DidMappingCreated(identifier, identity); + didMapping[legacyIdentifier] = newDid; + emit DidMappingCreated(legacyIdentifier, newDid); } function _createResourceMapping( @@ -163,9 +177,14 @@ contract LegacyMappingRegistry is LegacyMappingRegistryInterface, ControlledUpgr // Checks the uniqueness of the Resource mapping if (bytes(resourceMapping[legacyIdentifier]).length != 0) revert ResourceMappingAlreadyExist(legacyIdentifier); + // Check that DID mapping was created + if (isEmpty(didMapping[legacyIssuerIdentifier].toSlice())) revert DidMappingDoesNotExist(legacyIdentifier); + // Checks that owner of legacy DID controlled by identity account - if (identity != didMapping[legacyIssuerIdentifier]) - revert NotIdentityOwner(identity, didMapping[legacyIssuerIdentifier]); + address owner = DidUtils.convertEthereumIdentifierToAddress( + DidUtils.parseDid(didMapping[legacyIssuerIdentifier]).identifier + ); + if (identity != owner) revert NotIdentityOwner(identity, owner); // Checks that legacy issuer identifier is included into resource identifier if (!legacyIdentifier.toSlice().contains(legacyIssuerIdentifier.toSlice())) diff --git a/smart_contracts/contracts/migration/LegacyMappingRegistryInterface.sol b/smart_contracts/contracts/migration/LegacyMappingRegistryInterface.sol index 89398534..5eb40d64 100644 --- a/smart_contracts/contracts/migration/LegacyMappingRegistryInterface.sol +++ b/smart_contracts/contracts/migration/LegacyMappingRegistryInterface.sol @@ -5,10 +5,10 @@ interface LegacyMappingRegistryInterface { /** * @dev Event that is sent when a DID mapping is created. * - * @param identifier legacy DID identifier. - * @param identity Corresponding account address of DID owner. + * @param legacyIdentifier legacy DID identifier. + * @param newDid Corresponding new did. */ - event DidMappingCreated(string identifier, address identity); + event DidMappingCreated(string legacyIdentifier, string newDid); /** * @dev Event that is sent when a new Resource (SchemaId/CredentialDefinitionId) mapping is created. @@ -26,18 +26,21 @@ interface LegacyMappingRegistryInterface { * * This function can revert with following errors: * - `MappingAlreadyExist`: Raised if DID mapping with provided identifier already exist. + * - `IncorrectDid`: New DID does not match to identity * - `InvalidEd25519Key`: Raised if provided ED25519 verification key does not match to the DID identifier. * - `NotIdentityOwner`: Raised if sender account is not owner of the provided identity. * - `Unauthorized`: Raised if sender account does not have non of the roles assigned: TRUSTEE, ENDORSER, STEWARD. * - * @param identity Account address of the DID's owner. - * @param identifier legacy DID identifier. - * @param ed25519Key Ed25519 verification key of the legacy DID identifier. - * @param ed25519Signature ED25519 signature to prove key possession. + * @param identity Account address of the DID's owner. + * @param legacyIdentifier legacy DID identifier. + * @param newDid Corresponding new did. + * @param ed25519Key Ed25519 verification key of the legacy DID identifier. + * @param ed25519Signature ED25519 signature to prove key possession. */ function createDidMapping( address identity, - string calldata identifier, + string calldata legacyIdentifier, + string calldata newDid, bytes32 ed25519Key, bytes calldata ed25519Signature ) external; @@ -50,6 +53,7 @@ interface LegacyMappingRegistryInterface { * * This function can revert with following errors: * - `MappingAlreadyExist`: Raised if DID mapping with provided identifier already exist. + * - `IncorrectDid`: New DID does not match to identity * - `InvalidEd25519Key`: Raised if provided ED25519 verification key does not match to the DID identifier. * - `NotIdentityOwner`: Raised if signer account is not owner of the provided identity * - `Unauthorized`: Raised if sender account does not have non of the roles assigned: TRUSTEE, ENDORSER, STEWARD. @@ -58,7 +62,8 @@ interface LegacyMappingRegistryInterface { * @param sigV Part of EcDSA signature. * @param sigR Part of EcDSA signature. * @param sigS Part of EcDSA signature. - * @param identifier legacy DID identifier. + * @param legacyIdentifier legacy DID identifier. + * @param newDid Corresponding new did. * @param ed25519Key Ed25519 verification key of the legacy DID identifier. * @param ed25519Signature ED25519 signature to prove key possession. */ @@ -67,7 +72,8 @@ interface LegacyMappingRegistryInterface { uint8 sigV, bytes32 sigR, bytes32 sigS, - string calldata identifier, + string calldata legacyIdentifier, + string calldata newDid, bytes32 ed25519Key, bytes calldata ed25519Signature ) external; diff --git a/smart_contracts/test/migration/LegacyMappingRegistry.spec.ts b/smart_contracts/test/migration/LegacyMappingRegistry.spec.ts index 9e088ef7..0bdb8ca7 100644 --- a/smart_contracts/test/migration/LegacyMappingRegistry.spec.ts +++ b/smart_contracts/test/migration/LegacyMappingRegistry.spec.ts @@ -16,8 +16,10 @@ describe('LegacyMappingRegistry', function () { let legacyMappingRegistry: TestableLegacyMappingRegistry let testAccounts: TestAccounts let issuer: string + let issuerDid: string const legacyDid = '2vZAi1riCVGnQMfQAjbThG' + const testActorDid = `did:ethr:${testActorAddress}` const legacyVerkey = Uint8Array.from([ 15, 147, 97, 223, 64, 179, 188, 70, 162, 110, 219, 163, 185, 25, 180, 23, 224, 175, 15, 188, 235, 170, 233, 240, 145, 111, 204, 153, 108, 117, 188, 145, @@ -37,8 +39,8 @@ describe('LegacyMappingRegistry', function () { indyDidRegistryInit.connect(testAccountsInit.trustee.account) legacyMappingRegistryInit.connect(testAccountsInit.trustee.account) - const issuerId = `did:indybesu:${issuer}` - await createDid(indyDidRegistryInit, testAccountsInit.trustee.account.address, issuerId) + issuerDid = `did:indybesu:${issuer}` + await createDid(indyDidRegistryInit, testAccountsInit.trustee.account.address, issuerDid) legacyMappingRegistry = legacyMappingRegistryInit indyDidRegistry = indyDidRegistryInit @@ -47,17 +49,17 @@ describe('LegacyMappingRegistry', function () { describe('Add/Resolve DID mapping', function () { it('Should create DID mapping', async function () { - await legacyMappingRegistry.createDidMapping(issuer, legacyDid, legacyVerkey, legacySignature) + await legacyMappingRegistry.createDidMapping(issuer, legacyDid, issuerDid, legacyVerkey, legacySignature) const address = await legacyMappingRegistry.didMapping(legacyDid) - expect(address).to.be.equal(issuer) + expect(address).to.be.equal(issuerDid) }) it('Should fail if DID mapping is being created already exists', async function () { - await legacyMappingRegistry.createDidMapping(issuer, legacyDid, legacyVerkey, legacySignature) + await legacyMappingRegistry.createDidMapping(issuer, legacyDid, issuerDid, legacyVerkey, legacySignature) await expect( - legacyMappingRegistry.createDidMapping(issuer, legacyDid, legacyVerkey, legacySignature), + legacyMappingRegistry.createDidMapping(issuer, legacyDid, issuerDid, legacyVerkey, legacySignature), ).to.be.revertedWithCustomError(legacyMappingRegistry.baseInstance, MigrationErrors.DidMappingAlreadyExist) }) @@ -68,7 +70,7 @@ describe('LegacyMappingRegistry', function () { ]) await expect( - legacyMappingRegistry.createDidMapping(issuer, legacyDid, ed25519Key, legacySignature), + legacyMappingRegistry.createDidMapping(issuer, legacyDid, issuerDid, ed25519Key, legacySignature), ).to.be.revertedWithCustomError(legacyMappingRegistry.baseInstance, MigrationErrors.InvalidEd25519Key) }) @@ -76,7 +78,7 @@ describe('LegacyMappingRegistry', function () { legacyMappingRegistry.connect(testAccounts.trustee2.account) await expect( - legacyMappingRegistry.createDidMapping(issuer, legacyDid, legacyVerkey, legacySignature), + legacyMappingRegistry.createDidMapping(issuer, legacyDid, issuerDid, legacyVerkey, legacySignature), ).to.be.revertedWithCustomError(legacyMappingRegistry.baseInstance, DidErrors.NotIdentityOwner) }) }) @@ -88,12 +90,14 @@ describe('LegacyMappingRegistry', function () { testActorAddress, testActorPrivateKey, legacyDid, + testActorDid, legacyVerkey, legacySignature, ) await legacyMappingRegistry.createDidMappingSigned( testActorAddress, legacyDid, + testActorDid, legacyVerkey, legacySignature, sig, @@ -110,6 +114,7 @@ describe('LegacyMappingRegistry', function () { testActorAddress, testActorPrivateKey, legacyDid, + testActorDid, legacyVerkey, legacySignature, ) @@ -117,13 +122,21 @@ describe('LegacyMappingRegistry', function () { await legacyMappingRegistry.createDidMappingSigned( testActorAddress, legacyDid, + testActorDid, legacyVerkey, legacySignature, sig, ) await expect( - legacyMappingRegistry.createDidMappingSigned(testActorAddress, legacyDid, legacyVerkey, legacySignature, sig), + legacyMappingRegistry.createDidMappingSigned( + testActorAddress, + legacyDid, + testActorDid, + legacyVerkey, + legacySignature, + sig, + ), ).to.be.revertedWithCustomError(legacyMappingRegistry.baseInstance, MigrationErrors.DidMappingAlreadyExist) }) @@ -134,6 +147,7 @@ describe('LegacyMappingRegistry', function () { testAccounts.trustee2.account.address, testActorPrivateKey, legacyDid, + testActorDid, legacyVerkey, legacySignature, ) @@ -142,6 +156,7 @@ describe('LegacyMappingRegistry', function () { legacyMappingRegistry.createDidMappingSigned( testAccounts.trustee2.account.address, legacyDid, + testActorDid, legacyVerkey, legacySignature, sig, @@ -155,19 +170,27 @@ describe('LegacyMappingRegistry', function () { testActorAddress, testActorPrivateKey, '356FbajrLCJxbQbn8GSb3B', + testActorDid, legacyVerkey, legacySignature, ) await expect( - legacyMappingRegistry.createDidMappingSigned(testActorAddress, legacyDid, legacyVerkey, legacySignature, sig), + legacyMappingRegistry.createDidMappingSigned( + testActorAddress, + legacyDid, + issuerDid, + legacyVerkey, + legacySignature, + sig, + ), ).to.be.revertedWithCustomError(legacyMappingRegistry.baseInstance, DidErrors.NotIdentityOwner) }) }) describe('Add/Resolve Resource mapping', function () { beforeEach(async function () { - await legacyMappingRegistry.createDidMapping(issuer, legacyDid, legacyVerkey, legacySignature) + await legacyMappingRegistry.createDidMapping(issuer, legacyDid, issuerDid, legacyVerkey, legacySignature) }) it('Should create Resource mapping', async function () { @@ -188,7 +211,7 @@ describe('LegacyMappingRegistry', function () { it('Should fail if mapping is being created with not existing DID mapping', async function () { await expect( legacyMappingRegistry.createResourceMapping(issuer, '356FbajrLCJxbQbn8GSb3B', legacySchemaId, schemaId), - ).to.be.revertedWithCustomError(legacyMappingRegistry.baseInstance, DidErrors.NotIdentityOwner) + ).to.be.revertedWithCustomError(legacyMappingRegistry.baseInstance, MigrationErrors.DidMappingDoesNotExist) }) it('Should fail if mapping is being created with not owned DID mapping', async function () { @@ -210,12 +233,14 @@ describe('LegacyMappingRegistry', function () { testActorAddress, testActorPrivateKey, legacyDid, + testActorDid, legacyVerkey, legacySignature, ) await legacyMappingRegistry.createDidMappingSigned( testActorAddress, legacyDid, + testActorDid, legacyVerkey, legacySignature, sig, diff --git a/smart_contracts/test/utils/errors.ts b/smart_contracts/test/utils/errors.ts index 2dc742a1..46d9f201 100644 --- a/smart_contracts/test/utils/errors.ts +++ b/smart_contracts/test/utils/errors.ts @@ -49,4 +49,5 @@ export namespace MigrationErrors { export const DidMappingAlreadyExist = 'DidMappingAlreadyExist' export const ResourceMappingAlreadyExist = 'ResourceMappingAlreadyExist' export const InvalidEd25519Key = 'InvalidEd25519Key' + export const DidMappingDoesNotExist = 'DidMappingDoesNotExist' } diff --git a/vdr/src/contracts/did/types/did.rs b/vdr/src/contracts/did/types/did.rs index d10227d9..78afc4cd 100644 --- a/vdr/src/contracts/did/types/did.rs +++ b/vdr/src/contracts/did/types/did.rs @@ -1,4 +1,4 @@ -use crate::{ContractParam, VdrError}; +use crate::{types::ContractOutput, ContractParam, VdrError}; use serde_derive::{Deserialize, Serialize}; pub const DID_PREFIX: &str = "did"; @@ -42,6 +42,14 @@ impl TryFrom<&DID> for ContractParam { } } +impl TryFrom for DID { + type Error = VdrError; + + fn try_from(value: ContractOutput) -> Result { + Ok(DID::from(value.get_string(0)?.as_str())) + } +} + #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] pub(crate) struct ParsedDid { pub(crate) method: String, diff --git a/vdr/src/contracts/migration/legacy_mapping_registry.rs b/vdr/src/contracts/migration/legacy_mapping_registry.rs index 7cb992da..4733609b 100644 --- a/vdr/src/contracts/migration/legacy_mapping_registry.rs +++ b/vdr/src/contracts/migration/legacy_mapping_registry.rs @@ -7,7 +7,6 @@ use crate::{ ed25519_signature::Ed25519Signature, resource_identifier::ResourceIdentifier, }, - did_ethr_registry::ETHR_DID_METHOD, error::VdrResult, types::{ Address, MethodStringParam, Transaction, TransactionBuilder, @@ -53,6 +52,7 @@ pub async fn build_create_did_mapping_transaction( .set_method(METHOD_CREATE_DID_MAPPING) .add_param(&identity)? .add_param(legacy_identifier)? + .add_param(did)? .add_param(legacy_verkey)? .add_param(ed25519_signature)? .set_type(TransactionType::Write) @@ -88,6 +88,7 @@ pub async fn build_create_did_mapping_endorsing_data( .add_param(&identity)? .add_param(&MethodStringParam::from(METHOD_CREATE_DID_MAPPING))? .add_param(legacy_identifier)? + .add_param(did)? .add_param(legacy_verkey)? .add_param(ed25519_signature)? .build(client) @@ -129,6 +130,7 @@ pub async fn build_create_did_mapping_signed_transaction( .add_param(&signature.r())? .add_param(&signature.s())? .add_param(legacy_identifier)? + .add_param(did)? .add_param(legacy_verkey)? .add_param(ed25519_signature)? .set_type(TransactionType::Write) @@ -176,8 +178,7 @@ pub fn parse_did_mapping_result(client: &LedgerClient, bytes: &[u8]) -> VdrResul TransactionParser::new() .set_contract(CONTRACT_NAME) .set_method(METHOD_DID_MAPPING) - .parse::
(client, bytes) - .map(|address| DID::build(ETHR_DID_METHOD, None, address.as_ref())) + .parse::(client, bytes) } /// Build transaction to execute LegacyMappingRegistry.createResourceMapping contract method to