Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

fix!: Oracle output array start as RegisterMemindex #205

Merged
merged 1 commit into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions brillig_bytecode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ impl VM {
current_value_index += 1
}
OracleOutput::Array { start, length } => {
let array_id =
self.registers.get(RegisterMemIndex::Register(start));
let array_id = self.registers.get(start);
let heap = &mut self.memory.entry(array_id).or_default().memory_map;
for (i, value) in data.output_values.iter().enumerate() {
heap.insert(i, (*value).into());
Expand Down Expand Up @@ -690,7 +689,8 @@ mod tests {

let oracle_input =
OracleInput::RegisterMemIndex(RegisterMemIndex::Register(RegisterIndex(0)));
let oracle_output = OracleOutput::Array { start: RegisterIndex(3), length: 2 };
let oracle_output =
OracleOutput::Array { start: RegisterMemIndex::Register(RegisterIndex(3)), length: 2 };

let mut oracle_data = OracleData {
name: "get_notes".to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion brillig_bytecode/src/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub enum OracleInput {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum OracleOutput {
RegisterIndex(RegisterIndex),
Array { start: RegisterIndex, length: usize },
Array { start: RegisterMemIndex, length: usize },
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
Expand Down