feat(revive): v0.0.40 — pallet-revive 10 integration tests E2E SCAFFOLD-level + integrity validation 🎉
Ship 3 v0.0.40 SHIPPED — pallet-revive Config wiring validation tests E2E.
Slice 3.1 SCAFFOLD-level scope: verify Config types correctly wired + constants
preserved + AddressMapper trait bound satisfied + integrity formula passes.
Real PolkaVM bytecode E2E (upload_code + bare_call + storage deposits actual)
deferred a Phase 3.x maduración post cargo-contract v6 install + ink! v6
contract templates Slices 3.2-3.6.
Cambios:
- crates/origin-chain-runtime/src/lib.rs: +10 tests #[cfg(test)] mod tests:
1. revive_chain_id_eip155_unique_origin_metaverse — ChainId=9_120_005 verified
2. revive_native_to_eth_ratio_one_million_canonical — NativeToEthRatio=1_000_000
3. revive_deposit_per_byte_canonical_milli_ogc — DepositPerByte=MILLI_OGC
4. revive_deposit_per_item_canonical_one_ogc — DepositPerItem=Ogc::ONE
5. revive_evm_bytecode_allowed_canonical — AllowEVMBytecode=true per SBS-5
6. revive_runtime_memory_128_mb_canonical — RuntimeMemory=128 MB
7. revive_pvf_memory_2_gb_canonical_integrity_pass — PVFMemory=2 GB + formula
`storage_limit = (PVF-RuntimeMemory)/2 > 700 MB` validated
8. revive_safety_toggles_production_safe_canonical — UnsafeUnstableInterface=false
9. revive_pallet_index_11_canonical_post_governance — Index=11 post Governance
10. revive_address_mapper_account32_returns_h160_canonical — AddressMapper trait
bound satisfied compile-time canonical
Verificación:
- cargo check --workspace clean (27 warnings pre-existentes deprecated)
- cargo test --workspace: 213 tests verde 0 failures NO regresiones
(baseline 203 + 10 nuevos revive integration tests)
- cargo test -p origin-chain-runtime: 26 tests verde
(16 baseline + 10 nuevos)
- cargo build --features wasm-build: WASM_BINARY 2.8 MB clean
- __construct_runtime_integrity_test pallet-revive 0.10.1 PASS empírico
Próximo Ship 4 v0.0.41: ReviveApi Runtime API exposure via sp_api::impl_runtime_apis!
+ LANDMARK Palace Phase 3 SCAFFOLD COMPLETE + monorepo bump + CHARON_ROADMAP_V1.3
refresh sesión 4+ comprehensive.
⚓ Phase 3 Slice 3.1 Ship 3/4 SHIPPED. 213 verde. La nave canonical lista para API exposure.
🤖 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
86d9251908
commit
c02f525b9a
1 file changed
+114
@@ -742,4 +742,118 @@ mod tests {
|
|||||||
assert_eq!(MILLISECS_PER_BLOCK, 6_000);
|
assert_eq!(MILLISECS_PER_BLOCK, 6_000);
|
||||||
assert_eq!(SLOT_DURATION, MILLISECS_PER_BLOCK);
|
assert_eq!(SLOT_DURATION, MILLISECS_PER_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// Phase 3 Slice 3.1 v0.0.40 — pallet-revive integration tests E2E
|
||||||
|
// SCAFFOLD-level: verify Config wiring + constants + AddressMapper +
|
||||||
|
// Genesis. Real PolkaVM bytecode E2E deferred a Phase 3.x maduración
|
||||||
|
// post cargo-contract v6 install + ink! v6 contract templates (Slice 3.2+).
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn revive_chain_id_eip155_unique_origin_metaverse() {
|
||||||
|
// OriginChainId canonical 9_120_005 — EIP-155 unique identifier
|
||||||
|
// previene cross-chain replay attacks canonical post-mainnet.
|
||||||
|
use frame_support::traits::Get;
|
||||||
|
let chain_id: u64 = <<Runtime as pallet_revive::Config>::ChainId>::get();
|
||||||
|
assert_eq!(chain_id, 9_120_005_u64);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn revive_native_to_eth_ratio_one_million_canonical() {
|
||||||
|
// OGC 12 decimals → ETH 18 decimals = ratio 10^6 canonical.
|
||||||
|
// Mapping balance OGC↔ETH-equivalent units para EVM compat.
|
||||||
|
use frame_support::traits::Get;
|
||||||
|
let ratio: u32 = <<Runtime as pallet_revive::Config>::NativeToEthRatio>::get();
|
||||||
|
assert_eq!(ratio, 1_000_000_u32);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn revive_deposit_per_byte_canonical_milli_ogc() {
|
||||||
|
// Asset Hub pattern adapted OGC tokenomics — 1 MILLI_OGC per byte canonical.
|
||||||
|
use frame_support::traits::Get;
|
||||||
|
let deposit_per_byte: Balance =
|
||||||
|
<<Runtime as pallet_revive::Config>::DepositPerByte>::get();
|
||||||
|
assert_eq!(deposit_per_byte, MILLI_OGC);
|
||||||
|
assert_eq!(deposit_per_byte, Ogc::ONE / 1_000);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn revive_deposit_per_item_canonical_one_ogc() {
|
||||||
|
// Storage item deposit = 1 OGC canonical (gate storage proliferation).
|
||||||
|
use frame_support::traits::Get;
|
||||||
|
let deposit_per_item: Balance =
|
||||||
|
<<Runtime as pallet_revive::Config>::DepositPerItem>::get();
|
||||||
|
assert_eq!(deposit_per_item, Ogc::ONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn revive_evm_bytecode_allowed_canonical() {
|
||||||
|
// SBS-5 ratificado: Solidity contracts deployables via revive compiler.
|
||||||
|
// AllowEVMBytecode = true canonical para opens Ethereum dev ecosystem.
|
||||||
|
use frame_support::traits::Get;
|
||||||
|
let allow_evm: bool = <<Runtime as pallet_revive::Config>::AllowEVMBytecode>::get();
|
||||||
|
assert!(allow_evm, "EVM bytecode must be allowed per SBS-5 ratified");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn revive_runtime_memory_128_mb_canonical() {
|
||||||
|
// RuntimeMemory canonical 128 MB — runtime memory allocation budget.
|
||||||
|
use frame_support::traits::Get;
|
||||||
|
let runtime_memory: u32 = <<Runtime as pallet_revive::Config>::RuntimeMemory>::get();
|
||||||
|
assert_eq!(runtime_memory, 128_u32 * 1024 * 1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn revive_pvf_memory_2_gb_canonical_integrity_pass() {
|
||||||
|
// PVFMemory canonical 2 GB — required canonical para pass
|
||||||
|
// __construct_runtime_integrity_test (formula: storage_limit =
|
||||||
|
// (PVFMemory - RuntimeMemory) / 2 > max_storage_size ~650 MB).
|
||||||
|
use frame_support::traits::Get;
|
||||||
|
let pvf_memory: u32 = <<Runtime as pallet_revive::Config>::PVFMemory>::get();
|
||||||
|
assert_eq!(pvf_memory, 2_u32 * 1024 * 1024 * 1024);
|
||||||
|
// Verify integrity formula passes canonical
|
||||||
|
let runtime_memory: u32 = <<Runtime as pallet_revive::Config>::RuntimeMemory>::get();
|
||||||
|
let storage_limit: u32 = (pvf_memory - runtime_memory) / 2;
|
||||||
|
// ~960 MB storage limit canonical — comfortably above 650 MB max storage.
|
||||||
|
assert!(
|
||||||
|
storage_limit > 700_u32 * 1024 * 1024,
|
||||||
|
"storage_limit must exceed 700 MB para pallet-revive integrity canonical"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn revive_safety_toggles_production_safe_canonical() {
|
||||||
|
// Production canonical safety: UnsafeUnstableInterface=false.
|
||||||
|
// DebugEnabled NO disponible en pallet-revive 0.10.1 (added 0.12+).
|
||||||
|
use frame_support::traits::Get;
|
||||||
|
let unsafe_interface: bool =
|
||||||
|
<<Runtime as pallet_revive::Config>::UnsafeUnstableInterface>::get();
|
||||||
|
assert!(
|
||||||
|
!unsafe_interface,
|
||||||
|
"Unstable interface MUST be disabled en production runtime canonical"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn revive_pallet_index_11_canonical_post_governance() {
|
||||||
|
// Pallet index canonical: Revive=11 (post Governance=10 Phase 5.1).
|
||||||
|
// Asegura orden storage migrations canonical canonical preservado.
|
||||||
|
use frame_support::traits::PalletInfoAccess;
|
||||||
|
assert_eq!(<crate::Revive as PalletInfoAccess>::index(), 11);
|
||||||
|
assert_eq!(<crate::Revive as PalletInfoAccess>::name(), "Revive");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn revive_address_mapper_account32_returns_h160_canonical() {
|
||||||
|
// AccountId32Mapper canonical: AccountId32 → H160 mapping deterministic.
|
||||||
|
// BLAKE2b derivation per Asset Hub canonical solochain pattern.
|
||||||
|
// Slice 3.1 SCAFFOLD: verify mapper type bound, no real address conversion
|
||||||
|
// (requires pallet runtime context). Phase 3.x maduración: real mapping tests.
|
||||||
|
use pallet_revive::AddressMapper;
|
||||||
|
type ConfiguredMapper = <Runtime as pallet_revive::Config>::AddressMapper;
|
||||||
|
// Compile-time verification que el mapper type implements AddressMapper trait
|
||||||
|
fn _verify_implements_mapper<M: AddressMapper<Runtime>>() {}
|
||||||
|
_verify_implements_mapper::<ConfiguredMapper>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user