8000 Fix: Instantiate 2 address length by SlayerAnsh · Pull Request #467 · andromedaprotocol/andromeda-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Fix: Instantiate 2 address length #467

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

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
8000 Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ andromeda-fungible-tokens = { path = "./packages/andromeda-fungible-tokens", ver
andromeda-finance = { path = "./packages/andromeda-finance", version = "1.0.0" }
andromeda-data-storage = { path = "./packages/andromeda-data-storage", version = "1.0.0" }
andromeda-modules = { path = "./packages/andromeda-modules", version = "1.0.0" }
andromeda-app = { path = "./packages/andromeda-app", version = "1.0.0" }
andromeda-app = { path = "./packages/andromeda-app", version = "1.0.1" }
andromeda-ecosystem = { path = "./packages/andromeda-ecosystem", version = "1.0.0" }
andromeda-testing = { path = "./packages/andromeda-testing", version = "1.0.0" }

Expand Down
2 changes: 1 addition & 1 deletion contracts/app/andromeda-app-contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "andromeda-app-contract"
version = "1.0.0"
version = "1.0.1"
edition = "2021"
rust-version = "1.65.0"

Expand Down
2 changes: 1 addition & 1 deletion packages/andromeda-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "andromeda-app"
version = "1.0.0"
version = "1.0.1"
edition = "2021"
rust-version = "1.65.0"
description = "Utility methods and message definitions for the Andromeda App Contract"
Expand Down
13 changes: 13 additions & 0 deletions packages/andromeda-app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ impl AppComponent {
let creator = api.addr_canonicalize(parent_addr.as_str())?;
let new_addr = instantiate2_address(&checksum, &creator, &salt).unwrap();

// Instantiate 2 impl uses default cannonical address of 32 bytes (SHA 256). But as mentioned here -
// https://github.com/cosmos/cosmos-sdk/blob/v0.45.8/docs/architecture/adr-028-public-key-addresses.md
// chains can use different length for cannonical address, eg, injective uses 20 (eth based).
// Instead of having fallback for each chain we can use parent address, which itself is a contract.
// Slice the default 32 bytes canonical address to size of parent cannonical address

let cannonical_parent_addr = api.addr_canonicalize(parent_addr.as_str())?;
let new_addr = new_addr
.as_slice()
.split_at(cannonical_parent_addr.len())
.0
.into();

Ok(Some(api.addr_humanize(&new_addr)?))
}

Expand Down
2 changes: 1 addition & 1 deletion packages/andromeda-testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ prost = "0.9.0"
anyhow = "1.0.79"

andromeda-non-fungible-tokens = { workspace = true }
andromeda-app = { version = "1.0.0", path = "../andromeda-app" }
andromeda-app = { version = "1.0.1", path = "../andromeda-app" }
andromeda-modules = { version = "1.0.0", path = "../andromeda-modules" }
andromeda-adodb = { version = "1.0.0", path = "../../contracts/os/andromeda-adodb", features = [
"testing",
Expand Down
Loading
0