-
Notifications
You must be signed in to change notification settings - Fork 2k
Integrate the secure mint plugin #17887
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
Closed
Closed
Changes from all commits
Commits
Show all changes
101 commits
Select commit
Hold shift + click to select a range
c6dc3d6
Copy of llo integration test
cll-gg c889993
Remove other tests
cll-gg ad34149
Remove more unused code
cll-gg e640516
Remove a bit more
cll-gg 6fdedd9
Remove more unused code
cll-gg e42d99d
Just run one test
cll-gg 7a5a0ea
Remove a bit more
cll-gg 07132ea
WIP addSecureMintOCRJobs (fails atm)
cll-gg ea79090
Add some logging
cll-gg f4d3d4c
Typo
cll-gg 535cd32
Create eth key in node to have a transmitter
cll-gg dc91356
Allow no bootstrappers to make the job start up
cll-gg 69d5525
Fix parameters (broken two commits ago)
cll-gg 05eba5f
Use non-zero contract address so that logpoller starts up
cll-gg eea5b31
Bridge is now called and returns data (observation fails)
cll-gg ab11de2
Add some notes
cll-gg 8418fe9
WIP: validate jobs running successfully
cll-gg 8911317
Make test logging more manageable
cll-gg 7dad43c
Fix observation
cll-gg 1df5dc5
Improve logging
cll-gg dfb1a4d
Make it work by not asserting on saved pipeline runs (secure mint pip…
cll-gg b87c271
Enable validation
cll-gg 43140df
Use pluginType = securemint now. All parts to update are tagged with …
cll-gg 3f08384
Fix unit test
cll-gg d0c9106
Use plugin config from new plugin repo repo
cll-gg 2421772
Create NewSecureMintServices
cll-gg 9a0c1bc
Implemented part of the delegate and part of the service
cll-gg b4ca53a
Use SecureMintOCR3OnchainKeyringAdapter to make it possible to use th…
cll-gg 0fca34e
Try to set contract config - plugin doesn't get created otherwise (WIP)
cll-gg f2ab95c
Set the onchain config
cll-gg 96702ca
Use stub contract transmitter
cll-gg af75e5c
WIP onchain config
cll-gg 1864a58
Use mock dependencies for now
cll-gg 35a35c4
Deploy DF Cache contract and set onchain config on it
cll-gg a3725c7
More clarity on onchain contract usage
cll-gg 097eef4
Set secureMintOnchainConfigUsingEvmSimpleConfig
cll-gg f6e4b14
Step further in using the simple config
cll-gg b5999d7
Two vibe-coded files to help
cll-gg 2d30733
One step further: configPollerEVMSimple reads on-chain config
cll-gg 46def63
Bit more print
cll-gg 3cd1e55
Use aggregator for onchain ocr config now in the test
cll-gg b4b66b5
Got the oracle running!
cll-gg c9881d7
Make llo part of the test succeed again - to start from a successful …
cll-gg 8e54595
Remove a lot of the LLO stuff from the test
cll-gg aecc9b4
Remove more unused things
cll-gg afc2e28
Cleanup of the implementation (so far)
cll-gg 4ef7900
One more not-needed change
cll-gg 65f690b
Create sm bootstrap job
cll-gg d331844
Make nodes and secure mint job use bootstrap node
cll-gg e693745
Waiting a bit longer lets the oracle run and generate an outcome
cll-gg d3331e8
Add more logging, rename test, start data source
cll-gg 073798c
Pipeline completes now, observation fails in parsing the result
cll-gg c83c630
Make the bridge return por.Mintables and wait for pipeline completion
cll-gg ea53dab
Add a bit more output to the bridge
cll-gg 03dba0c
Use sm plugin second iteration branch
cll-gg 677bafa
Parse EA response
cll-gg 10bc711
Updating ea
cll-gg 9d0cf17
Let bridge respond as real EA with initial and later response + send …
cll-gg d7488da
Transmit is called!
cll-gg 632f9f1
Assert on report being (stub) transmitted
cll-gg 36420b5
Remove duplicate code
cll-gg 0a82b63
Clean up todos
cll-gg 135bd49
Merge branch 'develop' into sm-integration-test
cll-gg 28e52f9
Fixes after merging with develop
cll-gg 8ca9591
Done: validate secure mint plugin spec
cll-gg 18d531b
Add test for ea and use intermediate types based on Michael's message
cll-gg 0e8960a
Clean up EA request/response usage
cll-gg fbcaf80
Clean up ea.go a bit more
cll-gg 5c8b418
Fix some more todos
cll-gg b6b9fe1
Small test cleanup
cll-gg 26cfca1
Move all chain-write-related todos out of the PR into a ticket
cll-gg 1c75908
Remove temporary tracing
cll-gg 4fda889
Remove newline
cll-gg cc537da
Done: consolidated two securemint packages into one
cll-gg 9a5253b
Update plugin to fourth_iteration (commit cdd3409730eb2122d118f8324d2…
cll-gg fa9d8d0
Bit more cleanup
cll-gg b8bc503
Rename LatestRelevantBlocks to LatestBlocks in EA response
cll-gg 04ca0a2
Make 'reserve' and 'platform' configurable through plugin config jobspec
cll-gg 8c4e087
Leave a todo
cll-gg 8d7fb36
Clean up delegate + services, remove all LOOPP-related things for now
cll-gg 861669b
Use promwrapper for metrics
cll-gg f0b4742
Write readme
cll-gg 0bb737d
Last todo done: improve stubContractReader
cll-gg a0bc180
Merge branch 'develop' into sm-integration-test
cll-gg a92d9fe
Remove unrelated change
cll-gg 2d1e45a
Merge branch 'develop' into sm-integration-test
cll-gg 9c50a3c
Deploy & configure the ocr3 configurator contract
cll-gg 9294fcf
Debug instructions
cll-gg d76e765
Use llo config provider in bootstrap job
cll-gg b543e80
Using the public csa key as transmitter, similar to LLO (WIP)
cll-gg 7b14781
Made it work with stubs!
cll-gg 63ab311
Clean up
cll-gg 68ce6d8
Simplify
cll-gg aa55485
Small cleanup
cll-gg a4e0e63
Bit more small cleanup
cll-gg 48ebe0f
Merge branch 'develop' into sm-integration-test
cll-gg 145a2f3
Use correct chainlink-common version + temp fixes for that
cll-gg 1257c96
Merge branch 'develop' into sm-integration-test
cll-gg bade218
Merge branch 'develop' into sm-integration-test
cll-gg cf43408
Use local chainlink-common temporarily to make it work (depends on ht…
cll-gg 70d8bfc
Merge branch 'develop' into sm-integration-test
cll-gg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # SecureMint Plugin | ||
|
|
||
| ## Overview | ||
|
|
||
| The SecureMint plugin is a plugin that allows for secure minting of tokens. | ||
|
|
||
| ## Validation | ||
|
|
||
| Validating whether the SecureMint plugin is working as expected is done by running the integration test. | ||
|
|
||
| The test is located in the `core/services/ocr3/securemint` directory. | ||
|
|
||
| ### Prerequisites: | ||
| ```bash | ||
| docker run --name cl-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=dbname -p 5432:5432 -d postgres | ||
| make setup-testdb | ||
| ``` | ||
|
|
||
| ### Run test: | ||
| ```bash | ||
| time CL_DATABASE_URL=postgresql://chainlink_dev:insecurepassword@localhost:5432/chainlink_development_test?sslmode=disable go test -timeout 2m -run ^TestIntegration_SecureMint_happy_path$ github.com/smartcontractkit/chainlink/v2/core/services/ocr3/securemint -v 2>&1 | tee all.log | awk '/DEBUG|INFO|WARN|ERROR/ { print > "node_logs.log"; next }; { print > "other.log" }; tail all.log' | ||
| ``` | ||
|
|
||
| ### If you change any dependencies: | ||
| ```bash | ||
| go mod tidy && go mod vendor | ||
| modvendor -copy="**/*.a **/*.h" -v | ||
| ``` | ||
|
|
||
| (the `modvendor` step might not be necessary, but for me it was (see also https://github.com/marcboeker/go-duckdb/issues/174#issuecomment-1979097864)) | ||
|
|
||
| ### Logs | ||
|
|
||
| * other.log: Contains all non-node output from the test run, this can be used to quickly see test failures | ||
| * node_logs.log: Contains all logs from the nodes started up in the test run, this can be used to see the full output of the test run | ||
| * all.log: Contains the complete output of the test run, this can be used to see test failures within the context of the node logs | ||
|
|
||
|
|
||
| ### Debug test with VSCode: | ||
|
|
||
| Create a launch.json file in the .vscode directory with the following content: | ||
|
|
||
| ```json | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "Debug Secure Mint Integration Test", | ||
| "type": "go", | ||
| "request": "launch", | ||
| "mode": "test", | ||
| "program": "${workspaceFolder}/core/services/ocr3/securemint/integrationtest", | ||
| "args": [ | ||
| "-test.run", | ||
| "^TestIntegration_SecureMint_happy_path$", | ||
| "-test.v", | ||
| "-test.timeout", | ||
| "2m", | ||
| "2>&1", | ||
| "|", | ||
| "tee", | ||
| "all.log", | ||
| "|", | ||
| "awk '/DEBUG|INFO|WARN|ERROR/ { print > 'node_logs.log'; next }; { print > 'other.log' }'", | ||
| ], | ||
| "env": { | ||
| "ENV": "test", | ||
| "CL_DATABASE_URL": "postgresql://chainlink_dev:insecurepassword@localhost:5432/chainlink_development_test?sslmode=disable", | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| Then run the test by Cmd+P: "Start Debugging". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package config | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
|
|
||
| "github.com/pkg/errors" | ||
| ) | ||
|
|
||
| // SecureMintConfig holds secure mint specific configuration | ||
| type SecureMintConfig struct { | ||
| Token string `json:"token"` | ||
| Reserves string `json:"reserves"` | ||
| } | ||
|
|
||
| // Parse parses the secure mint configuration from JSON bytes | ||
| func Parse(configBytes []byte) (*SecureMintConfig, error) { | ||
| if len(configBytes) == 0 { | ||
| return nil, errors.New("secure mint config cannot be empty") | ||
| } | ||
|
|
||
| var config SecureMintConfig | ||
| if err := json.Unmarshal(configBytes, &config); err != nil { | ||
| return nil, errors.Wrap(err, "failed to unmarshal SecureMintConfig") | ||
| } | ||
|
|
||
| return &config, nil | ||
| } | ||
|
|
||
| // Validate validates the secure mint plugin-specific config. | ||
| func (cfg *SecureMintConfig) Validate() error { | ||
| if cfg == nil { | ||
| return errors.New("secure mint plugin config cannot be nil") | ||
| } | ||
|
|
||
| if cfg.Token == "" { | ||
| return errors.New("token cannot be empty") | ||
| } | ||
|
|
||
| if cfg.Reserves == "" { | ||
| return errors.New("reserves cannot be empty") | ||
| } | ||
|
|
||
| return nil | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.