Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ab37149
enable target_a and _b syncing for sidechain mode and prepare new dem…
brenzi Nov 23, 2023
2ae982d
add shard vault proxy account on target A/B as well. derivation is de…
brenzi Nov 23, 2023
d62b26d
prepare event listener on target A and fix demoscript
brenzi Nov 23, 2023
d9bff04
remove old enclave_bridge unshield call from trusted_call
brenzi Nov 23, 2023
e9c408c
abstracting parentchain effect opaque_calls. stf can send to any pare…
brenzi Nov 23, 2023
ff686b6
sending stf extrinsics to all parentchains now
brenzi Nov 24, 2023
ec5918e
WIP: triggering block import of target_a and b upon sidechain on_slot
brenzi Nov 24, 2023
42b10e7
refactored aura to trigger target_a and target_b import
brenzi Nov 25, 2023
2f12d4b
shielding from target_a worked
brenzi Nov 25, 2023
a62dc20
demo passes first and second rungit add -u!
brenzi Nov 25, 2023
3c5cafc
log cosmetics
brenzi Nov 26, 2023
72f2849
generic event display (fails). log cosmetics
brenzi Nov 27, 2023
30c1ef5
hack the fees. and more pimps
brenzi Nov 27, 2023
c46c67b
recorded demo with this
brenzi Nov 27, 2023
90cb372
fixed cargo test
brenzi Nov 28, 2023
6d97c2a
clippy
brenzi Nov 28, 2023
c47a9c5
fixed enclave tests
brenzi Nov 28, 2023
6eacfd7
cleanup
brenzi Nov 28, 2023
886af3b
Merge branch 'master' into ab/target-a-shielding-unshielding-sidechai…
brenzi Nov 28, 2023
b16439c
fix CI
brenzi Nov 28, 2023
2ea0472
CI: introduce fee tolerance when assering balances
brenzi Nov 28, 2023
13c20f3
fix evm tests
brenzi Nov 28, 2023
20b7468
fix
brenzi Nov 28, 2023
83ee1aa
clippy with test flag
brenzi Nov 28, 2023
39a3147
fix demo_sidechain with fee tolerance
brenzi Nov 28, 2023
a70685d
CI fixes
brenzi Nov 28, 2023
b75036e
review remarks fixed
brenzi Nov 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed cargo test
  • Loading branch information
brenzi committed Nov 28, 2023
commit 90cb372a3d58b86bb44b820d734d875886467f31
3 changes: 2 additions & 1 deletion core-primitives/stf-executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ mod tests {
int: u8,
) -> (ExecutedOperation<TrustedCallSignedMock, GetterMock>, H256) {
let hash = H256::from([int; 32]);
let opaque_call: Vec<OpaqueCall> = vec![OpaqueCall(vec![int; 10])];
let opaque_call: Vec<ParentchainCall> =
vec![ParentchainCall::Integritee(OpaqueCall(vec![int; 10]))];
let operation =
ExecutedOperation::success(hash, TrustedOperationOrHash::Hash(hash), opaque_call);
(operation, hash)
Expand Down
4 changes: 4 additions & 0 deletions core/parentchain/block-importer/src/block_importer_mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::{
error::{Error, Result},
ImportParentchainBlocks,
};
use itp_types::parentchain::ParentchainId;
use std::{sync::RwLock, vec::Vec};

/// Mock implementation for the block importer.
Expand Down Expand Up @@ -58,4 +59,7 @@ where
imported_blocks_lock.extend(blocks_to_import);
Ok(())
}
fn parentchain_id(&self) -> ParentchainId {
ParentchainId::Integritee
}
}
17 changes: 14 additions & 3 deletions sidechain/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,14 @@ mod tests {
onchain_mock: OnchainMock,
trigger_parentchain_import: Arc<TriggerParentchainBlockImportMock<SignedParentchainBlock>>,
) -> TestAura {
Aura::new(Keyring::Alice.pair(), onchain_mock, trigger_parentchain_import, EnvironmentMock)
Aura::new(
Keyring::Alice.pair(),
onchain_mock,
trigger_parentchain_import,
None,
None,
EnvironmentMock,
)
}

fn get_default_aura() -> TestAura {
Expand All @@ -417,7 +424,9 @@ mod tests {
timestamp: now,
duration: SLOT_DURATION,
ends_at: now + SLOT_DURATION,
last_imported_parentchain_head: header.clone(),
last_imported_integritee_parentchain_head: header.clone(),
maybe_last_imported_target_a_parentchain_head: None,
maybe_last_imported_target_b_parentchain_head: None,
}
}

Expand Down Expand Up @@ -533,7 +542,9 @@ mod tests {
timestamp: now,
duration: nano_dur,
ends_at: now + nano_dur,
last_imported_parentchain_head: ParentchainHeaderBuilder::default().build(),
last_imported_integritee_parentchain_head: ParentchainHeaderBuilder::default().build(),
maybe_last_imported_target_a_parentchain_head: None,
maybe_last_imported_target_b_parentchain_head: None,
};

let result = PerShardSlotWorkerScheduler::on_slot(
Expand Down
2 changes: 2 additions & 0 deletions sidechain/consensus/aura/src/test/fixtures/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ pub type TestAura = Aura<
EnvironmentMock,
OnchainMock,
TriggerParentchainBlockImportMock<SignedBlock<ParentchainBlock>>,
TriggerParentchainBlockImportMock<SignedBlock<ParentchainBlock>>,
TriggerParentchainBlockImportMock<SignedBlock<ParentchainBlock>>,
>;
26 changes: 24 additions & 2 deletions sidechain/consensus/slots/src/mocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,36 @@ where
todo!()
}

