Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feat/evm/math-ext…
Browse files Browse the repository at this point in the history
…ension
  • Loading branch information
joshuajbouw committed Jun 29, 2021
2 parents 429f18b + 7e0fe60 commit 3f449d5
Show file tree
Hide file tree
Showing 83 changed files with 2,047 additions and 485 deletions.
7 changes: 5 additions & 2 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions chain/chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1770,15 +1770,19 @@ impl Chain {
let shard_state_header = self.get_state_header(shard_id, sync_hash)?;
let mut height = shard_state_header.chunk_height_included();
let state_root = shard_state_header.chunk_prev_state_root();
let epoch_id = self.get_block_header(&sync_hash)?.epoch_id().clone();

for part_id in 0..num_parts {
let key = StatePartKey(sync_hash, shard_id, part_id).try_to_vec()?;
let part = self.store.owned_store().get(ColStateParts, &key)?.unwrap();

self.runtime_adapter.apply_state_part(
shard_id,
&state_root,
part_id,
num_parts,
&part,
&epoch_id,
)?;
}

Expand Down
1 change: 1 addition & 0 deletions chain/chain/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ impl RuntimeAdapter for KeyValueRuntime {
part_id: u64,
_num_parts: u64,
data: &[u8],
_epoch_id: &EpochId,
) -> Result<(), Error> {
if part_id != 0 {
return Ok(());
Expand Down
1 change: 1 addition & 0 deletions chain/chain/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ pub trait RuntimeAdapter: Send + Sync {
part_id: u64,
num_parts: u64,
part: &[u8],
epoch_id: &EpochId,
) -> Result<(), Error>;

/// Returns StateRootNode of a state.
Expand Down
5 changes: 4 additions & 1 deletion chain/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ near-chunks = { path = "../chunks" }
near-telemetry = { path = "../telemetry" }
near-performance-metrics = { path = "../../utils/near-performance-metrics" }
near-performance-metrics-macros = { path = "../../utils/near-performance-metrics-macros" }
near-vm-runner = { path = "../../runtime/near-vm-runner" }

# Required to pass sandbox feature to node-runtime. Used in tests but cannot in dev-dependencies because
# of passing features
Expand All @@ -59,13 +60,15 @@ expensive_tests = []
adversarial = ["near-network/adversarial", "near-chain/adversarial"]
metric_recorder = ["near-client-primitives/metric_recorder"]
delay_detector = ["near-chain/delay_detector", "near-network/delay_detector", "delay-detector"]
protocol_feature_evm = ["near-primitives/protocol_feature_evm", "near-chain/protocol_feature_evm", "node-runtime/protocol_feature_evm"]
protocol_feature_block_header_v3 = ["near-primitives/protocol_feature_block_header_v3", "near-chain/protocol_feature_block_header_v3", "near-store/protocol_feature_block_header_v3"]
protocol_feature_add_account_versions = ["near-primitives/protocol_feature_add_account_versions"]
protocol_feature_fix_storage_usage = ["near-primitives/protocol_feature_fix_storage_usage"]
protocol_feature_restore_receipts_after_fix = []
protocol_feature_cap_max_gas_price = ["near-primitives/protocol_feature_cap_max_gas_price"]
protocol_feature_count_refund_receipts_in_gas_limit = ["near-primitives/protocol_feature_count_refund_receipts_in_gas_limit", "node-runtime/protocol_feature_count_refund_receipts_in_gas_limit"]
nightly_protocol = []
nightly_protocol_features = ["nightly_protocol", "near-chain/nightly_protocol_features", "protocol_feature_block_header_v3", "protocol_feature_add_account_versions", "protocol_feature_fix_storage_usage", "protocol_feature_restore_receipts_after_fix", "protocol_feature_cap_max_gas_price"]
nightly_protocol_features = ["nightly_protocol", "near-chain/nightly_protocol_features", "protocol_feature_block_header_v3", "protocol_feature_add_account_versions", "protocol_feature_fix_storage_usage", "protocol_feature_restore_receipts_after_fix", "protocol_feature_cap_max_gas_price", "protocol_feature_count_refund_receipts_in_gas_limit"]
sandbox = ["near-network/sandbox", "near-chain/sandbox", "node-runtime/sandbox"]

[[test]]
Expand Down
1 change: 1 addition & 0 deletions chain/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,7 @@ mod test {
vec![],
vec![],
None,
None,
)) as Arc<dyn RuntimeAdapter>
})
.collect()
Expand Down
4 changes: 4 additions & 0 deletions chain/client/tests/challenges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ fn test_verify_chunk_invalid_state_challenge() {
vec![],
vec![],
None,
None,
))];
let mut env = TestEnv::new_with_runtime(ChainGenesis::test(), 1, 1, runtimes);
let signer = InMemorySigner::from_seed("test0", KeyType::ED25519, "test0");
Expand Down Expand Up @@ -570,6 +571,7 @@ fn test_fishermen_challenge() {
vec![],
vec![],
None,
None,
))
};
let runtime1 = create_runtime();
Expand Down Expand Up @@ -632,6 +634,7 @@ fn test_challenge_in_different_epoch() {
vec![],
vec![],
None,
None,
));
let runtime2 = Arc::new(nearcore::NightshadeRuntime::new(
Path::new("."),
Expand All @@ -640,6 +643,7 @@ fn test_challenge_in_different_epoch() {
vec![],
vec![],
None,
None,
));
let runtimes: Vec<Arc<dyn RuntimeAdapter>> = vec![runtime1, runtime2];
let networks = vec![network_adapter.clone(), network_adapter.clone()];
Expand Down
Loading

0 comments on commit 3f449d5

Please sign in to comment.