Skip to content

Commit 1285ac1

Browse files
Revert "Release V0.4.4 (#1588)"
This reverts commit bd348d8.
1 parent bd348d8 commit 1285ac1

File tree

142 files changed

+64940
-80231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+64940
-80231
lines changed

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Generated by Cargo
22
# will have compiled files and executables
33
target
4-
docker-build
54
**/target/
65
/storage/
76
/test-utils/node/storage
@@ -42,6 +41,3 @@ tmp/
4241

4342
# Logs
4443
*.log
45-
46-
# Vim tmp files
47-
*.swp

.gitlab-ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ test_cargo:
1717
- *setup_cache
1818
script:
1919
- rustc --version && cargo --version
20-
- cargo fmt --all -- --check
2120
- cargo check --all --tests --benches --all-features
2221
- cargo test --all --verbose
2322

CODEOWNERS

-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@
33
/chain/ @ilblackdragon @SkidanovAlex
44

55
/runtime/ @nearmax @evgenykuzyakov
6-
7-
/genesis-tools/ @nearmax

Cargo.lock

+1,196-1,089
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@ members = [
3131
"test-utils/loadtester",
3232
"test-utils/state-viewer",
3333
"near/",
34-
"genesis-tools/genesis-csv-to-json",
3534
"genesis-tools/genesis-populate",
36-
"genesis-tools/keypair-generator",
3735
]
3836

3937
[dev-dependencies]
4038
actix = "0.8.2"
4139
lazy_static = "1.4.0"
4240
log = "0.4.6"
43-
rand = "0.7"
41+
rand = "0.6"
4442
serde_json = "1.0.0"
4543
reqwest = "0.9"
4644
futures = "0.1.25"

Dockerfile

+1-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ RUN --mount=type=cache,target=/tmp/target \
3030
--mount=type=cache,target=/usr/local/cargo/git \
3131
--mount=type=cache,target=/usr/local/cargo/registry \
3232
cargo build -p near --release && \
33-
cargo build -p keypair-generator --release && \
34-
cargo build -p genesis-csv-to-json --release && \
35-
cp /tmp/target/release/near /usr/local/bin/ && \
36-
cp /tmp/target/release/keypair-generator /usr/local/bin && \
37-
cp /tmp/target/release/genesis-csv-to-json /usr/local/bin
33+
cp /tmp/target/release/near /usr/local/bin/
3834

3935
EXPOSE 3030 24567
4036

Dockerfile.prod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM phusion/baseimage:0.11
33
EXPOSE 3030 24567
44

