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

Murisi/draft4 #1659

Closed
wants to merge 81 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
3b8a2d1
pos: cubic slashing with new procedure for recording and unbonding/wi…
brentstone Mar 18, 2023
e41b7da
fix `bond_amount`
brentstone May 11, 2023
6e7798c
fix PoS client query related functions
brentstone May 11, 2023
73fcdee
pos/lib.rs: WIP fix things inside of `bonds_and_unbonds`
brentstone May 16, 2023
2c6283f
Merge 'origin/tomas/fix-max-wait-tries' into draft (#1456)
Fraccaman May 23, 2023
819d0ed
Merge 'origin/tomas/find-validator-by-tm' (#1344)
Fraccaman May 23, 2023
b64a771
store total bond sums of each validator for efficient computation
brentstone May 23, 2023
5e6383c
refactor epoch offsets with params methods
tzemanovic May 23, 2023
a81b4bb
fixup! store total bond sums of each validator for efficient computation
tzemanovic May 23, 2023
fb5b678
Merge branch 'cwgoes/cse-in-inflation' (#1444)
cwgoes May 24, 2023
f101a69
changelog: add #1444
cwgoes May 24, 2023
4c22a9b
remove unused cubic slash function
brentstone May 24, 2023
05ce4f9
Merge branch 'murisi/restructure-tx-draft' into draft
May 24, 2023
2770df4
Updated the WASM checksums.
May 24, 2023
8412e41
Fixed the header of transactions in dry_run.
May 24, 2023
726557d
use cometbft binary
adrianbrink May 23, 2023
52bbe56
Merge branch 'adrian/upgrade_cometbft' (#1454)
tzemanovic May 24, 2023
16b9734
Fixed local tx prover dependency regression.
May 25, 2023
70f3ccf
Remove unused module
cwgoes May 24, 2023
8e7570e
update changelog
cwgoes May 24, 2023
c73eb2c
Merge branch 'cwgoes/remove-unused-named-address' (1469)
cwgoes May 25, 2023
a96f397
fixup! add cubic_slash_window_length to bounds (maybe still needs cha…
brentstone May 24, 2023
249469a
refactor slash lookup
tzemanovic May 24, 2023
f2f5e7d
revert bound cleaning for readability
brentstone May 25, 2023
d5331b5
Merge branch 'murisi/fix-dry-run-header' into draft
May 25, 2023
899bb44
Update WASM checksums.
May 25, 2023
54a12d1
aesthetic cleaning
brentstone May 25, 2023
058251d
withdraw: fix bounds for collecting slashes for an unbond
brentstone May 25, 2023
8e66ff9
make find_slashes_in_ranges inclusive on end epoch
tzemanovic May 25, 2023
548dfa4
sdk: use hash instead of wasm code
Fraccaman May 25, 2023
36c3f49
add cli to sdk impl for tx unjail
tzemanovic May 25, 2023
301a768
get_slashed_amount: inclusive on infraction epoch
tzemanovic May 25, 2023
11a6d92
Merge 'origin/fraccaman/fix-sdk-tx-with-hash' (#1474)
Fraccaman May 25, 2023
597b311
fixup! Merge 'origin/fraccaman/fix-sdk-tx-with-hash' (#1474)
Fraccaman May 25, 2023
3dbb6dc
rip slash pool
tzemanovic May 25, 2023
b5ec5c9
remove test code until slash pool transfers are solved
brentstone May 25, 2023
99484da
fix clippy
brentstone May 25, 2023
552050c
clean up logging
brentstone May 25, 2023
6f3414e
fixup!: don't call `process_slashes` within `advance_epoch`
brentstone May 26, 2023
e6a6c06
Merge branch 'brent/cubic-slashing' into draft
brentstone May 26, 2023
7e7e9f2
Merge branch 'tomas/persist-epoch-update-delay' (#1455)
tzemanovic May 26, 2023
814a643
Revert "fixup! Merge 'origin/fraccaman/fix-sdk-tx-with-hash' (#1474)"
juped May 30, 2023
42d1c08
Revert "Merge 'origin/fraccaman/fix-sdk-tx-with-hash' (#1474)"
juped May 30, 2023
daa545d
sdk: use hash instead of wasm code
Fraccaman May 25, 2023
38cc7f8
Merge branch 'fraccaman/fix-sdk-tx-with-hash' (#1474) into draft
juped May 30, 2023
1e94882
fixup! Merge 'origin/fraccaman/fix-sdk-tx-with-hash' (#1474)
Fraccaman May 25, 2023
8db7532
Removed unnecessary header updates for dry runs.
Jun 1, 2023
285b7bd
Separate transaction building from signing from submission.
Jun 2, 2023
c562fff
Separating out the reveal PK transaction construction.
Jun 6, 2023
95b84fb
Now update proof of work solution in transaction header.
Jun 8, 2023
00a6c67
Now only use TxBroadcastData::Wrapper for non dry runs.
Jun 8, 2023
1a7fa74
Only reveal a public key when the signer is an implicit address.
Jun 8, 2023
773825f
Increased usage of PublicKeys relative to SecretKeys in tx construction.
Jun 8, 2023
ec85de5
Allow Tx builders to take verification keys.
Jun 9, 2023
52bb61b
Simplified the reveal PK transaction construction flow. Factored chai…
Jun 9, 2023
ade4786
Increased the number of init-proposal and vote-proposal test vectors.…
Jun 17, 2023
5367124
Now moving proposal code into extra section.
Jun 17, 2023
d832ea8
Added CLI subcommand for validator change commission. Cleared up the …
Jun 19, 2023
65cc5bb
Now sign over all sections in transactions.
Jun 16, 2023
676a5ed
Fixed the tests involving transaction signing.
Jun 20, 2023
1274d1a
Fixed clippy and formatting issues.
Jun 21, 2023
874a02a
Merged in 0.17.4.
Jun 22, 2023
7737db5
Merged in v0.17.4.
murisi Jun 23, 2023
ef34267
VPs now check that code and data are signed together.
murisi Jun 25, 2023
1819d16
Make the signature section unmalleable.
murisi Jun 25, 2023
a3a8bbc
Expanded validate_header to check for signature over all sections, an…
murisi Jun 27, 2023
d52a137
[fix]: Fix failing test-wasm by adding code section and also signing …
murisi Jul 2, 2023
3968108
Merged in base.
murisi Jul 2, 2023
b20c0b2
Added changelog entry.
murisi Jul 3, 2023
9718565
Fixed processing of code inside init-proposal transactions.
murisi Jun 23, 2023
cbaf707
Added changelog entry.
murisi Jul 3, 2023
8ef2d92
Merged in base 0.18.0.
murisi Jul 4, 2023
56a0863
Merged in 0.18.0.
murisi Jul 4, 2023
cc4ecb4
Merged in murisi/fix-tx-malleability.
murisi Jul 4, 2023
e2b7895
Factored out the submission of the reveal PK transaction.
murisi Jul 3, 2023
8224f75
Added changelog entry.
murisi Jul 3, 2023
257d2bd
Merged in base 0.18.0.
murisi Jul 4, 2023
655f5d6
Merged in murisi/separate-signing.
murisi Jul 4, 2023
d361d62
Disable encrypting transactions when sending.
murisi Jul 2, 2023
4901372
Stop encrypting transactions in tests.
murisi Jul 2, 2023
a5b244e
Added a changelog entry.
murisi Jul 3, 2023
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
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/1607-fix-tx-malleability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fixed bug that allowed transactions to be modified without invalidating
transaction hash ([\#1607](https://github.com/anoma/namada/pull/1607))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Move the content and code of init proposal transactions
into separare section to reduce tx size for hardware wallets
([\#1611](https://github.com/anoma/namada/pull/1611))
3 changes: 3 additions & 0 deletions .changelog/unreleased/improvements/1498-separate-signing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Separate the transaction building, signing, and submission
actions in the SDKs API to enable hardware wallet usage
([\#1498](https://github.com/anoma/namada/pull/1498))
2 changes: 2 additions & 0 deletions .changelog/unreleased/improvements/1636-disable-encryption.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Disable encryption when sending transactions
([\#1636](https://github.com/anoma/namada/pull/1636))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove unused named address file
1 change: 1 addition & 0 deletions .changelog/unreleased/unreleased/1444.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Common sub-expression elimination in inflation calculation
13 changes: 12 additions & 1 deletion apps/src/bin/namada-client/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub async fn main() -> Result<()> {
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_init_validator::<HttpClient>(&client, ctx, args)
.await;
.await?;
}
Sub::TxInitProposal(TxInitProposal(args)) => {
wait_until_node_is_synched(&args.tx.ledger_address).await;
Expand Down Expand Up @@ -148,6 +148,17 @@ pub async fn main() -> Result<()> {
tx::submit_withdraw::<HttpClient>(&client, ctx, args)
.await?;
}
Sub::TxCommissionRateChange(TxCommissionRateChange(args)) => {
wait_until_node_is_synched(&args.tx.ledger_address).await;
let client =
HttpClient::new(args.tx.ledger_address.clone())
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_validator_commission_change::<HttpClient>(
&client, ctx, args,
)
.await?;
}
// Ledger queries
Sub::QueryEpoch(QueryEpoch(args)) => {
wait_until_node_is_synched(&args.ledger_address).await;
Expand Down
67 changes: 60 additions & 7 deletions apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ pub mod cmds {
.subcommand(Bond::def().display_order(2))
.subcommand(Unbond::def().display_order(2))
.subcommand(Withdraw::def().display_order(2))
.subcommand(TxCommissionRateChange::def().display_order(2))
// Queries
.subcommand(QueryEpoch::def().display_order(3))
.subcommand(QueryTransfers::def().display_order(3))
Expand Down Expand Up @@ -198,6 +199,8 @@ pub mod cmds {
Self::parse_with_ctx(matches, TxInitProposal);
let tx_vote_proposal =
Self::parse_with_ctx(matches, TxVoteProposal);
let tx_commission_rate_change =
Self::parse_with_ctx(matches, TxCommissionRateChange);
let bond = Self::parse_with_ctx(matches, Bond);
let unbond = Self::parse_with_ctx(matches, Unbond);
let withdraw = Self::parse_with_ctx(matches, Withdraw);
Expand Down Expand Up @@ -232,6 +235,7 @@ pub mod cmds {
.or(tx_init_proposal)
.or(tx_vote_proposal)
.or(tx_init_validator)
.or(tx_commission_rate_change)
.or(bond)
.or(unbond)
.or(withdraw)
Expand Down Expand Up @@ -294,6 +298,7 @@ pub mod cmds {
TxUpdateVp(TxUpdateVp),
TxInitAccount(TxInitAccount),
TxInitValidator(TxInitValidator),
TxCommissionRateChange(TxCommissionRateChange),
TxInitProposal(TxInitProposal),
TxVoteProposal(TxVoteProposal),
TxRevealPk(TxRevealPk),
Expand Down Expand Up @@ -1534,6 +1539,32 @@ pub mod cmds {
}
}

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

impl SubCmd for TxCommissionRateChange {
const CMD: &'static str = "change-commission-rate";

fn parse(matches: &ArgMatches) -> Option<Self>
where
Self: Sized,
{
matches.subcommand_matches(Self::CMD).map(|matches| {
TxCommissionRateChange(args::CommissionRateChange::parse(
matches,
))
})
}

fn def() -> App {
App::new(Self::CMD)
.about("Change commission raate.")
.add_args::<args::CommissionRateChange<args::CliTypes>>()
}
}

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

Expand Down Expand Up @@ -1935,6 +1966,8 @@ pub mod args {
pub const VALIDATOR_CODE_PATH: ArgOpt<PathBuf> =
arg_opt("validator-code-path");
pub const VALUE: ArgOpt<String> = arg_opt("value");
pub const VERIFICATION_KEY: ArgOpt<WalletPublicKey> =
arg_opt("verification-key");
pub const VIEWING_KEY: Arg<WalletViewingKey> = arg("key");
pub const WALLET_ALIAS_FORCE: ArgFlag = flag("wallet-alias-force");
pub const WASM_CHECKSUMS_PATH: Arg<PathBuf> = arg("wasm-checksums-path");
Expand Down Expand Up @@ -3101,11 +3134,11 @@ pub mod args {
}
}

impl CliToSdk<TxCommissionRateChange<SdkTypes>>
for TxCommissionRateChange<CliTypes>
impl CliToSdk<CommissionRateChange<SdkTypes>>
for CommissionRateChange<CliTypes>
{
fn to_sdk(self, ctx: &mut Context) -> TxCommissionRateChange<SdkTypes> {
TxCommissionRateChange::<SdkTypes> {
fn to_sdk(self, ctx: &mut Context) -> CommissionRateChange<SdkTypes> {
CommissionRateChange::<SdkTypes> {
tx: self.tx.to_sdk(ctx),
validator: ctx.get(&self.validator),
rate: self.rate,
Expand All @@ -3114,7 +3147,7 @@ pub mod args {
}
}

impl Args for TxCommissionRateChange<CliTypes> {
impl Args for CommissionRateChange<CliTypes> {
fn parse(matches: &ArgMatches) -> Self {
let tx = Tx::parse(matches);
let validator = VALIDATOR.parse(matches);
Expand Down Expand Up @@ -3340,11 +3373,16 @@ pub mod args {
fee_token: ctx.get(&self.fee_token),
gas_limit: self.gas_limit,
signing_key: self.signing_key.map(|x| ctx.get_cached(&x)),
verification_key: self
.verification_key
.map(|x| ctx.get_cached(&x)),
signer: self.signer.map(|x| ctx.get(&x)),
tx_reveal_code_path: self.tx_reveal_code_path,
password: self.password,
expiration: self.expiration,
chain_id: self.chain_id,
chain_id: self
.chain_id
.or_else(|| Some(ctx.config.ledger.chain_id.clone())),
}
}
}
Expand Down Expand Up @@ -3403,7 +3441,8 @@ pub mod args {
public key, public key hash or alias from your \
wallet.",
)
.conflicts_with(SIGNER.name),
.conflicts_with(SIGNER.name)
.conflicts_with(VERIFICATION_KEY.name),
)
.arg(
SIGNER
Expand All @@ -3412,6 +3451,18 @@ pub mod args {
"Sign the transaction with the keypair of the public \
key of the given address.",
)
.conflicts_with(SIGNING_KEY_OPT.name)
.conflicts_with(VERIFICATION_KEY.name),
)
.arg(
VERIFICATION_KEY
.def()
.help(
"Sign the transaction with the key for the given \
public key, public key hash or alias from your \
wallet.",
)
.conflicts_with(SIGNER.name)
.conflicts_with(SIGNING_KEY_OPT.name),
)
.arg(CHAIN_ID_OPT.def().help("The chain ID."))
Expand All @@ -3431,6 +3482,7 @@ pub mod args {
let gas_limit = GAS_LIMIT.parse(matches).amount.into();
let expiration = EXPIRATION_OPT.parse(matches);
let signing_key = SIGNING_KEY_OPT.parse(matches);
let verification_key = VERIFICATION_KEY.parse(matches);
let signer = SIGNER.parse(matches);
let tx_reveal_code_path = PathBuf::from(TX_REVEAL_PK);
let chain_id = CHAIN_ID_OPT.parse(matches);
Expand All @@ -3448,6 +3500,7 @@ pub mod args {
gas_limit,
expiration,
signing_key,
verification_key,
signer,
tx_reveal_code_path,
password,
Expand Down
28 changes: 8 additions & 20 deletions apps/src/lib/client/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ use crate::cli::args;

/// Find the public key for the given address and try to load the keypair
/// for it from the wallet. Panics if the key cannot be found or loaded.
pub async fn find_keypair<
pub async fn find_pk<
C: namada::ledger::queries::Client + Sync,
U: WalletUtils,
>(
client: &C,
wallet: &mut Wallet<U>,
addr: &Address,
) -> Result<common::SecretKey, tx::Error> {
namada::ledger::signing::find_keypair::<C, U>(client, wallet, addr, None)
.await
) -> Result<common::PublicKey, tx::Error> {
namada::ledger::signing::find_pk(client, wallet, addr, None).await
}

/// Given CLI arguments and some defaults, determine the rightful transaction
Expand All @@ -38,7 +37,7 @@ pub async fn tx_signer<
wallet: &mut Wallet<U>,
args: &args::Tx,
default: TxSigningKey,
) -> Result<common::SecretKey, tx::Error> {
) -> Result<(Option<Address>, common::PublicKey), tx::Error> {
namada::ledger::signing::tx_signer::<C, U>(client, wallet, args, default)
.await
}
Expand All @@ -55,23 +54,12 @@ pub async fn sign_tx<
C: namada::ledger::queries::Client + Sync,
U: WalletUtils,
>(
client: &C,
wallet: &mut Wallet<U>,
tx: Tx,
tx: &mut Tx,
args: &args::Tx,
default: TxSigningKey,
#[cfg(not(feature = "mainnet"))] requires_pow: bool,
) -> Result<TxBroadcastData, tx::Error> {
namada::ledger::signing::sign_tx::<C, U>(
client,
wallet,
tx,
args,
default,
#[cfg(not(feature = "mainnet"))]
requires_pow,
)
.await
default: &common::PublicKey,
) -> Result<(), tx::Error> {
namada::ledger::signing::sign_tx(wallet, tx, args, default).await
}

/// Create a wrapper tx from a normal tx. Get the hash of the
Expand Down
Loading