Skip to content
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

[OP] chore: remove unused activated_height #77

Merged
merged 1 commit into from
Oct 5, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions contracts/op-finality-gadget/schema/op-finality-gadget.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@
"title": "InstantiateMsg",
"type": "object",
"required": [
"activated_height",
"admin",
"consumer_id",
"is_enabled"
],
"properties": {
"activated_height": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"admin": {
"type": "string"
},
Expand Down Expand Up @@ -374,15 +368,9 @@
"description": "Config are OP finality gadget's configuration",
"type": "object",
"required": [
"activated_height",
"consumer_id"
],
"properties": {
"activated_height": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"consumer_id": {
"type": "string"
}
Expand Down
6 changes: 0 additions & 6 deletions contracts/op-finality-gadget/schema/raw/instantiate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@
"title": "InstantiateMsg",
"type": "object",
"required": [
"activated_height",
"admin",
"consumer_id",
"is_enabled"
],
"properties": {
"activated_height": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"admin": {
"type": "string"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
"description": "Config are OP finality gadget's configuration",
"type": "object",
"required": [
"activated_height",
"consumer_id"
],
"properties": {
"activated_height": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"consumer_id": {
"type": "string"
}
Expand Down
4 changes: 0 additions & 4 deletions contracts/op-finality-gadget/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub fn instantiate(

let config = Config {
consumer_id: msg.consumer_id,
activated_height: msg.activated_height,
};
CONFIG.save(deps.storage, &config)?;

Expand Down Expand Up @@ -117,13 +116,11 @@ pub(crate) mod tests {
let mut deps = mock_dependencies();
let init_admin = deps.api.addr_make(INIT_ADMIN);
let consumer_id = "op".to_string();
let activated_height = 1000;

// Create an InstantiateMsg with admin set to init_admin
let msg = InstantiateMsg {
admin: init_admin.to_string(),
consumer_id,
activated_height,
is_enabled: true,
};

Expand Down Expand Up @@ -153,7 +150,6 @@ pub(crate) mod tests {
let instantiate_msg = InstantiateMsg {
admin: init_admin.to_string(), // Admin provided
consumer_id: "op-stack-l2-11155420".to_string(),
activated_height: 13513311,
is_enabled: true,
};

Expand Down
1 change: 0 additions & 1 deletion contracts/op-finality-gadget/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use babylon_merkle::Proof;
pub struct InstantiateMsg {
pub admin: String,
pub consumer_id: String,
pub activated_height: u64,
pub is_enabled: bool,
}

Expand Down
2 changes: 0 additions & 2 deletions contracts/op-finality-gadget/src/state/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ pub const IS_ENABLED: Item<bool> = Item::new("is_enabled");
#[cw_serde]
pub struct Config {
pub consumer_id: String,
// activated_height is the consumer chain block height at which the finality gadget is activated
pub activated_height: u64,
}
4 changes: 0 additions & 4 deletions contracts/op-finality-gadget/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ fn instantiate_works() {
let msg = InstantiateMsg {
admin: mock_api.addr_make(CREATOR),
consumer_id: "op-stack-l2-11155420".to_string(),
activated_height: 13513311,
is_enabled: false,
};
let info = mock_info(CREATOR, &[]);
Expand All @@ -30,7 +29,6 @@ fn instantiate_works() {
let res: Config =
from_json(query(&mut deps, mock_env(), QueryMsg::Config {}).unwrap()).unwrap();
assert_eq!(msg.consumer_id, res.consumer_id);
assert_eq!(msg.activated_height, res.activated_height);

// Check the admin is properly stored in the state and returned
let res: AdminResponse =
Expand All @@ -51,7 +49,6 @@ fn disable_and_reenable_works() {
let msg = InstantiateMsg {
admin: mock_api.addr_make(CREATOR),
consumer_id: "op-stack-l2-11155420".to_string(),
activated_height: 13513311,
is_enabled: false,
};
let info = mock_info(CREATOR, &[]);
Expand Down Expand Up @@ -111,7 +108,6 @@ fn instantiate_enabled() {
let msg = InstantiateMsg {
admin: mock_api.addr_make(CREATOR),
consumer_id: "op-stack-l2-11155420".to_string(),
activated_height: 13513311,
is_enabled: true,
};
let info = mock_info(CREATOR, &[]);
Expand Down