Skip to content

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvja committed Oct 16, 2024
2 parents c6ed0d9 + 4c5428d commit 0e66bab
Show file tree
Hide file tree
Showing 18 changed files with 237 additions and 336 deletions.
146 changes: 73 additions & 73 deletions Cargo.lock

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ arrayvec = "0.7.4"
ascii = "1.1.0"
base64 = { version = "0.21", default-features = false, features = ["alloc"] }
blake3 = { version = "1.3.3", default-features = false }
borsh = { version = "0.10.3", default-features = false }
borsh = { version = "0.10.4", default-features = false }
bs58 = { version = "0.5.0", default-features = false }
bytemuck = { version = "1.14", default-features = false }
chrono = { version = "0.4", default-features = false }
Expand All @@ -56,17 +56,17 @@ hex-literal = "0.4.1"
rayon = "1.10.0"

# Use unreleased ibc-rs which supports custom verifier.
ibc = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false, features = ["borsh", "serde"] }
ibc-client-tendermint-types = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false }
ibc-core-channel-types = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false }
ibc-core-client-context = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false }
ibc-core-client-types = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false }
ibc-core-commitment-types = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false }
ibc-core-connection-types = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false }
ibc-core-host = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false }
ibc-core-host-types = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false }
ibc-primitives = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false }
ibc-testkit = { git = "https://github.com/mina86/ibc-rs", rev = "f07276383091f75b7ee8bff6fd434f8214ac5054", default-features = false }
ibc = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false, features = ["borsh", "serde"] }
ibc-client-tendermint-types = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false }
ibc-core-channel-types = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false }
ibc-core-client-context = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false }
ibc-core-client-types = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false }
ibc-core-commitment-types = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false }
ibc-core-connection-types = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false }
ibc-core-host = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false }
ibc-core-host-types = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false }
ibc-primitives = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false }
ibc-testkit = { git = "https://github.com/mina86/ibc-rs", rev = "e1be8c9292c82c1e7c158067f0014fb292ee652d", default-features = false }

ibc-proto = { version = "0.41.0", default-features = false }
insta = { version = "1.34.0" }
Expand Down
7 changes: 6 additions & 1 deletion common/cf-guest/src/client/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ where
ctx.store_consensus_state(
ibc::path::ClientConsensusStatePath::new(
client_id.clone(),
0,
1,
u64::from(self.latest_height),
),
consensus_state.into(),
Expand Down Expand Up @@ -384,6 +384,11 @@ where
Err(ibc::ClientError::ConsensusStateNotFound { .. }) => {
return Ok(ibc::Status::Expired)
}
// If the client state is not found, then a new client is going to be created and since its known from
// above that the client state is not frozen, we return the client state as active.
Err(ibc::ClientError::ClientStateNotFound { .. }) => {
return Ok(ibc::Status::Active)
}
Err(err) => return Err(err),
};

Expand Down
12 changes: 6 additions & 6 deletions common/cf-solana/src/client/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ impl ibc::ClientStateCommon for ClientState {
}
}


impl<E> ibc::ClientStateExecution<E> for ClientState
where
E: ibc::ExecutionContext + ibc::ClientExecutionContext + CommonContext,
Expand All @@ -188,7 +187,7 @@ where
ctx.store_consensus_state(
ibc::path::ClientConsensusStatePath::new(
client_id.clone(),
0,
1,
self.latest_slot.get(),
),
consensus_state.into(),
Expand Down Expand Up @@ -299,6 +298,11 @@ where
Err(ibc::ClientError::ConsensusStateNotFound { .. }) => {
return Ok(ibc::Status::Expired)
}
// If the client state is not found, then a new client is going to be created and since its known from
// above that the client state is not frozen, we return the client state as active.
Err(ibc::ClientError::ClientStateNotFound { .. }) => {
return Ok(ibc::Status::Active)
}
Err(err) => return Err(err),
};

Expand All @@ -311,7 +315,6 @@ where
}
}


impl ClientState {
pub fn do_update_state(
&self,
Expand Down Expand Up @@ -511,12 +514,10 @@ impl ClientState {
}
}


fn error(msg: impl ToString) -> ibc::ClientError {
ibc::ClientError::Other { description: msg.to_string() }
}


/// Checks client id’s client type is what’s expected and then parses the id as
/// `ClientIdx`.
///
Expand All @@ -536,7 +537,6 @@ fn parse_client_id(client_id: &ibc::ClientId) -> Result<trie_ids::ClientIdx> {
Err(ibc::ClientError::ClientSpecific { description })
}


#[test]
fn test_verify_client_type() {
use core::str::FromStr;
Expand Down
8 changes: 4 additions & 4 deletions common/memory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ mod test_write_log {
fn test_free_commit() {
let (mut alloc, ptrs) = make_allocator();
let mut wlog = WriteLog::new(&mut alloc);
for num in 5..10 {
wlog.free(ptrs[num]);
for ptr in &ptrs[5..10] {
wlog.free(*ptr);
}
assert_nodes(10, wlog.allocator(), &ptrs, 0);
wlog.commit();
Expand All @@ -421,8 +421,8 @@ mod test_write_log {
fn test_free_rollback() {
let (mut alloc, ptrs) = make_allocator();
let mut wlog = WriteLog::new(&mut alloc);
for num in 5..10 {
wlog.free(ptrs[num]);
for ptr in &ptrs[5..10] {
wlog.free(*ptr);
}
assert_nodes(10, wlog.allocator(), &ptrs, 0);
core::mem::drop(wlog);
Expand Down
1 change: 1 addition & 0 deletions common/sealable-trie/src/bits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,7 @@ mod test_pop {
}

#[test]
#[allow(clippy::just_underscores_and_digits)]
fn test_pop_back_slice() {
let bytes = [
7, 182, 182, 167, 177, 247, 171, 255, 255, 255, 0, 0, 0, 0, 0, 0,
Expand Down
1 change: 0 additions & 1 deletion common/sealable-trie/src/bits/ext_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ fn test_decode() {

#[track_caller]
fn test(length: u16, offset: U3, bad: &[u8], good: &[u8]) {
let offset = U3::try_from(offset).unwrap();
let num = length * 8 + u16::from(offset);
let bad = [&num.to_be_bytes()[..], bad].concat();
assert_eq!(None, ExtKey::decode(&bad, 0));
Expand Down
10 changes: 8 additions & 2 deletions common/sealable-trie/src/trie/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ fn stress_test_iter() {
}
}

#[derive(Clone, Eq, Ord)]
#[derive(Clone, Eq)]
struct Key {
len: u8,
buf: [u8; 35],
Expand Down Expand Up @@ -425,9 +425,15 @@ impl core::cmp::PartialEq for Key {
fn eq(&self, other: &Self) -> bool { self.as_bytes() == other.as_bytes() }
}

impl core::cmp::Ord for Key {
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
self.as_bytes().cmp(other.as_bytes())
}
}

impl core::cmp::PartialOrd for Key {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
self.as_bytes().partial_cmp(other.as_bytes())
Some(self.cmp(other))
}
}

Expand Down
13 changes: 5 additions & 8 deletions common/trie-geyser/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,16 @@ fn test_slot_data_serialisation() {
);

let mut proof = proof::MerkleProof::default();
let level = [
CryptoHash::test(10).into(),
CryptoHash::test(11).into(),
CryptoHash::test(12).into(),
];
let level =
[CryptoHash::test(10), CryptoHash::test(11), CryptoHash::test(12)];
proof.push_level(&level, 1);

let data = SlotData {
delta_hash_proof: proof::DeltaHashProof {
parent_blockhash: CryptoHash::test(101).into(),
accounts_delta_hash: CryptoHash::test(102).into(),
parent_blockhash: CryptoHash::test(101),
accounts_delta_hash: CryptoHash::test(102),
num_sigs: 103,
blockhash: CryptoHash::test(104).into(),
blockhash: CryptoHash::test(104),
epoch_accounts_hash: None,
},
witness_proof: proof::AccountProof { account_hash_data, proof },
Expand Down
144 changes: 0 additions & 144 deletions solana/app/README.md

This file was deleted.

3 changes: 2 additions & 1 deletion solana/signature-verifier/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ impl<'a, 'info> SignaturesAccount<'a, 'info> {
#[cfg(any(test, not(feature = "library")))]
pub(crate) fn write_count_and_sort(&self, count: u32) -> Result {
let mut data = self.0.try_borrow_mut_data()?;
let (head, tail) = stdx::split_at_mut::<4, _>(&mut *data)
#[allow(clippy::explicit_auto_deref)]
let (head, tail) = stdx::split_at_mut::<4, _>(*data)
.ok_or(ProgramError::AccountDataTooSmall)?;
let entries = stdx::as_chunks_mut::<{ SignatureHash::SIZE }, _>(tail)
.0
Expand Down
Loading

0 comments on commit 0e66bab

Please sign in to comment.