Skip to content

I125 system events not emitted #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 34 commits into
base: alpha4
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
05d9a0c
pumb ethabi-contract = "16.0.0"
SurfingNerd Jul 4, 2024
8c75682
fixed warnings
SurfingNerd Jul 7, 2024
8c7d346
experimentation version with hardcoded Certifier contract
SurfingNerd Jul 31, 2024
26b14de
cargo fmt --all -- --config imports_granularity=Crate
SurfingNerd Sep 10, 2024
dfdfe9e
hardcoded certifier address also for refresh_cache function.
SurfingNerd Sep 13, 2024
2c0aaa6
cargo fmt --all -- --config imports_granularity=Crate
SurfingNerd Sep 17, 2024
86ecdbb
unused field
SurfingNerd Nov 1, 2024
f349d78
cleanup
SurfingNerd Nov 1, 2024
83d3c5a
cleanup
SurfingNerd Nov 1, 2024
32f328d
cargo fmt --all -- --config imports_granularity=Crate
SurfingNerd Nov 1, 2024
6360666
removed RequestMiddleware use
SurfingNerd Nov 5, 2024
8dfc0e9
cargo fix
SurfingNerd Nov 5, 2024
cff8e2f
cargo fix --lib -p parity-rpc
SurfingNerd Nov 5, 2024
af9ecab
trial of ingegrating fake blooms.
SurfingNerd Nov 6, 2024
63384bf
faking blooms by writing fake blooms to ethbloom::BloomRef
SurfingNerd Nov 6, 2024
2853299
hbbft: writing fake blooms on hbbft engine hooks
SurfingNerd Nov 6, 2024
278c19e
logging the fake blooms
SurfingNerd Nov 6, 2024
0fd1baf
cargo fix
SurfingNerd Nov 6, 2024
5ef8a34
formatted imports
SurfingNerd Nov 7, 2024
b028571
writing the fake bloom in header.rs
SurfingNerd Nov 7, 2024
8e832a4
undone fake blooms,
SurfingNerd Nov 7, 2024
c7665af
unused Bloom import.
SurfingNerd Nov 7, 2024
e690fcc
calculating real gas used for execute_code_as_system to prevent overf…
SurfingNerd Nov 7, 2024
ee62bf5
fixed test imports
SurfingNerd Nov 16, 2024
474a28f
cargo fmt --all -- --config imports_granularity=Crate
SurfingNerd Nov 17, 2024
28523a4
commented out currently unused fields for hbbft peers management.
SurfingNerd Nov 17, 2024
3b38650
cargo fmt --all -- --config imports_granularity=Crate
SurfingNerd Nov 17, 2024
0db8cad
for the sake of faster CI tests, and not overshooting the github quot…
SurfingNerd Nov 20, 2024
a2a3d65
merge remove registry with cleanup
SurfingNerd Nov 20, 2024
942c171
unused const since removing registry usage: SERVICE_TRANSACTION_CONTR…
SurfingNerd Nov 20, 2024
7346222
fix for JSON tests deactivation.
SurfingNerd Nov 20, 2024
f59fa0b
Merge branch 'i120-remove-registry' into i125-system-events-not-emitted
SurfingNerd Nov 20, 2024
2a2a558
github CI: reactivated pulling of the submodules.
SurfingNerd Nov 21, 2024
3d079bf
BREAKING: removed check : Block {} ({}) has different number of recei…
SurfingNerd Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ jobs:
matrix:
platform:
- ubuntu-latest
# - macos-latest
toolchain:
- 1.72
- 1.75
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout sources
Expand All @@ -32,9 +31,12 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --locked --all --release --features "json-tests" --verbose --no-run
#args: deactivated JSON Tests, so we do not run out of quota on CI tests for merge intesive time. --locked --all --release --features "json-tests" --verbose --no-run
args: --locked --all --release --verbose --no-run
- name: Run tests for ${{ matrix.platform }}
uses: actions-rs/cargo@v1
with:
command: test
args: --locked --all --release --features "json-tests" --verbose
#args: deactivated JSON Tests --locked --all --release --features "json-tests" --verbose
args: --locked --all --release --verbose

4 changes: 2 additions & 2 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 bin/oe/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use parity_rpc::{
};
use parity_runtime::Executor;

pub use parity_rpc::{HttpServer, IpcServer, RequestMiddleware};
pub use parity_rpc::{HttpServer, IpcServer};
//pub use parity_rpc::ws::Server as WsServer;
pub use parity_rpc::ws::{ws, Server as WsServer};

Expand Down
2 changes: 1 addition & 1 deletion crates/accounts/ethstore/src/account/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod version;
pub use self::{
cipher::{Aes128Ctr, Cipher},
crypto::Crypto,
kdf::{Kdf, Pbkdf2, Prf, Scrypt},
kdf::{Kdf, Pbkdf2, Prf},
safe_account::SafeAccount,
version::Version,
};
4 changes: 2 additions & 2 deletions crates/accounts/ethstore/src/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ mod version;
pub use self::{
bytes::Bytes,
cipher::{Aes128Ctr, Cipher, CipherSer, CipherSerParams},
crypto::{CipherText, Crypto},
crypto::Crypto,
error::Error,
hash::{H128, H160, H256},
id::Uuid,
kdf::{Kdf, KdfSer, KdfSerParams, Pbkdf2, Prf, Scrypt},
key_file::{KeyFile, OpaqueKeyFile},
presale::{Encseed, PresaleWallet},
presale::PresaleWallet,
vault_file::VaultFile,
vault_key_file::{
insert_vault_name_to_json_meta, remove_vault_name_from_json_meta, VaultKeyFile,
Expand Down
4 changes: 1 addition & 3 deletions crates/concensus/ethash/src/keccak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,5 @@ pub mod keccak_512 {
pub mod keccak_256 {
use super::hash;

pub use self::hash::{
keccak256 as inplace, keccak256_range as inplace_range, keccak_256 as write,
};
pub use self::hash::{keccak256 as inplace, keccak_256 as write};
}
2 changes: 1 addition & 1 deletion crates/concensus/miner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ common-types = { path = "../../ethcore/types" }
error-chain = "0.12"
ethabi = "12.0.0"
ethabi-derive = { git = 'https://github.com/rimrakhimov/ethabi', branch = 'rimrakhimov/remove-syn-export-span' }
ethabi-contract = "11.0.0"
ethabi-contract = "16.0.0"
ethcore-call-contract = { path = "../../vm/call-contract" }
ethereum-types = "0.9.2"
futures = "0.1"
Expand Down
36 changes: 13 additions & 23 deletions crates/concensus/miner/src/service_transaction_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ use call_contract::{CallContract, RegistryInfo};
use ethabi::FunctionOutputDecoder;
use ethereum_types::Address;
use parking_lot::RwLock;
use std::{collections::HashMap, mem, sync::Arc};
use std::{collections::HashMap, mem, str::FromStr, sync::Arc};
use types::{ids::BlockId, transaction::SignedTransaction};

use_contract!(
service_transaction,
"res/contracts/service_transaction.json"
);

const SERVICE_TRANSACTION_CONTRACT_REGISTRY_NAME: &'static str = "service_transaction_checker";

/// Service transactions checker.
#[derive(Default, Clone)]
pub struct ServiceTransactionChecker {
Expand Down Expand Up @@ -67,12 +65,8 @@ impl ServiceTransactionChecker {
{
return Ok(*allowed);
}
let contract_address = client
.registry_address(
SERVICE_TRANSACTION_CONTRACT_REGISTRY_NAME.to_owned(),
BlockId::Latest,
)
.ok_or_else(|| "Certifier contract is not configured")?;
let x = Address::from_str("5000000000000000000000000000000000000001".into()).unwrap();
let contract_address = x;
self.call_contract(client, contract_address, sender)
.and_then(|allowed| {
if let Some(mut cache) = self.certified_addresses_cache.try_write() {
Expand All @@ -95,21 +89,17 @@ impl ServiceTransactionChecker {
HashMap::default(),
);

if let Some(contract_address) = client.registry_address(
SERVICE_TRANSACTION_CONTRACT_REGISTRY_NAME.to_owned(),
BlockId::Latest,
) {
let addresses: Vec<_> = cache.keys().collect();
let mut cache: HashMap<Address, bool> = HashMap::default();
for address in addresses {
let allowed = self.call_contract(client, contract_address, *address)?;
cache.insert(*address, allowed);
}
*self.certified_addresses_cache.write() = cache;
Ok(true)
} else {
Ok(false)
let contract_address =
Address::from_str("5000000000000000000000000000000000000001".into()).unwrap();

let addresses: Vec<_> = cache.keys().collect();
let mut cache: HashMap<Address, bool> = HashMap::default();
for address in addresses {
let allowed = self.call_contract(client, contract_address, *address)?;
cache.insert(*address, allowed);
}
*self.certified_addresses_cache.write() = cache;
Ok(true)
}

fn call_contract<C: CallContract + RegistryInfo>(
Expand Down
2 changes: 1 addition & 1 deletion crates/db/blooms-db/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl Database {

// Constant forks may lead to increased ratio of false positives in bloom filters
// since we do not rebuild top or mid level, but we should not be worried about that
// because most of the time events at block n(a) occur also on block n(b) or n+1(b)
// because most of the time events at block n(a) occur also on block n(b) or n+1(b)3
db_files.accrue_bloom(pos, bloom)?;
}
db_files.flush()?;
Expand Down
2 changes: 1 addition & 1 deletion crates/ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ eip-152 = { version = "0.1", path = "../util/EIP-152" }
env_logger = { version = "0.5", optional = true }
error-chain = { version = "0.12", default-features = false }
ethabi = "12.0.0"
ethabi-contract = "11.0.0"
ethabi-contract = "16.0.0"
ethabi-derive = { git = 'https://github.com/rimrakhimov/ethabi', branch = 'rimrakhimov/remove-syn-export-span' }
ethash = { path = "../concensus/ethash" }
ethcore-blockchain = { path = "./blockchain" }
Expand Down
3 changes: 1 addition & 2 deletions crates/ethcore/benches/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ impl<'a> BuiltinBenchmark<'a> {

let builtin = builtins
.get(&H160::from_str(builtin_address).unwrap())
.unwrap()
.clone();
.unwrap();
let input = FromHex::from_hex(input).unwrap();
let expected = FromHex::from_hex(expected).unwrap();

Expand Down
8 changes: 4 additions & 4 deletions crates/ethcore/blockchain/src/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
};
use ethereum_types::{Bloom, BloomRef, H256, U256};
use itertools::Itertools;
use log::{info, trace, warn};

Check warning on line 53 in crates/ethcore/blockchain/src/blockchain.rs

View workflow job for this annotation

GitHub Actions / Check

unused import: `warn`

Check warning on line 53 in crates/ethcore/blockchain/src/blockchain.rs

View workflow job for this annotation

GitHub Actions / Check

unused import: `warn`

Check warning on line 53 in crates/ethcore/blockchain/src/blockchain.rs

View workflow job for this annotation

GitHub Actions / Check

unused import: `warn`

Check warning on line 53 in crates/ethcore/blockchain/src/blockchain.rs

View workflow job for this annotation

GitHub Actions / Test and Build (ubuntu-latest, 1.75)

unused import: `warn`

Check warning on line 53 in crates/ethcore/blockchain/src/blockchain.rs

View workflow job for this annotation

GitHub Actions / Test and Build (ubuntu-latest, 1.75)

unused import: `warn`
use parity_bytes::Bytes;
use parity_util_mem::{allocators::new_malloc_size_ops, MallocSizeOf};
use parking_lot::{Mutex, RwLock};
Expand Down Expand Up @@ -469,10 +469,10 @@
.filter_map(|(number, hash)| self.block_receipts(&hash).map(|r| (number, hash, r.receipts)))
.filter_map(|(number, hash, receipts)| self.block_body(&hash).map(|ref b| (number, hash, receipts, b.transaction_hashes())))
.flat_map(|(number, hash, mut receipts, mut hashes)| {
if receipts.len() != hashes.len() {
warn!("Block {} ({}) has different number of receipts ({}) to transactions ({}). Database corrupt?", number, hash, receipts.len(), hashes.len());
assert!(false);
}
// if receipts.len() != hashes.len() {
// warn!("Block {} ({}) has different number of receipts ({}) to transactions ({}). Database corrupt?", number, hash, receipts.len(), hashes.len());
// assert!(false);
// }
let mut log_index = receipts.iter().fold(0, |sum, receipt| sum + receipt.receipt().logs.len());

let receipts_len = receipts.len();
Expand Down
5 changes: 1 addition & 4 deletions crates/ethcore/src/engines/hbbft/contracts/keygen_history.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use client::traits::EngineClient;
use crypto::{
self,
publickey::{ec_math_utils::public_add, Public},
};
use crypto::{self, publickey::Public};
use engines::{
hbbft::{
contracts::validator_set::{get_validator_pubkeys, ValidatorType},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ pub(crate) struct HbbftEarlyEpochEndManager {

node_id_to_address: BTreeMap<NodeId, Address>,

address_to_node_id: BTreeMap<Address, NodeId>,

// address_to_node_id: BTreeMap<Address, NodeId>,
signing_address: Address,
}

Expand Down Expand Up @@ -109,7 +108,7 @@ impl HbbftEarlyEpochEndManager {
validators: validators,
flagged_validators: flagged_validators,
node_id_to_address,
address_to_node_id,
// address_to_node_id,
signing_address: signing_address.clone(),
};

Expand Down
3 changes: 0 additions & 3 deletions crates/ethcore/src/engines/hbbft/hbbft_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,9 +1175,6 @@ impl HoneyBadgerBFT {
Err(e) => {
error!(target: "consensus", "Error initializing synckeygen: {:?}", e);
}
Err(_) => {
error!(target: "consensus", "Error initializing synckeygen: unknown Error");
}
}
}
}
Expand Down
14 changes: 4 additions & 10 deletions crates/ethcore/src/engines/hbbft/hbbft_network_fork_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,11 @@ impl HbbftNetworkForkManager {
#[cfg(test)]
mod tests {

use std::{fs, str::FromStr};

use crate::engines::{hbbft::test::hbbft_test_client::HbbftTestClient, signer::from_keypair};

use super::*;
use ethereum_types::Address;
use ethjson::spec::hbbft::HbbftNetworkFork;
use hbbft::sync_key_gen::{Ack, Part};

use crate::engines::signer::from_keypair;
use crypto::publickey::{KeyPair, Secret};
//use parity_crypto::publickey::{KeyPair, Secret};
use ethjson::spec::hbbft::HbbftNetworkFork;
use std::str::FromStr;

#[test]
fn test_fork_manager_should_fork() {
Expand All @@ -330,7 +324,7 @@ mod tests {
let signer = from_keypair(key1);

//let signer = Box::new(Signer (key1));
let signer_lock = Arc::new(RwLock::new(Some(signer)));
let signer_lock = std::sync::Arc::new(RwLock::new(Some(signer)));

let own_id = NodeId::default();
fork_manager.initialize(own_id, 8, vec![test_fork]);
Expand Down
21 changes: 11 additions & 10 deletions crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@
ethereum::public_key_to_address::public_key_to_address,
};

use super::{contracts::staking::get_pool_public_key, NodeId};
use bytes::ToPretty;

use ethereum_types::Address;

use super::{contracts::staking::get_pool_public_key, NodeId};

#[derive(Clone, Debug)]
struct ValidatorConnectionData {
// mining_address: Address,
staking_address: Address,
socket_addr: SocketAddr,
public_key: NodeId,
// staking_address: Address,
// socket_addr: SocketAddr,
// public_key: NodeId,
peer_string: String,
mining_address: Address,
}
Expand All @@ -42,7 +40,9 @@
}
}

/// connections are not always required
/// connections are not always required.
/// - during syncing
/// - if not validator address specified.
fn should_not_connect(&self, client: &dyn BlockChainClient) -> bool {
// don't do any connections while the network is syncing.
// the connection is not required yet, and might be outdated.
Expand Down Expand Up @@ -301,7 +301,7 @@
/// because those should be current validators by now.
/// Make sure to connect to the new current validators,
/// before disconnecting from the pending validators.
pub fn disconnect_pending_validators(

Check warning on line 304 in crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs

View workflow job for this annotation

GitHub Actions / Check

method `disconnect_pending_validators` is never used

Check warning on line 304 in crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs

View workflow job for this annotation

GitHub Actions / Check

method `disconnect_pending_validators` is never used

Check warning on line 304 in crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs

View workflow job for this annotation

GitHub Actions / Check

method `disconnect_pending_validators` is never used

Check warning on line 304 in crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs

View workflow job for this annotation

GitHub Actions / Test and Build (ubuntu-latest, 1.75)

method `disconnect_pending_validators` is never used

Check warning on line 304 in crates/ethcore/src/engines/hbbft/hbbft_peers_management.rs

View workflow job for this annotation

GitHub Actions / Test and Build (ubuntu-latest, 1.75)

method `disconnect_pending_validators` is never used
&mut self,
client: &dyn BlockChainClient,
) -> Result<usize, String> {
Expand Down Expand Up @@ -544,14 +544,15 @@
info!(target: "engine", "adding reserved peer: {}", peer_string);
if let Err(err) = peers_management.add_reserved_peer(&peer_string) {
warn!(target: "engine", "failed to adding reserved: {} : {}", peer_string, err);
return None;
}

return Some(ValidatorConnectionData {
staking_address: staking_address,
//staking_address: staking_address,
//mining_address: *address,
socket_addr: socket_addr,
//socket_addr: socket_addr,
peer_string,
public_key: node_id.clone(),
//public_key: node_id.clone(),
mining_address: Address::zero(), // all caller of this function will set this value.
});
} else {
Expand Down
4 changes: 2 additions & 2 deletions crates/ethcore/src/engines/validator_set/safe_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ mod tests {
use types::{header::Header, log_entry::LogEntry};

let client = generate_dummy_client_with_spec(Spec::new_validator_safe_contract);
let engine = client.engine().clone();
let engine = client.engine();
let validator_contract = "0000000000000000000000000000000000000005"
.parse::<Address>()
.unwrap();
Expand Down Expand Up @@ -900,7 +900,7 @@ mod tests {
use types::header::Header;

let client = generate_dummy_client_with_spec(Spec::new_validator_safe_contract);
let engine = client.engine().clone();
let engine = client.engine();

let mut new_header = Header::default();
new_header.set_number(0); // so the validator set doesn't look for a log
Expand Down
17 changes: 16 additions & 1 deletion crates/ethcore/src/machine/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ use std::{
sync::Arc,
};

use ethereum_types::{Address, H256, U256};
use ethereum_types::{Address, Bloom, H256, U256};
use types::{
header::Header,
receipt::TransactionOutcome,
transaction::{
self, SignedTransaction, TypedTransaction, UnverifiedTransaction, SYSTEM_ADDRESS,
UNSIGNED_SENDER,
Expand Down Expand Up @@ -210,6 +211,20 @@ impl EthereumMachine {
.map_err(|e| ::engines::EngineError::FailedSystemCall(format!("{}", e)))?;
let output = res.return_data.to_vec();

let logs = substate.logs.clone();
let gas_used = gas - res.gas_left;
let mut log_bloom = Bloom::zero();
//log_bloom.accrue(logs);

for log in substate.logs {
let bloom = log.bloom();
log_bloom.accrue_bloom(&bloom);
}

block.receipts.push(types::receipt::TypedReceipt::Legacy(
types::receipt::LegacyReceipt::new(TransactionOutcome::StatusCode(1), gas_used, logs),
));

Ok(output)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/net/node-filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ log = "0.4"
parking_lot = "0.11.1"
ethabi = "12.0.0"
ethabi-derive = { git = 'https://github.com/rimrakhimov/ethabi', branch = 'rimrakhimov/remove-syn-export-span' }
ethabi-contract = "11.0.0"
ethabi-contract = "16.0.0"
lru-cache = "0.1"

[dev-dependencies]
Expand Down
1 change: 0 additions & 1 deletion crates/rpc/src/v1/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ mod subscription_manager;
mod work;

pub use self::{
dispatch::{Dispatcher, FullDispatcher},
network_settings::NetworkSettings,
poll_filter::{limit_logs, PollFilter, SyncPollFilter},
poll_manager::PollManager,
Expand Down
Loading
Loading