Skip to content

Commit

Permalink
Switching length type from usize to u32
Browse files Browse the repository at this point in the history
When trying to deploy the contract, it gives this error when the type of length is usize:

Error: rpc error: code = Unknown desc = rpc error: code = Unknown desc = failed to execute message; message index: 0: Error calling the VM: Error compiling Wasm: Could not compile: WebAssembly translation error: Error in middleware Gatekeeper: Float operator detected: F64Load { memarg: MemoryImmediate { align: 3, offset: 8, memory: 0 } }. The use of floats is not supported.: create wasm contract failed [CosmWasm/[email protected]/x/wasm/keeper/keeper.go:160] With gas wanted: '0' and gas used: '9525292' : unknown request
  • Loading branch information
anstylian committed Nov 28, 2024
1 parent ca20afa commit c24d390
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion contracts/voting-verifier/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ fn parse_message_id(
Ok((id.tx_hash_as_hex(), 0))
}
MessageIdFormat::Bech32m { prefix, length } => {
let bech32m_message_id = Bech32mFormat::from_str(prefix, *length, message_id)
let bech32m_message_id = Bech32mFormat::from_str(prefix, *length as usize, message_id)
.map_err(|_| ContractError::InvalidMessageID(message_id.into()))?;
Ok((bech32m_message_id.to_string().try_into()?, 0))
}
Expand Down
4 changes: 2 additions & 2 deletions packages/axelar-wasm-std/src/msg_id/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub enum MessageIdFormat {
HexTxHash,
Bech32m {
prefix: nonempty::String,
length: usize,
length: u32,
},
}

Expand All @@ -72,7 +72,7 @@ pub fn verify_msg_id(message_id: &str, format: &MessageIdFormat) -> Result<(), R
}
MessageIdFormat::HexTxHash => HexTxHash::from_str(message_id).map(|_| ()),
MessageIdFormat::Bech32m { prefix, length } => {
Bech32mFormat::from_str(prefix, *length, message_id).map(|_| ())
Bech32mFormat::from_str(prefix, *length as usize, message_id).map(|_| ())
}
}
}
Expand Down

0 comments on commit c24d390

Please sign in to comment.