-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Tokenomics] Harden settlement (part 1: TLM isolation) #889
base: main
Are you sure you want to change the base?
Conversation
The CI will now also run the e2e tests on devnet, which increases the time it takes to complete all CI checks. You may need to run GCP workloads (requires changing the namespace to 889) |
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.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
linter-name (fail-on-found)
x/tokenomics/token_logic_module/result.go|76 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|88 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|93 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|98 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|103 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|108 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|113 col 4| // TODO_IN_THIS_COMMIT: godoc... use for determinstic loops
x/tokenomics/token_logic_module/result.go|118 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|123 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|128 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|133 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|138 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|152 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|166 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|172 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|180 col 4| // TODO_IN_THIS_COMMIT: godoc...
x/tokenomics/token_logic_module/result.go|188 col 4| // TODO_IN_THIS_COMMIT: godoc... use for determinstic loops
x/tokenomics/token_logic_module/result.go|196 col 4| // TODO_IN_THIS_COMMIT: godoc... // SHOULD NEVER be used for loops
x/tokenomics/token_logic_module/result.go|213 col 4| // TODO_IN_THIS_COMMIT: godoc... // SHOULD NEVER be used for loops
2df9645
to
77a3944
Compare
3731434
to
65c9499
Compare
- Isolate TLM processors from the tokenomics keeper - Restructure TLM processors to avoid non-deterministic execution - Consolidate and postpone ALL state modification until the end of settlement
d5eb029
to
24ceb12
Compare
tests/integration/tokenomics/token_logic_modules/commutative_test.go
Outdated
Show resolved
Hide resolved
tests/integration/tokenomics/token_logic_modules/commutative_test.go
Outdated
Show resolved
Hide resolved
tests/integration/tokenomics/token_logic_modules/commutative_test.go
Outdated
Show resolved
Hide resolved
tests/integration/tokenomics/token_logic_modules/commutative_test.go
Outdated
Show resolved
Hide resolved
tests/integration/tokenomics/token_logic_modules/tlm_processor_suite_test.go
Outdated
Show resolved
Hide resolved
tests/integration/tokenomics/token_logic_modules/tlm_processor_suite_test.go
Outdated
Show resolved
Hide resolved
tests/integration/tokenomics/token_logic_modules/tlm_processor_suite_test.go
Outdated
Show resolved
Hide resolved
tests/integration/tokenomics/token_logic_modules/tlm_processor_suite_test.go
Outdated
Show resolved
Hide resolved
tests/integration/tokenomics/token_logic_modules/tlm_processor_suite_test.go
Outdated
Show resolved
Hide resolved
tests/integration/tokenomics/token_logic_modules/tlm_processor_suite_test.go
Outdated
Show resolved
Hide resolved
ace0637
to
67777cc
Compare
Log entire |
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
14297015 | Triggered | Generic High Entropy Secret | aecfe41 | testutil/testclient/localnet.go | View secret |
12819930 | Triggered | Generic Password | 3187418 | localnet/kubernetes/observability-prometheus-stack.yaml | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
…tlement # By Redouane Lakrache (3) and others # Via GitHub * pokt/main: [Observability] Foundation for load testing telemetry (#832) [Tokenomics] Implement Global Mint Reimbursement Request (#878) [Docs] Assign owners to all `TODO_BETA` (#898) [Supplier] Add supplier staking fee (#883) [Application] Single Service Applications (#886) # Conflicts: # testutil/keeper/tokenomics.go # x/tokenomics/keeper/settle_pending_claims.go # x/tokenomics/keeper/token_logic_modules.go # x/tokenomics/keeper/token_logic_modules_test.go # x/tokenomics/module/abci.go # x/tokenomics/types/errors.go
The CI will now also run the e2e tests on devnet, which increases the time it takes to complete all CI checks. You may need to run GCP workloads (requires changing the namespace to 889) |
The image is going to be pushed after the next commit. You can use If you also want to run E2E tests, please add |
# This is the address that will receive the dao/foundation rewards during claim settlement (global mint TLM). | ||
# DEV_NOTE: This is a temporary solution which allows us to configure the dao reward address between networks | ||
# (e.g. localnet, testnet, etc.) | ||
# TODO_TECHDEBT: Make this a tokenomics module parameter. |
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.
This is pretty important and I'd rather do it sooner rather than later.
Would prefer that we add a PR (before this) and avoid this TECHDEBT altogether. Wouldn't that be easier/faster/cleaner?
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.
- How long would you say it takes you to add a new param right now?
- Do you think there's a way (a need?) to streamline/automate [1] in some way?
[1] https://dev.poktroll.com/develop/developer_guide/adding_params?_highlight=para
@@ -1,6 +1,13 @@ | |||
version: 1 | |||
build: | |||
main: cmd/poktrolld | |||
ldflags: | |||
# The dao reward address SHOULD match that of the "pnf" below (i.e. `make poktrolld_addr ACC_NAME=pnf`). |
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.
Why is this a SHOULD and not a MUST?
@@ -4,6 +4,15 @@ import ( | |||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" | |||
) | |||
|
|||
// DaoRewardAddress is the address that will receive the dao/foundation rewards | |||
// during claim settlement (global mint TLM). It is intended to be assigned via | |||
// -ldflags="-X github.com/pokt-network/poktroll/app.FoundationRewardAddress=<foundation_address>" |
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.
In config.yaml
, the name is DaoRewardAddress
and here its FoundationRewardAddress
.
Per my other comment, I would like to avoid merging this flag-based approach to main altogether.
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.
Really great work @bryanchriswhite!
My comments/messages are terse but I tried to go through the whole PR.
Overall, it's VERY clean. VERY easy to read. VERY well organized.
I honestly see no blockers and most of my comments are just minor NITS & comment improvements.
Again, very well designed 🔥
@@ -0,0 +1,5 @@ | |||
package token_logic_modules | |||
|
|||
// TODO_TEST(@bryanchriswhite): Settlement proceeds in the face of errors |
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.
- Please create tests w/ a skip inside of them (cleaner)
- Please add more details/steps on what you intended to test (it'll help you not to forget how to implement the test later)
# This is the address that will receive the dao/foundation rewards during claim settlement (global mint TLM). | ||
# DEV_NOTE: This is a temporary solution which allows us to configure the dao reward address between networks | ||
# (e.g. localnet, testnet, etc.) | ||
# TODO_TECHDEBT: Make this a tokenomics module parameter. |
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.
Use TODO_TECHDEBT only when it's like a post mainnet and doesn't have a timeline sort of thing.
// TokenomicsKeepersOpt is a function which receives and potentially modifies the context | ||
// and tokenomics keepers during construction of the aggregation. | ||
type TokenomicsModuleKeepersOpt func(context.Context, *TokenomicsModuleKeepers) context.Context | ||
// tokenomicsModuleKeepersConfig is a configuration struct for a TokenomicsModuleKeepers |
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.
Can you add test in the naming of all of these so its explicit its not for core business logic in prod?
} | ||
} | ||
|
||
func WithTLMProcessors(processors []tlm.TokenLogicModule) TokenomicsModuleKeepersOptFn { |
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.
godoc
@@ -38,6 +39,9 @@ var ( | |||
func init() { | |||
cmd.InitSDKConfig() | |||
|
|||
// TODO_TECHDEBT: Remove once the DAO reward address is promoted to a tokenomics module param. |
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.
TODO_IN_THIS or PRIOR TO THIS
} | ||
|
||
// The test description is a unique identifier for each permutation. | ||
// E.g.: "permutaiton_1_of_2__TLMRelayBurnEqualsMint_TLMGlobalMint" |
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.
Thoughts on something like this?
// E.g.: "permutaiton_1_of_2__TLMRelayBurnEqualsMint_TLMGlobalMint" | |
// E.g.: "permutaiton_1_of_2:TLMRelayBurnEqualsMint_TLMGlobalMint" |
s.createClaims(&s.keepers, 1000) | ||
settledResults, expiredResults := s.settleClaims(t) | ||
|
||
// Set the expected state based on the effects of the first iteration; |
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.
// Set the expected state based on the effects of the first iteration; | |
// First iteration only. | |
// Set the expected state based on the effects of the first iteration. |
settledResults, expiredResults := s.settleClaims(t) | ||
|
||
// Set the expected state based on the effects of the first iteration; | ||
// this decouples the assertions from any specific tlm effects. |
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.
Thoughts on actually having a function to assert on a results to make sure we don't assert on (for example) 0=0
everywhere?
keeper.WithApplication(*s.app), | ||
keeper.WithSupplier(*s.supplier), | ||
keeper.WithModuleParams(map[string]types.Msg{ | ||
// TODO_TECHDEBT: Set tokenomics mint allocation params to maximize coverage, once available. |
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.
TODO_BETA?
// assertExpectedSettlementState asserts that the current network state matches the | ||
// expected settlement state, and that actualSettledResults and actualExpiredResults | ||
// match their corresponding expectations. | ||
func (s *tlmProcessorTestSuite) assertExpectedSettlementState( |
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.
Is there any way to update the test such that we moe forward one (or two) more sessions and confirm the state/balances are unchanged (since there are no new claims).
This is likely a different test, but just want to sanity checks the session start/end edge case + lingering claims.
Summary
Refactors claim settlement and token logic module processing:
Issue
Type of change
Select one or more from the following:
consensus-breaking
label if so. See [Infra] Automatically add theconsensus-breaking
label #791 for detailsTesting
make docusaurus_start
; only needed if you make doc changesmake go_develop_and_test
make test_e2e
devnet-test-e2e
label to the PR.Sanity Checklist