commit 8c1339aac5729e0e425d92c79f0c068fc80d2b91
parent 7d27faa960efcf68d025c36bb756b4f4b24f53f5
Author: nolash <dev@holbrook.no>
Date: Sun, 14 Nov 2021 05:23:44 +0100
Correct interface in solidity contract
Diffstat:
7 files changed, 20 insertions(+), 31 deletions(-)
diff --git a/python/eth_contract_registry/data/Registry.bin b/python/eth_contract_registry/data/Registry.bin
@@ -1 +1 @@
-60806040523480156200001157600080fd5b5060405162000d4a38038062000d4a8339818101604052810190620000379190620001c5565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060005b815181101562000104576001828281518110620000c0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190806001815401808255809150506001900390600052602060002001600090919091909150558080620000fb90620002ac565b9150506200007a565b505062000383565b6000620001236200011d8462000233565b6200020a565b905080838252602082019050828560208602820111156200014357600080fd5b60005b858110156200017757816200015c8882620001ae565b84526020840193506020830192505060018101905062000146565b5050509392505050565b600082601f8301126200019357600080fd5b8151620001a58482602086016200010c565b91505092915050565b600081519050620001bf8162000369565b92915050565b600060208284031215620001d857600080fd5b600082015167ffffffffffffffff811115620001f357600080fd5b620002018482850162000181565b91505092915050565b60006200021662000229565b905062000224828262000276565b919050565b6000604051905090565b600067ffffffffffffffff82111562000251576200025062000329565b5b602082029050602081019050919050565b6000819050919050565b6000819050919050565b620002818262000358565b810181811067ffffffffffffffff82111715620002a357620002a262000329565b5b80604052505050565b6000620002b9826200026c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620002ef57620002ee620002fa565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b620003748162000262565b81146200038057600080fd5b50565b6109b780620003936000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c0100000000000000000000000000000000000000000000000000000000900480639648eca2116100785780639648eca214610158578063bb34534c14610188578063f0f86f71146101b8578063f2fde38b146101e8576100a5565b806301ffc9a7146100aa57806328f2d4da146100da5780635deed44e1461010a5780638da5cb5b1461013a575b600080fd5b6100c460048036038101906100bf919061075f565b610218565b6040516100d191906107f9565b60405180910390f35b6100f460048036038101906100ef9190610788565b61031d565b6040516101019190610814565b60405180910390f35b610124600480360381019061011f91906106d3565b610341565b6040516101319190610814565b60405180910390f35b61014261035e565b60405161014f91906107de565b60405180910390f35b610172600480360381019061016d91906106d3565b610382565b60405161017f9190610814565b60405180910390f35b6101a2600480360381019061019d91906106d3565b61039f565b6040516101af91906107de565b60405180910390f35b6101d260048036038101906101cd91906106fc565b6103dc565b6040516101df91906107f9565b60405180910390f35b61020260048036038101906101fd91906106aa565b6105b2565b60405161020f91906107f9565b60405180910390f35b600063bb34534c7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561026d5760019050610318565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156102c05760019050610318565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156103135760019050610318565b600090505b919050565b6001818154811061032d57600080fd5b906000526020600020016000915090505481565b600060046000838152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060036000838152602001908152602001600020549050919050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461043757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166002600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104a357600080fd5b6000805b6001805490508110156105185786600182815481106104ef577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154141561050557600191505b8080610510906108ad565b9150506104a7565b508061052357600080fd5b846002600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508360036000888152602001908152602001600020819055508260046000868152602001908152602001600020819055506001915050949350505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461060d57600080fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b60008135905061066581610925565b92915050565b60008135905061067a8161093c565b92915050565b60008135905061068f81610953565b92915050565b6000813590506106a48161096a565b92915050565b6000602082840312156106bc57600080fd5b60006106ca84828501610656565b91505092915050565b6000602082840312156106e557600080fd5b60006106f38482850161066b565b91505092915050565b6000806000806080858703121561071257600080fd5b60006107208782880161066b565b945050602061073187828801610656565b93505060406107428782880161066b565b92505060606107538782880161066b565b91505092959194509250565b60006020828403121561077157600080fd5b600061077f84828501610680565b91505092915050565b60006020828403121561079a57600080fd5b60006107a884828501610695565b91505092915050565b6107ba8161082f565b82525050565b6107c981610841565b82525050565b6107d88161084d565b82525050565b60006020820190506107f360008301846107b1565b92915050565b600060208201905061080e60008301846107c0565b92915050565b600060208201905061082960008301846107cf565b92915050565b600061083a82610883565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006108b8826108a3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156108eb576108ea6108f6565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b61092e8161082f565b811461093957600080fd5b50565b6109458161084d565b811461095057600080fd5b50565b61095c81610857565b811461096757600080fd5b50565b610973816108a3565b811461097e57600080fd5b5056fea26469706673582212209aec8f03f7dd2f0da35bbb26ca6174db7a60d79848dc0b74c76949c70d59711d64736f6c63430008030033
-\ No newline at end of file
+60806040523480156200001157600080fd5b5060405162000e5738038062000e578339818101604052810190620000379190620001ad565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060005b8151811015620000e05760018282815181106200009c576200009b6200031d565b5b602002602001015190806001815401808255809150506001900390600052602060002001600090919091909150558080620000d790620002a0565b9150506200007a565b5050620003ba565b6000620000ff620000f98462000227565b620001fe565b9050808382526020820190508285602086028201111562000125576200012462000380565b5b60005b858110156200015957816200013e888262000196565b84526020840193506020830192505060018101905062000128565b5050509392505050565b600082601f8301126200017b576200017a6200037b565b5b81516200018d848260208601620000e8565b91505092915050565b600081519050620001a781620003a0565b92915050565b600060208284031215620001c657620001c56200038a565b5b600082015167ffffffffffffffff811115620001e757620001e662000385565b5b620001f58482850162000163565b91505092915050565b60006200020a6200021d565b90506200021882826200026a565b919050565b6000604051905090565b600067ffffffffffffffff8211156200024557620002446200034c565b5b602082029050602081019050919050565b6000819050919050565b6000819050919050565b62000275826200038f565b810181811067ffffffffffffffff821117156200029757620002966200034c565b5b80604052505050565b6000620002ad8262000260565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415620002e357620002e2620002ee565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b620003ab8162000256565b8114620003b757600080fd5b50565b610a8d80620003ca6000396000f3fe608060405234801561001057600080fd5b506004361061009a576000357c0100000000000000000000000000000000000000000000000000000000900480638da5cb5b116100785780638da5cb5b1461012f578063ba44593c1461014d578063bb34534c1461017d578063f2fde38b146101ad5761009a565b806301ffc9a71461009f57806328f2d4da146100cf5780636d5de9f0146100ff575b600080fd5b6100b960048036038101906100b491906107f9565b6101dd565b6040516100c6919061089b565b60405180910390f35b6100e960048036038101906100e49190610826565b6102e2565b6040516100f691906108b6565b60405180910390f35b610119600480360381019061011491906107b9565b610306565b604051610126919061089b565b60405180910390f35b61013761040e565b6040516101449190610880565b60405180910390f35b61016760048036038101906101629190610779565b610432565b604051610174919061089b565b60405180910390f35b6101976004803603810190610192919061074c565b6105ea565b6040516101a49190610880565b60405180910390f35b6101c760048036038101906101c2919061071f565b610627565b6040516101d4919061089b565b60405180910390f35b600063bb34534c7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561023257600190506102dd565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561028557600190506102dd565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156102d857600190506102dd565b600090505b919050565b600181815481106102f257600080fd5b906000526020600020016000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461036157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166002600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156103ce57600080fd5b6003600084815260200190815260200160002082908060018154018082558091505060019003906000526020600020016000909190919091505592915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461048d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166002600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104f957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561053357600080fd5b6000805b600180549050811015610582578460018281548110610559576105586109c7565b5b9060005260206000200154141561056f57600191505b808061057a9061094f565b915050610537565b508061058d57600080fd5b826002600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600191505092915050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461068257600080fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000813590506106da816109fb565b92915050565b6000813590506106ef81610a12565b92915050565b60008135905061070481610a29565b92915050565b60008135905061071981610a40565b92915050565b600060208284031215610735576107346109f6565b5b6000610743848285016106cb565b91505092915050565b600060208284031215610762576107616109f6565b5b6000610770848285016106e0565b91505092915050565b600080604083850312156107905761078f6109f6565b5b600061079e858286016106e0565b92505060206107af858286016106cb565b9150509250929050565b600080604083850312156107d0576107cf6109f6565b5b60006107de858286016106e0565b92505060206107ef858286016106e0565b9150509250929050565b60006020828403121561080f5761080e6109f6565b5b600061081d848285016106f5565b91505092915050565b60006020828403121561083c5761083b6109f6565b5b600061084a8482850161070a565b91505092915050565b61085c816108d1565b82525050565b61086b816108e3565b82525050565b61087a816108ef565b82525050565b60006020820190506108956000830184610853565b92915050565b60006020820190506108b06000830184610862565b92915050565b60006020820190506108cb6000830184610871565b92915050565b60006108dc82610925565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061095a82610945565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561098d5761098c610998565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b610a04816108d1565b8114610a0f57600080fd5b50565b610a1b816108ef565b8114610a2657600080fd5b50565b610a32816108f9565b8114610a3d57600080fd5b50565b610a4981610945565b8114610a5457600080fd5b5056fea2646970667358221220edeee9a0ce45f26bfa94076b7732f30406a68307309040a0afe5bcb2f0097e2064736f6c63430008070033
+\ No newline at end of file
diff --git a/python/eth_contract_registry/data/Registry.json b/python/eth_contract_registry/data/Registry.json
@@ -1 +1 @@
-[{"inputs":[{"internalType":"bytes32[]","name":"_identifiers","type":"bytes32[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"}],"name":"chainOf","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_chain","type":"bytes32"}],"name":"configSumOf","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"identifiers","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"},{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes32","name":"_chainDescriptor","type":"bytes32"},{"internalType":"bytes32","name":"_chainConfig","type":"bytes32"}],"name":"set","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
+[{"inputs":[{"internalType":"bytes32[]","name":"_identifiers","type":"bytes32[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"},{"internalType":"bytes32","name":"_reference","type":"bytes32"}],"name":"bind","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"identifiers","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_identifier","type":"bytes32"},{"internalType":"address","name":"_address","type":"address"}],"name":"set","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
diff --git a/python/eth_contract_registry/registry.py b/python/eth_contract_registry/registry.py
@@ -93,22 +93,14 @@ class ContractRegistry(Registry):
raise NotImplementedError()
- def set(self, contract_address, sender_address, identifier_string, address, chain_spec, chain_config_hash):
+ def set(self, contract_address, sender_address, identifier_string, address):
enc = ABIContractEncoder()
enc.method('set')
enc.typ(ABIContractType.BYTES32)
enc.typ(ABIContractType.ADDRESS)
- enc.typ(ABIContractType.BYTES32)
- enc.typ(ABIContractType.BYTES32)
identifier = to_identifier(identifier_string)
enc.bytes32(identifier)
enc.address(address)
- chain_str = str(chain_spec)
- h = hashlib.new('sha256')
- h.update(chain_str.encode('utf-8'))
- chain_description_hash_bytes = h.digest()
- enc.bytes32(chain_description_hash_bytes.hex())
- enc.bytes32(chain_config_hash)
data = enc.encode()
tx = self.template(sender_address, contract_address, use_nonce=True)
tx = self.set_code(tx, data)
diff --git a/python/eth_contract_registry/runnable/set.py b/python/eth_contract_registry/runnable/set.py
@@ -76,7 +76,7 @@ def main():
raise ValueError('chain config hash must be 32 bytes')
chain_config_hash = add_0x(chain_config_hash)
- (tx_hash_hex, o) = c.set(registry_address, signer_address, config.get('_IDENTIFIER'), subject_address, chain_spec, chain_config_hash)
+ (tx_hash_hex, o) = c.set(registry_address, signer_address, config.get('_IDENTIFIER'), subject_address)
if config.get('_RPC_SEND'):
conn.do(o)
diff --git a/python/requirements.txt b/python/requirements.txt
@@ -1,2 +1,2 @@
-confini>=0.3.6rc3,<0.5.0
-chainlib-eth>=0.0.9a3,<=0.1.0
+confini~=0.5.2
+chainlib-eth~=0.0.12
diff --git a/python/setup.cfg b/python/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = eth-contract-registry
-version = 0.6.3a3
+version = 0.7.1a2
description = Ethereum Smart Contract key-value registry
author = Louis Holbrook
author_email = dev@holbrook.no
diff --git a/solidity/Registry.sol b/solidity/Registry.sol
@@ -12,8 +12,7 @@ contract CICRegistry {
bytes32[] public identifiers;
mapping (bytes32 => address) entries; // contractidentifier -> address
- mapping (bytes32 => bytes32) chainIdentifiers; // contractidentifier -> chainidentifier
- mapping (bytes32 => bytes32) chainConfigs; // chainidentifier -> chainconfig
+ mapping (bytes32 => bytes32[]) entryBindings; // contractidentifier -> chainidentifier
constructor(bytes32[] memory _identifiers) public {
owner = msg.sender;
@@ -22,9 +21,11 @@ contract CICRegistry {
}
}
- function set(bytes32 _identifier, address _address, bytes32 _chainDescriptor, bytes32 _chainConfig) public returns (bool) {
+ function set(bytes32 _identifier, address _address) public returns (bool) {
require(msg.sender == owner);
require(entries[_identifier] == address(0));
+ require(_address != address(0));
+
bool found = false;
for (uint i = 0; i < identifiers.length; i++) {
if (identifiers[i] == _identifier) {
@@ -34,11 +35,16 @@ contract CICRegistry {
require(found);
entries[_identifier] = _address;
- chainIdentifiers[_identifier] = _chainDescriptor;
- chainConfigs[_chainDescriptor] = _chainConfig;
return true;
}
+ function bind(bytes32 _identifier, bytes32 _reference) public returns (bool) {
+ require(msg.sender == owner);
+ require(entries[_identifier] != address(0));
+
+ entryBindings[_identifier].push(_reference);
+ }
+
// Implements EIP 173
function transferOwnership(address _newOwner) public returns (bool) {
require(msg.sender == owner);
@@ -51,17 +57,8 @@ contract CICRegistry {
return entries[_identifier];
}
- function chainOf(bytes32 _identifier) public view returns (bytes32) {
- return chainIdentifiers[_identifier];
- }
-
- function configSumOf(bytes32 _chain) public view returns (bytes32) {
- return chainConfigs[_chain];
- }
-
- // Implements EIP 165
function supportsInterface(bytes4 _sum) public pure returns (bool) {
- if (_sum == 0xbb34534c) { // Registry
+ if (_sum == 0x633ee8e7) { // Registry
return true;
}
if (_sum == 0x01ffc9a7) { // EIP165