Skip to content

Commit

Permalink
Add predicates verification (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlopes11 authored May 25, 2022
1 parent c17f248 commit 4c5bc87
Show file tree
Hide file tree
Showing 20 changed files with 719 additions and 448 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fuel-asm = "0.5"
fuel-crypto = "0.5"
fuel-merkle = "0.1"
fuel-storage = "0.1"
fuel-tx = "0.11"
fuel-tx = "0.12"
fuel-types = "0.5"
itertools = "0.10"
secp256k1 = { version = "0.20", features = ["recovery"] }
Expand All @@ -27,7 +27,7 @@ tracing = "0.1"
rand = { version = "0.8", optional = true }

[dev-dependencies]
fuel-tx = { version = "0.11", features = ["random"] }
fuel-tx = { version = "0.12", features = ["random"] }
fuel-vm = { path = ".", default-features = false, features = ["test-helpers"] }
serde_json = "1.0"

Expand Down
2 changes: 1 addition & 1 deletion src/call.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Inter-contract call supporting structures
use crate::consts::*;
use crate::contract::Contract;

use fuel_asm::PanicReason;
use fuel_tx::Contract;
use fuel_types::bytes::{self, SizedBytes};
use fuel_types::{AssetId, ContractId, Word};

Expand Down
2 changes: 1 addition & 1 deletion src/consts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! VM parameters
use fuel_tx::consts::*;
use fuel_tx::default_parameters::*;
use fuel_types::{AssetId, Bytes32, Word};

use std::mem;
Expand Down
12 changes: 0 additions & 12 deletions src/context.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! VM runtime context definitions
use fuel_tx::Transaction;

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
/// Runtime context description.
Expand All @@ -28,13 +26,3 @@ impl Context {
matches!(self, Self::Predicate | Self::Script)
}
}

impl From<&Transaction> for Context {
fn from(tx: &Transaction) -> Self {
if tx.is_script() {
Self::Script
} else {
Self::Predicate
}
}
}
119 changes: 0 additions & 119 deletions src/contract.rs

This file was deleted.

3 changes: 2 additions & 1 deletion src/interpreter/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use crate::error::RuntimeError;
use crate::storage::InterpreterStorage;

use fuel_asm::PanicReason;
use fuel_tx::{consts::CONTRACT_MAX_SIZE, Input};
use fuel_tx::default_parameters::*;
use fuel_tx::Input;
use fuel_types::{bytes, Address, AssetId, Bytes32, Bytes8, ContractId, RegisterId, Word};

use std::mem;
Expand Down
3 changes: 1 addition & 2 deletions src/interpreter/contract.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use super::Interpreter;
use crate::consts::*;
use crate::contract::Contract;
use crate::error::RuntimeError;
use crate::storage::InterpreterStorage;

use fuel_asm::{PanicReason, RegisterId, Word};
use fuel_tx::Receipt;
use fuel_tx::{Contract, Receipt};
use fuel_types::{Address, AssetId, ContractId};

use std::borrow::Cow;
Expand Down
Loading

0 comments on commit 4c5bc87

Please sign in to comment.