What problem does your feature solve?
In cmd/soroban-cli/src/commands/snapshot/create.rs, the second match on val.data (around line 383) returns true or false from each arm, which looks like it was intended to filter whether an entry should be saved into the snapshot. However the result of the match is discarded (semicolon on the closing brace), and the snapshot.ledger_entries.push(...) and count_saved += 1 that follow execute unconditionally for every entry:
|
ScVal::ContractInstance(ScContractInstance { |
|
executable: ContractExecutable::StellarAsset, |
|
storage: Some(storage), |
|
}) => { |
|
if let Some(name) = |
|
get_name_from_stellar_asset_contract_storage(storage) |
|
{ |
|
let asset: builder::Asset = name.parse()?; |
|
if let Some(issuer) = match asset |
|
.resolve(&global_args.locator)? |
|
{ |
|
Asset::Native => None, |
|
Asset::CreditAlphanum4(a4) => Some(a4.issuer), |
|
Asset::CreditAlphanum12(a12) => Some(a12.issuer), |
|
} { |
|
print.infoln(format!( |
|
"Adding asset issuer {issuer} to search" |
|
)); |
|
next.account_ids.insert(issuer); |
|
} |
|
} |
|
} |
|
_ => {} |
|
} |
|
} |
|
keep |
|
} |
|
_ => false, |
|
}; |
|
snapshot |
|
.ledger_entries |
|
.push((Box::new(key), (Box::new(val), Some(u32::MAX)))); |
match &val.data {
LedgerEntryData::ConfigSetting(ConfigSettingEntry::StateArchival(
state_archival,
)) => {
// ...
false
}
LedgerEntryData::ContractData(e) => {
// ...
keep
}
_ => false,
}; // <-- result discarded
snapshot
.ledger_entries
.push((Box::new(key), (Box::new(val), Some(u32::MAX))));
count_saved += 1;
Does this mean all matched entries (including ConfigSetting entries that return false) are being unconditionally included in the final snapshot? I think so.
What would you like to see?
The match result should be used to conditionally save the entry, if that was the original intent.
What alternatives are there?
If all entries are intentionally being saved, the false return values in the match arms are dead code and should be cleaned up to avoid confusion.
What problem does your feature solve?
In
cmd/soroban-cli/src/commands/snapshot/create.rs, the secondmatchonval.data(around line 383) returnstrueorfalsefrom each arm, which looks like it was intended to filter whether an entry should be saved into the snapshot. However the result of thematchis discarded (semicolon on the closing brace), and thesnapshot.ledger_entries.push(...)andcount_saved += 1that follow execute unconditionally for every entry:stellar-cli/cmd/soroban-cli/src/commands/snapshot/create.rs
Lines 383 to 414 in a1c9455
Does this mean all matched entries (including
ConfigSettingentries that returnfalse) are being unconditionally included in the final snapshot? I think so.What would you like to see?
The
matchresult should be used to conditionally save the entry, if that was the original intent.What alternatives are there?
If all entries are intentionally being saved, the
falsereturn values in the match arms are dead code and should be cleaned up to avoid confusion.