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

Consolidate Duplicate Server appConfig and Config Structure #391

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aruokhai
Copy link

@aruokhai aruokhai commented Dec 2, 2024

Objective

A duplicate configuration struct in the Server directory complicates coordination. By consolidating it into a single Config structure, the configuration flow becomes more streamlined and efficient.

Scope

Non-critical, as it only affects Config parsing and usage.

closes #390

Copy link
Collaborator

@louisinger louisinger left a comment

Choose a reason for hiding this comment

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

Beside FromConfig, LGTM, thanks for the contribution 🙏

cc @altafan

common/bip68.go Outdated Show resolved Hide resolved
@aruokhai aruokhai force-pushed the consolidate-server-conf branch from 3f8b261 to e3809b8 Compare December 5, 2024 10:10
server/internal/config/config.go Show resolved Hide resolved
server/internal/config/config.go Show resolved Hide resolved
server/internal/config/config.go Show resolved Hide resolved
@tiero
Copy link
Member

tiero commented Dec 12, 2024

Please merge master in your branch, @bordalix should have been addressed already

@aruokhai aruokhai force-pushed the consolidate-server-conf branch from e3809b8 to a922e41 Compare December 13, 2024 09:20
}
}

if c.UnilateralExitDelay.Type == common.LocktimeTypeBlock {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry guys, but I must insist on this.

If you look at code, and you pass to config a UnilateralExitDelay of 666, from func DetermineLocktimeType() the c.UnilateralExitDelay.Type will be common.LocktimeTypeBlock so Validate() will always throw here.

This means we will never be able to pass a value >= 512 to UnilateralExitDelay.

Am I wrong?

Copy link
Collaborator

Choose a reason for hiding this comment

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

no if you pass 666, it will be read as common.LocktimeTypeSecond.

That's the expected behaviour. We don't have a flag to signal what type of lockime we want to use, so we are using the value itself:

  • if < 512 = we admit it's a "block number" locktime
  • if > 512 = we admit it's a "second" locktime

)
}

if c.BoardingExitDelay.Type == common.LocktimeTypeBlock {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, but with BoardingExitDelay

@@ -216,3 +272,343 @@ func getNetwork() (common.Network, error) {
return common.Network{}, fmt.Errorf("unknown network %s", viper.GetString(Network))
}
}

func DetermineLocktimeType(locktime int64) common.Locktime {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
func DetermineLocktimeType(locktime int64) common.Locktime {
func determineLocktimeType(locktime int64) common.Locktime {

no need to be exported, right ? cc @altafan

@aruokhai aruokhai force-pushed the consolidate-server-conf branch from a922e41 to 644a654 Compare December 20, 2024 09:09
@aruokhai aruokhai force-pushed the consolidate-server-conf branch from 644a654 to 4657e95 Compare December 20, 2024 09:57
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.

Merge app-config and config packages
5 participants