-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
111 changed files
with
19,250 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[alias] | ||
wasm = "build --release --target wasm32-unknown-unknown" | ||
unit-test = "test --lib" | ||
schema = "run --example schema" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.rs] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
[package] | ||
name = "abstract-manager" | ||
version = { workspace = true } | ||
authors = { workspace = true } | ||
edition = { workspace = true } | ||
description = "Abstract Manager Contract" | ||
license = { workspace = true } | ||
readme = "README.md" | ||
repository = "https://github.com/AbstractSDK/contracts" | ||
|
||
exclude = ["contract.wasm", "hash.txt"] | ||
|
||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[features] | ||
default = ["export"] | ||
export = [] | ||
|
||
|
||
[dependencies] | ||
cosmwasm-std = { workspace = true } | ||
cosmwasm-schema = { workspace = true } | ||
cw-controllers = { workspace = true } | ||
cw-storage-plus = { workspace = true } | ||
cw2 = { workspace = true } | ||
cw20 = { workspace = true } | ||
cw-asset = { workspace = true } | ||
schemars = { workspace = true } | ||
serde = { workspace = true } | ||
thiserror = { workspace = true } | ||
abstract-sdk = { workspace = true } | ||
abstract-core = { workspace = true } | ||
semver = { workspace = true } | ||
cw-semver = { workspace = true } | ||
abstract-macros = { workspace = true } | ||
cw-ownable = { workspace = true } | ||
|
||
[dev-dependencies] | ||
cw20 = { workspace = true } | ||
abstract-interface = { workspace = true } | ||
cw-orch = { workspace = true } | ||
anyhow = { workspace = true } | ||
account-factory = { workspace = true } | ||
ans-host = { workspace = true } | ||
version-control = { workspace = true } | ||
proxy = { workspace = true } | ||
module-factory = { workspace = true } | ||
rstest = { workspace = true } | ||
speculoos = { workspace = true } | ||
abstract-sdk = { workspace = true, features = ["test-utils"] } | ||
abstract-adapter = { workspace = true, features = ["test-utils"] } | ||
abstract-app = { workspace = true, features = ["test-utils"] } | ||
abstract-testing = { workspace = true } | ||
abstract-macros = { workspace = true } | ||
|
||
[profile.release] | ||
rpath = false | ||
lto = true | ||
overflow-checks = true | ||
opt-level = 3 | ||
debug = false | ||
debug-assertions = false | ||
codegen-units = 1 | ||
panic = 'abort' | ||
incremental = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Abstract Manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Abstract Module Versioning | ||
|
||
A document detailing the Abstract module versioning. | ||
|
||
Instead of storing dependencies we store dependents for each module. So if a module A depends on B and C, then B and C will have A as a dependent. | ||
|
||
`DEPENDANTS: Map<ModuleId, Vec<ModuleId>>` | ||
|
||
## Module version dependencies | ||
|
||
Every module (App/Adapter) has a set of dependencies it can declare. The dependencies ensure a couple things: | ||
|
||
- A module can only be installed when it's dependencies are installed. | ||
- A module can not be un-installed as long as some other module depends on it. (entry for the module in the dependants map is not empty) | ||
- A module can not be upgraded if its (possibly also upgraded) dependents don't support the new version. | ||
|
||
## Version requirements | ||
|
||
Version requirements are stored in the module itself and can be queried. | ||
|
||
## Manager Version-Management Flow | ||
|
||
### Installation | ||
|
||
1. Call module factory to add the module. | ||
2. On factory callback, query module dependencies and assert current state passes requirements. | ||
3. Add dependents to dependency store. | ||
|
||
### Migration | ||
|
||
1. Retrieve new version number of module. (if not provided) | ||
2. Load dependents of the to-be-migrated module and assert new version passes dependent requirements. | ||
- Exclude any modules that are being migrated before. This ensures that the migration is not blocked by a module that is being migrated. | ||
3. Migrate all the modules that have applied for a migration. | ||
|
||
Then for each module that was migrated: | ||
|
||
1. Remove self as a dependent when it no longer applies. I.e. the module depended on a module A but no longer does after the migration. | ||
2. Add self as a dependent when it applies. I.e. the module did not depended on a module B but does after the migration. | ||
now what could happen is that the new version of the module | ||
2. Update dependency version. | ||
3. Add dependencies (there might be a new requirement) | ||
|
||
### Uninstall | ||
|
||
1. Load dependents of module and assert it is empty. | ||
2. Query dependencies and remove self as dependent. | ||
3. Uninstall the module. | ||
|
||
## Notes on major releases | ||
|
||
When a new major version of a module is released all the dependent modules should be upgraded first. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use abstract_sdk::core::manager::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; | ||
use cosmwasm_schema::write_api; | ||
|
||
fn main() { | ||
write_api! { | ||
instantiate: InstantiateMsg, | ||
query: QueryMsg, | ||
execute: ExecuteMsg, | ||
migrate: MigrateMsg, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# stable | ||
newline_style = "unix" | ||
hard_tabs = false | ||
tab_spaces = 4 | ||
reorder_imports = true | ||
# imports_granularity = "crate" | ||
# unstable... should we require `rustup run nightly cargo fmt` ? | ||
# or just update the style guide when they are stable? | ||
#fn_single_line = true | ||
#format_code_in_doc_comments = true | ||
#overflow_delimited_expr = true | ||
#reorder_impl_items = true | ||
#struct_field_align_threshold = 20 | ||
#struct_lit_single_line = true | ||
#report_todo = "Always" |
Oops, something went wrong.