Skip to content

Commit

Permalink
Merge pull request #15 from push-protocol/audit/issue-4
Browse files Browse the repository at this point in the history
Audit Issue4: use dynamic chainId in verifyChannelAlias
  • Loading branch information
0xNilesh authored Nov 20, 2024
2 parents e05c197 + 950a276 commit 9066f89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pub trait IPushComm<TContractState> {
self: @TContractState, channel: ContractAddress, user: ContractAddress
) -> bool;
fn users_count(self: @TContractState) -> u256;
fn chain_id(self: @TContractState) -> felt252;
fn chain_name(self: @TContractState) -> felt252;
fn push_token_address(self: @TContractState) -> ContractAddress;
fn push_governance_address(self: @TContractState) -> ContractAddress;
Expand Down
11 changes: 2 additions & 9 deletions src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ pub mod PushComm {
push_token_address: ContractAddress,
// Chain Info
chain_name: felt252,
chain_id: felt252,
}

#[starknet::storage_node]
Expand Down Expand Up @@ -157,10 +156,7 @@ pub mod PushComm {
push_governance: ContractAddress,
chain_name: felt252
) {
let chain_id = get_execution_info().unbox().tx_info.unbox().chain_id;

self.ownable.initializer(owner);
self.chain_id.write(chain_id);
self.chain_name.write(chain_name);
self.governance.write(push_governance);
}
Expand Down Expand Up @@ -335,11 +331,12 @@ pub mod PushComm {

// Channel
fn verify_channel_alias(ref self: ContractState, channel_address: EthAddress) {
let chain_id = get_execution_info().unbox().tx_info.unbox().chain_id;
self
.emit(
ChannelAlias {
chain_name: self.chain_name.read(),
chain_id: self.chain_id.read(),
chain_id: chain_id,
channel_owner_address: get_caller_address(),
ethereum_channel_address: channel_address
}
Expand Down Expand Up @@ -395,10 +392,6 @@ pub mod PushComm {
self.users_count.read()
}

fn chain_id(self: @ContractState) -> felt252 {
self.chain_id.read()
}

fn push_governance_address(self: @ContractState) -> ContractAddress {
self.governance.read()
}
Expand Down

0 comments on commit 9066f89

Please sign in to comment.