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

P-chain: updating wallet to use dynamic fee calculator #3189

Closed
wants to merge 4 commits into from

Conversation

abi87
Copy link
Contributor

@abi87 abi87 commented Jul 15, 2024

Why this should be merged

Splitting introduction of dynamic fees into 4 PRs:

How this works

  • Updated platforvm API to serve dynamic fees related stuff (config and gas cap)
  • Updated wallet to use dynamic fee calculator when needed
  • Updated UTs to use the new wallet interface (explicitly pass fee calculator)

How this was tested

Extra UTs. All new code is not wired in yet. Will be done in a sequent PR

@abi87 abi87 self-assigned this Jul 15, 2024
@abi87 abi87 changed the title P-chain: update wallet P-chain: updated wallet to use dynamic fee calculator Jul 15, 2024
@abi87 abi87 changed the title P-chain: updated wallet to use dynamic fee calculator P-chain: updating wallet to use dynamic fee calculator Jul 15, 2024
@abi87 abi87 marked this pull request as ready for review July 15, 2024 10:35
@abi87 abi87 mentioned this pull request Jul 17, 2024
5 tasks
Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

overall looks good. few small comments.

@@ -252,7 +255,11 @@ func newEnvironment(t *testing.T, ctrl *gomock.Controller, f fork) *environment
}

func addSubnet(env *environment) {
builder, signer := env.factory.NewWallet(preFundedKeys[0])
builder, signer, feeCalc, err := env.factory.NewWallet(preFundedKeys[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add the t *testing.T to the addSubnet instead of panic'ing ?

}

// GetNextFeeRates returns the next fee rates that a transaction must pay to be accepted now
func (s *Service) GetDynamicFeeConfig(_ *http.Request, _ *struct{}, reply *DynamicFeesConfigReply) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

The method, as implemented, makes me feel a bit uncomfortable. The reply is being used in some cases, but not in others, and the caller is expected to deduce that by examining the error code. In addition, the caller is expected to provide a valid reply pointer, or the method might (sometimes) panic.

I know that this aligns with the existing calling convension in this file, and was wondering if there is a good reason for that. In particular, I would that written it as

func (s *Service) GetDynamicFeeConfig(_ *http.Request, _ *struct{}) (reply *DynamicFeesConfigReply, err error) 

since that would have the convention that the err and the reply are mutually exclusive.

@StephenButtolph
Copy link
Contributor

This has been refactored into #3232 and #3286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants