Skip to content

Commit

Permalink
feat(hardfork): reject unknown vm versions and add an integration tes…
Browse files Browse the repository at this point in the history
…t for this feature
  • Loading branch information
yangby-cryptape committed Jun 29, 2021
1 parent 59dc192 commit 09c7975
Show file tree
Hide file tree
Showing 12 changed files with 459 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion script/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub enum ScriptError {
InvalidScriptHashType(String),

/// InvalidVmVersion
#[error("Invalid vm version {0}")]
#[error("Invalid VM Version: {0}")]
InvalidVmVersion(u8),

/// Known bugs are detected in transaction script outputs
Expand Down
7 changes: 7 additions & 0 deletions test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ lazy_static = "1.4.0"
byteorder = "1.3.1"
jsonrpc-core = "17.1"

[features]
default = [
"ckb-constant/test-only",
"ckb-types/test-only",
"ckb-jsonrpc-types/test-only"
]

# Prevent this from interfering with workspaces
[workspace]
members = ["."]
Expand Down
1 change: 1 addition & 0 deletions test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ fn all_specs() -> Vec<Box<dyn Spec>> {
Box::new(CheckAbsoluteEpochSince),
Box::new(CheckRelativeEpochSince),
Box::new(CheckBlockExtension),
Box::new(CheckVmVersion),
Box::new(DuplicateCellDepsForDataHashTypeLockScript),
Box::new(DuplicateCellDepsForDataHashTypeTypeScript),
Box::new(DuplicateCellDepsForTypeHashTypeLockScript),
Expand Down
2 changes: 2 additions & 0 deletions test/src/specs/hardfork/v2021/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
mod cell_deps;
mod extension;
mod since;
mod vm_version;

pub use cell_deps::{
DuplicateCellDepsForDataHashTypeLockScript, DuplicateCellDepsForDataHashTypeTypeScript,
DuplicateCellDepsForTypeHashTypeLockScript, DuplicateCellDepsForTypeHashTypeTypeScript,
};
pub use extension::CheckBlockExtension;
pub use since::{CheckAbsoluteEpochSince, CheckRelativeEpochSince};
pub use vm_version::CheckVmVersion;
Loading

0 comments on commit 09c7975

Please sign in to comment.