-
Notifications
You must be signed in to change notification settings - Fork 396
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: add initial txfees logic #3956
base: master
Are you sure you want to change the base?
Conversation
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! |
genesis.VM.RealmParams = append(genesis.VM.RealmParams, tsGenesis.VM.RealmParams...) | ||
genesis.Auth.Params.FeeCollector = tsGenesis.Auth.Params.FeeCollector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should be able to set all the parameter values here, but the genesis toml file should then contain all the default values for the Auth
module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the more default values you can set in the genesis_params.toml file (with comments), the better. it's doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I like having this genesis_params
as the source of truth for gno.land
params. Should we apply them with a right merge? It would be better to have the file override the default values set in params.go
files instead of having the file replace all the values, even empty one.
output += "# Fee Coinbase\n" | ||
output += "Balance: " + balance + "\n\n" | ||
|
||
// XXX: Get the actual param value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can't; is the info really useful? if yes, we can import a contract a get the value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
I simply want to show current fee collector address.
There is no way right now to get params values from the gno files perspective.
we can't; is the info really useful?
I think it can be useful; if updated, there is no easy and straightforward way from a user perspective to get this info (except with gnokey
, which is not something I would call user-friendly).
if yes, we can import a contract a get the value.
wdym? If you mean setting the value while updating the param, I'm not a big fan of this idea because we cannot get the initial value of the param, and in specific, this context, the initial value can stay there for a while.
@@ -12,6 +12,9 @@ | |||
# TODO: chain_tz = "UTC" | |||
# TODO: default_storage_allowance = "" | |||
|
|||
["auth"] | |||
fee_collector = "g1najfm5t7dr4f2m38cg55xt6gh2lxsk92tgh0xy" # "gno.land/r/sys/txfees" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should set this in the auth/params.go
, this file (genesis_params.toml
) is just for filetests (testing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I think the choice for the coinbase in auth is alright for now 👍
cc @moul
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should set this in the auth/params.go, this file (genesis_params.toml) is just for filetests (testing)
hmmm, that's a bit confusing. Maybe we should rename it then? But it made sense to have this file living in gno.land
, setting all default parameter values for gno.land. For example, setting FeeCollector to sys/txfees
is something only gno.land should be aware of, so it makes sense to have this file describing the default values of gno.land Params. (see my other comments)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auth/params.go
is where you define the module's suggested default values for the chain it will run on.
genesis_params.toml
is not intended for file tests; rather, it customizes the blockchain genesis for the gno.land chain. It may seem counterintuitive to have two default values. However:
- The values in
*/params.go
andgenesis_params.toml
can differ. For example, we might expect most tm2 chains to have a block time of 8 seconds, but we may want gno.land-based chains to have a shorter default block time. - The
genesis_params.toml
file in the monorepo acts as documentation, similar to the Tendermint default configuration file, which is filled with comments. This file usually contains default values that can be skipped but makes it easier for users to update a value without searching for a key.
Please specify in both locations.
tm2/pkg/sdk/auth/keeper.go
Outdated
func (ak AccountKeeper) FeeCollectorAddress(ctx sdk.Context) crypto.Address { | ||
feeCollector := ak.GetParams(ctx).FeeCollector | ||
if feeCollector.IsZero() { | ||
feeCollector = crypto.AddressFromPreimage([]byte(DefaultFeeCollectorName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just panic if there is no fee collector. Your current implementation isn't caching the case of IsZero. Let's explicitly panic so that blockchain builders can define something custom or just keep the default value, which should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with panicing, but I'm concerned about the fact that NewAccountKeeper
doesn't initialize DefaultParam
, which means that by default, calling FeeCollectorAddress
on a fresh account keeper from NewAccountKeeper
will panic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be heading in a good direction. Please continue and let me know when you're finished.
(blocking so i can review)
address: #3782
This PR implements the foundation for transaction fee logic. Notably, it:
FeeCollector
parameter to theauth
module and a proposal function to update it.I'm unsure about the placement/name, but the proposal I made made sense to me based on the actual context of the Account Keeper and the placeholder for the fee collector.
NOTE: It was my first time using Params. It wasn't immediately clear where to set the initial value, and it seems that multiple sources of truth exist for some parameters. It seems a bit fastidious to add a new Param to the Params module. However, I assume modules are still missing or not implemented yet.