mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-02-18 12:13:07 +00:00
* Update config and crate naming
- Updated configs to the lates main repo configs.
- Updated all main repo crate namings to be same as the main repo.
- Added `create_dir_all` to `pub(crate) fn create_tempdir(custom_work_dir: Option<PathBuf>) -> std::io::Result<TempDir> {`.
- Wired in optional `persist_dir` when using the local deployer.
- Update `time` vulnerability
**Note:** Unsure about the `service_params` mapping in `pub(crate) fn cryptarchia_deployment(config: &GeneralConfig) -> CryptarchiaDeploymentSettings {`
44 lines
1.5 KiB
Rust
44 lines
1.5 KiB
Rust
use lb_core::mantle::{
|
|
MantleTx, Op, OpProof, SignedMantleTx, Transaction as _,
|
|
ledger::Tx as LedgerTx,
|
|
ops::channel::{ChannelId, MsgId, inscribe::InscriptionOp},
|
|
};
|
|
use lb_key_management_system_service::keys::{Ed25519Key, ZkKey};
|
|
use testing_framework_core::scenario::DynError;
|
|
|
|
/// Builds a signed inscription transaction with deterministic payload for
|
|
/// testing.
|
|
pub fn create_inscription_transaction_with_id(id: ChannelId) -> Result<SignedMantleTx, DynError> {
|
|
let signing_key = Ed25519Key::from_bytes(&[0u8; 32]);
|
|
let signer = signing_key.public_key();
|
|
|
|
let inscription_op = InscriptionOp {
|
|
channel_id: id,
|
|
inscription: format!("Test channel inscription {id:?}").into_bytes(),
|
|
parent: MsgId::root(),
|
|
signer,
|
|
};
|
|
|
|
let mantle_tx = MantleTx {
|
|
ops: vec![Op::ChannelInscribe(inscription_op)],
|
|
ledger_tx: LedgerTx::new(vec![], vec![]),
|
|
storage_gas_price: 0,
|
|
execution_gas_price: 0,
|
|
};
|
|
|
|
let tx_hash = mantle_tx.hash();
|
|
let signature = signing_key.sign_payload(tx_hash.as_signing_bytes().as_ref());
|
|
let zk_key = ZkKey::zero();
|
|
tracing::debug!(channel = ?id, tx_hash = ?tx_hash, "building inscription transaction");
|
|
|
|
let zk_signature = ZkKey::multi_sign(&[zk_key], tx_hash.as_ref())
|
|
.map_err(|err| format!("zk signature generation failed: {err}"))?;
|
|
|
|
SignedMantleTx::new(
|
|
mantle_tx,
|
|
vec![OpProof::Ed25519Sig(signature)],
|
|
zk_signature,
|
|
)
|
|
.map_err(|err| format!("failed to build signed mantle transaction: {err}").into())
|
|
}
|