Skip to content
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

Evm integration step 2: working Node #2144

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

grumbach
Copy link
Member

@grumbach grumbach commented Sep 26, 2024

DO NOT MERGE YET!
PLEASE MERGE THIS AFTER #2142

  • @grumbach working on the node part
    • sn_node
    • sn_protocol
    • sn_networking
    • sn_node_manager
  • @mickvandijke working on the client part

The objective being to have a fully working network with evm payments. Next step is to rewrite the cli and fix/trim remaining wallet and native currency traces.

evmlib/src/transaction.rs Fixed Show fixed Hide fixed
evmlib/src/transaction.rs Fixed Show fixed Hide fixed
evmlib/src/transaction.rs Fixed Show fixed Hide fixed
evmlib/src/transaction.rs Fixed Show fixed Hide fixed
Ok(EthereumWallet::from(signer))
}

// TODO(optimization): Find a way to reuse/persist contracts and/or a provider without the wallet nonce going out of sync

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
// let new_balance = AttoTokens::from_atto(wallet_original_balance - total_cost.as_atto());
// info!("Verifying new balance on paying wallet is {new_balance} ...");
// let paying_wallet = wallet_client.into_wallet();
// // assert_eq!(paying_wallet.balance(), new_balance);// TODO adapt to evm

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note test

Suspicious comment
// );
// println!("Verifying new balance on paying wallet is now {new_balance} ...");
// let paying_wallet = wallet_client.into_wallet();
// // TODO adapt to evm

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note test

Suspicious comment
// );
// }

// // TODO adapt to evm

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note test

Suspicious comment
retrieved_reg.ops.len()
);
println!("current local cached ops length is {}", register.ops.len());
// // TODO adapt to evm

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note test

Suspicious comment
sn_node_manager/src/local.rs Fixed Show fixed Hide fixed
@mickvandijke mickvandijke mentioned this pull request Sep 26, 2024
4 tasks
@grumbach grumbach force-pushed the evm_integration_step_2 branch from 4512988 to 347f0f8 Compare September 27, 2024 05:04
@@ -258,12 +288,12 @@ fn main() -> Result<()> {
let restart_options = rt.block_on(async move {
let mut node_builder = NodeBuilder::new(
keypair,
rewards_address,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we still carry out forwarding ?
if so, the previous usage of set owner as None was requested from community to leave the optioin that node owner could keep their earnings for other usage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont have forwarding anymore

node_socket_addr,
bootstrap_peers,
opt.local,
root_dir,
opt.owner.clone(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if no longer used, remove the member field.

.get_node_wallet_balance()
.expect("Failed to get node wallet balance")
.as_nano(),
wallet_balance: 0, // NB TODO: Implement this using metrics data?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put as a remind, as this seems shall be resolved before merge

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should remove it as there is no more wallet in the node? I've added a new event to report rewards so we can still have a view into this.

debug!("Received payment of {received_fee:?} for {pretty_key}");
debug!("Payment quote signature is valid for record {pretty_key}");

// verify quote timestamp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the following block of code can actually be within a function of quote, say quote.is_expired()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't verify if the quote is expired here, the smart contract does it

// check if payment is valid on chain
debug!("Verifying payment for record {pretty_key}");
self.evm_network()
.verify_chunk_payment(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it also cover the verification of the royalty_fee ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no royalties anymore


Ok(())
}
// // Copyright 2024 MaidSafe.net limited.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fund transfer shall still be supported ?
or, it's now totally using third party wallet to do this ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now it will be left to third party wallets, until we decide to re-introduce it.

use xor_name::XorName;

#[tokio::test]
async fn storage_payment_succeeds() -> Result<()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the scenarioes here are valid client usage, which shall be covered against a local network during CI.
they need to be updated to using the new EVM.
However, wondering if there will be gas fee incurred ?

@@ -870,6 +874,12 @@ pub enum LocalSubCmd {
/// services, which in this case would be 5. The range must also go from lower to higher.
#[clap(long, value_parser = PortRange::parse)]
rpc_port: Option<PortRange>,
/// Specify the wallet address that will receive the node's earnings.
#[clap(long)]
rewards_address: RewardsAddress,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems all owner usage is actually no longer useful.
shall they be removed to avoid misuse/confusing ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean owner_prefix?

@grumbach grumbach changed the base branch from main to evm-dev September 30, 2024 07:15
@grumbach grumbach merged commit d765773 into maidsafe:evm-dev Sep 30, 2024
7 of 40 checks passed
@grumbach grumbach changed the title Evm integration step 2: working Node and Client Evm integration step 2: working Node Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants