Skip to content

pkg/settings/cresettings: add PerWorkflow.ChainAllowed#1727

Merged
pavel-raykov merged 1 commit intomainfrom
chains-allowed
Dec 10, 2025
Merged

pkg/settings/cresettings: add PerWorkflow.ChainAllowed#1727
pavel-raykov merged 1 commit intomainfrom
chains-allowed

Conversation

@jmank88
Copy link
Contributor

@jmank88 jmank88 commented Dec 7, 2025

https://smartcontract-it.atlassian.net/browse/PLEX-2121

This PR adds a limits.GateLimiter to be used with a new cresetting PerWorkflow.ChainAllowed. This setting holds both the typical overridable value, as well as a map by chain selector. The latter allows chains to be made accessible via an override on the org, owner, or workflow ID. The former enabled (dis)allowing by default for a particular org, owner, or workflow.

Supports:

@github-actions
Copy link

github-actions bot commented Dec 7, 2025

✅ API Diff Results - No breaking changes


📄 View full apidiff report

"ConsensusCallsLimit": "2000",
"LogLineLimit": "1kb",
"LogEventLimit": "1000",
"ChainAllowed": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we care to name it something like AdditionalChain instead of ChainAllowed since the latter seems to imply that the empty value forbids them all, whereas it is just meant that "secret" chains are not allowed yet.

Copy link
Contributor Author

@jmank88 jmank88 Dec 8, 2025

Choose a reason for hiding this comment

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

Empty does forbid them all. We don't have any pre-existing notion of public or private to build on - we just have the chain selector ID.

We could include a default set of public chains here, but I was concerned that is an implementation detail, and regardless it will evolve over time and different between environments and zones, so it can be stale.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, so how one will keep it up to date - will we have a file with all chainIDs somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the deployments repo

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, so how deployments repo is better than a set of public chains here? Is it because the deployments repo is a "source of truth" and is better maintained? Also, currently where would such list of public chainIDs be here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

return s.open, nil
}

func (s *simpleGateLimiter) AllowErr(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

why AllowErr and not just Allow ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aligning with the other limiters. We could support both, but the error has metadata that we to expose

pavel-raykov
pavel-raykov previously approved these changes Dec 9, 2025
"Default": "false",
"Values": {
"12922642891491394802": "true",
"3379446385462418246": "true"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why only these two?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could include more chains, but it would be assuming implementation details about the deployed system, and it can't serve as the source of truth because we need to be able to roll out new chains without making code changes here. I originally had it empty, but we use these dev/testnets (EVM chain ID 1337 and 2337) in tests, so including them seemed worthwhile.

"ConsensusCallsLimit": "2000",
"LogLineLimit": "1kb",
"LogEventLimit": "1000",
"ChainAllowed": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not make it a separate entry following the capability name like "evm"? Or anything outside "PerWorkflow"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well we have chain agnostic selectors rather than per-family chain IDs, and we want this to affect reads and writes. Being under PerWorkflow is what allows us to override and grant access at the workflow level.

@jmank88 jmank88 added this pull request to the merge queue Dec 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 10, 2025
@pavel-raykov pavel-raykov added this pull request to the merge queue Dec 10, 2025
Merged via the queue into main with commit 9585274 Dec 10, 2025
35 of 36 checks passed
@pavel-raykov pavel-raykov deleted the chains-allowed branch December 10, 2025 11:20
@jmank88 jmank88 restored the chains-allowed branch December 10, 2025 19:50
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.

4 participants