Skip to content

[ARCH-330] Add keystore postgres storage#1651

Merged
pavel-raykov merged 6 commits intomainfrom
add-pg-storage
Oct 28, 2025
Merged

[ARCH-330] Add keystore postgres storage#1651
pavel-raykov merged 6 commits intomainfrom
add-pg-storage

Conversation

@pavel-raykov
Copy link
Copy Markdown
Contributor

@pavel-raykov pavel-raykov commented Oct 28, 2025

The failing race test TestStandardCapabilityCallsAreAsync is unrelated.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 28, 2025

✅ API Diff Results - No breaking changes


📄 View full apidiff report

Comment thread keystore/pgstore/pgstore.go
Comment thread keystore/pgstore/pgstore.go Outdated
jmank88
jmank88 previously approved these changes Oct 28, 2025
"github.com/smartcontractkit/chainlink-common/pkg/sqlutil/sqltest"
)

func TestPgStorage(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should test the update as well and make sure data changes/timestamp updated, name remains the same etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have added a part testing the update.

About the updated_at timestamp: currently no business logic uses it and most likely it will stay the same (it should only be used as additional debug information). If we start exposing it, then we should also test it; but for now, to keep it lightweight I think it is fine to not touch created_at and updated_at fields at all.


var _ keystore.Storage = &Storage{}

// Storage implements Storage using a Postgres database
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the migration file in core then I guess? Curious if we could keep the migration file here to fully decouple, I could imagine using a PG database for storage outside of the core context (e.g. JD)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The migration has been added here https://github.com/smartcontractkit/chainlink/blob/b19ae3b2ffaed741930917ce4f20a076b0dcfad3/core/store/migrate/migrations/0280_create_keystore_table.sql#L1 . I guess it will be possible to decouple it, but then we will have to recreate all the CL_DATABASE_URL logic just for this. As the main goal is to keep the implementation lightweight I think it is fine to reuse the main database for now.

@pavel-raykov pavel-raykov requested a review from jmank88 October 28, 2025 19:35
@pavel-raykov pavel-raykov merged commit 549f867 into main Oct 28, 2025
18 of 22 checks passed
@pavel-raykov pavel-raykov deleted the add-pg-storage branch October 28, 2025 20:36
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