55
COPY scripts/run_docker.sh /usr/local/bin/run.sh
6-
COPY docker-build/* /usr/local/bin/
6+
COPY docker-build/near /usr/local/bin/near
77

88
ENTRYPOINT ["/sbin/my_init", "--"]
99

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ docker-nearcore:
22
DOCKER_BUILDKIT=1 docker build -t nearcore-dev -f Dockerfile .
33
mkdir -p docker-build
44
docker run -v ${PWD}/docker-build:/opt/mount --rm --entrypoint cp nearcore-dev /usr/local/bin/near /opt/mount/near
5-
docker run -v ${PWD}/docker-build:/opt/mount --rm --entrypoint cp nearcore-dev /usr/local/bin/genesis-csv-to-json /opt/mount/genesis-csv-to-json
6-
docker run -v ${PWD}/docker-build:/opt/mount --rm --entrypoint cp nearcore-dev /usr/local/bin/keypair-generator /opt/mount/keypair-generator
75
docker build -t nearcore -f Dockerfile.prod .
6+
rm -rf docker-build

async-utils/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ authors = ["Near Inc <hello@nearprotocol.com>"]
55
edition = "2018"
66

77
[dependencies]
8-
futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat", "async-await"] }
8+
futures03 = { package = "futures-preview", version = "0.3.0-alpha.16", features = ["compat", "async-await", "nightly"] }
99
tokio = "0.1.15"

async-utils/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(await_macro, async_await)]
2+
13
use std::time::{Duration, Instant};
24

35
use futures03::{compat::Future01CompatExt as _, FutureExt as _};
@@ -8,7 +10,7 @@ use futures03::{compat::Future01CompatExt as _, FutureExt as _};
810
/// It is useful when the `futures-preview` is imported as `futures03`.
911
macro_rules! select { // replace `::futures_util` with `::futures03` as the crate path
1012
($($tokens:tt)*) => {
11-
futures03::inner_macro::select! {
13+
futures03::inner_select::select! {
1214
futures_crate_path ( ::futures03 )
1315
$( $tokens )*
1416
}

chain/chain/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ serde_derive = "1.0"
1515
cached = "0.9.0"
1616
lazy_static = "1.4"
1717

18-
borsh = "0.2.9"
18+
borsh = "0.2.7"
1919

2020
near-crypto = { path = "../../core/crypto" }
2121
near-primitives = { path = "../../core/primitives" }

chain/chain/src/chain.rs

+2-76
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use near_primitives::receipt::Receipt;
1414
use near_primitives::sharding::{
1515
ChunkHash, ChunkHashHeight, ReceiptProof, ShardChunk, ShardChunkHeader, ShardProof,
1616
};
17-
use near_primitives::transaction::{ExecutionOutcome, ExecutionStatus};
17+
use near_primitives::transaction::ExecutionOutcome;
1818
use near_primitives::types::{AccountId, Balance, BlockIndex, ChunkExtra, Gas, ShardId};
1919
use near_store::{Store, COL_STATE_HEADERS};
2020

@@ -27,10 +27,6 @@ use crate::types::{
2727
ReceiptProofResponse, ReceiptResponse, RootProof, RuntimeAdapter, ShardStateSyncResponseHeader,
2828
ShardStateSyncResponsePart, StateHeaderKey, Tip, ValidatorSignatureVerificationResult,
2929
};
30-
use near_primitives::views::{
31-
ExecutionOutcomeView, ExecutionOutcomeWithIdView, ExecutionStatusView,
32-
FinalExecutionOutcomeView, FinalExecutionStatus,
33-
};
3430

3531
/// Maximum number of orphans chain can store.
3632
pub const MAX_ORPHAN_SIZE: usize = 1024;
@@ -1312,72 +1308,6 @@ impl Chain {
13121308

13131309
Ok(())
13141310
}
1315-
1316-
pub fn get_transaction_execution_result(
1317-
&mut self,
1318-
hash: &CryptoHash,
1319-
) -> Result<ExecutionOutcomeView, String> {
1320-
match self.get_transaction_result(hash) {
1321-
Ok(result) => Ok(result.clone().into()),
1322-
Err(err) => match err.kind() {
1323-
ErrorKind::DBNotFoundErr(_) => {
1324-
Ok(ExecutionOutcome { status: ExecutionStatus::Unknown, ..Default::default() }
1325-
.into())
1326-
}
1327-
_ => Err(err.to_string()),
1328-
},
1329-
}
1330-
}
1331-
1332-
fn get_recursive_transaction_results(
1333-
&mut self,
1334-
hash: &CryptoHash,
1335-
) -> Result<Vec<ExecutionOutcomeWithIdView>, String> {
1336-
let outcome = self.get_transaction_execution_result(hash)?;
1337-
let receipt_ids = outcome.receipt_ids.clone();
1338-
let mut transactions = vec![ExecutionOutcomeWithIdView { id: (*hash).into(), outcome }];
1339-
for hash in &receipt_ids {
1340-
transactions
1341-
.extend(self.get_recursive_transaction_results(&hash.clone().into())?.into_iter());
1342-
}
1343-
Ok(transactions)
1344-
}
1345-
1346-
pub fn get_final_transaction_result(
1347-
&mut self,
1348-
hash: &CryptoHash,
1349-
) -> Result<FinalExecutionOutcomeView, String> {
1350-
let mut outcomes = self.get_recursive_transaction_results(hash)?;
1351-
let mut looking_for_id = (*hash).into();
1352-
let num_outcomes = outcomes.len();
1353-
let status = outcomes
1354-
.iter()
1355-
.find_map(|outcome_with_id| {
1356-
if outcome_with_id.id == looking_for_id {
1357-
match &outcome_with_id.outcome.status {
1358-
ExecutionStatusView::Unknown if num_outcomes == 1 => {
1359-
Some(FinalExecutionStatus::NotStarted)
1360-
}
1361-
ExecutionStatusView::Unknown => Some(FinalExecutionStatus::Started),
1362-
ExecutionStatusView::Failure(e) => {
1363-
Some(FinalExecutionStatus::Failure(e.clone()))
1364-
}
1365-
ExecutionStatusView::SuccessValue(v) => {
1366-
Some(FinalExecutionStatus::SuccessValue(v.clone()))
1367-
}
1368-
ExecutionStatusView::SuccessReceiptId(id) => {
1369-
looking_for_id = id.clone();
1370-
None
1371-
}
1372-
}
1373-
} else {
1374-
None
1375-
}
1376-
})
1377-
.expect("results should resolve to a final outcome");
1378-
let receipts = outcomes.split_off(1);
1379-
Ok(FinalExecutionOutcomeView { status, transaction: outcomes.pop().unwrap(), receipts })
1380-
}
13811311
}
13821312

13831313
/// Various chain getters.
@@ -1507,7 +1437,7 @@ impl Chain {
15071437

15081438
/// Returns underlying RuntimeAdapter.
15091439
#[inline]
1510-
pub fn runtime_adapter(&self) -> Arc<dyn RuntimeAdapter> {
1440+
pub fn runtime_adapter(&self) -> Arc<RuntimeAdapter> {
15111441
self.runtime_adapter.clone()
15121442
}
15131443

@@ -2035,10 +1965,6 @@ impl<'a> ChainUpdate<'a> {
20351965
return Err(ErrorKind::InvalidEpochHash.into());
20361966
}
20371967

2038-
if header.inner.chunk_mask.len() as u64 != self.runtime_adapter.num_shards() {
2039-
return Err(ErrorKind::InvalidChunkMask.into());
2040-
}
2041-
20421968
// Prevent time warp attacks and some timestamp manipulations by forcing strict
20431969
// time progression.
20441970
if header.inner.timestamp <= prev_header.inner.timestamp {

chain/chain/src/error.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ pub enum ErrorKind {
7575
/// Invalid chunk.
7676
#[fail(display = "Invalid Chunk")]
7777
InvalidChunk,
78-
/// Invalid chunk mask
79-
#[fail(display = "Invalid Chunk Mask")]
80-
InvalidChunkMask,
8178
/// Invalid epoch hash
8279
#[fail(display = "Invalid Epoch Hash")]
8380
InvalidEpochHash,
@@ -159,7 +156,6 @@ impl Error {
159156
| ErrorKind::InvalidBlockConfirmation
160157
| ErrorKind::InvalidBlockWeight
161158
| ErrorKind::InvalidChunk
162-
| ErrorKind::InvalidChunkMask
163159
| ErrorKind::InvalidStateRoot
164160
| ErrorKind::InvalidTxRoot
165161
| ErrorKind::InvalidChunkReceiptsRoot
@@ -203,3 +199,6 @@ impl From<String> for Error {
203199
}
204200

205201
impl std::error::Error for Error {}
202+
203+
unsafe impl Send for Error {}
204+
unsafe impl Sync for Error {}

chain/chain/src/test_utils.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ use near_primitives::transaction::{
1818
TransferAction,
1919
};
2020
use near_primitives::types::{
21-
AccountId, Balance, BlockIndex, EpochId, MerkleHash, Nonce, ShardId, StateRoot, ValidatorStake,
21+
AccountId, Balance, BlockIndex, EpochId, MerkleHash, Nonce, ShardId, StateRoot,
22+
ValidatorStake,
2223
};
2324
use near_primitives::views::QueryResponse;
2425
use near_store::test_utils::create_test_store;
@@ -31,7 +32,7 @@ use crate::types::{
3132
ValidatorSignatureVerificationResult, Weight,
3233
};
3334
use crate::{Chain, ChainGenesis, ValidTransaction};
34-
use near_primitives::errors::RuntimeError;
35+
use near_primitives::errors::InvalidTxErrorOrStorageError;
3536
use near_primitives::merkle::{merklize, verify_path, MerklePath};
3637

3738
pub const DEFAULT_STATE_NUM_PARTS: u64 = 17; /* TODO MOO */
@@ -178,7 +179,7 @@ impl KeyValueRuntime {
178179
}
179180
let prev_block_header = self
180181
.get_block_header(prev_hash)?
181-
.ok_or_else(|| format!("Missing block {} when computing the epoch", prev_hash))?;
182+
.ok_or(format!("Missing block {} when computing the epoch", prev_hash))?;
182183
Ok(prev_block_header.inner.height)
183184
}
184185

@@ -440,7 +441,7 @@ impl RuntimeAdapter for KeyValueRuntime {
440441
_gas_price: Balance,
441442
_state_root: StateRoot,
442443
transaction: SignedTransaction,
443-
) -> Result<ValidTransaction, RuntimeError> {
444+
) -> Result<ValidTransaction, InvalidTxErrorOrStorageError> {
444445
Ok(ValidTransaction { transaction })
445446
}
446447

chain/chain/src/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use borsh::{BorshDeserialize, BorshSerialize};
44

55
use near_crypto::{Signature, Signer};
66
pub use near_primitives::block::{Block, BlockHeader, Weight};
7-
use near_primitives::errors::RuntimeError;
7+
use near_primitives::errors::InvalidTxErrorOrStorageError;
88
use near_primitives::hash::{hash, CryptoHash};
99
use near_primitives::merkle::{merklize, MerklePath};
1010
use near_primitives::receipt::Receipt;
@@ -141,7 +141,7 @@ pub trait RuntimeAdapter: Send + Sync {
141141
gas_price: Balance,
142142
state_root: StateRoot,
143143
transaction: SignedTransaction,
144-
) -> Result<ValidTransaction, RuntimeError>;
144+
) -> Result<ValidTransaction, InvalidTxErrorOrStorageError>;
145145

146146
/// Filter transactions by verifying each one by one in the given order. Every successful
147147
/// verification stores the updated account balances to be used by next transactions.

chain/chunks/Cargo.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ edition = "2018"
66

77
[dependencies]
88
actix = "0.8.1"
9+
typed-arena = "1.4.1"
910
futures = "0.1.25"
1011
tokio = "0.1"
11-
rand = "0.7"
12+
rand = "0.6"
13+
rand_xorshift = "0.1"
1214
chrono = "0.4.6"
1315
log = "0.4"
14-
borsh = "0.2.9"
16+
borsh = "0.2.2"
1517
serde = "1.0"
1618
serde_derive = "1.0"
19+
elapsed = "0.1"
20+
protobuf = "2.4"
1721
reed-solomon-erasure = "3.1.1"
22+
crossbeam = "0.3.0"
1823
cached = "0.9.0"
1924

2025
near-crypto = { path = "../../core/crypto" }

chain/client/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ authors = ["Near Inc <hello@nearprotocol.com>"]
55
edition = "2018"
66

77
[dependencies]
8-
ansi_term = "0.12"
8+
ansi_term = "0.11.0"
99
actix = "0.8.1"
1010
futures = "0.1"
1111
chrono = { version = "0.4.4", features = ["serde"] }
1212
kvdb = "0.1"
1313
log = "0.4"
14-
rand = "0.7"
14+
rand = "0.6.5"
1515
serde = { version = "1.0", features = ["derive"] }
1616
serde_derive = "1.0"
1717
serde_json = "1.0"

0 commit comments

Comments
 (0)