Skip to content

Commit

Permalink
refactor: remove superfluous CommandExecuted contract type
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth committed Mar 7, 2024
1 parent 0802231 commit bba0824
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
8 changes: 2 additions & 6 deletions contracts/axelar-gateway/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use soroban_sdk::{contract, contractimpl, Address, Bytes, BytesN, Env, String};
use axelar_auth_verifier::AxelarAuthVerifierClient;

use crate::interface::AxelarGatewayInterface;
use crate::storage_types::{CommandExecutedKey, ContractCallApprovalKey, DataKey};
use crate::storage_types::{ContractCallApprovalKey, DataKey};
use crate::types::{self, Command, SignedCommandBatch};
use crate::{error::Error, event};

Expand Down Expand Up @@ -125,7 +125,7 @@ impl AxelarGatewayInterface for AxelarGateway {
}

for (command_id, command) in batch.commands {
let key = Self::command_executed_key(command_id.clone());
let key = DataKey::CommandExecuted(command_id.clone());

// TODO: switch to full revert, or add allow selecting subset of commands to process
// Skip command if already executed. This allows batches to be processed partially.
Expand Down Expand Up @@ -168,10 +168,6 @@ impl AxelarGateway {
})
}

fn command_executed_key(command_id: BytesN<32>) -> DataKey {
DataKey::CommandExecuted(CommandExecutedKey { command_id })
}

fn approve_contract_call(
env: &Env,
command_id: BytesN<32>,
Expand Down
7 changes: 1 addition & 6 deletions contracts/axelar-gateway/src/storage_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ pub struct ContractCallApprovalKey {
pub payload_hash: BytesN<32>,
}

#[contracttype]
#[derive(Clone, Debug)]
pub struct CommandExecutedKey {
pub command_id: BytesN<32>,
}

#[contracttype]
#[derive(Clone, Debug)]
pub enum DataKey {
Initialized,
AuthModule,
CommandExecuted(CommandExecutedKey),
CommandExecuted(BytesN<32>),
ContractCallApproval(ContractCallApprovalKey),
}

0 comments on commit bba0824

Please sign in to comment.