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

TTL Implementation #261

Merged
merged 37 commits into from
Dec 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2269c7e
refactor address generation code into libwallet, bool to flag whether…
yeastplume Nov 20, 2019
088db19
rustfmt
yeastplume Nov 20, 2019
8155593
require payment proof addr as part of init_tx
yeastplume Nov 20, 2019
82924c9
rustfmt
yeastplume Nov 20, 2019
b50d74c
store payment proof on sender transaction side
yeastplume Nov 25, 2019
d4bf98a
rustfmt
yeastplume Nov 25, 2019
5a611a2
change sig to ed25519 sig
yeastplume Nov 25, 2019
6329545
rustfmt
yeastplume Nov 25, 2019
97cb59e
add message creation and signature
yeastplume Nov 25, 2019
78bee07
rustfmt
yeastplume Nov 25, 2019
57441d3
add payment proof verification function
yeastplume Nov 25, 2019
71b08f8
rustfmt
yeastplume Nov 25, 2019
d6547b4
validate proof on sender side, store proof
yeastplume Nov 26, 2019
3f8ac46
rustfmt
yeastplume Nov 26, 2019
f393147
fix json tests
yeastplume Nov 26, 2019
d6cb03a
fixes and updates to tests
yeastplume Nov 26, 2019
8a611fd
added API functions for converting and retrieving proof addresses
yeastplume Nov 27, 2019
efe4760
rustfmt
yeastplume Nov 27, 2019
d6e35fa
add payment proof to init_send_tx example
yeastplume Nov 27, 2019
f5ac501
rustfmt
yeastplume Nov 27, 2019
d61d859
incorrect comment
yeastplume Nov 27, 2019
4bef3d6
add commands for requesting payment proofs
yeastplume Nov 27, 2019
901a5d0
rustfmt
yeastplume Nov 27, 2019
2871734
wire up payment proofs into command line
yeastplume Nov 27, 2019
2235713
rustfmt
yeastplume Nov 27, 2019
3756a94
add address command
yeastplume Nov 28, 2019
ceb8253
rustfmt
yeastplume Nov 28, 2019
494d673
added tor sending from owner api
yeastplume Nov 28, 2019
7305732
rustfmt
yeastplume Nov 28, 2019
e9d18ec
add TTL to slate, transaction log
yeastplume Nov 28, 2019
88d1418
ttl cutoff tests
yeastplume Nov 28, 2019
cdc7ce5
merge from upstream
yeastplume Nov 28, 2019
becd744
add ttl check to recieve functions, add tests, modify doctests
yeastplume Nov 28, 2019
300543d
rustfmt
yeastplume Nov 28, 2019
1a94e92
fixes from upstream changes and test fixes
yeastplume Nov 29, 2019
b7086bb
rustfmt
yeastplume Nov 29, 2019
85dd711
remove unnecessary block header version check
yeastplume Nov 29, 2019
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
603 changes: 326 additions & 277 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions api/src/foreign_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pub trait ForeignRpc {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "4",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"num_participants": 2,
"participant_data": [
Expand Down Expand Up @@ -253,7 +253,7 @@ pub trait ForeignRpc {
"fee": "7000000",
"height": "5",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"participant_data": [
{
Expand Down Expand Up @@ -283,7 +283,7 @@ pub trait ForeignRpc {
"height": "5",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"num_participants": 2,
"participant_data": [
Expand Down Expand Up @@ -420,7 +420,7 @@ pub trait ForeignRpc {
"fee": "7000000",
"height": "5",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"participant_data": [
{
Expand Down Expand Up @@ -455,7 +455,7 @@ pub trait ForeignRpc {
"height": "5",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"num_participants": 2,
"participant_data": [
Expand Down
3 changes: 2 additions & 1 deletion api/src/owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ use crate::libwallet::{
NodeHeightResult, OutputCommitMapping, Slate, TxLogEntry, WalletInfo, WalletInst,
WalletLCProvider,
};
use crate::util::logger::LoggingConfig;
use crate::util::secp::key::SecretKey;
use crate::util::{from_hex, static_secp_instance, LoggingConfig, Mutex, ZeroingString};
use crate::util::{from_hex, static_secp_instance, Mutex, ZeroingString};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{channel, Sender};
use std::sync::Arc;
Expand Down
20 changes: 12 additions & 8 deletions api/src/owner_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ pub trait OwnerRpc: Sync + Send {
"num_outputs": 1,
"parent_key_id": "0200000000000000000000000000000000",
"stored_tx": null,
"ttl_cutoff_height": null,
"tx_slate_id": null,
"payment_proof": null,
"tx_type": "ConfirmedCoinbase"
Expand All @@ -258,6 +259,7 @@ pub trait OwnerRpc: Sync + Send {
"num_outputs": 1,
"parent_key_id": "0200000000000000000000000000000000",
"stored_tx": null,
"ttl_cutoff_height": null,
"tx_slate_id": null,
"payment_proof": null,
"tx_type": "ConfirmedCoinbase"
Expand Down Expand Up @@ -343,6 +345,7 @@ pub trait OwnerRpc: Sync + Send {
"message": "my message",
"target_slate_version": null,
"payment_proof_recipient_address": null,
"ttl_blocks": null,
"send_args": null
}
},
Expand All @@ -361,7 +364,7 @@ pub trait OwnerRpc: Sync + Send {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"num_participants": 2,
"participant_data": [
Expand Down Expand Up @@ -448,7 +451,7 @@ pub trait OwnerRpc: Sync + Send {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"num_participants": 2,
"participant_data": [
Expand Down Expand Up @@ -514,7 +517,7 @@ pub trait OwnerRpc: Sync + Send {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"num_participants": 2,
"participant_data": [
Expand Down Expand Up @@ -565,6 +568,7 @@ pub trait OwnerRpc: Sync + Send {
"message": "Ok, here are your grins",
"target_slate_version": null,
"payment_proof_recipient_address": null,
"ttl_blocks": null,
"send_args": null
}
],
Expand All @@ -583,7 +587,7 @@ pub trait OwnerRpc: Sync + Send {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"num_participants": 2,
"participant_data": [
Expand Down Expand Up @@ -671,7 +675,7 @@ pub trait OwnerRpc: Sync + Send {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "4",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"num_participants": 2,
"participant_data": [
Expand Down Expand Up @@ -760,7 +764,7 @@ pub trait OwnerRpc: Sync + Send {
},
"num_participants": 2,
"id": "0436430c-2b02-624c-2032-570501212b00",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"tx": {
"offset": "d202964900000000d302964900000000d402964900000000d502964900000000",
Expand Down Expand Up @@ -835,7 +839,7 @@ pub trait OwnerRpc: Sync + Send {
"fee": "7000000",
"height": "5",
"id": "0436430c-2b02-624c-2032-570501212b00",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"lock_height": "0",
"num_participants": 2,
Expand Down Expand Up @@ -1116,7 +1120,7 @@ pub trait OwnerRpc: Sync + Send {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "4",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"payment_proof": null,
"num_participants": 2,
"participant_data": [
Expand Down
23 changes: 14 additions & 9 deletions api/src/owner_rpc_s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ use crate::libwallet::{
OutputCommitMapping, Slate, SlateVersion, StatusMessage, TxLogEntry, VersionedSlate,
WalletInfo, WalletLCProvider,
};
use crate::util::logger::LoggingConfig;
use crate::util::secp::key::{PublicKey, SecretKey};
use crate::util::{static_secp_instance, LoggingConfig, ZeroingString};
use crate::util::{static_secp_instance, ZeroingString};
use crate::{ECDHPubkey, Owner, PubAddress, Token};
use easy_jsonrpc_mw;
use rand::thread_rng;
Expand Down Expand Up @@ -263,6 +264,7 @@ pub trait OwnerRpcS {
"num_outputs": 1,
"parent_key_id": "0200000000000000000000000000000000",
"stored_tx": null,
"ttl_cutoff_height": null,
"tx_slate_id": null,
"payment_proof": null,
"tx_type": "ConfirmedCoinbase"
Expand All @@ -282,6 +284,7 @@ pub trait OwnerRpcS {
"num_outputs": 1,
"parent_key_id": "0200000000000000000000000000000000",
"stored_tx": null,
"ttl_cutoff_height": null,
"payment_proof": null,
"tx_slate_id": null,
"tx_type": "ConfirmedCoinbase"
Expand Down Expand Up @@ -374,6 +377,7 @@ pub trait OwnerRpcS {
"message": "my message",
"target_slate_version": null,
"payment_proof_recipient_address": "d03c09e9c19bb74aa9ea44e0fe5ae237a9bf40bddf0941064a80913a4459c8bb",
"ttl_blocks": null,
"send_args": null
}
},
Expand All @@ -392,7 +396,7 @@ pub trait OwnerRpcS {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"num_participants": 2,
"payment_proof": {
"receiver_address": "d03c09e9c19bb74aa9ea44e0fe5ae237a9bf40bddf0941064a80913a4459c8bb",
Expand Down Expand Up @@ -484,7 +488,7 @@ pub trait OwnerRpcS {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"num_participants": 2,
"payment_proof": null,
"participant_data": [
Expand Down Expand Up @@ -555,7 +559,7 @@ pub trait OwnerRpcS {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"num_participants": 2,
"payment_proof": null,
"participant_data": [
Expand Down Expand Up @@ -606,6 +610,7 @@ pub trait OwnerRpcS {
"message": "Ok, here are your grins",
"target_slate_version": null,
"payment_proof_recipient_address": null,
"ttl_blocks": null,
"send_args": null
}
},
Expand All @@ -624,7 +629,7 @@ pub trait OwnerRpcS {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"num_participants": 2,
"payment_proof": null,
"participant_data": [
Expand Down Expand Up @@ -715,7 +720,7 @@ pub trait OwnerRpcS {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "4",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"num_participants": 2,
"payment_proof": null,
"participant_data": [
Expand Down Expand Up @@ -847,7 +852,7 @@ pub trait OwnerRpcS {
"fee": "7000000",
"height": "5",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"participant_data": [
{
"id": "0",
Expand Down Expand Up @@ -882,7 +887,7 @@ pub trait OwnerRpcS {
"height": "5",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "0",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"num_participants": 2,
"payment_proof": null,
"participant_data": [
Expand Down Expand Up @@ -1180,7 +1185,7 @@ pub trait OwnerRpcS {
"height": "4",
"id": "0436430c-2b02-624c-2032-570501212b00",
"lock_height": "4",
"ttl_cutoff_height": "0",
"ttl_cutoff_height": null,
"num_participants": 2,
"participant_data": [
{
Expand Down
2 changes: 1 addition & 1 deletion config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::comments::insert_comments;
use crate::core::global;
use crate::types::{ConfigError, GlobalWalletConfig, GlobalWalletConfigMembers};
use crate::types::{TorConfig, WalletConfig};
use crate::util::LoggingConfig;
use crate::util::logger::LoggingConfig;

/// Wallet configuration file name
pub const WALLET_CONFIG_FILE_NAME: &'static str = "grin-wallet.toml";
Expand Down
2 changes: 1 addition & 1 deletion config/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::io;
use std::path::PathBuf;

use crate::core::global::ChainTypes;
use crate::util::LoggingConfig;
use crate::util::logger::LoggingConfig;

/// Command-line wallet configuration
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
Expand Down
6 changes: 3 additions & 3 deletions controller/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ fn check_middleware(
// allow coinbases to be built regardless
ForeignCheckMiddlewareFn::BuildCoinbase => Ok(()),
_ => {
let mut bhv = 1;
let mut bhv = 2;
if let Some(n) = node_version_info {
bhv = n.block_header_version;
}
if let Some(s) = slate {
if s.version_info.version < CURRENT_SLATE_VERSION
|| (bhv == 1 && s.version_info.block_header_version != 1)
|| (bhv > 1 && s.version_info.block_header_version < GRIN_BLOCK_HEADER_VERSION)
// || (bhv == 3 && s.version_info.block_header_version != 3)
|| (bhv > 3 && s.version_info.block_header_version < GRIN_BLOCK_HEADER_VERSION)
{
Err(ErrorKind::Compatibility(
"Incoming Slate is not compatible with this wallet. \
Expand Down
6 changes: 6 additions & 0 deletions controller/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ pub fn txs(
bMG->"Type",
bMG->"Shared Transaction Id",
bMG->"Creation Time",
bMG->"TTL Cutoff Height",
bMG->"Confirmed?",
bMG->"Confirmation Time",
bMG->"Num. \nInputs",
Expand All @@ -173,6 +174,10 @@ pub fn txs(
};
let entry_type = format!("{}", t.tx_type);
let creation_ts = format!("{}", t.creation_ts.format("%Y-%m-%d %H:%M:%S"));
let ttl_cutoff_height = match t.ttl_cutoff_height {
Some(b) => format!("{}", b),
None => "None".to_owned(),
};
let confirmation_ts = match t.confirmation_ts {
Some(m) => format!("{}", m.format("%Y-%m-%d %H:%M:%S")),
None => "None".to_owned(),
Expand Down Expand Up @@ -212,6 +217,7 @@ pub fn txs(
bFC->entry_type,
bFC->slate_id,
bFB->creation_ts,
bFB->ttl_cutoff_height,
bFC->confirmed,
bFB->confirmation_ts,
bFC->num_inputs,
Expand Down
Loading