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

Remove Static Fee Config #3610

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Remove Static Fee Config #3610

wants to merge 30 commits into from

Conversation

samliok
Copy link
Contributor

@samliok samliok commented Dec 18, 2024

Why this should be merged

After the Etna update there is no longer use for the staticFeeConfig as well as the static fee calculator. This PR removes these structs as well as cleans up the surrounding tests and configs.

How this works

How this was tested

CI/CD

Need to be documented in RELEASES.md?

Yes

@samliok samliok self-assigned this Dec 18, 2024
@samliok samliok marked this pull request as draft December 18, 2024 19:13
@samliok samliok marked this pull request as ready for review December 18, 2024 23:04
@samliok samliok mentioned this pull request Dec 19, 2024
@samliok samliok linked an issue Dec 19, 2024 that may be closed by this pull request
config/config.go Outdated Show resolved Hide resolved
vms/avm/client.go Outdated Show resolved Hide resolved
vms/platformvm/config/internal.go Outdated Show resolved Hide resolved
vms/platformvm/txs/fee/static_config.go Outdated Show resolved Hide resolved
wallet/chain/p/builder/builder.go Outdated Show resolved Hide resolved
wallet/chain/p/builder/context.go Outdated Show resolved Hide resolved
config/flags.go Show resolved Hide resolved
vms/platformvm/txs/executor/import_test.go Outdated Show resolved Hide resolved
@@ -477,81 +442,6 @@ func TestExportTx(t *testing.T) {
}
}

func TestTransformSubnetTx(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are removing this test - should we also be removing NewTransformSubnetTx entirely? It feels odd to keep that function around but not to have any tests for 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 agree, could this be done in a follow up? there seems to be a lot of references to TransformSubnetTx

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that's a reasonable followup

vms/platformvm/txs/fee/calculator_test.go Outdated Show resolved Hide resolved
Comment on lines 1735 to 1784
{
name: "valid tx",
newExecutor: func(ctrl *gomock.Controller) (*txs.RemoveSubnetValidatorTx, *standardTxExecutor) {
env := newValidRemoveSubnetValidatorTxVerifyEnv(t, ctrl)

// Set dependency expectations.
env.state.EXPECT().GetTimestamp().Return(env.latestForkTime).AnyTimes()
env.state.EXPECT().GetCurrentValidator(env.unsignedTx.Subnet, env.unsignedTx.NodeID).Return(env.staker, nil).Times(1)
subnetOwner := fxmock.NewOwner(ctrl)
env.state.EXPECT().GetSubnetOwner(env.unsignedTx.Subnet).Return(subnetOwner, nil).Times(1)
env.fx.EXPECT().VerifyPermission(env.unsignedTx, env.unsignedTx.SubnetAuth, env.tx.Creds[len(env.tx.Creds)-1], subnetOwner).Return(nil).Times(1)
env.flowChecker.EXPECT().VerifySpend(
env.unsignedTx, env.state, env.unsignedTx.Ins, env.unsignedTx.Outs, env.tx.Creds[:len(env.tx.Creds)-1], gomock.Any(),
).Return(nil).Times(1)
env.state.EXPECT().DeleteCurrentValidator(env.staker)
env.state.EXPECT().DeleteUTXO(gomock.Any()).Times(len(env.unsignedTx.Ins))
env.state.EXPECT().AddUTXO(gomock.Any()).Times(len(env.unsignedTx.Outs))

// This isn't actually called, but is added here as a regression
// test to ensure that converted subnets can still remove
// permissioned validators.
env.state.EXPECT().GetSubnetToL1Conversion(env.unsignedTx.Subnet).Return(
state.SubnetToL1Conversion{
ConversionID: ids.GenerateTestID(),
ChainID: ids.GenerateTestID(),
Addr: []byte("address"),
},
nil,
).AnyTimes()

cfg := &config.Internal{
UpgradeConfig: upgradetest.GetConfigWithUpgradeTime(upgradetest.Etna, env.latestForkTime),
}
feeCalculator := state.NewStaticFeeCalculator(cfg, env.state.GetTimestamp())
e := &standardTxExecutor{
backend: &Backend{
Config: cfg,
Bootstrapped: utils.NewAtomic(true),
Fx: env.fx,
FlowChecker: env.flowChecker,
Ctx: &snow.Context{},
},
feeCalculator: feeCalculator,
tx: env.tx,
state: env.state,
}
return env.unsignedTx, e
},
expectedErr: nil,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this still be able to be tested? (valid transactions)

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.

update GetTxFee endpoint in service.go
3 participants