Skip to content
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

Aptos (combined branch) #13716

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft

Aptos (combined branch) #13716

wants to merge 6 commits into from

Conversation

archseer
Copy link
Contributor

@archseer archseer commented Jun 28, 2024

Contains #14076, #14078 and staged changes

Comment on lines 313 to 314
plugin := env.NewPlugin("aptos")
loopKs := &keystore.AptosLooppSigner{Aptos: ks}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps all this can be moved into InitAptos?

return flat
}

const triggerID = "[email protected]"
Copy link
Contributor

Choose a reason for hiding this comment

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

I like having this merged as an example trigger. I only wish it could go to common but it can't because of EVM dep :( Maybe we should create a special sub-directory with example capabilities and move on-demand trigger there as well...? @cedric-cordenier thoughts?

core/scripts/keystone/main.go Outdated Show resolved Hide resolved
@@ -206,6 +207,13 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
opts.CapabilitiesRegistry = capabilities.NewRegistry(globalLogger)
}

// Use a recurring trigger with mock data for testing purposes
Copy link
Contributor

Choose a reason for hiding this comment

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

Testing where? Can it be under some flag? It doesn't seem right to always add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll move this inside the mock_trigger.go, that way it's only used if the capability is used

@archseer archseer force-pushed the aptos-init branch 2 times, most recently from 9abfa6f to c4351e3 Compare September 11, 2024 06:16
Base automatically changed from fix-multichain-keybundle to develop September 17, 2024 14:55
@archseer archseer force-pushed the aptos-init branch 2 times, most recently from e255623 to b73c5ff Compare September 18, 2024 09:49
@archseer archseer force-pushed the aptos-init branch 2 times, most recently from 6453f9f to 0bf0cc1 Compare September 25, 2024 07:26
Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

🎖️ No JIRA issue number found in: PR title, commit message, or branch name. Please include the issue ID in one of these.

Copy link
Contributor

github-actions bot commented Oct 23, 2024

AER Report: CI Core

aer_workflow , commit , Detect Changes , Clean Go Tidy & Generate , Scheduled Run Frequency , Find New Flaky Tests In Root Project / Find Tests To Run , lint , Core Tests (go_core_tests) , Core Tests (go_core_tests_integration) , Core Tests (go_core_ccip_deployment_tests) , Find New Flaky Tests In Deployment Project , Core Tests (go_core_race_tests) , Core Tests (go_core_fuzz) , Find New Flaky Tests In Root Project / Run Tests , Find New Flaky Tests In Root Project / Report , Flakey Test Detection , SonarQube Scan

1. Integer overflow conversion int -> uint8:[Golang Lint]

Source of Error:
core/capabilities/streams/mock_trigger.go:76:20: G115: integer overflow conversion int -> uint8 (gosec)
		bytes[31] = uint8(i + 1)
		 ^
**Why**: This error occurs because converting an `int` to `uint8` can cause an overflow if the `int` value exceeds the range of `uint8`.

Suggested fix: Ensure that the int value being converted to uint8 is within the range of uint8 (0 to 255) or use a type that can handle larger values.

2. Integer overflow conversion int64 -> uint32:[Golang Lint]

Source of Error:
core/capabilities/streams/mock_trigger.go:143:29: G115: integer overflow conversion int64 -> uint32 (gosec)
	Timestamp: uint32(timestamp),
	 ^
core/capabilities/streams/mock_trigger.go:144:29: G115: integer overflow conversion int64 -> uint32 (gosec)
	ValidFromTimestamp: uint32(timestamp),
	 ^
core/capabilities/streams/mock_trigger.go:149:29: G115: integer overflow conversion int64 -> uint32 (gosec)
	ExpiresAt: uint32(timestamp + 1000000),
	 ^
**Why**: This error occurs because converting an `int64` to `uint32` can cause an overflow if the `int64` value exceeds the range of `uint32`.

Suggested fix: Ensure that the int64 value being converted to uint32 is within the range of uint32 (0 to 4,294,967,295) or use a type that can handle larger values.

3. Integer overflow conversion int -> uint32:[Golang Lint]

Source of Error:
core/capabilities/streams/mock_trigger.go:186:94: G115: integer overflow conversion int -> uint32 (gosec)
	reportCtx := ocrTypes.ReportContext{ReportTimestamp: ocrTypes.ReportTimestamp{Epoch: uint32(baseTimestamp + j)}}
	 ^
**Why**: This error occurs because converting an `int` to `uint32` can cause an overflow if the `int` value exceeds the range of `uint32`.

Suggested fix: Ensure that the int value being converted to uint32 is within the range of uint32 (0 to 4,294,967,295) or use a type that can handle larger values.

4. Replace prices[i] = prices[i] + 1 with prices[i]++:[Golang Lint]

Source of Error:
core/capabilities/streams/mock_trigger.go:178:4: assignOp: replace `prices[i] = prices[i] + 1` with `prices[i]++` (gocritic)
	prices[i] = prices[i] + 1
	^
**Why**: This error occurs because the `prices[i] = prices[i] + 1` operation can be simplified to `prices[i]++`.

Suggested fix: Replace prices[i] = prices[i] + 1 with prices[i]++.

5. Receiver name should be consistent:[Golang Lint]

Source of Error:
core/capabilities/streams/mock_trigger.go:114:1: receiver-naming: receiver name o should be consistent with previous receiver name m for MockTriggerService (revive)
func (o *MockTriggerService) RegisterTrigger(ctx context.Context, req capabilities.TriggerRegistrationRequest) (<-chan capabilities.TriggerResponse, error) {
	ch, err := o.MercuryTriggerService.RegisterTrigger(ctx, req)
	if err != nil {
		return nil, err
	}
	config, _ := o.MercuryTriggerService.ValidateConfig(req.Config)
	o.subscribersMu.Lock()
	defer o.subscribersMu.Unlock()
	o.subscribers[req.Metadata.WorkflowID] = config.FeedIds
	return ch, nil
}
core/capabilities/streams/mock_trigger.go:127:1: receiver-naming: receiver name o should be consistent with previous receiver name m for MockTriggerService (revive)
func (o *MockTriggerService) UnregisterTrigger(ctx context.Context, req capabilities.TriggerRegistrationRequest) error {
	err := o.MercuryTriggerService.UnregisterTrigger(ctx, req)
	o.subscribersMu.Lock()
	defer o.subscribersMu.Unlock()
	delete(o.subscribers, req.Metadata.WorkflowID)
	return err
}
**Why**: This error occurs because the receiver name `o` is inconsistent with the previous receiver name `m` for `MockTriggerService`.

Suggested fix: Use a consistent receiver name for all methods of MockTriggerService.

6. Unnecessary trailing newline:[Golang Lint]

Source of Error:
core/capabilities/streams/mock_trigger.go:216:3: unnecessary trailing newline (whitespace)

^
**Why**: This error occurs because there is an unnecessary trailing newline in the code.

Suggested fix: Remove the unnecessary trailing newline.

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
11.67% Technical Debt Ratio on New Code (required ≤ 4%)
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

archseer and others added 5 commits November 11, 2024 19:40
…v/test (#14560)

* Add ARG MODE to plugins/chainlink.Dockerfile to enable Beholder in dev/test

* Adjusting make scripts to accept build tags with TAG var

* Testing out new build args

---------

Co-authored-by: Sergei Drugalev <[email protected]>
Co-authored-by: Damjan Smickovski <[email protected]>
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