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

Commit

Permalink
Feature: Checkpoint refactor and cross-net message execution (#67)
Browse files Browse the repository at this point in the history
* add cron fields

* fmt code

* Update gateway/src/state.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* Update gateway/src/types.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* update cron (#65)

* update cron

* fix lint

---------

Co-authored-by: willesxm <willeslau@gmail.com>

* add submit cron impl

* add more checks

* add some todo

* derive total validators

* add todo

* specify rust tool chain

* add tests

* support abort

* simplify impl

* Track validators (#70)

* track validators

* add validator check to submit cron

* update impl

* Weighted vote (#71)

* track validators

* add validator check to submit cron

* update impl

* weighted vote

* Update gateway/src/cron.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* update method name

---------

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* Cron submit tests (#73)

* track validators

* add validator check to submit cron

* update impl

* weighted vote

* Update gateway/src/cron.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* update method name

* add tests

* refactor pending epoches

* fix clippy

* add more tests

---------

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* Refactor checkpoints (#74)

* track validators

* add validator check to submit cron

* update impl

* weighted vote

* Update gateway/src/cron.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* update method name

* add tests

* refactor pending epoches

* fix clippy

* add more tests

* initial commit

* Cross execution (#75)

* update bottom up execution

* update cross message execution

* fix fmt

* update review and clean up

* check message ordering

* Cross execution tests (#76)

* fix clippy

* fmt code

---------

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* cargo fmt

* Vote checkpoints (#81)

* track validators

* add validator check to submit cron

* update impl

* weighted vote

* Update gateway/src/cron.rs

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* update method name

* add tests

* refactor pending epoches

* fix clippy

* add more tests

* initial commit

* Cross execution (#75)

* update bottom up execution

* update cross message execution

* fix fmt

* update review and clean up

* check message ordering

* Cross execution tests (#76)

* fix clippy

* fmt code

* generics for cron submission

* migrate to sdk

* format code

* remove wip field

* work in progress

* local changes

* reorg code

* update comment

* update tests

* format code and clippy

* fix error

---------

Co-authored-by: adlrocha <adlrocha@tutamail.com>

* rename checkpoints to bottomup and topdown

* fix tests

* use CrossMsg for topdown checkpoint

* fix checkpoint (#85)

* update queue serialization (#86)

* update queue serialization

* remove println

* fix fmt

* genesis_epoch bottomup checkpoints to zero

* fix test with new genesis checkpoint

---------

Co-authored-by: willesxm <willeslau@gmail.com>
Co-authored-by: adlrocha <adlrocha@tutamail.com>
  • Loading branch information
3 people authored Apr 10, 2023
1 parent dc3eaee commit bcb5eb0
Show file tree
Hide file tree
Showing 26 changed files with 3,095 additions and 1,098 deletions.
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

0 comments on commit bcb5eb0

Please sign in to comment.