-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix commit error on GraphQL service startup (#1802)
Related issues: - Closes #1801 This PR removes the unnecessary DB commit that occurs during startup of the GraphQL API service. Because the committed transaction has no corresponding change in block height, the state transition fails and throws an error. This error then causes startup of the Fuel node to fail. This can currently happen in local and production builds, but we did not have coverage for this in test. This is because this requires loading the off-chain database using something like `CombinedDatabase::open(...)`, while most tests in the codebase use a default off-chain database, i.e. `from_database`: ``` pub async fn from_database( database: Database, config: Config, ) -> anyhow::Result<Self> { let combined_database = CombinedDatabase::new(database, Default::default(), Default::default()); Self::from_combined_database(combined_database, config).await } ``` This PR introduces a test that performs the following steps: 1. Creates a node using a RocksDB database on the filesystem for on-chain, off-chain, and relayer ("combined") data 2. Sends some transactions to the node 3. Shuts down the node 4. Creates a second node by loading the same database on the filesystem for on-chain, off-chain, and relayer data 5. Waits for the second node to become healthy Before removing the commit, this test failed with the observed failure: ``` The initialization of the service failed.: error occurred in the underlying datastore `NewHeightIsNotSet { prev_height: 3 }` ``` With the code change, this test passes. --------- Co-authored-by: xgreenx <xgreenx9999@gmail.com>
- Loading branch information
Showing
5 changed files
with
63 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters