Skip to content

Commit

Permalink
chore: fix clippy and try removing symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
albert-llimos committed Feb 13, 2025
1 parent 812617c commit 1e47995
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
3 changes: 2 additions & 1 deletion engine/src/witness/sol/lookup_table_witnessing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::str::FromStr;
// only error if the rpc call fails or returns an unrecognized format respons. That is
// because this address will be provided by the user (user alts) and in case of the address
// not being a valid ALT we still want to reach consensus.
#[allow(dead_code)]
pub async fn get_lookup_table_state<SolRetryRpcClient>(
sol_rpc: &SolRetryRpcClient,
lookup_table_address: SolAddress,
Expand Down Expand Up @@ -147,7 +148,7 @@ mod tests {

// Check the first one just to make sure it's working
assert_eq!(
addresses.iter().next().unwrap(),
addresses.first().unwrap(),
&SolAddress::from_str("11111111111111111111111111111111").unwrap()
);

Expand Down
10 changes: 5 additions & 5 deletions localnet/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ build-localnet() {
REPLY=$(check_endpoint_health -H "Content-Type: application/json" -s -d '{"id":1, "jsonrpc":"2.0", "method": "chain_getBlockHash", "params":[0]}' 'http://localhost:9947') || [ -z $(echo $REPLY | grep -o '\"result\":\"0x[^"]*' | grep -o '0x.*') ]
DOT_GENESIS_HASH=$(echo $REPLY | grep -o '\"result\":\"0x[^"]*' | grep -o '0x.*')

if ! solana --version | grep -q Agave; then
# Not needed for newer clients even if the image was generated in the old v1.18.17
echo "🐛 Fix solana symlink issue ..."
ln -sf $SOLANA_BASE_PATH/test-ledger/accounts/snapshot/100 $SOLANA_BASE_PATH/test-ledger/snapshot/100/accounts_hardlinks/account_path_0
fi
# if ! solana --version | grep -q Agave; then
# # Not needed for newer clients even if the image was generated in the old v1.18.17
# echo "🐛 Fix solana symlink issue ..."
# ln -sf $SOLANA_BASE_PATH/test-ledger/accounts/snapshot/100 $SOLANA_BASE_PATH/test-ledger/snapshot/100/accounts_hardlinks/account_path_0
# fi

if which solana-test-validator >>$DEBUG_OUTPUT_DESTINATION 2>&1; then
echo "☀️ Waiting for Solana node to start"
Expand Down
9 changes: 7 additions & 2 deletions state-chain/cf-integration-tests/src/solana.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use cf_chains::{
api::{SolanaApi, SolanaEnvironment, SolanaTransactionBuildingError},
sol_tx_core::sol_test_values,
transaction_builder::SolanaTransactionBuilder,
SolAddress, SolApiEnvironment, SolCcmAccounts, SolCcmAddress, SolHash, SolPubkey,
SolanaCrypto,
SolAddress, SolAddressLookupTableAccount, SolApiEnvironment, SolCcmAccounts, SolCcmAddress,
SolHash, SolPubkey, SolanaCrypto,
},
CcmChannelMetadata, CcmDepositMetadata, Chain, ChannelRefundParameters,
ExecutexSwapAndCallError, ForeignChainAddress, RequiresSignatureRefresh, SetAggKeyWithAggKey,
Expand Down Expand Up @@ -84,6 +84,11 @@ fn setup_sol_environments() {
usdc_token_vault_ata: sol_test_values::USDC_TOKEN_VAULT_ASSOCIATED_TOKEN_ACCOUNT,
swap_endpoint_program: sol_test_values::SWAP_ENDPOINT_PROGRAM,
swap_endpoint_program_data_account: sol_test_values::SWAP_ENDPOINT_PROGRAM_DATA_ACCOUNT,
alt_manager_program: sol_test_values::ALT_MANAGER_PROGRAM,
address_lookup_table_account: SolAddressLookupTableAccount {
key: sol_test_values::ADDRESS_LOOKUP_TABLE_ACCOUNT.into(),
addresses: vec![],
},
});

// Environment::AvailableDurableNonces
Expand Down
9 changes: 9 additions & 0 deletions state-chain/chains/src/sol/sol_tx_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ pub mod sol_test_values {
const_address("35uYgHdfZQT4kHkaaXQ6ZdCkK5LFrsk43btTLbGCRCNT");
pub const SWAP_ENDPOINT_PROGRAM_DATA_ACCOUNT: SolAddress =
const_address("2tmtGLQcBd11BMiE9B1tAkQXwmPNgR79Meki2Eme4Ec9");
pub const ALT_MANAGER_PROGRAM: SolAddress =
const_address("49XegQyykAXwzigc6u7gXbaLjhKfNadWMZwFiovzjwUw");
pub const ADDRESS_LOOKUP_TABLE_ACCOUNT: SolAddress =
const_address("7drVSq2ymJLNnXyCciHbNqHyzuSt1SL4iQSEThiESN2c");
pub const EVENT_AND_SENDER_ACCOUNTS: [VaultSwapAccountAndSender; 11] = [
VaultSwapAccountAndSender {
vault_swap_account: const_address("2cHcSNtikMpjxJfwwoYL3udpy7hedRExyhakk2eZ6cYA"),
Expand Down Expand Up @@ -248,6 +252,11 @@ pub mod sol_test_values {
usdc_token_vault_ata: USDC_TOKEN_VAULT_ASSOCIATED_TOKEN_ACCOUNT,
swap_endpoint_program: SWAP_ENDPOINT_PROGRAM,
swap_endpoint_program_data_account: SWAP_ENDPOINT_PROGRAM_DATA_ACCOUNT,
alt_manager_program: ALT_MANAGER_PROGRAM,
address_lookup_table_account: SolAddressLookupTableAccount {
key: ADDRESS_LOOKUP_TABLE_ACCOUNT.into(),
addresses: vec![],
},
}
}

Expand Down
1 change: 1 addition & 0 deletions state-chain/chains/src/sol/transaction_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ pub mod test {
env.vault_program,
env.vault_program_data_account,
agg_key(),
env.alt_manager_program,
durable_nonce(),
compute_price(),
vec![chainflip_alt()],
Expand Down
5 changes: 5 additions & 0 deletions state-chain/pallets/cf-environment/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ impl ChainEnvironment<ApiEnvironment, SolApiEnvironment> for MockSolEnvironment
usdc_token_vault_ata: SolAddress([0x00; 32]),
swap_endpoint_program: SolAddress([0x00; 32]),
swap_endpoint_program_data_account: SolAddress([0x00; 32]),
alt_manager_program: SolAddress([0x00; 32]),
address_lookup_table_account: SolAddressLookupTableAccount {
key: SolAddress([0x00; 32]).into(),
addresses: vec![],
},
})
}
}
Expand Down

0 comments on commit 1e47995

Please sign in to comment.