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

Next step 4. Active branch #65

Open
wants to merge 33 commits into
base: 20250220-active
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b817de8
Remove clvm_tools_rs to a devDependency WIP
prozacchiwawa Feb 19, 2025
827a986
Use an updated version of clvm_tools_rs, stable constants
prozacchiwawa Feb 20, 2025
43eff58
Clippy, upgrade should be complete
prozacchiwawa Feb 20, 2025
5b8bd87
fmt
prozacchiwawa Feb 20, 2025
7e70916
Add utils
prozacchiwawa Feb 20, 2025
ebdd5fe
Ser/deser for game handler (need to investigate)
prozacchiwawa Feb 20, 2025
840fdbf
fmt
prozacchiwawa Feb 20, 2025
e3c23bd
ProgramRef
prozacchiwawa Feb 20, 2025
89e5ca9
Validation program ref
prozacchiwawa Feb 20, 2025
5b29088
Puzzle
prozacchiwawa Feb 20, 2025
707714f
Fully propogate ProgramRef and Puzzle
prozacchiwawa Feb 20, 2025
933ae12
Shutdown
prozacchiwawa Feb 20, 2025
0233306
update wasm
prozacchiwawa Feb 20, 2025
088d5ef
fix
prozacchiwawa Feb 20, 2025
e8db543
Remove test references to clvm_tools_rs
prozacchiwawa Feb 20, 2025
449e97a
Change versions
prozacchiwawa Feb 20, 2025
4f62d16
Set bson
prozacchiwawa Feb 20, 2025
2d69398
set bson
prozacchiwawa Feb 20, 2025
0750143
Earlier versions
prozacchiwawa Feb 20, 2025
e7e72ff
Bump
prozacchiwawa Feb 20, 2025
0958ef9
Update
prozacchiwawa Feb 20, 2025
20ed74c
Update
prozacchiwawa Feb 20, 2025
91b5c8d
relax
prozacchiwawa Feb 20, 2025
bcb85e5
Try greater version
prozacchiwawa Feb 20, 2025
8e6f050
Up to date everything
prozacchiwawa Feb 20, 2025
a2ad5bc
clean some things up with from traits
prozacchiwawa Feb 20, 2025
23065f8
fmt
prozacchiwawa Feb 20, 2025
09e7478
Merge pull request #72 from Chia-Network/20250219-remove-clvm-tools-r…
prozacchiwawa Feb 20, 2025
f6d614b
Merge up
prozacchiwawa Feb 25, 2025
bfe3c79
Fragment src::common::types into many files
richardkiss Mar 3, 2025
e535298
Merge pull request #76 from richardkiss/active
prozacchiwawa Mar 3, 2025
cdc9d99
Fragment src::channel_handler::types into many files
richardkiss Mar 6, 2025
4d430c2
Merge pull request #79 from richardkiss/channel_handler_types
prozacchiwawa Mar 7, 2025
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
511 changes: 275 additions & 236 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,20 @@ server = ["dep:tokio","dep:salvo","dep:exec"]
used_linker = []

[dependencies]
clvm_tools_rs = { git = "https://github.com/Chia-Network/clvm_tools_rs.git", rev = "ec75759377791c9b785123d2d3e2457d08ac6621" }
clvmr = { version = "=0.3.2", features = ["pre-eval"] }
clvmr = { version = "=0.12.0", features = ["pre-eval"] }
serde_json = "1.0"
rand = "0.8.5"
rand_chacha = "0.3.1"
clvm-traits = "0.7.0"
clvm-traits = "0.20.0"
blst = "=0.3.13"
subtle = "2.5.0"
num-bigint = "0.4.4"
num-traits = "0.2.15"
chia-bls = "=0.9.0"
clvm-utils = "0.7.0"
clvm-utils = "0.20.0"
lazy_static = "1.4.0"
ff = { version = "0.13.0", features = ["derive"] }
bson = "2.11.0"
bson = "2.13.0"
sha2 = "0.10.8"
indoc = "2.0.5"
serde = "1.0.203"
Expand All @@ -46,8 +45,8 @@ exec = "0.3.1"
[build-dependencies]
serde = "1.0.203"
toml = "0.8.14"
clvm_tools_rs = { git = "https://github.com/Chia-Network/clvm_tools_rs.git", rev = "ec75759377791c9b785123d2d3e2457d08ac6621" }
clvmr = { version = "=0.3.2", features = ["pre-eval"] }
clvm_tools_rs = { git = "https://github.com/Chia-Network/clvm_tools_rs.git", rev = "f5f6ebd339b4782d9b3c65db8796af554d341bd8" }
clvmr = { version = "=0.12.0", features = ["pre-eval"] }

