Skip to content

Commit

Permalink
feat: Add nv22 skeleton (#1929)
Browse files Browse the repository at this point in the history
* [WIP] feat: Add nv22 skeleton

Addition of Network Version 22 skeleton

* Update mod.rs

* Update default.rs

* Update mod.rs

* Update fvm/src/gas/price_list.rs

Co-authored-by: Aayush Rajasekaran <arajasek94@gmail.com>

* Update nv21-dev to nv22-dev

* Add nv22-dev to Cargo.toml

* Fix formatting issue

* Update fvm/src/gas/price_list.rs

---------

Co-authored-by: Aayush Rajasekaran <arajasek94@gmail.com>
  • Loading branch information
TippyFlits and arajasek committed Dec 6, 2023
1 parent 6a248c1 commit e3f3bf9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions fvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ testing = []
arb = ["arbitrary", "quickcheck", "fvm_shared/arb", "cid/arb"]
m2-native = []
gas_calibration = []
nv22-dev = []
2 changes: 2 additions & 0 deletions fvm/src/gas/price_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,8 @@ impl PriceList {
pub fn price_list_by_network_version(network_version: NetworkVersion) -> &'static PriceList {
match network_version {
NetworkVersion::V21 => &WATERMELON_PRICES,
#[cfg(feature = "nv22-dev")]
_ if network_version == NetworkVersion::V22 => &WATERMELON_PRICES,
_ => panic!("network version {nv} not supported", nv = network_version),
}
}
Expand Down
5 changes: 5 additions & 0 deletions fvm/src/machine/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ where
/// * `blockstore`: The underlying [blockstore][`Blockstore`] for reading/writing state.
/// * `externs`: Client-provided ["external"][`Externs`] methods for accessing chain state.
pub fn new(context: &MachineContext, blockstore: B, externs: E) -> anyhow::Result<Self> {
#[cfg(not(feature = "nv22-dev"))]
const SUPPORTED_VERSIONS: RangeInclusive<NetworkVersion> =
NetworkVersion::V21..=NetworkVersion::V21;

#[cfg(feature = "nv22-dev")]
const SUPPORTED_VERSIONS: RangeInclusive<NetworkVersion> =
NetworkVersion::V21..=NetworkVersion::V22;

debug!(
"initializing a new machine, epoch={}, base_fee={}, nv={:?}, root={}",
context.epoch, &context.base_fee, context.network_version, context.initial_state_root
Expand Down
2 changes: 2 additions & 0 deletions shared/src/version/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ impl NetworkVersion {
pub const V20: Self = Self(20);
/// Watermelon (builtin-actors v12)
pub const V21: Self = Self(21);
/// TBD builtin-actors v13
pub const V22: Self = Self(22);

pub const MAX: Self = Self(u32::MAX);

Expand Down

0 comments on commit e3f3bf9

Please sign in to comment.