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

fix: remove assert when producing block for new onchain account #313

Conversation

mFragaBA
Copy link
Contributor

when running integration tests for onchain accounts we stumbled upon this error:

thread 'tokio-runtime-worker' panicked at store/src/db/sql.rs:176:17:
assertion failed: account.is_new()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2024-04-10T17:43:27.830234Z  INFO write_block_to_db: miden-store: store/src/db/mod.rs:290: close, time.busy: 418µs, time.idle: 18.3µs
2024-04-10T17:43:27.830332Z ERROR apply_block: miden-store: store/src/db/mod.rs:275: error: SQLite pool interaction task failed: Apply block task failed: Panic
2024-04-10T17:43:27.830331Z ERROR store:apply_block:apply_block: miden-store: store/src/state.rs:107: error: Block applying was broken because of closed channel on database side: channel closed

The culprit is the check:

Some(AccountDetails::Full(account)) => {
                debug_assert!(account.is_new());
                ...

The issue with this check is that whenever we submit a transaction from a new account we're already making the account nonce = 1 (could be > 1 once we enable multiple transactions for an account in a single block), but since it's the first transaction we submit to the node a Full account details is created.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

@igamigo igamigo merged commit 7056c4f into 0xPolygonMiden:next Apr 10, 2024
5 checks passed
bobbinth pushed a commit that referenced this pull request Apr 12, 2024
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.

3 participants