Skip to content

Commit c0cbdf8

Browse files
committed
type renames
1 parent f18923c commit c0cbdf8

File tree

10 files changed

+73
-110
lines changed

10 files changed

+73
-110
lines changed

e2e/interchaintestv8/solana/test_helpers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ func (s *Solana) SubmitChunkedRelayPackets(
2828
) (solana.Signature, error) {
2929
t.Helper()
3030

31-
var batch relayertypes.RelayPacketBatch
31+
var batch relayertypes.SolanaRelayPacketBatch
3232
err := proto.Unmarshal(resp.Tx, &batch)
3333
if err != nil {
34-
return solana.Signature{}, fmt.Errorf("failed to unmarshal RelayPacketBatch: %w", err)
34+
return solana.Signature{}, fmt.Errorf("failed to unmarshal SolanaRelayPacketBatch: %w", err)
3535
}
3636
if len(batch.Packets) == 0 {
3737
return solana.Signature{}, fmt.Errorf("no relay packets provided")
@@ -60,7 +60,7 @@ func (s *Solana) SubmitChunkedRelayPackets(
6060
packetResults := make(chan packetResult, len(batch.Packets))
6161

6262
for packetIdx, packet := range batch.Packets {
63-
go func(pktIdx int, pkt *relayertypes.PacketTransactions) {
63+
go func(pktIdx int, pkt *relayertypes.SolanaPacketTxs) {
6464
packetStart := time.Now()
6565
t.Logf("--- Packet %d: Starting (%d chunks + 1 final tx) ---", pktIdx+1, len(pkt.Chunks))
6666

e2e/interchaintestv8/solana_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,6 @@ func (s *IbcEurekaSolanaTestSuite) Test_CleanupOrphanedTendermintHeaderChunks()
14891489
s.Require().True(s.Run("Call cleanup_chunks instruction", func() {
14901490
cleanupInstruction, err := ics07_tendermint.NewCleanupIncompleteUploadInstruction(
14911491
submitter,
1492-
submitter,
14931492
)
14941493
s.Require().NoError(err)
14951494

e2e/interchaintestv8/types/relayer/relayer.pb.go

Lines changed: 42 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/go-anchor/ics07tendermint/instructions.go

Lines changed: 4 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/relayer/modules/cosmos-to-solana/src/lib.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,9 @@ impl RelayerService for CosmosToSolanaRelayerModuleService {
194194
packet_txs.len()
195195
);
196196

197-
// Serialize packet transactions into RelayPacketBatch
198-
let packets = packet_txs
199-
.iter()
200-
.map(|pkt| api::PacketTransactions {
201-
chunks: pkt.chunk_txs.clone(),
202-
final_tx: pkt.final_tx.clone(),
203-
cleanup_tx: pkt.cleanup_tx.clone(),
204-
})
205-
.collect();
206-
207-
let batch = api::RelayPacketBatch { packets };
197+
let batch = api::SolanaRelayPacketBatch {
198+
packets: packet_txs,
199+
};
208200
let tx = prost::Message::encode_to_vec(&batch);
209201

210202
Ok(Response::new(api::RelayByTxResponse {

packages/relayer/modules/cosmos-to-solana/src/tx_builder.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use tendermint_proto::Protobuf;
4444

4545
use crate::constants::ANCHOR_DISCRIMINATOR_SIZE;
4646
use crate::gmp;
47-
use ibc_eureka_relayer_core::api;
47+
use ibc_eureka_relayer_core::api::{self, SolanaPacketTxs};
4848

4949
use solana_ibc_types::{
5050
ics07::{ics07_instructions, ClientState, ConsensusState, SignatureData},
@@ -87,17 +87,6 @@ struct UploadChunkParams {
8787
chunk_data: Vec<u8>,
8888
}
8989

90-
/// Organized transactions for chunked packet operations
91-
#[derive(Debug, serde::Serialize, serde::Deserialize)]
92-
pub struct SolanaPacketTxs {
93-
/// All chunk upload transactions for payloads and proof
94-
pub chunk_txs: Vec<Vec<u8>>,
95-
/// Final packet transaction (recv/ack/timeout)
96-
pub final_tx: Vec<u8>,
97-
/// Cleanup transaction (reclaims rent from chunks)
98-
pub cleanup_tx: Vec<u8>,
99-
}
100-
10190
/// Helper to derive header chunk PDA
10291
fn derive_header_chunk(
10392
submitter: Pubkey,
@@ -1385,7 +1374,7 @@ impl TxBuilder {
13851374
)?;
13861375

13871376
Ok(SolanaPacketTxs {
1388-
chunk_txs,
1377+
chunks: chunk_txs,
13891378
final_tx: recv_tx,
13901379
cleanup_tx,
13911380
})
@@ -1448,7 +1437,7 @@ impl TxBuilder {
14481437
)?;
14491438

14501439
Ok(SolanaPacketTxs {
1451-
chunk_txs,
1440+
chunks: chunk_txs,
14521441
final_tx: ack_tx,
14531442
cleanup_tx,
14541443
})
@@ -1494,7 +1483,7 @@ impl TxBuilder {
14941483
)?;
14951484

14961485
Ok(SolanaPacketTxs {
1497-
chunk_txs,
1486+
chunks: chunk_txs,
14981487
final_tx: timeout_tx,
14991488
cleanup_tx,
15001489
})

programs/solana/programs/ics07-tendermint/src/instructions/cleanup_incomplete_upload.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ use anchor_lang::prelude::*;
33
use anchor_lang::Discriminator;
44

55
/// Cleans up incomplete update client uploads by closing both `HeaderChunk` and `SignatureVerification` PDAs
6-
pub fn cleanup_incomplete_upload(
7-
ctx: Context<CleanupIncompleteUpload>,
8-
submitter: Pubkey,
9-
) -> Result<()> {
6+
pub fn cleanup_incomplete_upload(ctx: Context<CleanupIncompleteUpload>) -> Result<()> {
7+
let submitter = ctx.accounts.submitter.key();
8+
109
for account in ctx.remaining_accounts {
1110
if account.owner != &crate::ID || account.lamports() == 0 {
1211
continue;
@@ -15,7 +14,7 @@ pub fn cleanup_incomplete_upload(
1514
let should_close = is_owned_by_submitter(account, submitter)?;
1615

1716
if should_close {
18-
crate::helpers::close_account(account, &ctx.accounts.submitter_account)?;
17+
crate::helpers::close_account(account, &ctx.accounts.submitter)?;
1918
}
2019
}
2120

programs/solana/programs/ics07-tendermint/src/instructions/cleanup_incomplete_upload/tests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ fn setup_test_accounts_with_chunks(
138138
}
139139
}
140140

141-
fn create_cleanup_instruction(test_accounts: &TestAccounts, submitter: Pubkey) -> Instruction {
142-
let instruction_data = crate::instruction::CleanupIncompleteUpload { submitter };
141+
fn create_cleanup_instruction(test_accounts: &TestAccounts) -> Instruction {
142+
let instruction_data = crate::instruction::CleanupIncompleteUpload;
143143

144144
let mut account_metas = vec![AccountMeta::new(test_accounts.submitter, true)];
145145

@@ -203,7 +203,7 @@ fn test_cleanup_successful_with_rent_reclaim() {
203203
let total_expected_rent = chunk_rent_per * u64::from(num_chunks);
204204
let initial_submitter_balance = 10_000_000_000u64;
205205

206-
let instruction = create_cleanup_instruction(&test_accounts, submitter);
206+
let instruction = create_cleanup_instruction(&test_accounts);
207207

208208
let result = assert_instruction_succeeds(&instruction, &test_accounts.accounts);
209209

@@ -358,7 +358,7 @@ fn test_cleanup_with_missing_chunks() {
358358
},
359359
));
360360

361-
let instruction_data = crate::instruction::CleanupIncompleteUpload { submitter };
361+
let instruction_data = crate::instruction::CleanupIncompleteUpload;
362362

363363
let instruction = Instruction {
364364
program_id: crate::ID,
@@ -425,7 +425,7 @@ fn test_cleanup_with_wrong_chunk_order() {
425425
let test_accounts =
426426
setup_test_accounts_with_chunks(chain_id, cleanup_height, submitter, 3, true);
427427

428-
let instruction_data = crate::instruction::CleanupIncompleteUpload { submitter };
428+
let instruction_data = crate::instruction::CleanupIncompleteUpload;
429429

430430
// Pass chunks in wrong order (2, 0, 1 instead of 0, 1, 2)
431431
let instruction = Instruction {

0 commit comments

Comments
 (0)