Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native SUI bridging error #20455

Open
xhuppa opened this issue Nov 28, 2024 · 3 comments
Open

Native SUI bridging error #20455

xhuppa opened this issue Nov 28, 2024 · 3 comments

Comments

@xhuppa
Copy link

xhuppa commented Nov 28, 2024

When bridging native SUI I run into this error when simulating the transaction, any reason why?

Error checking transaction input objects: MutableObjectUsedMoreThanOnce { object_id: 0x7f7e... e1fc8 }

@patrickkuo
Copy link
Contributor

@xhuppa can you provide more context, i.e. what are you trying to do, how to reproduce this or any code snippets you can provide.

@MystenLabs MystenLabs deleted a comment from Demilewis Nov 28, 2024
@xhuppa
Copy link
Author

xhuppa commented Nov 28, 2024

@patrickkuo Im trying to bridge native SUI over from SUI to Ethereum (or anychain) using the wormhole bridge. But im getting this MutableObjectUsedMoreThanOnce error. Heres some code for more insight:

`

  const balances = await this.client.getProvider().getCoins({
    owner: senderAddress,
  });

  const gasCoin = balances.data.find(
    (coin) => coin.coinType === "0x2::sui::SUI"
  );
  if (!gasCoin) {
    throw new Error("No valid gas coins available for this transaction.");
  }

  try {
    transaction.setGasPayment([
      {
        objectId: gasCoin.coinObjectId,
        version: parseInt(gasCoin.version, 10),
        digest: gasCoin.digest,
      },
    ]);
    console.log("Successfully set the gas coin.");
  } catch (error) {
    console.error("Error while setting gas payment:", error);
    throw error;
  }

  let serializedTransaction: Uint8Array;
  try {
    serializedTransaction = await transaction.build({
      client: this.client.getProvider(),
    });

    const { signature, tx: signedTx } = await safeClientResponse(
      this.client.getSecureSuivmClient().signTransaction({
        tx: toBase64(serializedTransaction),
        publicKey: senderAddress,
        blockchainId: "sui:mainnet" as BlockchainId,
      })
    );

    const dryRunResult = await this.client
      .getProvider()
      .dryRunTransactionBlock({
        transactionBlock: serializedTransaction,
      });

    if (dryRunResult.effects?.status?.status !== "success") {
      throw new Error(
        `Dry run validation failed: ${dryRunResult.effects?.status?.error}`
      );
    }
  } catch (error) {
    console.error("Error during transaction validation:", error);
    throw error;
  }`

@xhuppa
Copy link
Author

xhuppa commented Nov 29, 2024

@patrickkuo It seems like the same objectId is being used by blockData.gasConfig.payment[0] and blockData.inputs[0].value.Object.ImmOrOwned

I assume thats from doing a native bridge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants