Skip to content

Commit 5bcfeaf

Browse files
committed
Remove whitelist Ethereum events from the ledger
1 parent b687ba1 commit 5bcfeaf

5 files changed

Lines changed: 3 additions & 89 deletions

File tree

apps/src/lib/node/ledger/ethereum_oracle/events.rs

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ pub mod eth_events {
77
};
88
use ethbridge_events::{DynEventCodec, Events as RawEvents};
99
use ethbridge_governance_events::{
10-
GovernanceEvents, NewContractFilter, UpdateBridgeWhitelistFilter,
10+
GovernanceEvents, NewContractFilter,
1111
UpgradedContractFilter, ValidatorSetUpdateFilter,
1212
};
1313
use namada::core::types::ethereum_structs;
1414
use namada::eth_bridge::ethers::contract::EthEvent;
1515
use namada::types::address::Address;
1616
use namada::types::ethereum_events::{
17-
EthAddress, EthereumEvent, TokenWhitelist, TransferToEthereum,
17+
EthAddress, EthereumEvent, TransferToEthereum,
1818
TransferToEthereumKind, TransferToNamada, Uint,
1919
};
2020
use namada::types::keccak::KeccakHash;
@@ -106,31 +106,6 @@ pub mod eth_events {
106106
NewContractFilter::name().into(),
107107
));
108108
}
109-
RawEvents::Governance(
110-
GovernanceEvents::UpdateBridgeWhitelistFilter(
111-
UpdateBridgeWhitelistFilter {
112-
nonce,
113-
tokens,
114-
token_cap,
115-
},
116-
),
117-
) => {
118-
let mut whitelist = vec![];
119-
120-
for (token, cap) in
121-
tokens.into_iter().zip(token_cap.into_iter())
122-
{
123-
whitelist.push(TokenWhitelist {
124-
token: token.parse_eth_address()?,
125-
cap: cap.parse_amount()?,
126-
});
127-
}
128-
129-
EthereumEvent::UpdateBridgeWhitelist {
130-
nonce: nonce.parse_uint256()?,
131-
whitelist,
132-
}
133-
}
134109
RawEvents::Governance(
135110
GovernanceEvents::UpgradedContractFilter(
136111
UpgradedContractFilter { name: _, addr: _ },
@@ -342,7 +317,7 @@ pub mod eth_events {
342317
use ethabi::ethereum_types::{H160, U256};
343318
use ethbridge_events::{
344319
TRANSFER_TO_ERC_CODEC, TRANSFER_TO_NAMADA_CODEC,
345-
UPDATE_BRIDGE_WHITELIST_CODEC, VALIDATOR_SET_UPDATE_CODEC,
320+
VALIDATOR_SET_UPDATE_CODEC,
346321
};
347322
use namada::eth_bridge::ethers::abi::AbiEncode;
348323

@@ -553,11 +528,6 @@ pub mod eth_events {
553528
bridge_validator_set_hash: [1; 32],
554529
governance_validator_set_hash: [2; 32],
555530
};
556-
let whitelist = UpdateBridgeWhitelistFilter {
557-
nonce: 0u64.into(),
558-
tokens: vec![H160([0; 20]); 2],
559-
token_cap: vec![0u64.into(); 2],
560-
};
561531
assert_eq!(
562532
{
563533
let decoded: TransferToNamadaFilter =
@@ -593,18 +563,6 @@ pub mod eth_events {
593563
},
594564
update
595565
);
596-
assert_eq!(
597-
{
598-
let decoded: UpdateBridgeWhitelistFilter =
599-
UPDATE_BRIDGE_WHITELIST_CODEC
600-
.decode(&get_log(whitelist.clone().encode()))
601-
.expect("Test failed")
602-
.try_into()
603-
.expect("Test failed");
604-
decoded
605-
},
606-
whitelist
607-
);
608566
}
609567

610568
/// Return an Ethereum events log, from the given encoded event

apps/src/lib/node/ledger/shell/vote_extensions/eth_events.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,6 @@ where
276276
return Err(VoteExtensionError::InvalidNamNonce);
277277
}
278278
}
279-
EthereumEvent::UpdateBridgeWhitelist { .. } => {
280-
// TODO: check nonce of whitelist update;
281-
// for this, we need to store the nonce of
282-
// whitelist updates somewhere
283-
}
284279
// consider other ethereum event kinds valid
285280
_ => {}
286281
}

core/src/types/ethereum_events.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -334,16 +334,6 @@ pub enum EthereumEvent {
334334
#[allow(dead_code)]
335335
address: EthAddress,
336336
},
337-
/// Event indication a new Ethereum based token has been whitelisted for
338-
/// transfer across the bridge
339-
UpdateBridgeWhitelist {
340-
/// Monotonically increasing nonce
341-
#[allow(dead_code)]
342-
nonce: Uint,
343-
/// Tokens to be allowed to be transferred across the bridge
344-
#[allow(dead_code)]
345-
whitelist: Vec<TokenWhitelist>,
346-
},
347337
}
348338

349339
impl EthereumEvent {
@@ -462,30 +452,6 @@ pub struct TransferToEthereum {
462452
pub gas_payer: Address,
463453
}
464454

465-
/// struct for whitelisting a token from Ethereum.
466-
/// Includes the address of issuing contract and
467-
/// a cap on the max amount of this token allowed to be
468-
/// held by the bridge.
469-
#[derive(
470-
Clone,
471-
Debug,
472-
PartialEq,
473-
Eq,
474-
Hash,
475-
PartialOrd,
476-
Ord,
477-
BorshSerialize,
478-
BorshDeserialize,
479-
BorshSchema,
480-
)]
481-
#[allow(dead_code)]
482-
pub struct TokenWhitelist {
483-
/// Address of Ethereum smart contract issuing token
484-
pub token: EthAddress,
485-
/// Maximum amount of token allowed on the bridge
486-
pub cap: Amount,
487-
}
488-
489455
#[cfg(test)]
490456
pub mod tests {
491457
use std::str::FromStr;

core/src/types/storage.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,6 @@ pub struct PrefixValue {
12541254
pub struct EthEventsQueue {
12551255
/// Queue of transfer to Namada events.
12561256
pub transfers_to_namada: InnerEthEventsQueue<TransfersToNamada>,
1257-
// TODO: add queue of update whitelist events
12581257
}
12591258

12601259
/// A queue of confirmed Ethereum events of type `E`.

ethereum_bridge/src/protocol/transactions/ethereum_events/events.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,10 +757,6 @@ mod tests {
757757
name: "bridge".to_string(),
758758
address: arbitrary_eth_address(),
759759
},
760-
EthereumEvent::UpdateBridgeWhitelist {
761-
nonce: arbitrary_nonce(),
762-
whitelist: vec![],
763-
},
764760
EthereumEvent::UpgradedContract {
765761
name: "bridge".to_string(),
766762
address: arbitrary_eth_address(),

0 commit comments

Comments
 (0)