Skip to content

Commit 8c0524f

Browse files
authored
Merge pull request #2910 from ProvableHQ/fix-package-deploy
Use external Process in Package::deploy
2 parents cdc406f + 3072437 commit 8c0524f

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

vm/package/deploy.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ impl<'de, N: Network> Deserialize<'de> for DeployResponse<N> {
113113
impl<N: Network> Package<N> {
114114
pub fn deploy<A: crate::circuit::Aleo<Network = N, BaseField = N::Field>>(
115115
&self,
116+
process: &Process<N>,
116117
endpoint: Option<String>,
117118
) -> Result<Deployment<N>> {
118119
// Retrieve the main program.
@@ -122,9 +123,6 @@ impl<N: Network> Package<N> {
122123

123124
dev_println!("⏳ Deploying '{}'...\n", program_id.to_string());
124125

125-
// Get the process.
126-
let process = self.get_process()?;
127-
128126
// Initialize the RNG.
129127
let rng = &mut rand::thread_rng();
130128
// Compute the deployment.
@@ -158,8 +156,11 @@ mod tests {
158156
// Samples a new package at a temporary directory.
159157
let (directory, package) = crate::package::test_helpers::sample_token_package();
160158

159+
// Generate the process with the appropriate imports.
160+
let process = package.get_process().unwrap();
161+
161162
// Deploy the package.
162-
let deployment = package.deploy::<CurrentAleo>(None).unwrap();
163+
let deployment = package.deploy::<CurrentAleo>(&process, None).unwrap();
163164

164165
// Ensure the deployment edition matches.
165166
assert_eq!(0, deployment.edition());
@@ -177,8 +178,11 @@ mod tests {
177178
// Samples a new package at a temporary directory.
178179
let (directory, package) = crate::package::test_helpers::sample_wallet_package();
179180

181+
// Generate the process with the appropriate imports.
182+
let process = package.get_process().unwrap();
183+
180184
// Deploy the package.
181-
let deployment = package.deploy::<CurrentAleo>(None).unwrap();
185+
let deployment = package.deploy::<CurrentAleo>(&process, None).unwrap();
182186

183187
// Ensure the deployment edition matches.
184188
assert_eq!(0, deployment.edition());

vm/package/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ impl<N: Network> Package<N> {
165165
// 2) the AVM bytecode of the imported program matches the AVM bytecode of the program *on-chain*
166166
// 3) consensus performs the exact same checks (in `verify_deployment`)
167167
// Open the Aleo program file.
168-
let import_program_file = AleoFile::open(&imports_directory, program_id, false)?;
168+
let is_main = false;
169+
let import_program_file = AleoFile::open(&imports_directory, program_id, is_main)?;
169170
// Get the program.
170171
Ok(import_program_file.program().clone())
171172
})

0 commit comments

Comments
 (0)