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

Feature: Checkpoint refactor and cross-net message execution #67

Merged
merged 28 commits into from
Apr 10, 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
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
target: wasm32-unknown-unknown
toolchain: nightly-2022-10-03
override: true
- run: cargo b --all --release
- run: cargo t --all --release
- run: cargo b --all
- run: cargo t --all

fmt:
name: Rustfmt
Expand All @@ -38,7 +38,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
args: --all --check

clippy:
name: Clippy
Expand All @@ -55,4 +55,4 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
args: --all -- -D clippy::all
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ members = [
"gateway",
"subnet-actor",
"sdk",
"common",
"atomic-exec",
"atomic-exec/primitives",
"atomic-exec/examples/fungible-token",
Expand Down
17 changes: 8 additions & 9 deletions atomic-exec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Actor {
}

let msgs = rt.transaction(|st: &mut State, rt| {
st.modify_atomic_exec(rt.store(), &exec_id, &actors, |entry| {
st.modify_atomic_exec(rt.store(), exec_id, actors, |entry| {
// Record the pre-commitment
entry.insert(from.to_string().unwrap(), params.commit);

Expand Down Expand Up @@ -135,13 +135,12 @@ impl Actor {

// Remove the atomic execution entry
rt.transaction(|st: &mut State, rt| {
st.rm_atomic_exec(rt.store(), &exec_id, &actors)
.map_err(|e| {
e.downcast_default(
ExitCode::USR_ILLEGAL_STATE,
"failed to remove atomic exec from registry",
)
})
st.rm_atomic_exec(rt.store(), exec_id, actors).map_err(|e| {
e.downcast_default(
ExitCode::USR_ILLEGAL_STATE,
"failed to remove atomic exec from registry",
)
})
})?;

Ok(true)
Expand Down Expand Up @@ -180,7 +179,7 @@ impl Actor {
}

let msg = rt.transaction(|st: &mut State, rt| {
st.modify_atomic_exec(rt.store(), &exec_id, &actors, |entry| {
st.modify_atomic_exec(rt.store(), exec_id, actors, |entry| {
// Remove the pre-commitment
entry.remove_entry(&from.to_string().unwrap());

Expand Down
27 changes: 27 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "ipc-actor-common"
description = "The common code used by both gateway actor and subnet actor, but not by sdk exposed to users"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0.56"
log = "0.4.17"
primitives = { git = "https://github.com/consensus-shipyard/fvm-utils" }
ipc-sdk = { path = "../sdk" }
num-traits = "0.2.14"
fvm_ipld_blockstore = "0.1.1"
fvm_ipld_encoding = "0.3.3"
lazy_static = "1.4.0"
serde_tuple = "0.5"
serde = { version = "1.0.136", features = ["derive"] }
fvm_shared = { version = "=3.0.0-alpha.17", default-features = false }
thiserror = "1.0.38"
fil_actors_runtime = { git = "https://github.com/consensus-shipyard/fvm-utils", features = ["fil-actor"] }
integer-encoding = { version = "3.0.3", default-features = false }

[dev-dependencies]
serde_json = "1.0.95"
cid = "0.8.6"
3 changes: 3 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#![feature(map_first_last)]

pub mod vote;
13 changes: 13 additions & 0 deletions common/src/vote/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
mod submission;
mod voting;

pub use crate::vote::submission::EpochVoteSubmissions;
pub use crate::vote::voting::Voting;

pub type UniqueBytesKey = Vec<u8>;

/// The vote trait that requires each vote to be unique by `unique_key`.
pub trait UniqueVote: PartialEq + Clone {
/// Outputs the unique bytes key of the vote
fn unique_key(&self) -> anyhow::Result<UniqueBytesKey>;
}
Loading