fn import_parentchain_blocks_until(
fn import_integritee_parentchain_blocks_until(
&self,
_last_imported_parentchain_header: &<B::Header as ParentchainHeaderTrait>::Hash,
) -> Result<Option<B::Header>> {
todo!()
}

fn peek_latest_parentchain_header(&self) -> Result<Option<B::Header>> {
fn peek_latest_integritee_parentchain_header(&self) -> Result<Option<B::Header>> {
todo!()
}

fn import_target_a_parentchain_blocks_until(
&self,
_last_imported_parentchain_header: &<B::Header as ParentchainHeaderTrait>::Hash,
) -> Result<Option<B::Header>> {
todo!()
}

fn peek_latest_target_a_parentchain_header(&self) -> Result<Option<B::Header>> {
todo!()
}

fn import_target_b_parentchain_blocks_until(
&self,
_last_imported_parentchain_header: &<B::Header as ParentchainHeaderTrait>::Hash,
) -> Result<Option<B::Header>> {
todo!()
}

fn peek_latest_target_b_parentchain_header(&self) -> Result<Option<B::Header>> {
todo!()
}

Expand Down
2 changes: 2 additions & 0 deletions sidechain/consensus/slots/src/per_shard_slot_worker_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,7 @@ fn slot_info_from_now() -> SlotInfo<ParentchainBlock> {
SLOT_DURATION,
slot_ends_at,
ParentchainHeaderBuilder::default().build(),
None,
None,
)
}
33 changes: 26 additions & 7 deletions sidechain/consensus/slots/src/slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ mod tests {
timestamp: duration_now(),
duration: SLOT_DURATION,
ends_at: duration_now() + SLOT_DURATION,
last_imported_parentchain_head: ParentchainHeaderBuilder::default().build(),
last_imported_integritee_parentchain_head: ParentchainHeaderBuilder::default().build(),
maybe_last_imported_target_a_parentchain_head: None,
maybe_last_imported_target_b_parentchain_head: None,
}
}

Expand Down Expand Up @@ -270,11 +272,18 @@ mod tests {
let slot: Slot = 1000.into();

let slot_end_time = slot_ends_at(slot, SLOT_DURATION);
let slot_one: SlotInfo<ParentchainBlock> =
SlotInfo::new(slot, timestamp, SLOT_DURATION, slot_end_time, pc_header.clone());
let slot_one: SlotInfo<ParentchainBlock> = SlotInfo::new(
slot,
timestamp,
SLOT_DURATION,
slot_end_time,
pc_header.clone(),
None,
None,
);
thread::sleep(Duration::from_millis(200));
let slot_two: SlotInfo<ParentchainBlock> =
SlotInfo::new(slot, timestamp, SLOT_DURATION, slot_end_time, pc_header);
SlotInfo::new(slot, timestamp, SLOT_DURATION, slot_end_time, pc_header, None, None);

let difference_of_ends_at =
(slot_one.ends_at.as_millis()).abs_diff(slot_two.ends_at.as_millis());
Expand All @@ -294,7 +303,9 @@ mod tests {
timestamp: duration_now() - Duration::from_secs(5),
duration: SLOT_DURATION,
ends_at: duration_now() + SLOT_DURATION - Duration::from_secs(5),
last_imported_parentchain_head: ParentchainHeaderBuilder::default().build(),
last_imported_integritee_parentchain_head: ParentchainHeaderBuilder::default().build(),
maybe_last_imported_target_a_parentchain_head: None,
maybe_last_imported_target_b_parentchain_head: None,
};
assert!(slot.duration_remaining().is_none());
}
Expand All @@ -306,7 +317,9 @@ mod tests {
timestamp: duration_now() - Duration::from_secs(5),
duration: SLOT_DURATION,
ends_at: duration_now() + Duration::from_secs(60),
last_imported_parentchain_head: ParentchainHeaderBuilder::default().build(),
last_imported_integritee_parentchain_head: ParentchainHeaderBuilder::default().build(),
maybe_last_imported_target_a_parentchain_head: None,
maybe_last_imported_target_b_parentchain_head: None,
};
let maybe_duration_remaining = slot.duration_remaining();
assert!(maybe_duration_remaining.is_some());
Expand All @@ -322,7 +335,7 @@ mod tests {

thread::sleep(SLOT_DURATION * 2);
let slot: SlotInfo<ParentchainBlock> =
SlotInfo::new(slot, timestamp, SLOT_DURATION, slot_end_time, pc_header);
SlotInfo::new(slot, timestamp, SLOT_DURATION, slot_end_time, pc_header, None, None);

assert!(slot.ends_at < duration_now());
}
Expand Down Expand Up @@ -366,6 +379,8 @@ mod tests {
duration_now(),
SLOT_DURATION,
ParentchainHeaderBuilder::default().build(),
None,
None,
&mut LastSlot,
)
.unwrap()
Expand All @@ -380,6 +395,8 @@ mod tests {
duration_now() + SLOT_DURATION,
SLOT_DURATION,
ParentchainHeaderBuilder::default().build(),
None,
None,
&mut LastSlot
)
.unwrap()
Expand All @@ -393,6 +410,8 @@ mod tests {
duration_now(),
Default::default(),
ParentchainHeaderBuilder::default().build(),
None,
None,
&mut LastSlot,
),
"Tried to yield next slot with 0 duration",
Expand Down