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

feat: refactor dymint config to support loading configuration from file #326

Conversation

mtsitrin
Copy link
Contributor

@mtsitrin mtsitrin commented May 21, 2023

  • Main change is the breaking of the SL config from raw json to an explicit struct.
  • also changing the namespaceID to string so it will be easier to set in conf file
  • renamed settlement.LayerClient to settlement.LayerI to indicate it's an interface

PR Standards

Opening a pull request should be able to meet the following requirements


For Author:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

@mtsitrin mtsitrin linked an issue May 21, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented May 21, 2023

Codecov Report

Merging #326 (4e19c87) into main (5615c11) will increase coverage by 0.13%.
The diff coverage is 73.04%.

@@            Coverage Diff             @@
##             main     #326      +/-   ##
==========================================
+ Coverage   53.68%   53.82%   +0.13%     
==========================================
  Files          80       80              
  Lines       12901    12876      -25     
==========================================
+ Hits         6926     6930       +4     
+ Misses       5032     5013      -19     
+ Partials      943      933      -10     
Impacted Files Coverage Δ
settlement/settlement.go 0.00% <ø> (ø)
testutil/mocks.go 100.00% <ø> (ø)
block/manager.go 72.01% <25.00%> (+0.78%) ⬆️
settlement/dymension/dymension.go 19.21% <36.36%> (-2.09%) ⬇️
state/executor.go 77.84% <62.50%> (+1.32%) ⬆️
conv/config.go 62.50% <65.21%> (+15.44%) ⬆️
settlement/mock/mock.go 67.56% <68.75%> (-1.59%) ⬇️
config/config.go 100.00% <100.00%> (+8.82%) ⬆️
conv/addr.go 100.00% <100.00%> (ø)
node/node.go 67.59% <100.00%> (ø)
... and 3 more

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mtsitrin mtsitrin marked this pull request as ready for review May 21, 2023 12:34
@mtsitrin mtsitrin requested a review from a team as a code owner May 21, 2023 12:34
@mtsitrin mtsitrin requested a review from omritoptix May 21, 2023 12:34
@@ -12,14 +12,18 @@ import (
func TestGetNodeConfig(t *testing.T) {
t.Parallel()

validCosmos := "127.0.0.1:1234"
validOptimint := "/ip4/127.0.0.1/tcp/1234"
Copy link
Contributor

Choose a reason for hiding this comment

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

optimint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

copied it from conv/addr_test.go

config/config.go Outdated Show resolved Hide resolved
func NewBlockExecutor(proposerAddress []byte, namespaceID string, chainID string, mempool mempool.Mempool, proxyApp proxy.AppConns, eventBus *tmtypes.EventBus, logger log.Logger) *BlockExecutor {
bytes, err := hex.DecodeString(namespaceID)
if err != nil {
panic(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

is the error for the rollapp operator indicative in case a wrong string is supplied?

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 add some logging

// Config for the DymensionLayerClient
type Config struct {
KeyringBackend cosmosaccount.KeyringBackend `json:"keyring_backend"`
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you remove KeyringBackend?

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 only support test for the sequencer
no reason to expose it as a configuration parameter if it's not supported

Copy link
Contributor

Choose a reason for hiding this comment

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

are you sure? In the cosmosclient we init I see this keyring backends supported:

type KeyringBackend string

const (
	// KeyringTest is the test keyring backend. With this backend, your keys will be
	// stored under your app's data dir,
	KeyringTest KeyringBackend = "test"

	// KeyringOS is the OS keyring backend. with this backend, your keys will be
	// stored in your operating system's secured keyring.
	KeyringOS KeyringBackend = "os"

	// KeyringMemory is in memory keyring backend, your keys will be stored in application memory.
	KeyringMemory KeyringBackend = "memory"
)

either way we'll for sure need to support more keyring backends in the near future (specifically ledger) so not sure what's the motivation for removing 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.

yeah but the sequencer can't use anything else as it will request signing approval for each submission.
anyway I leave it in the configuration

omritoptix
omritoptix previously approved these changes May 23, 2023
…-dymint-config-to-support-loading-configuration-from-file
@mtsitrin mtsitrin merged commit b59ca6f into main May 30, 2023
@mtsitrin mtsitrin deleted the mtsitrin/325-refactor-dymint-config-to-support-loading-configuration-from-file branch May 30, 2023 08:12
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.

refactor dymint config to support loading configuration from file
2 participants