-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
fendermint/vm/interpreter/golden/fvmstateparams/cbor/fvmstateparams.cbor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a86a73746174655f726f6f74d82a58250001bd3ffa3d1e11163d5fa40a156e3caef9cf45f736ce99b42abede4c32ccf9d50f9018966974696d657374616d701b146ef18ccc9e55bb6f6e6574776f726b5f76657273696f6e1568626173655f6665655100c167b71a6b28cec166ff4ca208fbb3446b636972635f737570706c795100fc8ea419cbcbc401a12180e388e68f5d68636861696e5f69641b000b6b07b4af45db6b706f7765725f7363616c65006b6170705f76657273696f6e01 |
1 change: 1 addition & 0 deletions
1
fendermint/vm/interpreter/golden/fvmstateparams/cbor/fvmstateparams.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FvmStateParams { state_root: Cid(bag6t76r5dyirmpk7uqfbk3r4v3446rpxg3hjtnbkx3peymwm7hkq7eaysy), timestamp: Timestamp(1472379715227375035), network_version: NetworkVersion(21), base_fee: TokenAmount(257079523536971773801.541083398290518852), circ_supply: TokenAmount(335706089450661601774.571585084053688157), chain_id: 3213905584145883, power_scale: 0, app_version: 1 } |
10 changes: 10 additions & 0 deletions
10
fendermint/vm/interpreter/golden/fvmstateparams/json/fvmstateparams.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"state_root": "QmQysvBaHAk7sygxwxzTN2mdvA5jqXMhXzSqTDSNDDJBnF", | ||
"timestamp": 4888195286957380285, | ||
"network_version": 21, | ||
"base_fee": "19429382762560951179258988865468432764", | ||
"circ_supply": "250860824295515106050023062062359002052", | ||
"chain_id": 0, | ||
"power_scale": 3, | ||
"app_version": 1 | ||
} |
1 change: 1 addition & 0 deletions
1
fendermint/vm/interpreter/golden/fvmstateparams/json/fvmstateparams.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FvmStateParams { state_root: Cid(QmQysvBaHAk7sygxwxzTN2mdvA5jqXMhXzSqTDSNDDJBnF), timestamp: Timestamp(4888195286957380285), network_version: NetworkVersion(21), base_fee: TokenAmount(19429382762560951179.258988865468432764), circ_supply: TokenAmount(250860824295515106050.023062062359002052), chain_id: 0, power_scale: 3, app_version: 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2022-2024 Protocol Labs | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
use fendermint_testing::arb::{ArbCid, ArbTokenAmount}; | ||
use fendermint_vm_core::{chainid, Timestamp}; | ||
use fvm_shared::version::NetworkVersion; | ||
use quickcheck::{Arbitrary, Gen}; | ||
|
||
use crate::fvm::state::FvmStateParams; | ||
|
||
impl Arbitrary for FvmStateParams { | ||
fn arbitrary(g: &mut Gen) -> Self { | ||
Self { | ||
state_root: ArbCid::arbitrary(g).0, | ||
timestamp: Timestamp(u64::arbitrary(g)), | ||
network_version: NetworkVersion::new(*g.choose(&[21]).unwrap()), | ||
base_fee: ArbTokenAmount::arbitrary(g).0, | ||
circ_supply: ArbTokenAmount::arbitrary(g).0, | ||
chain_id: chainid::from_str_hashed(String::arbitrary(g).as_str()) | ||
.unwrap() | ||
.into(), | ||
power_scale: *g.choose(&[-1, 0, 3]).unwrap(), | ||
app_version: *g.choose(&[0, 1, 2]).unwrap(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2022-2024 Protocol Labs | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
/// JSON based test in case we want to configure the FvmStateParams by hand. | ||
mod json { | ||
use fendermint_testing::golden_json; | ||
use fendermint_vm_interpreter::fvm::state::FvmStateParams; | ||
use quickcheck::Arbitrary; | ||
golden_json! { "fvmstateparams/json", fvmstateparams, FvmStateParams::arbitrary } | ||
} | ||
|
||
/// CBOR based tests in case we have to grab FvmStateParams from on-chain storage. | ||
mod cbor { | ||
use fendermint_testing::golden_cbor; | ||
use fendermint_vm_interpreter::fvm::state::FvmStateParams; | ||
use quickcheck::Arbitrary; | ||
golden_cbor! { "fvmstateparams/cbor", fvmstateparams, FvmStateParams::arbitrary } | ||
} |