Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions soroban-spec-rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ use soroban_spec::read::{from_wasm, FromWasmError};

use types::{generate_enum, generate_error_enum, generate_event, generate_struct, generate_union};

// IMPORTANT: The "docs" fields of spec entries are not output in Rust token
// streams as rustdocs, because rustdocs can contain rust code, and that code
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
// will be executed. Generated code may be generated on untrusted wasms
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
// containing untrusted spec docs.

#[derive(thiserror::Error, Debug)]
pub enum GenerateFromFileError {
#[error("reading file: {0}")]
Expand Down
5 changes: 5 additions & 0 deletions soroban-spec-rust/src/trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ use stellar_xdr::ScSpecFunctionV0;

use super::types::generate_type_ident;

// IMPORTANT: The "docs" fields of spec entries are not output in Rust token
// streams as rustdocs, because rustdocs can contain rust code, and that code
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
// will be executed. Generated code may be generated on untrusted wasms
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
// containing untrusted spec docs.

/// Constructs a token stream containing a single trait that has a function for
/// every function spec.
pub fn generate_trait(name: &str, specs: &[&ScSpecFunctionV0]) -> TokenStream {
Expand Down
5 changes: 3 additions & 2 deletions soroban-spec-rust/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ use stellar_xdr::{
};

// IMPORTANT: The "docs" fields of spec entries are not output in Rust token
// streams as rustdocs, because rustdocs are evaluated and execute code by
// default in Rust projects.
// streams as rustdocs, because rustdocs can contain rust code, and that code
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
// will be executed. Generated code may be generated on untrusted wasms
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
Comment thread
leighmcculloch marked this conversation as resolved.
Outdated
// containing untrusted spec docs.

// TODO: Replace the unwrap()s in this code with returning Result.
// TODO: Create Idents in a way that we can get a Result back and return it too
Expand Down
Loading