-
Notifications
You must be signed in to change notification settings - Fork 129
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
feat(internal/client): Introduction of Client
that implements LockImportRun
, BlockchainEvents
, and PrecommitActions
.
#4477
base: refactor/client-db
Are you sure you want to change the base?
Conversation
b93e7cc
to
cf9fb20
Compare
8fe8796
to
8cc1aa9
Compare
e690825
to
0fc61bb
Compare
0fc61bb
to
fdc527e
Compare
Client
that implements LockImportRun
, BlockchainEvents
, and PrecommitActions
.
Client
that implements LockImportRun
, BlockchainEvents
, and PrecommitActions
.Client
that implements LockImportRun
, BlockchainEvents
, and PrecommitActions
.
82c2680
to
3ba7d9e
Compare
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.
just some typos & nits
npw.pinnedBlocks.Add(hash, count) | ||
if count == 0 { | ||
npw.pinnedBlocks.Remove(hash) | ||
} |
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.
npw.pinnedBlocks.Add(hash, count) | |
if count == 0 { | |
npw.pinnedBlocks.Remove(hash) | |
} | |
if count == 0 { | |
npw.pinnedBlocks.Remove(hash) | |
} else { | |
npw.pinnedBlocks.Add(hash, count) | |
} |
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.
Since pinnedBlocks
is an lru cache this is expected behaviour. We should be modifying the count before we remove. See the substrate impl.
defer s.Unlock() | ||
_, ok := s.channels[subsID] | ||
if !ok { | ||
panic(fmt.Sprintf("invalid subsID: %d", subsID)) |
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.
Why does this warrant a panic? I would have gone with a debug log (or maybe warning).
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 replicated this from the substrate impl. I think given this is an internal registry type, we want to alert the developer that this is wrong behaviour. We shouldn't be unregistering subscription IDs that do not exist.
Co-authored-by: Haiko Schol <hs@haikoschol.com>
Changes
BlockchainEvents
interface.PreCommitActions
interface.Client
type that implements bothBlockchainEvents
andPrecommitActions
interfaces.Client.LockImportRun
function that will be used as a dependency in future work.Client
to unpin blocks from memory based on notificationsClient
.Tests
go test -tags integration github.com/ChainSafe/gossamer
Issues
closes #4455, #4456, #4457