Skip to content

Commit

Permalink
Added EAM types (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-shashank authored Dec 4, 2024
1 parent 40ee586 commit 6399170
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 12 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
crate: [
"fil_actor_account_state",
"fil_actor_cron_state",
"fil_actor_eam_state",
"fil_actor_ethaccount_state"
]
steps:
Expand Down Expand Up @@ -62,7 +61,7 @@ jobs:
with:
crate: ${{ matrix.crate }}

publish-verifreg:
publish-verifreg-and-eam:
runs-on: ubuntu-latest
needs: publish-shared
steps:
Expand All @@ -71,11 +70,14 @@ jobs:
- name: Publish verifreg crate
uses: ./.github/composite-actions/publish-crate
with:
crate: "fil_actor_verifreg_state"
crate: [
"fil_actor_verifreg_state",
"fil_actor_eam_state"
]

publish-market-and-miner:
runs-on: ubuntu-latest
needs: publish-verifreg
needs: publish-verifreg-and-eam
strategy:
matrix:
crate: [
Expand Down
3 changes: 3 additions & 0 deletions actors/eam/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ version.workspace = true
keywords.workspace = true

[dependencies]
fil_actor_evm_state = { workspace = true }
fvm_ipld_encoding = { workspace = true }
fvm_shared3 = { workspace = true }
fvm_shared4 = { workspace = true }
num-derive = { workspace = true }
num-traits = { workspace = true }
serde = { workspace = true }
35 changes: 34 additions & 1 deletion actors/eam/src/v10/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_shared3::METHOD_CONSTRUCTOR;
use fil_actor_evm_state::evm_shared::v10::address::EthAddress;
use fvm_ipld_encoding::{strict_bytes, tuple::*};
use fvm_shared3::{address::Address, ActorID, METHOD_CONSTRUCTOR};
use num_derive::FromPrimitive;
use serde::{Deserialize, Serialize};

#[derive(FromPrimitive)]
#[repr(u64)]
Expand All @@ -12,3 +15,33 @@ pub enum Method {
Create2 = 3,
CreateExternal = 4,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CreateParams {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
pub nonce: u64,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct Create2Params {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
#[serde(with = "strict_bytes")]
pub salt: [u8; 32],
}

#[derive(Serialize, Deserialize)]
#[serde(transparent)]
pub struct CreateExternalParams(#[serde(with = "strict_bytes")] pub Vec<u8>);

#[derive(Serialize_tuple, Deserialize_tuple, Debug, PartialEq, Eq)]
pub struct Return {
pub actor_id: ActorID,
pub robust_address: Option<Address>,
pub eth_address: EthAddress,
}

pub type CreateReturn = Return;
pub type Create2Return = Return;
pub type CreateExternalReturn = Return;
35 changes: 34 additions & 1 deletion actors/eam/src/v11/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_shared3::METHOD_CONSTRUCTOR;
use fil_actor_evm_state::evm_shared::v11::address::EthAddress;
use fvm_ipld_encoding::{strict_bytes, tuple::*};
use fvm_shared3::{address::Address, ActorID, METHOD_CONSTRUCTOR};
use num_derive::FromPrimitive;
use serde::{Deserialize, Serialize};

#[derive(FromPrimitive)]
#[repr(u64)]
Expand All @@ -12,3 +15,33 @@ pub enum Method {
Create2 = 3,
CreateExternal = 4,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CreateParams {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
pub nonce: u64,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct Create2Params {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
#[serde(with = "strict_bytes")]
pub salt: [u8; 32],
}

#[derive(Serialize, Deserialize)]
#[serde(transparent)]
pub struct CreateExternalParams(#[serde(with = "strict_bytes")] pub Vec<u8>);

#[derive(Serialize_tuple, Deserialize_tuple, Debug, PartialEq, Eq)]
pub struct Return {
pub actor_id: ActorID,
pub robust_address: Option<Address>,
pub eth_address: EthAddress,
}

pub type CreateReturn = Return;
pub type Create2Return = Return;
pub type CreateExternalReturn = Return;
35 changes: 34 additions & 1 deletion actors/eam/src/v12/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_shared4::METHOD_CONSTRUCTOR;
use fil_actor_evm_state::evm_shared::v12::address::EthAddress;
use fvm_ipld_encoding::{strict_bytes, tuple::*};
use fvm_shared4::{address::Address, ActorID, METHOD_CONSTRUCTOR};
use num_derive::FromPrimitive;
use serde::{Deserialize, Serialize};

#[derive(FromPrimitive)]
#[repr(u64)]
Expand All @@ -12,3 +15,33 @@ pub enum Method {
Create2 = 3,
CreateExternal = 4,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CreateParams {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
pub nonce: u64,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct Create2Params {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
#[serde(with = "strict_bytes")]
pub salt: [u8; 32],
}

#[derive(Serialize, Deserialize)]
#[serde(transparent)]
pub struct CreateExternalParams(#[serde(with = "strict_bytes")] pub Vec<u8>);

#[derive(Serialize_tuple, Deserialize_tuple, Debug, PartialEq, Eq)]
pub struct Return {
pub actor_id: ActorID,
pub robust_address: Option<Address>,
pub eth_address: EthAddress,
}

pub type CreateReturn = Return;
pub type Create2Return = Return;
pub type CreateExternalReturn = Return;
35 changes: 34 additions & 1 deletion actors/eam/src/v13/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_shared4::METHOD_CONSTRUCTOR;
use fil_actor_evm_state::evm_shared::v13::address::EthAddress;
use fvm_ipld_encoding::{strict_bytes, tuple::*};
use fvm_shared4::{address::Address, ActorID, METHOD_CONSTRUCTOR};
use num_derive::FromPrimitive;
use serde::{Deserialize, Serialize};

#[derive(FromPrimitive)]
#[repr(u64)]
Expand All @@ -12,3 +15,33 @@ pub enum Method {
Create2 = 3,
CreateExternal = 4,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CreateParams {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
pub nonce: u64,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct Create2Params {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
#[serde(with = "strict_bytes")]
pub salt: [u8; 32],
}

#[derive(Serialize, Deserialize)]
#[serde(transparent)]
pub struct CreateExternalParams(#[serde(with = "strict_bytes")] pub Vec<u8>);

#[derive(Serialize_tuple, Deserialize_tuple, Debug, PartialEq, Eq)]
pub struct Return {
pub actor_id: ActorID,
pub robust_address: Option<Address>,
pub eth_address: EthAddress,
}

pub type CreateReturn = Return;
pub type Create2Return = Return;
pub type CreateExternalReturn = Return;
35 changes: 34 additions & 1 deletion actors/eam/src/v14/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_shared4::METHOD_CONSTRUCTOR;
use fil_actor_evm_state::evm_shared::v14::address::EthAddress;
use fvm_ipld_encoding::{strict_bytes, tuple::*};
use fvm_shared4::{address::Address, ActorID, METHOD_CONSTRUCTOR};
use num_derive::FromPrimitive;
use serde::{Deserialize, Serialize};

#[derive(FromPrimitive)]
#[repr(u64)]
Expand All @@ -12,3 +15,33 @@ pub enum Method {
Create2 = 3,
CreateExternal = 4,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CreateParams {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
pub nonce: u64,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct Create2Params {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
#[serde(with = "strict_bytes")]
pub salt: [u8; 32],
}

#[derive(Serialize, Deserialize)]
#[serde(transparent)]
pub struct CreateExternalParams(#[serde(with = "strict_bytes")] pub Vec<u8>);

#[derive(Serialize_tuple, Deserialize_tuple, Debug, PartialEq, Eq)]
pub struct Return {
pub actor_id: ActorID,
pub robust_address: Option<Address>,
pub eth_address: EthAddress,
}

pub type CreateReturn = Return;
pub type Create2Return = Return;
pub type CreateExternalReturn = Return;
35 changes: 34 additions & 1 deletion actors/eam/src/v15/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use fvm_shared4::METHOD_CONSTRUCTOR;
use fil_actor_evm_state::evm_shared::v15::address::EthAddress;
use fvm_ipld_encoding::{strict_bytes, tuple::*};
use fvm_shared4::{address::Address, ActorID, METHOD_CONSTRUCTOR};
use num_derive::FromPrimitive;
use serde::{Deserialize, Serialize};

#[derive(FromPrimitive)]
#[repr(u64)]
Expand All @@ -12,3 +15,33 @@ pub enum Method {
Create2 = 3,
CreateExternal = 4,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CreateParams {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
pub nonce: u64,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct Create2Params {
#[serde(with = "strict_bytes")]
pub initcode: Vec<u8>,
#[serde(with = "strict_bytes")]
pub salt: [u8; 32],
}

#[derive(Serialize, Deserialize)]
#[serde(transparent)]
pub struct CreateExternalParams(#[serde(with = "strict_bytes")] pub Vec<u8>);

#[derive(Serialize_tuple, Deserialize_tuple, Debug, PartialEq, Eq)]
pub struct Return {
pub actor_id: ActorID,
pub robust_address: Option<Address>,
pub eth_address: EthAddress,
}

pub type CreateReturn = Return;
pub type Create2Return = Return;
pub type CreateExternalReturn = Return;
4 changes: 2 additions & 2 deletions fil_actors_shared/src/abi/commp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

use cid::Cid;
use fvm_shared::{
commcid::data_commitment_v1_to_cid, piece::PieceInfo as PieceInfoV2,
sector::RegisteredSealProof as RegisteredSealProofV2,
piece::PieceInfo as PieceInfoV2, sector::RegisteredSealProof as RegisteredSealProofV2,
};
use fvm_shared4::commcid::data_commitment_v1_to_cid;

/// Computes an unsealed sector CID (`CommD`) from its constituent piece CIDs (`CommPs`) and sizes.
///
Expand Down

0 comments on commit 6399170

Please sign in to comment.