Open manumonti opened 4 months ago
Right. For a proxy upgrade there is no tx_hash on the proxy contract instance.
We may have to go through the ChainManager differently.
Perhaps...
creation = chain.get_creation_metadata(contract_instance.address)
receipt = creation.receipt
Update: this fails for every script that upgrades a proxy contract instance as derek mentioned.
So this script also fails with mainnet/deploy_bqeth.py script.
A workaround is to modify _get_entry()
function in deployment/registry.py
so a receipt
object is always created:
def _get_entry(
contract_instance: ContractInstance, registry_names: Dict[ContractName, ContractName]
) -> RegistryEntry:
contract_abi = _get_abi(contract_instance)
contract_name = _get_name(contract_instance=contract_instance, registry_names=registry_names)
class Object(object):
pass
receipt = Object()
receipt.transaction = Object()
receipt.transaction.chain_id = 137
receipt.transaction.sender = "0x00000"
receipt.txn_hash = "0x00000000000"
receipt.block_number = 0
receipt.deployer = "0x0000000"
if(contract_instance.txn_hash is not None):
receipt = chain.get_receipt(contract_instance.txn_hash)
entry = RegistryEntry(
name=contract_name,
address=to_checksum_address(contract_instance.address),
abi=contract_abi,
chain_id=receipt.transaction.chain_id,
tx_hash=receipt.txn_hash,
block_number=receipt.block_number,
deployer=receipt.transaction.sender,
)
return entry
https://github.com/nucypher/nucypher-contracts/blob/07ce241f1186e46342fc74a213ab81d5a791862f/scripts/lynx/upgrade_coordinator.py#L29
This script fails on the last step:
After a little investigation, the problem seems that the returned deployment
coordinator
doesn't contain the transaction hash. See https://github.com/vzotova/nucypher-contracts/blob/free-fee-model/deployment/registry.py#L63.Error trace:
Note: this line was changed from
receipt = contract_instance.receipt
toreceipt = chain.get_receipt(contract_instance.txn_hash)
because when we updated the ape dependencies, this line failed with the following error: