Skip to content

Commit

Permalink
Merge pull request #141 from SurfingNerd/i120-merge-remove-registry
Browse files Browse the repository at this point in the history
I120 merge remove registry
  • Loading branch information
SurfingNerd authored Nov 22, 2024
2 parents 64ed79a + 1ab9f20 commit f328103
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 30 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ jobs:
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 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/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
Original file line number Diff line number Diff line change
Expand Up @@ -324,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
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

0 comments on commit f328103

Please sign in to comment.