Skip to content

Commit

Permalink
feat(gateway): add permission control to gateway (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgorenflo authored Jul 16, 2024
1 parent 5152aec commit 9c7990b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions contracts/gateway/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub fn execute(
info: MessageInfo,
msg: ExecuteMsg,
) -> Result<Response, axelar_wasm_std::ContractError> {
let msg = msg.ensure_permissions(deps.storage, &info.sender)?;
Ok(internal::execute(deps, env, info, msg)?)
}

Expand Down
4 changes: 4 additions & 0 deletions packages/gateway-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
axelar-wasm-std = { workspace = true }
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
error-stack = { workspace = true }
msgs-derive = { workspace = true }
router-api = { workspace = true }

[lints]
Expand Down
6 changes: 4 additions & 2 deletions packages/gateway-api/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
use cosmwasm_schema::{cw_serde, QueryResponses};
use msgs_derive::EnsurePermissions;
use router_api::{CrossChainId, Message};

#[cw_serde]
#[derive(EnsurePermissions)]
pub enum ExecuteMsg {
// Permissionless
/// Before messages that are unknown to the system can be routed, they need to be verified.
/// Use this call to trigger verification for any of the given messages that is still unverified.
#[permission(Any)]
VerifyMessages(Vec<Message>),

// Permissionless
/// Forward the given messages to the next step of the routing layer. If these messages are coming in from an external chain,
/// they have to be verified first.
#[permission(Any)]
RouteMessages(Vec<Message>),
}

Expand Down

0 comments on commit 9c7990b

Please sign in to comment.