Move.

Publication

Partagez vos connaissances.

Jeremy.
Nov 09, 2023
Questions et Réponses avec des Experts

Trouble Publishing Move Module onto Move VM with "MODULE_ADDRESS_DOES_NOT_MATCH_SENDER" Error

Hi everyone, I'm attempting to integrate Move VM into my custom network and encountering issues while trying to publish a Move module onto the Move VM. I've read that Move VM is "platform agnostic," and I'd appreciate guidance on the initial steps involved and whether this process involves significant effort. Additionally, I'm encountering a specific problem. I keep receiving the following error related to the Move stdlib dependency when attempting to publish a Move module:

VMError {
  major_status: MODULE_ADDRESS_DOES_NOT_MATCH_SENDER,
  sub_status: None,
  message: None,
  exec_state: None,
  location: Undefined,
  indices: [(AddressIdentifier, 0)],
  offsets: []
}
Below is a snippet of my code:


fn build_and_publish_package(package_path: &str) {
  // Code for compiling the package and obtaining compiled units
  let instance = MoveVM::new(vec![]).unwrap();
  let myresolver = MyResolver::new();
  let mut new_session = instance.new_session(&myresolver);
  let sender_address = AccountAddress::ONE;
  let _ = new_session
    .publish_module_bundle(modules.clone(), sender_address, &mut UnmeteredGasMeter {})
    .unwrap();
}

In my Move.toml file, the stdlib is assigned the address 0x1. Importantly, I'm not using the stdlib anywhere in my code. Despite this, I'm consistently encountering the error mentioned above. Could someone please help me understand what could be going wrong or offer insights into troubleshooting this issue effectively?

  • Move
  • Move Script
0
2
Partager
Commentaires
.

Réponses

2
Jackson.
Nov 9 2023, 12:17

The problem you're facing is due to compiling the Move package in moving test mode, which includes a stdlib Move module with a different address assigned to it. When compiling the package, ensure that you are not including the stdlib Move module or any other modules with conflicting addresses. Compile the Move package without test mode to resolve the address mismatch issue. This should resolve the error you're encountering during module publishing.

If you have any questions, you can ask them here;

0
Commentaires
.
Steven.
Nov 9 2023, 12:26

The error message you're encountering,

VMError { major_status: MODULE_ADDRESS_DOES_NOT_MATCH_SENDER, sub_status: None, message: None, exec_state: None, location: Undefined, indices: [(AddressIdentifier, 0)], offsets: [] }

indicates that the address of the module you're trying to publish does not match the sender's address. In the Move VM, the sender's address is determined by the account that initiates the transaction. If the address of the module you're trying to publish does not match this sender's address, you will encounter this error. In your code, you're setting the sender's address to AccountAddress::ONE, which corresponds to the address 0x1. However, your Move.toml file assigns the stdlib address to 0x1. Even though you're not using the stdlib in your code, the Move VM still checks for this address when publishing a module. To resolve this issue, you can try changing the sender's address to a different value that doesn't conflict with the stdlib address. For example:

let sender_address = AccountAddress::new([2u8; AccountAddress::LENGTH]); 

This will assign the sender's address to 0x2, which should not conflict with the stdlib address. As for the process of integrating Move VM into your custom network, it can be relatively straightforward or it can require a significant amount of effort, often referred to as "lift". This largely depends on the complexity of your network and the specifics of your applications.

0
Commentaires
.

Connaissez-vous la réponse ?

Veuillez vous connecter et la partager.

Move is an executable bytecode language used to implement custom transactions and smart contracts.

148Publications231Réponses
Sui.X.Peera.

Gagne ta part de 1000 Sui

Gagne des points de réputation et obtiens des récompenses pour avoir aidé la communauté Sui à se développer.

Campagne de RécompensesJuillet