-
Notifications
You must be signed in to change notification settings - Fork 13
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
Alloy Transmuter Support #245
Conversation
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 did a quick skim without any deep review for now. Looks like everything is going well and on the right track. Great 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.
Great work! Left some comments
Also, would be great to document somewhere the logic around how |
@iboss-ptk, please ping me once ready for another round of 👀 |
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 already looks good to me. Nice work!
However, I would like to run the tests before approving. Will come back to this.
Btw please make PRs from this repo directly (not fork) - it would simplify the review process in the future.
I will add you to the repo
config.json
Outdated
] | ||
], | ||
"is-alloyed-transmuter-enabled": true |
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 please update the following and merge them before this PR is merged?
Configs:
- https://github.com/osmosis-labs/infrastructure/blob/main/environments/sqs-osmosis-zone/environments/stage/ansible/vars/sqs.yaml
- https://github.com/osmosis-labs/infrastructure/blob/main/environments/sqs-osmosis-zone/environments/prod/ansible/vars/sqs.yaml
- https://github.com/osmosis-labs/infrastructure/blob/main/environments/sqs-osmosis-zone/environments/testnet/ansible/vars/sqs.yaml
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 can't access infrastructure
repo
sqsdomain/cw_pool.go
Outdated
} | ||
|
||
func (model *CosmWasmPoolModel) IsAlloyTransmuter() bool { | ||
return model.ContractInfo.Matches("crates.io:transmuter", "3.0.0") |
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 if the contract is migrated? We would then require code updates and redeployment?
Please consider removing this hard-coded dependency here and on the node side.
The current code ID model allows us to simply update the config without performing any code changes
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 consider going back to the code ID config when determining if a pool is an alloy transmuter within SQS.
To achieve this on the Osmosis node side, we can continue utilizing the CW info but only match the name e.g. crates.io:transmuter-alloy
(no version). This way, if the version is updated, it will still be auto-propagated from Osmosis node. However, give SQS the flexibility of handling it via standard means.
The proposed code ID approach would ensure compatibility with how other cw pool types are handled while also allowing the flexibility of only updating configs without code changes if migration is done.
With the current approach, we still need a boolean config but also hardcode the version here which I think is suboptimal for operations.
Please let me know what you think
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.
noted
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.
but then, this logic required on the ingester side, do we also have config on that side, I didn't see any. If there is any update required, both side needs to be effected.
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 think versions are more reliable than code ids due to it's characteristics that it does not change from env to env. That's why I think it's ok to hard code it and have it defined once (in sqs repo). Even though the contract gets migrated and it requires no change on sqs. It will still work. These infos are bound to conversion logic anyway.
For versioning matching, we can use semver matching to check on which pool version we are operating on as well to increase range of compatability. For example, for alloy transmuter it can be ">=3.0.0" for now.
Other cosmwasmpool can also adopt this approach (I didn't update then in this PR since I would love to push this out earlier to test it with USDT alloyed, it requires a bit more regression testing).
Bottom line is that, we can't avoid code changes if the logics for calculating token out changes. We can be lax on the config (eg. ">=3.0.0" and no restriction on the upper bound) until there is a version that requires new calculation. We can have sqs disregard newer versions via config if that's a desired property of the system to control incompatible pool type to not get calculated.
On another point, "matching name only" does not work well IMO. Since there might be changes in the pool transformation logic in the future version, which means we have to change contract name again.
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.
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 think that we should discuss this decision via a separate ADR to avoid blocking this line of work.
I would like to avoid merging partial progress with a new paradigm that has trade-offs. If we want to change how CW pools are handled, let's aim to change this for all pools at once rather than introducing custom handling for the alloyed pool but keeping everything else via code IDs.
What I would like to avoid is us never coming back to this and then having to deal with operational challenges stemming from the custom logic.
In terms of versions, I don't understand why we need to track these hard-coded versions in general when contract names should suffice. We should establish a rule that all future versions of a cw pool model struct transferred between node and sqs are backward compatible. This removes the need for version matching on the node side, removing the need to either have a config (node-side) or hard code it in sqsdomain
.
I'm supportive of using versions in the SQS config rather than hardcoding. But again, I propose making that decision in a separate ADR and/or issue to avoid overly long debates on the otherwise complete work here.
Again, my main counter-argument to the proposed change in this PR is the following:
- Operational challenges stemming from hardcoding versions on both osmosis and sqs side
- Applying an operational change to one cw pool only, causing inconsistencies in handling
- The trade-offs are not fully analyzed before making a change that impacts service operations
However, I think that we should explore the version idea in SQS configs in general. That is an interesting proposal.
@iboss-ptk please let me know what you think
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.
Fair point on consistency.
I will revert back the config to code ids and and have a separated ADR for versioning we discussed to unblock things. That being said. Since old transmuter is not forward compatible, it still need minimum version >=3.0.0
hardcoded. Because even though it is a non-issue on the sqs side in case there is no minimum version in place, ingester needs this information to do pool transformation properly as old transmuter does not have those queries we use for v3.0.0.
And current transmuter v3 on mainnet is already crates.io:transmuter
v3.0.0
so this can't be changed to crates.io:transmuter-alloy
unless having a migration (and I don't think that make much sense anyway since it is still a newer version of the same thing).
To summarize:
- I don't think we can get rid of any hardcoded version except making more lax and keep backward compatibility. Which might or might not make sense depending on
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.
Thanks
Per this comment, the latest solution is more extensible.
If we keep it as a convention that all alloyed transmuters stay within the same major version and add a relevant semver constraint (<4.0.0
), we solve all future extensibility problems.
In the original approach, due to semver being hardcoded directly, we would have to make code changes and dependency updates to all of sqsdomain
, osmosis
and sqs
if a migration was done.
Now, migrations within the same major are auto-accounted for
name := "crates.io:transmuter" | ||
version := ">= 3.0.0" | ||
|
||
constraints, err := semver.NewConstraint(version) | ||
// this must never panic | ||
if err != nil { | ||
panic(err) | ||
} | ||
return model.ContractInfo.Matches(name, constraints) |
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 like this approach. It is now extensible without having to make code changes to both, the osmosis
node side and sqs
for minor migrations.
Can we also add constraint of semver being less than <4.0.0 so that, if there are any future versions, those are auto-accounted for without more code changes?
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.
At least for now that I'm aware of, 4.0.0 will still be compatible, so I would avoid constraining that if you don't want code change. Until there is a version the requires changes in logic, I think leave this lax constraints would be easier to operate.
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 think we should have a standard where a separate major means a breaking change.
If 4.0.0
is compatible, can it be 3.1.0
instead?
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's breaking other parts. For 4.0.0 we are planning to remove some entrypoints, putting more constraints on denom, but just does not effect sqs.
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.
Got it, let's leave it as is. Thank you!
@@ -0,0 +1,46 @@ | |||
# CosmWasm Pools |
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.
Do you mind adding a paragraph about semver and the general new version handling we arrived at with the cw pools? For example, "alloyed transmuter versions are expected to exist within the same major version i.e >=3.0.0 and <4.0.0"
@iboss-ptk thanks for addressing all operational concerns. Great work. I pre-approved the PR but the following things remain:
|
CosmWasmPoolModel
with information queried from contract to sqssqs tag for these changes block osmosis-labs/osmosis#8291