[lib]
name = "chia_gaming"
Expand Down
18 changes: 10 additions & 8 deletions src/channel_handler/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::rc::Rc;
use clvm_traits::{ClvmEncoder, ToClvm};
use clvmr::run_program;

use clvm_tools_rs::classic::clvm::sexp::proper_list;
use crate::utils::proper_list;

use log::debug;

Expand Down Expand Up @@ -36,7 +36,9 @@ impl Game {
game_hex_file: &str,
) -> Result<Game, Error> {
let poker_generator = read_hex_puzzle(allocator, game_hex_file)?;
let nil = allocator.encode_atom(&[]).into_gen()?;
let nil = allocator
.encode_atom(clvm_traits::Atom::Borrowed(&[]))
.into_gen()?;
let poker_generator_clvm = poker_generator.to_clvm(allocator).into_gen()?;
debug!("running start");
let template_clvm = run_program(
Expand Down Expand Up @@ -72,17 +74,17 @@ impl Game {
.expect("should be an atom");
let required_size_factor = Amount::new(
atom_from_clvm(allocator, template_list[3])
.and_then(u64_from_atom)
.and_then(|a| u64_from_atom(&a))
.expect("should be an atom"),
);
let initial_max_move_size = atom_from_clvm(allocator, template_list[4])
.and_then(usize_from_atom)
.and_then(|a| usize_from_atom(&a))
.expect("should be an atom");
let validation_prog = Rc::new(Program::from_nodeptr(allocator, template_list[5])?);
let initial_validation_program = ValidationProgram::new(allocator, validation_prog);
let initial_validation_program_hash =
if let Some(a) = atom_from_clvm(allocator, template_list[6]) {
Hash::from_slice(a)
Hash::from_slice(&a)
} else {
return Err(Error::StrErr(
"not an atom for initial_validation_hash".to_string(),
Expand All @@ -91,7 +93,7 @@ impl Game {
let initial_state_node = template_list[7];
let initial_state = Rc::new(Program::from_nodeptr(allocator, initial_state_node)?);
let initial_mover_share_proportion = atom_from_clvm(allocator, template_list[8])
.and_then(usize_from_atom)
.and_then(|a| usize_from_atom(&a))
.expect("should be an atom");
Ok(Game {
id: game_id,
Expand Down Expand Up @@ -130,7 +132,7 @@ impl Game {
my_contribution_this_game: our_contribution.clone(),
their_contribution_this_game: their_contribution.clone(),
initial_validation_program: self.initial_validation_program.clone(),
initial_state: self.initial_state.clone(),
initial_state: self.initial_state.clone().into(),
initial_move: vec![],
initial_max_move_size: self.initial_max_move_size,
initial_mover_share: mover_share,
Expand All @@ -143,7 +145,7 @@ impl Game {
my_contribution_this_game: their_contribution.clone(),
their_contribution_this_game: our_contribution.clone(),
initial_validation_program: self.initial_validation_program.clone(),
initial_state: self.initial_state.clone(),
initial_state: self.initial_state.clone().into(),
initial_move: vec![],
initial_max_move_size: self.initial_max_move_size,
initial_mover_share: waiter_share,
Expand Down
Loading
Loading