Skip to content

[CAPPL-400] Fix/truncate workflow names #2 #15896

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

Merged
merged 10 commits into from
Jan 14, 2025

Conversation

justinkaseman
Copy link
Contributor

@justinkaseman justinkaseman commented Jan 10, 2025

Supersedes #15864

@justinkaseman justinkaseman requested review from a team as code owners January 10, 2025 22:43
@justinkaseman justinkaseman changed the title Truncate workflow names #2 [CAPPL-400] Fix/truncate workflow names #2 Jan 10, 2025
Copy link
Contributor

github-actions bot commented Jan 10, 2025

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

// NOTE: Use in logging and metrics can use the longer and human friendly names
hashTruncateName := workflows.HashTruncateName(cfg.WorkflowName)
var htNameBytes []byte = hashTruncateName[:]
hashTruncateNameHex := hex.EncodeToString(htNameBytes)
Copy link
Contributor

Choose a reason for hiding this comment

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

how about we do the hex encoding to ensure UTF8 encoding in the HashTruncateName() so we hexName out of the HashTruncateName() is ready do use.

Copy link
Contributor

@cedric-cordenier cedric-cordenier left a comment

Choose a reason for hiding this comment

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

This isn't backwards compatible and will affect existing feeds

The name is important and needs to be stable for Aptos/DataFeeds since it's used to authorize the workflow in the consumer contract.

Maybe we can instead inject a function to transform the string name to the hexName? That could then default to what we currently have, but be overridden in the syncer to use our custom logic.

@justinkaseman justinkaseman requested review from a team as code owners January 13, 2025 18:39
Workflow sdk.WorkflowSpec
WorkflowID string
WorkflowOwner string
WorkflowName string
Copy link
Contributor

Choose a reason for hiding this comment

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

@justinkaseman Please add comments here detailing what should be used when:

  • WorkflowName is the full, human-readable workflow name
  • WorkflowNameTransform is responsible for translating the human-readable workflow name to its onchain format (i.e. hex encoded, max 10 bytes)

@@ -1300,6 +1301,10 @@ func NewEngine(ctx context.Context, cfg Config) (engine *Engine, err error) {
workflow.hexName = hex.EncodeToString([]byte(cfg.WorkflowName))
Copy link
Contributor

@MStreet3 MStreet3 Jan 13, 2025

Choose a reason for hiding this comment

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

is it simpler to not add the WorkflowNameTransform field (it's public and could get messed with in theory), not change the syncer and instead just do:

workflow.hexName = pkgworkflows.HashTruncateName(cfg.WorkflowName)

otherwise, I'm no longer a fan of the name and not a fan of something that has to be a fixed length being a public field (in hindsight having a public function be passed was no guarantee of hexName length either)

Copy link
Contributor Author

@justinkaseman justinkaseman Jan 13, 2025

Choose a reason for hiding this comment

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

That's what I originally tried to do, but as @cedric-cordenier caught here that would cause a breaking change for the existing Keystone feeds

@justinkaseman justinkaseman added this pull request to the merge queue Jan 14, 2025
Merged via the queue into develop with commit 9fab511 Jan 14, 2025
175 of 176 checks passed
@justinkaseman justinkaseman deleted the fix/truncate-workflow-names-2 branch January 14, 2025 10: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.

4 participants