Issue with 0x2::poseidon::poseidon_bn254_internal Failing on Chain but Passing Locally

I’m encountering an issue when publishing a Move contract on the Sui network (Testnet). The error occurs in the function 0x2::poseidon::poseidon_bn254_internal, with the following message:

st command aborted within function '0x0000000000000000000000000000000000000000000000000000000000000002::poseidon::poseidon_bn254_internal' at instruction 0 with code 1

Here’s the context:

  • Local Testing: The contract builds and tests successfully locally using sui move build and sui move test. No errors or warnings.

  • On-Chain: When I run sui client publish --gas-budget 100000000, it fails with the above error.

I’m wondering if anyone has successfully used 0x2::poseidon::poseidon_bn254_internal on-chain (e.g., Testnet or Devnet)? Could this be related to stricter parameter validation on-chain, a version mismatch with the standard library, or something else?

For reference:

  • Sui CLI version: 1.45.1

  • Network: Testnet

  • My contract calls poseidon_bn254_internal with a vector input (e.g., 32 bytes), and it works fine locally.

Any insights or suggestions would be greatly appreciated! If needed, I can share more details about my contract code or the full error log.

Thanks in advance!

I think the Poseidon hash function is only available in Sui Devnet.
In the protocol config file

       if chain != Chain::Mainnet && chain != Chain::Testnet {
                        cfg.feature_flags.enable_poseidon = true;
                        cfg.poseidon_bn254_cost_base = Some(260);
                        cfg.poseidon_bn254_cost_per_block = Some(10);
                    }

Details in this file: crates/sui-protocol-config/src/lib.rs line 2734, MystenLabs/sui Github repo.

Thank you for your answer, but why is such an important explanation not mentioned in the document? Also, when will this feature be available on the mainnet? Where can I get relevant information?

1 Like

I don’t know, either! :sweat_smile:

2 Likes