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

fetch weight from remote node #237

Merged
merged 10 commits into from
Sep 5, 2022
Merged

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Aug 23, 2022

Closing #12

src/chain.rs Outdated Show resolved Hide resolved
use pallet_transaction_payment::RuntimeDispatchInfo;
use sp_core::Bytes;

pub static SHARED_CLIENT: OnceCell<SubxtClient> = OnceCell::new();
Copy link
Member Author

Choose a reason for hiding this comment

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

this is needed because the MinerConfig trait doesn't take &self, so I had to use a global variable fine for now.

src/monitor.rs Outdated Show resolved Hide resolved
src/monitor.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
@niklasad1 niklasad1 requested a review from kianenigma August 29, 2022 13:35
src/chain.rs Outdated Show resolved Hide resolved
src/chain.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

One mistake with desired_targets otherwise looks good.

}

fn mock_votes(voters: u32, desired_targets: u16) -> Vec<(u32, u16)> {
assert!(voters >= desired_targets as u32);
Copy link
Member Author

@niklasad1 niklasad1 Sep 2, 2022

Choose a reason for hiding this comment

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

@kianenigma

I guess this assertion must be true because all the "desired targets" be used?!

Copy link
Contributor

Choose a reason for hiding this comment

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

correct. Since we're using only votes1, we should have at at least enough voters to cover all targets.

..Default::default()
};

assert_eq!(raw.solution.voter_count(), active_voters as usize);
Copy link
Contributor

Choose a reason for hiding this comment

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

As long as these pass, we're good.

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

Bueno

@niklasad1 niklasad1 changed the title hacky: fetch weight from remote node fetch weight from remote node Sep 5, 2022
@niklasad1 niklasad1 merged commit 62e2124 into main Sep 5, 2022
@niklasad1 niklasad1 deleted the na-hacky-use-runtime-fetch-weight branch September 5, 2022 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants