I have published a module. It has a function which publishes another module. When I try to call this function the transaction commits with error MODULE_ADDRESS_DOES_NOT_MATCH_SENDER
.
My code uses account::create_resource_account
to create the future module owner account and Aptos framework's aptos_framework::code::publish_package_txn(owner: &signer, metadata_serialized: vector<u8>, code: vector<vector<u8>>)
to publish the module.
I retreive the metadata and code by running these commands:
hexdump -ve '1/1 "%02x"' ./mymodue/build/mymodue/package-metadata.bcs
and
hexdump -ve '1/1 "%02x"' ./mymodue/build/mymodule/bytecode_modules/mymodulesource.mv
Here It is said that the VM does this, when a module is published:
StatusCode::MODULE_ADDRESS_DOES_NOT_MATCH_SENDER
is returned.Did you check Move.toml to make sure the named address where the module is deployed at matches that of the resource account you created?