diff --git a/Cargo.lock b/Cargo.lock index ab082c6..78f9826 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,7 +5,7 @@ version = 3 [[package]] name = "aluvm" version = "0.12.0-beta.5" -source = "git+https://github.com/AluVM/aluvm?branch=master#123919e666b204615391e817ff0ac9fffcb6e0bd" +source = "git+https://github.com/AluVM/aluvm?branch=master#a28c157b1d17c19cbab94db3169680704656eb86" dependencies = [ "amplify", "ascii-armor", @@ -804,7 +804,7 @@ dependencies = [ [[package]] name = "zk-aluvm" version = "0.12.0-beta.5" -source = "git+https://github.com/AluVM/zk-aluvm?branch=master#047c7f1b917967d5917928a1672c885399595048" +source = "git+https://github.com/AluVM/zk-aluvm?branch=master#9718e870ec8a766b46a768d65c0ed2ea580280ec" dependencies = [ "aluvm", "amplify", diff --git a/src/codex.rs b/src/codex.rs index eedf293..de5bf8c 100644 --- a/src/codex.rs +++ b/src/codex.rs @@ -23,7 +23,7 @@ use aluvm::alu::regs::Status; use aluvm::alu::{CoreConfig, CoreExt, Lib, LibId, LibSite, Vm}; -use aluvm::{fe256, RegE}; +use aluvm::{fe256, GfaConfig, RegE}; use amplify::confinement::{SmallVec, TinyOrdMap, TinyString}; use amplify::num::u256; use amplify::Bytes32; @@ -78,8 +78,9 @@ impl Codex { } // Phase one: get inputs, verify access conditions - let mut vm_inputs = - Vm::>::with(self.input_config, self.field_order); + let mut vm_inputs = Vm::>::with(self.input_config, GfaConfig { + field_order: self.field_order, + }); let mut read_once_input = SmallVec::new(); for input in &operation.destroying { let cell = memory @@ -130,7 +131,9 @@ impl Codex { read_once_output: operation.destructible.as_slice(), immutable_output: operation.immutable.as_slice(), }; - let mut vm_main = Vm::>::with(self.verification_config, self.field_order); + let mut vm_main = Vm::>::with(self.verification_config, GfaConfig { + field_order: self.field_order, + }); match vm_main.exec(*entry_point, &context, resolver) { Status::Ok => Ok(()), Status::Fail => { diff --git a/src/isa/core.rs b/src/isa/core.rs index d609e09..5c83457 100644 --- a/src/isa/core.rs +++ b/src/isa/core.rs @@ -24,8 +24,7 @@ use core::fmt::{self, Debug, Formatter}; use aluvm::alu::{CoreExt, NoExt, Register, Supercore}; -use aluvm::{GfaCore, RegE}; -use amplify::num::u256; +use aluvm::{GfaConfig, GfaCore, RegE}; #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)] enum Io { @@ -93,7 +92,7 @@ impl Debug for UsonicCore { impl CoreExt for UsonicCore { type Reg = RegE; - type Config = u256; + type Config = GfaConfig; fn with(config: Self::Config) -> Self { UsonicCore { ui: [0; 4], gfa: GfaCore::with(config) } } diff --git a/src/lib.rs b/src/lib.rs index 0d2990d..5a0208f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,7 +48,6 @@ mod contract; pub mod stl; mod util; -use amplify::num::u256; pub use codex::{AccessId, CallError, CallId, Codex, CodexId, LibRepo, Memory, VmContext}; pub use contract::{Consensus, ConstU32, Contract, ContractId, ContractMeta, ContractName}; pub use isa::{Instr, IoCat, UsonicCore, UsonicInstr, ISA_ULTRASONIC}; @@ -60,17 +59,3 @@ pub use util::Identity; pub use zkaluvm::fe256; pub const LIB_NAME_ULTRASONIC: &str = "UltraSONIC"; - -pub const FIELD_ORDER_25519: u256 = u256::from_inner([ - 0xFFFF_FFFF_FFFF_FFEC, - 0xFFFF_FFFF_FFFF_FFFF, - 0xFFFF_FFFF_FFFF_FFFF, - 0x8FFF_FFFF_FFFF_FFFF, -]); -pub const FIELD_ORDER_STARK: u256 = u256::from_inner([1, 0, 17, 0x0800_0000_0000_0000]); -pub const FIELD_ORDER_SECP: u256 = u256::from_inner([ - 0xFFFF_FFFE_FFFF_FC2E, - 0xFFFF_FFFF_FFFF_FFFF, - 0xFFFF_FFFF_FFFF_FFFF, - 0xFFFF_FFFF_FFFF_FFFF, -]);