Skip to content

Update/sdk validations#62

Merged
mateeullahmalik merged 2 commits intomasterfrom
update/sdk-validations
May 15, 2025
Merged

Update/sdk validations#62
mateeullahmalik merged 2 commits intomasterfrom
update/sdk-validations

Conversation

@mateeullahmalik
Copy link
Collaborator

No description provided.

@mateeullahmalik mateeullahmalik requested a review from j-rafique May 15, 2025 12:44
@mateeullahmalik mateeullahmalik merged commit 289fdda into master May 15, 2025
7 checks passed
@mateeullahmalik mateeullahmalik requested a review from Copilot May 15, 2025 12:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances SDK validation by propagating and verifying a base64 signature through the cascade flow, refactors event data handling to use typed EventData, and extends the task cache to track ActionID and transaction hash.

  • Add signature generation in E2E tests and wire signature through StartCascade and CreateCascadeTask.
  • Introduce validateAction & validateSignature in ManagerImpl, update cache storage and event handling for transaction hashes.
  • Refactor logging/events to use unified LogEvent and typed EventData, update adapters and types accordingly.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/system/e2e_cascade_test.go Generate and base64‐encode signature, pass signature into StartCascade.
sdk/task/manager.go Updated Manager interface and implementation to accept signature, added signature checks
sdk/task/helpers.go Added validateAction & validateSignature helpers for action and signature verification
sdk/task/task.go Extended BaseTask, replaced logEvent with LogEvent, adjusted cascade task flow
sdk/task/cache.go Extended TaskEntry with ActionID/TxHash, updated Set signature, added UpdateTxHash
sdk/event/types.go Switched event data to EventData type and updated NewEvent signature
sdk/event/keys.go Added standard EventDataKey constants
sdk/adapters/supernodeservice/adapter.go Updated EventLogger callback to use EventData
sdk/adapters/lumera/types.go Expanded Action struct with ActionType, Metadata, Creator
sdk/adapters/lumera/adapter.go Added DecodeCascadeMetadata & VerifySignature methods, updated toSdkAction mapping
Comments suppressed due to low confidence (3)

sdk/task/cascade.go:38

  • [nitpick] The actionId field on CascadeTask appears redundant since BaseTask.ActionID is used elsewhere; consider removing the lowercase actionId field to reduce confusion.
func NewCascadeTask(base BaseTask, filePath string, actionId string) *CascadeTask {

sdk/task/cache.go:134

  • There are no existing tests covering UpdateTxHash or the new ActionID/TxHash fields in TaskEntry; add unit tests to ensure these new behaviors are validated.
func (tc *TaskCache) UpdateTxHash(ctx context.Context, taskID string, txHash string) bool {

sdk/adapters/lumera/adapter.go:12

  • The code uses fmt.Errorf in new methods but fmt is not imported; add import "fmt" to avoid compile errors.
import (

Comment on lines +58 to +61
base64EnTcketDataHash := cascadeMetaData.DataHash

// Decode the data hash from base64 to raw bytes
dataHashBytes, err := base64.StdEncoding.DecodeString(base64EnTcketDataHash)
Copy link

Copilot AI May 15, 2025

Choose a reason for hiding this comment

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

The variable name base64EnTcketDataHash is misspelled and unclear; consider renaming it to base64EncodedDataHash for clarity.

Suggested change
base64EnTcketDataHash := cascadeMetaData.DataHash
// Decode the data hash from base64 to raw bytes
dataHashBytes, err := base64.StdEncoding.DecodeString(base64EnTcketDataHash)
base64EncodedDataHash := cascadeMetaData.DataHash
// Decode the data hash from base64 to raw bytes
dataHashBytes, err := base64.StdEncoding.DecodeString(base64EncodedDataHash)

Copilot uses AI. Check for mistakes.
@mateeullahmalik mateeullahmalik deleted the update/sdk-validations branch May 27, 2025 09:37
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