Skip to content

Commit

Permalink
Try #4271:
Browse files Browse the repository at this point in the history
  • Loading branch information
casperlabs-bors-ng[bot] authored Oct 17, 2023
2 parents d9783da + 3a915d5 commit 9c9f621
Show file tree
Hide file tree
Showing 188 changed files with 14,657 additions and 5,911 deletions.
396 changes: 217 additions & 179 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"execution_engine_testing/tests",
"hashing",
"json_rpc",
"juliet",
"node",
"smart_contracts/contract",
"smart_contracts/contracts/[!.]*/*",
Expand All @@ -14,6 +15,8 @@ members = [
"utils/validation",
"utils/highway-rewards-analysis",
]
# Ensures we do not pull in all the features of dev dependencies when building.
resolver = "2"

default-members = [
"ci/casper_updater",
Expand All @@ -22,6 +25,7 @@ default-members = [
"execution_engine_testing/tests",
"hashing",
"json_rpc",
"juliet",
"node",
"types",
"utils/global-state-update-gen",
Expand All @@ -31,15 +35,14 @@ default-members = [

exclude = ["utils/nctl/remotes/casper-client-rs"]

# Include debug symbols in the release build of `casper-engine-tests` so that `simple-transfer` will yield useful
# perf data.
[profile.release.package.casper-engine-tests]
debug = true

[profile.release]
codegen-units = 1
lto = true

[profile.bench]
codegen-units = 1
lto = true

[profile.release-with-debug]
inherits = "release"
debug = true
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ RUST_LOG=info cargo run --release -- validator resources/local/config.toml

If the environment variable is unset, it is equivalent to setting `RUST_LOG=error`.

When developing and running unit tests, setting `NODE_TEST_LOG=json` will cause the log messages produced by the tests to be JSON-formatted.

### Log message format

A typical log message will look like:
Expand Down
6 changes: 3 additions & 3 deletions execution_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ base16 = "0.2.1"
bincode = "1.3.1"
casper-hashing = { version = "2.0.0", path = "../hashing" }
casper-types = { version = "3.0.0", path = "../types", default-features = false, features = ["datasize", "gens", "json-schema"] }
casper-wasm-utils = "1.0.0"
casper-wasm-utils = "2.0.0"
datasize = "0.2.4"
either = "1.8.1"
hex_fmt = "0.3.0"
Expand All @@ -34,7 +34,7 @@ num-rational = { version = "0.4.0", features = ["serde"] }
num-traits = "0.2.10"
num_cpus = "1"
once_cell = "1.5.2"
parity-wasm = { version = "0.42", default-features = false }
parity-wasm = { version = "0.45.0", default-features = false }
proptest = { version = "1.0.0", optional = true }
rand = "0.8.3"
rand_chacha = "0.3.0"
Expand All @@ -47,7 +47,7 @@ thiserror = "1.0.18"
tracing = "0.1.18"
uint = "0.9.0"
uuid = { version = "0.8.1", features = ["serde", "v4"] }
wasmi = "0.9.1"
wasmi = "0.13.2"

[dev-dependencies]
assert_matches = "1.3.0"
Expand Down
16 changes: 8 additions & 8 deletions execution_engine/benches/trie_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ fn deserialize_trie_node(b: &mut Bencher) {
}

fn serialize_trie_node_pointer(b: &mut Bencher) {
let node = Trie::<Key, StoredValue>::Extension {
affix: (0..255).collect(),
pointer: Pointer::NodePointer(Digest::hash([0; 32])),
};
let node = Trie::<Key, StoredValue>::extension(
(0..255).collect(),
Pointer::NodePointer(Digest::hash([0; 32])),
);

b.iter(|| ToBytes::to_bytes(black_box(&node)));
}

fn deserialize_trie_node_pointer(b: &mut Bencher) {
let node = Trie::<Key, StoredValue>::Extension {
affix: (0..255).collect(),
pointer: Pointer::NodePointer(Digest::hash([0; 32])),
};
let node = Trie::<Key, StoredValue>::extension(
(0..255).collect(),
Pointer::NodePointer(Digest::hash([0; 32])),
);
let node_bytes = node.to_bytes().unwrap();

b.iter(|| Trie::<Key, StoredValue>::from_bytes(black_box(&node_bytes)));
Expand Down
7 changes: 1 addition & 6 deletions execution_engine/src/core/engine_state/engine_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ pub const DEFAULT_MAX_STORED_VALUE_SIZE: u32 = 8 * 1024 * 1024;
pub const DEFAULT_MINIMUM_DELEGATION_AMOUNT: u64 = 500 * 1_000_000_000;
/// Default value for strict argument checking.
pub const DEFAULT_STRICT_ARGUMENT_CHECKING: bool = false;
/// 91 days / 7 days in a week = 13 weeks
/// Length of total vesting schedule in days.
const VESTING_SCHEDULE_LENGTH_DAYS: usize = 91;
const DAY_MILLIS: usize = 24 * 60 * 60 * 1000;
/// Default length of total vesting schedule period expressed in days.
pub const DEFAULT_VESTING_SCHEDULE_LENGTH_MILLIS: u64 =
VESTING_SCHEDULE_LENGTH_DAYS as u64 * DAY_MILLIS as u64;
pub const DEFAULT_VESTING_SCHEDULE_LENGTH_MILLIS: u64 = 0;
/// Default value for allowing auction bids.
pub const DEFAULT_ALLOW_AUCTION_BIDS: bool = true;
/// Default value for allowing unrestricted transfers.
Expand Down
1 change: 1 addition & 0 deletions execution_engine/src/core/engine_state/execution_effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ impl From<ExecutionJournal> for ExecutionEffect {
| Transform::AddUInt256(_)
| Transform::AddUInt512(_)
| Transform::AddKeys(_) => ops.insert_add(key, Op::Add),
Transform::Prune => ops.insert_add(key, Op::Prune),
};
transforms.insert_add(key, transform);
}
Expand Down
11 changes: 8 additions & 3 deletions execution_engine/src/core/engine_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ where

match self
.state
.delete_keys(correlation_id, state_root_hash, keys_to_delete)
.prune_keys(correlation_id, state_root_hash, keys_to_delete)
{
Ok(DeleteResult::Deleted(post_state_hash)) => {
Ok(PruneResult::Success { post_state_hash })
Expand Down Expand Up @@ -2342,12 +2342,12 @@ where
(delay, era_id)
};

for key in withdraw_keys {
for key in &withdraw_keys {
// Transform only those withdraw purses that are still to be
// processed in the unbonding queue.
let withdraw_purses = tracking_copy
.borrow_mut()
.read(correlation_id, &key)
.read(correlation_id, key)
.map_err(|_| Error::FailedToGetWithdrawKeys)?
.ok_or(Error::FailedToGetStoredWithdraws)?
.as_withdraw()
Expand Down Expand Up @@ -2382,6 +2382,11 @@ where
}
}

// Post-migration clean up

for withdraw_key in withdraw_keys {
tracking_copy.borrow_mut().prune(withdraw_key);
}
Ok(())
}

Expand Down
12 changes: 5 additions & 7 deletions execution_engine/src/core/engine_state/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ use std::{
};

/// Representation of a single operation during execution.
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
#[derive(PartialEq, Eq, Debug, Clone, Copy, Default)]
pub enum Op {
/// Read value from a `Key`.
Read,
/// Write value under a `Key`.
Write,
/// Add a value into a `Key`.
Add,
/// Prune a value under a `Key`.
Prune,
/// No operation.
#[default]
NoOp,
}

Expand Down Expand Up @@ -44,19 +47,14 @@ impl Display for Op {
}
}

impl Default for Op {
fn default() -> Self {
Op::NoOp
}
}

impl From<&Op> for casper_types::OpKind {
fn from(op: &Op) -> Self {
match op {
Op::Read => casper_types::OpKind::Read,
Op::Write => casper_types::OpKind::Write,
Op::Add => casper_types::OpKind::Add,
Op::NoOp => casper_types::OpKind::NoOp,
Op::Prune => casper_types::OpKind::Delete,
}
}
}
Loading

0 comments on commit 9c9f621

Please sign in to comment.