Skip to content

Commit

Permalink
fix(mempool): pool cycles not reset on next mem block for readonly no…
Browse files Browse the repository at this point in the history
…de (#781)

* fix(mempool): pool cycles not reset on next mem block for readonly node (#781)
* fix(mempool): verify txs from fullnode

Right now, fullnode publish tx only after finalization. But we should
not depend on this behaviour.

For readonly node, we should verify cylces instead of blindly trust
fullnode.

* refactor(mempool): recreate cycles pool from config

In case we migrate to dynamic config in the future
  • Loading branch information
Flouse authored Aug 15, 2022
2 parents 8f83d91 + c36b022 commit 7e51d1a
Show file tree
Hide file tree
Showing 31 changed files with 67 additions and 56 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com).
- Decouple block producing, submission and confirming [#776](https://github.com/nervosnetwork/godwoken/pull/776)
- Support non EIP-155 transaction [#777](https://github.com/nervosnetwork/godwoken/pull/777)

## [v1.5.0-rc2] - 2022-08-12

- fix(mempool): pool cycles not reset on next mem block for readonly node [#781](https://github.com/nervosnetwork/godwoken/pull/781)

## [v1.5.0-rc1] - 2022-08-09

- fix(tests): wait withdrawal pushed into mem pool [#774](https://github.com/nervosnetwork/godwoken/pull/774)
Expand Down
56 changes: 28 additions & 28 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/benches/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-benches"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"
description = "Godwoken benchmarks."
Expand Down
2 changes: 1 addition & 1 deletion crates/block-producer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-block-producer"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion crates/chain/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-chain"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/challenge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-challenge"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/ckb-hardfork/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-ckb-hardfork"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-common"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-config"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/db/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-db"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/dynamic-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-dynamic-config"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/eoa-mapping/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-eoa-mapping"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-generator"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/godwoken-bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "godwoken-bin"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion crates/hash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-hash"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/jsonrpc-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-jsonrpc-types"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion crates/mem-pool/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gw-mem-pool"
version = "1.5.0-rc1"
version = "1.5.0-rc2"
authors = ["Nervos Network"]
edition = "2018"

Expand Down
7 changes: 7 additions & 0 deletions crates/mem-pool/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,13 @@ impl MemPool {
let db = self.store.begin_transaction();
self.remove_unexecutables(&mut mem_state, &db).await?;

// reset cycles pool available cycles.
// recreate from config, in case we migrate to dynamic config in the future.
self.cycles_pool = CyclesPool::new(
self.mem_block_config.max_cycles_limit,
self.mem_block_config.syscall_cycles.clone(),
);

// prepare next mem block
self.try_package_more_withdrawals(&mem_state, &mut withdrawals);
self.prepare_next_mem_block(&db, &mut mem_state, withdrawals, deposits, mem_block_txs)
Expand Down
Loading

0 comments on commit 7e51d1a

Please sign in to comment.