-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add causality region column and implement isolation rules #4162
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
074e99f
feature(offchain): Add `causality_region` column to entity tables
leoyvens 535f912
store: Move `has_causality_region` to manifest, rename to `entities_w…
leoyvens 648a6b7
*: Add `causality_region` to EntityKey
leoyvens 091155c
store: Insert the causality region
leoyvens 1399f74
store: Read isolation between causality regions
leoyvens c8f1698
fix: Fix release build
leoyvens bb6d9a5
provider: Make stop idempotent
leoyvens 9c7de71
tests: Refactor file ds test to use events
leoyvens ea6ec6f
tests: Test conflict between onchain and offchain
leoyvens 5c27c39
tests: Test conflict between offchain and offchain
leoyvens a06bc92
test: Fix unit test
leoyvens 0d0463a
tests: Improve tests and comments to address review
leoyvens 7e6bc96
fix: Change migration to add column 'if not exists'
leoyvens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ use graph::data::subgraph::{ | |
SubgraphFeature, | ||
}; | ||
use graph::data_source::{ | ||
offchain, DataSource, DataSourceCreationError, DataSourceTemplate, TriggerData, | ||
offchain, CausalityRegion, DataSource, DataSourceCreationError, DataSourceTemplate, TriggerData, | ||
}; | ||
use graph::env::EnvVars; | ||
use graph::prelude::*; | ||
|
@@ -653,6 +653,7 @@ where | |
let mut block_state = BlockState::<C>::new(EmptyStore::new(schema), LfuCache::new()); | ||
|
||
// PoI ignores offchain events. | ||
// See also: poi-ignores-offchain | ||
let proof_of_indexing = None; | ||
let causality_region = ""; | ||
|
||
|
@@ -998,7 +999,14 @@ async fn update_proof_of_indexing( | |
// Create the special POI entity key specific to this causality_region | ||
let entity_key = EntityKey { | ||
entity_type: POI_OBJECT.to_owned(), | ||
|
||
// There are two things called causality regions here, one is the causality region for | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment is really helpful 👍 |
||
// the poi which is a string and the PoI entity id. The other is the data source | ||
// causality region to which the PoI belongs as an entity. Currently offchain events do | ||
// not affect PoI so it is assumed to be `ONCHAIN`. | ||
// See also: poi-ignores-offchain | ||
entity_id: causality_region.into(), | ||
causality_region: CausalityRegion::ONCHAIN, | ||
}; | ||
|
||
// Grab the current digest attribute on this entity | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could benefit from some test coverage, just making sure that given some manifests, the DeploymentCreate ends up with the right entities