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

Set PoV in frontier template #225

Closed
wants to merge 10 commits into from
Closed

Conversation

rimbi
Copy link
Contributor

@rimbi rimbi commented Aug 24, 2023

I have copied the settings from the node-template in frontier repo.

@rimbi rimbi requested review from girazoki and tmpolaczyk August 24, 2023 07:50
@@ -604,6 +605,7 @@ impl<F: FindAuthor<u32>> FindAuthor<H160> for FindAuthorTruncated<F> {

parameter_types! {
pub BlockGasLimit: U256 = U256::from(BLOCK_GAS_LIMIT);
pub const GasLimitPovSizeRatio: u64 = BLOCK_GAS_LIMIT.saturating_div(MAX_POV_SIZE);
Copy link
Contributor

Choose a reason for hiding this comment

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

I always forget how does saturating_div differ from normal div, so in case anyone is curious:

For unsigned types, it's exactly the same as normal div. It still panics on division by 0.

For signed types, it's the same except one edge case: i8::MIN / -1 returns i8::MAX instead of overflowing (because -256 is a valid value but +256 is not, so it returns +255 instead).

In this case it's a u64 so it's the same as using /, but you can keep it for symmetry with the other operations.

@tmpolaczyk
Copy link
Contributor

Any chance we can test this?

@rimbi
Copy link
Contributor Author

rimbi commented Aug 24, 2023

Any chance we can test this?

I am looking for an example test now. Are you aware of any?

@tmpolaczyk
Copy link
Contributor

Maybe one of these? https://github.com/moonbeam-foundation/moonbeam/tree/master/test/suites/dev/test-pov

@tmpolaczyk
Copy link
Contributor

FYI we merged some CI changes and this has conflicts, @rimbi you should merge master and run pnpm fmt:fix and pnpm lint:fix

@rimbi
Copy link
Contributor Author

rimbi commented Aug 31, 2023

@tmpolaczyk @girazoki The tests pass now. But I am still not sure if they are enough to cover the change. What is your take on it?

The tests:
test/suites/dev-frontier-template/test-pov/

@rimbi rimbi requested review from girazoki and tmpolaczyk September 1, 2023 06:56
Copy link
Collaborator

@girazoki girazoki left a comment

Choose a reason for hiding this comment

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

Removing the expects should not be a solution for this. We need to investigate why the rpc is not returning the proof size

@rimbi
Copy link
Contributor Author

rimbi commented Sep 6, 2023

Is it expected to return proof_size? Could be that it is missing the functionality. @librelois had a PR for proof_size on the moonbeam. Is it because tanssi lack that?

@librelois
Copy link
Contributor

Could be that it is missing the functionality. @librelois had a PR for proof_size on the moonbeam. Is it because tanssi lack that?

yes, this feature was not merged upstream, you need to cherry-pick this commit on your substrate fork: moonbeam-foundation/substrate@0506153

@girazoki
Copy link
Collaborator

girazoki commented Sep 6, 2023

Thanks @librelois, @rimbi I will cherry-pick this change and see if it works

@girazoki
Copy link
Collaborator

girazoki commented Sep 8, 2023

We added the cherry-pick @rimbi, you need to change the commit in the cargo lock from 9202622403b4ecb4949ba48a3f8ba117d2f3b9bd to 1e3d44ae84b24ebfcf0850bbc49c962400dc0669

@rimbi
Copy link
Contributor Author

rimbi commented Sep 8, 2023

@girazoki the response still lacks proofSize. I am building the node with build --release -p tanssi-node.

@tmpolaczyk
Copy link
Contributor

It works for me locally, make sure to compile with cargo build --release --features fast-runtime

@rimbi
Copy link
Contributor Author

rimbi commented Sep 8, 2023

I have manipulated the numbers in the tests so that the tests pass. I don't know if they make sense or not. Please check my last commit. @girazoki @tmpolaczyk

@rimbi rimbi requested a review from girazoki September 8, 2023 16:12
@rimbi
Copy link
Contributor Author

rimbi commented Sep 11, 2023

Can we merge this?

@girazoki
Copy link
Collaborator

girazoki commented Sep 15, 2023

Nope, ideally we would want to know why the values we had originally (same as Moonbeam) dont work. It might well be that the pov is not being accounted in the EVM and that is why you had to lower the values

Copy link
Collaborator

@girazoki girazoki left a comment

Choose a reason for hiding this comment

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

I am requesting changes so that we dont forget to look at this

@@ -99,8 +99,8 @@ describeSuite({
// The block still contain the failed (out of gas) transaction so the PoV is still included
// in the block.
// 1M Gas allows ~250k of PoV, so we verify we are within range.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line is specially suspicious, 1M gas should indeed account for 250K pov proof, and our tests clearly indicate they dont

@girazoki
Copy link
Collaborator

So I investigated a bit more and I realizde your txs are failing (you can do pnpm moonwall run dev_frontier_tempalte and then grepTest the test that you want to run). I see all of them fail with OutOfGas, but if we remove the pov stuff, they dont fail. So the low numbers are probably because it fails

@girazoki
Copy link
Collaborator

girazoki commented Sep 29, 2023

More on this, is the estimateGas that it's failing. If the gas was well estimated, things would work. But seems estimateGas is not estimating the pov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants