Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/sign_and_send
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Jul 29, 2024
2 parents f099cbe + 98373fd commit e6a77aa
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 98 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/update-completed-sprint-on-issue-closed.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 0 additions & 67 deletions cmd/soroban-cli/src/commands/contract/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ use std::str::FromStr;
use std::{fmt::Debug, fs, io};

use clap::{arg, command, Parser};
use soroban_env_host::{
budget::Budget,
storage::Storage,
xdr::{
self, ContractCodeEntry, ContractDataDurability, ContractDataEntry, ContractExecutable,
Error as XdrError, LedgerEntryData, LedgerKey, LedgerKeyContractCode,
LedgerKeyContractData, ScAddress, ScContractInstance, ScVal,
},
};

use soroban_spec::read::FromWasmError;
use stellar_strkey::DecodeError;

use crate::commands::{global, NetworkRunnable};
use crate::config::{
Expand Down Expand Up @@ -69,21 +57,9 @@ pub enum Error {
#[error(transparent)]
Locator(#[from] locator::Error),
#[error(transparent)]
Xdr(#[from] XdrError),
#[error(transparent)]
Spec(#[from] soroban_spec::read::FromWasmError),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("missing result")]
MissingResult,
#[error("unexpected contract code data type: {0:?}")]
UnexpectedContractCodeDataType(LedgerEntryData),
#[error("reading file {0:?}: {1}")]
CannotWriteContractFile(PathBuf, io::Error),
#[error("cannot parse contract ID {0}: {1}")]
CannotParseContractId(String, DecodeError),
#[error("network details not provided")]
NetworkNotProvided,
#[error(transparent)]
Network(#[from] network::Error),
#[error("cannot create contract directory for {0:?}")]
Expand Down Expand Up @@ -153,46 +129,3 @@ impl NetworkRunnable for Cmd {
Ok(client.get_remote_wasm(&contract_id).await?)
}
}
pub fn get_contract_wasm_from_storage(
storage: &mut Storage,
contract_id: [u8; 32],
) -> Result<Vec<u8>, FromWasmError> {
let key = LedgerKey::ContractData(LedgerKeyContractData {
contract: ScAddress::Contract(contract_id.into()),
key: ScVal::LedgerKeyContractInstance,
durability: ContractDataDurability::Persistent,
});
match storage.get(&key.into(), &Budget::default()) {
Ok(rc) => match rc.as_ref() {
xdr::LedgerEntry {
data:
LedgerEntryData::ContractData(ContractDataEntry {
val: ScVal::ContractInstance(ScContractInstance { executable, .. }),
..
}),
..
} => match executable {
ContractExecutable::Wasm(hash) => {
if let Ok(rc) = storage.get(
&LedgerKey::ContractCode(LedgerKeyContractCode { hash: hash.clone() })
.into(),
&Budget::default(),
) {
match rc.as_ref() {
xdr::LedgerEntry {
data: LedgerEntryData::ContractCode(ContractCodeEntry { code, .. }),
..
} => Ok(code.to_vec()),
_ => Err(FromWasmError::NotFound),
}
} else {
Err(FromWasmError::NotFound)
}
}
ContractExecutable::StellarAsset => todo!(),
},
_ => Err(FromWasmError::NotFound),
},
_ => Err(FromWasmError::NotFound),
}
}
2 changes: 0 additions & 2 deletions cmd/soroban-cli/src/commands/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ pub enum Error {
InvalidUrl(String),
#[error("Inproper response {0}")]
InproperResponse(String),
#[error("Currently not supported on windows. Please visit:\n{0}")]
WindowsNotSupported(String),
}

impl Cmd {
Expand Down
2 changes: 0 additions & 2 deletions cmd/soroban-cli/src/config/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ pub enum Error {
InvalidUrl(String),
#[error("Inproper response {0}")]
InproperResponse(String),
#[error("Currently not supported on windows. Please visit:\n{0}")]
WindowsNotSupported(String),
}

#[derive(Debug, clap::Args, Clone, Default)]
Expand Down

0 comments on commit e6a77aa

Please sign in to comment.