Skip to content

Commit

Permalink
Rewrite spawn (#13)
Browse files Browse the repository at this point in the history
* Support spawn program in witnesses

* Add cycles charge for spawn

* Generic type

* Staged

* Rewrite spawn
  • Loading branch information
mohanson authored Mar 8, 2024
1 parent d44371f commit 6be39c2
Show file tree
Hide file tree
Showing 12 changed files with 548 additions and 1,046 deletions.
1 change: 0 additions & 1 deletion script/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ mod verify;
mod verify_env;

pub use crate::error::{ScriptError, TransactionScriptError};
pub use crate::syscalls::spawn::update_caller_machine;
pub use crate::types::{
ChunkCommand, CoreMachine, MachineContext, ResumableMachine, ScriptGroup, ScriptGroupType,
ScriptVersion, TransactionSnapshot, TransactionState, VerifyResult, VmIsa, VmVersion,
Expand Down
30 changes: 0 additions & 30 deletions script/src/syscalls/current_memory.rs

This file was deleted.

30 changes: 0 additions & 30 deletions script/src/syscalls/get_memory_limit.rs

This file was deleted.

12 changes: 0 additions & 12 deletions script/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
mod close;
mod current_cycles;
mod current_memory;
mod debugger;
mod exec;
mod get_memory_limit;
mod inherited_fd;
mod load_block_extension;
mod load_cell;
Expand All @@ -17,7 +15,6 @@ mod load_witness;
mod pipe;
mod process_id;
mod read;
mod set_content;
pub(crate) mod spawn;
mod utils;
mod vm_version;
Expand All @@ -32,10 +29,8 @@ mod tests;

pub use self::close::Close;
pub use self::current_cycles::CurrentCycles;
pub use self::current_memory::CurrentMemory;
pub use self::debugger::Debugger;
pub use self::exec::Exec;
pub use self::get_memory_limit::GetMemoryLimit;
pub use self::inherited_fd::InheritedFd;
pub use self::load_block_extension::LoadBlockExtension;
pub use self::load_cell::LoadCell;
Expand All @@ -49,7 +44,6 @@ pub use self::load_witness::LoadWitness;
pub use self::pipe::Pipe;
pub use self::process_id::ProcessID;
pub use self::read::Read;
pub use self::set_content::SetContent;
pub use self::spawn::Spawn;
pub use self::vm_version::VMVersion;
pub use self::wait::Wait;
Expand All @@ -69,9 +63,6 @@ pub const INDEX_OUT_OF_BOUND: u8 = 1;
pub const ITEM_MISSING: u8 = 2;
pub const SLICE_OUT_OF_BOUND: u8 = 3;
pub const WRONG_FORMAT: u8 = 4;
pub const SPAWN_EXCEEDED_MAX_CONTENT_LENGTH: u8 = 5;
pub const SPAWN_WRONG_MEMORY_LIMIT: u8 = 6;
pub const SPAWN_EXCEEDED_MAX_PEAK_MEMORY: u8 = 7;

pub const VM_VERSION: u64 = 2041;
pub const CURRENT_CYCLES: u64 = 2042;
Expand All @@ -98,9 +89,6 @@ pub const WRITE: u64 = 2605;
pub const READ: u64 = 2606;
pub const INHERITED_FD: u64 = 2607;
pub const CLOSE: u64 = 2608;
pub const GET_MEMORY_LIMIT: u64 = 2102;
pub const SET_CONTENT: u64 = 2103;
pub const CURRENT_MEMORY: u64 = 2105;
pub const DEBUG_PRINT_SYSCALL_NUMBER: u64 = 2177;
#[cfg(test)]
pub const DEBUG_PAUSE: u64 = 2178;
Expand Down
51 changes: 0 additions & 51 deletions script/src/syscalls/set_content.rs

This file was deleted.

Loading

0 comments on commit 6be39c2

Please sign in to comment.