Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Migrate to the new Ethereum contracts
([\#1885](https://github.com/anoma/namada/pull/1885))
41 changes: 8 additions & 33 deletions Cargo.lock

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

10 changes: 4 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ directories = "4.0.1"
ed25519-consensus = "1.2.0"
escargot = "0.5.7"
ethabi = "18.0.0"
ethbridge-bridge-contract = {git = "https://github.com/heliaxdev/ethbridge-rs", tag = "v0.23.0"}
ethbridge-bridge-events = {git = "https://github.com/heliaxdev/ethbridge-rs", tag = "v0.23.0"}
ethbridge-events = {git = "https://github.com/heliaxdev/ethbridge-rs", tag = "v0.23.0"}
ethbridge-governance-contract = {git = "https://github.com/heliaxdev/ethbridge-rs", tag = "v0.23.0"}
ethbridge-governance-events = {git = "https://github.com/heliaxdev/ethbridge-rs", tag = "v0.23.0"}
ethbridge-structs = { git = "https://github.com/heliaxdev/ethbridge-rs", tag = "v0.23.0" }
ethbridge-bridge-contract = {git = "https://github.com/heliaxdev/ethbridge-rs", tag = "v0.24.0"}
ethbridge-bridge-events = {git = "https://github.com/heliaxdev/ethbridge-rs", tag = "v0.24.0"}
ethbridge-events = {git = "https://github.com/heliaxdev/ethbridge-rs", tag = "v0.24.0"}
ethbridge-structs = { git = "https://github.com/heliaxdev/ethbridge-rs", tag = "v0.24.0" }
ethers = "2.0.0"
expectrl = "0.7.0"
eyre = "0.6.5"
Expand Down
1 change: 0 additions & 1 deletion apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ ed25519-consensus.workspace = true
ethabi.workspace = true
ethbridge-bridge-events.workspace = true
ethbridge-events.workspace = true
ethbridge-governance-events.workspace = true
eyre.workspace = true
fd-lock.workspace = true
ferveo-common.workspace = true
Expand Down
102 changes: 78 additions & 24 deletions apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2290,10 +2290,12 @@ pub mod cmds {
/// Used as sub-commands (`SubCmd` instance) in `namadar` binary.
#[derive(Clone, Debug)]
pub enum ValidatorSet {
/// Query an Ethereum ABI encoding of the consensus validator
/// set in Namada, at the given epoch, or the latest
/// one, if none is provided.
ConsensusValidatorSet(ConsensusValidatorSet),
/// Query the Bridge validator set in Namada, at the given epoch,
/// or the latest one, if none is provided.
BridgeValidatorSet(BridgeValidatorSet),
/// Query the Governance validator set in Namada, at the given epoch,
/// or the latest one, if none is provided.
GovernanceValidatorSet(GovernanceValidatorSet),
/// Query an Ethereum ABI encoding of a proof of the consensus
/// validator set in Namada, at the given epoch, or the next
/// one, if none is provided.
Expand All @@ -2308,14 +2310,19 @@ pub mod cmds {

fn parse(matches: &ArgMatches) -> Option<Self> {
matches.subcommand_matches(Self::CMD).and_then(|matches| {
let consensus_validator_set =
ConsensusValidatorSet::parse(matches)
.map(Self::ConsensusValidatorSet);
let bridge_validator_set = BridgeValidatorSet::parse(matches)
.map(Self::BridgeValidatorSet);
let governance_validator_set =
GovernanceValidatorSet::parse(matches)
.map(Self::GovernanceValidatorSet);
let validator_set_proof = ValidatorSetProof::parse(matches)
.map(Self::ValidatorSetProof);
let relay = ValidatorSetUpdateRelay::parse(matches)
.map(Self::ValidatorSetUpdateRelay);
consensus_validator_set.or(validator_set_proof).or(relay)
bridge_validator_set
.or(governance_validator_set)
.or(validator_set_proof)
.or(relay)
})
}

Expand All @@ -2327,34 +2334,56 @@ pub mod cmds {
contracts.",
)
.subcommand_required(true)
.subcommand(ConsensusValidatorSet::def().display_order(1))
.subcommand(BridgeValidatorSet::def().display_order(1))
.subcommand(GovernanceValidatorSet::def().display_order(1))
.subcommand(ValidatorSetProof::def().display_order(1))
.subcommand(ValidatorSetUpdateRelay::def().display_order(1))
}
}

#[derive(Clone, Debug)]
pub struct ConsensusValidatorSet(
pub args::ConsensusValidatorSet<args::CliTypes>,
pub struct BridgeValidatorSet(pub args::BridgeValidatorSet<args::CliTypes>);

impl SubCmd for BridgeValidatorSet {
const CMD: &'static str = "bridge";

fn parse(matches: &ArgMatches) -> Option<Self> {
matches
.subcommand_matches(Self::CMD)
.map(|matches| Self(args::BridgeValidatorSet::parse(matches)))
}

fn def() -> App {
App::new(Self::CMD)
.about(
"Query the Bridge validator set in Namada, at the given \
epoch, or the latest one, if none is provided.",
)
.add_args::<args::BridgeValidatorSet<args::CliTypes>>()
}
}

#[derive(Clone, Debug)]
pub struct GovernanceValidatorSet(
pub args::GovernanceValidatorSet<args::CliTypes>,
);

impl SubCmd for ConsensusValidatorSet {
const CMD: &'static str = "consensus";
impl SubCmd for GovernanceValidatorSet {
const CMD: &'static str = "governance";

fn parse(matches: &ArgMatches) -> Option<Self> {
matches.subcommand_matches(Self::CMD).map(|matches| {
Self(args::ConsensusValidatorSet::parse(matches))
Self(args::GovernanceValidatorSet::parse(matches))
})
}

fn def() -> App {
App::new(Self::CMD)
.about(
"Query an Ethereum ABI encoding of the consensus \
validator set in Namada, at the requested epoch, or the \
current one, if no epoch is provided.",
"Query the Governance validator set in Namada, at the \
given epoch, or the latest one, if none is provided.",
)
.add_args::<args::ConsensusValidatorSet<args::CliTypes>>()
.add_args::<args::GovernanceValidatorSet<args::CliTypes>>()
}
}

Expand Down Expand Up @@ -3184,18 +3213,18 @@ pub mod args {
}
}

impl CliToSdkCtxless<ConsensusValidatorSet<SdkTypes>>
for ConsensusValidatorSet<CliTypes>
impl CliToSdkCtxless<BridgeValidatorSet<SdkTypes>>
for BridgeValidatorSet<CliTypes>
{
fn to_sdk_ctxless(self) -> ConsensusValidatorSet<SdkTypes> {
ConsensusValidatorSet::<SdkTypes> {
fn to_sdk_ctxless(self) -> BridgeValidatorSet<SdkTypes> {
BridgeValidatorSet::<SdkTypes> {
query: self.query.to_sdk_ctxless(),
epoch: self.epoch,
}
}
}

impl Args for ConsensusValidatorSet<CliTypes> {
impl Args for BridgeValidatorSet<CliTypes> {
fn parse(matches: &ArgMatches) -> Self {
let query = Query::parse(matches);
let epoch = EPOCH.parse(matches);
Expand All @@ -3205,12 +3234,37 @@ pub mod args {
fn def(app: App) -> App {
app.add_args::<Query<CliTypes>>().arg(
EPOCH.def().help(
"The epoch of the consensus set of validators to query.",
"The epoch of the Bridge set of validators to query.",
),
)
}
}

impl CliToSdkCtxless<GovernanceValidatorSet<SdkTypes>>
for GovernanceValidatorSet<CliTypes>
{
fn to_sdk_ctxless(self) -> GovernanceValidatorSet<SdkTypes> {
GovernanceValidatorSet::<SdkTypes> {
query: self.query.to_sdk_ctxless(),
epoch: self.epoch,
}
}
}

impl Args for GovernanceValidatorSet<CliTypes> {
fn parse(matches: &ArgMatches) -> Self {
let query = Query::parse(matches);
let epoch = EPOCH.parse(matches);
Self { query, epoch }
}

fn def(app: App) -> App {
app.add_args::<Query<CliTypes>>().arg(EPOCH.def().help(
"The epoch of the Governance set of validators to query.",
))
}
}

impl CliToSdkCtxless<ValidatorSetProof<SdkTypes>>
for ValidatorSetProof<CliTypes>
{
Expand Down
22 changes: 20 additions & 2 deletions apps/src/lib/cli/relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl<IO> CliApi<IO> {
}
},
cli::NamadaRelayer::ValidatorSet(sub) => match sub {
ValidatorSet::ConsensusValidatorSet(ConsensusValidatorSet(
ValidatorSet::BridgeValidatorSet(BridgeValidatorSet(
mut args,
)) => {
let client = client.unwrap_or_else(|| {
Expand All @@ -137,9 +137,27 @@ impl<IO> CliApi<IO> {
.await
.proceed_or_else(error)?;
let args = args.to_sdk_ctxless();
validator_set::query_validator_set_args(&client, args)
validator_set::query_bridge_validator_set(&client, args)
.await;
}
ValidatorSet::GovernanceValidatorSet(
GovernanceValidatorSet(mut args),
) => {
let client = client.unwrap_or_else(|| {
C::from_tendermint_address(
&mut args.query.ledger_address,
)
});
client
.wait_until_node_is_synced()
.await
.proceed_or_else(error)?;
let args = args.to_sdk_ctxless();
validator_set::query_governnace_validator_set(
&client, args,
)
.await;
}
ValidatorSet::ValidatorSetProof(ValidatorSetProof(
mut args,
)) => {
Expand Down
4 changes: 0 additions & 4 deletions apps/src/lib/config/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,10 +1150,6 @@ pub fn genesis(num_validators: u64) -> Genesis {
address: EthAddress([0; 20]),
version: Default::default(),
},
governance: UpgradeableContract {
address: EthAddress([1; 20]),
version: Default::default(),
},
},
}),
native_token: address::nam(),
Expand Down
Loading