Skip to content

Commit

Permalink
fix: always take gas price from previous block (#9638)
Browse files Browse the repository at this point in the history
Part of #9618.

In post-state-root, chunk production is moved before block production,
thus we don't have a `Block` during applying chunk anymore. We need to
make sure that all necessary data is still propagated to
`Runtime::apply`.

It should've not have been an error for gas price, as it is taken from
previous block in the general case:
https://github.com/near/nearcore/blob/9c8d0bbec6a71876bb3317db2ade425f0077a184/chain/chain/src/chain.rs#L4120
However, when there is no chunk, there seem to be a very old error - it
is taken from the same block.

Luckily, after `ProtocolFeature::FixApplyChunks` it is not an issue:
when there is no chunk, gas price is not used at all. So I just start
taking it from previous block for consistency, to ensure that in
post-state-root current block can be safely removed.

Full context:
https://near.zulipchat.com/#narrow/stream/295302-general/topic/.E2.9C.94.20gas.20price.20inconsistency/near/394894144

## Testing

As the change must be no-op, existing tests are enough.
  • Loading branch information
Longarithm authored and nikurt committed Oct 23, 2023
1 parent cdb1743 commit 73ebfbb
Showing 1 changed file with 85 additions and 120 deletions.
Loading

0 comments on commit 73ebfbb

Please sign in to comment.