Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Engine/testing behavior update #960

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
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
90 changes: 8 additions & 82 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ path = "examples/minter/main.rs"

[workspace.dependencies]
# Arbiter local for development
# arbiter-bindings = { path = "arbiter-bindings" }
# arbiter-core = { path = "arbiter-core" }
# arbiter-engine = { path = "arbiter-engine" }
# arbiter-macros = { path = "arbiter-macros" }
arbiter-bindings = { path = "bindings" }
arbiter-core = { path = "core" }
arbiter-engine = { path = "engine" }
arbiter-macros = { path = "macros" }

# Arbiter crates.io for release, these need to be used to do crate releases!
arbiter-bindings = "0.1.4"
arbiter-core = "0.10.2"
arbiter-engine = "0.3.0"
arbiter-macros = "0.1.1"
# arbiter-bindings = "0.1.4"
# arbiter-core = "0.10.2"
# arbiter-engine = "0.3.0"
# arbiter-macros = "0.1.1"

revm = { version = "5.0.0", features = ["ethersdb", "std", "serde"] }
revm-primitives = "=2.0.0"
Expand Down
3 changes: 3 additions & 0 deletions bin/fork/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ const FORK_CONFIG_PATH: &str = "examples/fork/weth_config.toml";
const PATH_TO_DISK_STORAGE: &str = "examples/fork/test.json";

#[test]
#[ignore]
fn create_forked_db() {
let fork_config = ForkConfig::new(FORK_CONFIG_PATH).unwrap();
let fork = fork_config.into_fork().unwrap();
assert!(!fork.db.accounts.is_empty());
}

#[test]
#[ignore]
fn write_out() {
let fork_config =
ForkConfig::new(FORK_CONFIG_PATH).expect("WARNING: Failed to create ForkConfig");
Expand All @@ -27,6 +29,7 @@ fn write_out() {
}

#[test]
#[ignore]
fn read_in() {
// First write out so we know the file exists.
let fork_config = ForkConfig::new(FORK_CONFIG_PATH);
Expand Down
18 changes: 6 additions & 12 deletions engine/src/agent.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
//! The agent module contains the core agent abstraction for the Arbiter Engine.

use std::{fmt::Debug, sync::Arc};

use arbiter_core::middleware::ArbiterMiddleware;
use serde::{de::DeserializeOwned, Serialize};

use super::*;
use crate::{
machine::{Behavior, Engine, StateMachine},
messager::Messager,
};
use crate::machine::{Behavior, Engine, StateMachine};

/// An agent is an entity capable of processing events and producing actions.
/// These are the core actors in simulations or in onchain systems.
Expand All @@ -21,7 +15,6 @@ use crate::{
/// each of its [`Behavior`]s `startup()` methods. The [`Behavior`]s themselves
/// will return a stream of events that then let the [`Behavior`] move into the
/// `State::Processing` stage.
#[derive(Debug)]
pub struct Agent {
/// Identifier for this agent.
/// Used for routing messages.
Expand Down Expand Up @@ -78,10 +71,11 @@ pub struct AgentBuilder {
impl AgentBuilder {
/// Appends a behavior onto an [`AgentBuilder`]. Behaviors are initialized
/// when the agent builder is added to the [`crate::world::World`]
pub fn with_behavior<E: DeserializeOwned + Serialize + Send + Sync + Debug + 'static>(
mut self,
behavior: impl Behavior<E> + Serialize + DeserializeOwned + 'static,
) -> Self {
pub fn with_behavior<B, E>(mut self, behavior: B) -> Self
where
B: Behavior<E> + Send + 'static,
E: Send + Debug + 'static,
{
let engine = Engine::new(behavior);
if let Some(engines) = &mut self.behavior_engines {
engines.push(Box::new(engine));
Expand Down
Loading