mirror of
https://code.gri.mw/GUI/grim.git
synced 2026-07-15 03:08:56 +00:00
ea07fd2081
App side of the index-0 unpinning. Wallet::mint_proof_address allocates the next fresh derivation index from a persisted, never-reusing counter (src/wallet/proof_addrs.rs; proof_addrs.json in the wallet dir — an index carries no secret, the keys live in the wallet seed) and derives its slatepack/proof address through the wallet's existing indexed derivation (address_from_derivation_path), exactly as the app's default index-0 address is derived. Index 0 stays the default app address; nothing changes for normal receives. Allocation starts at 1, is monotonic and persisted before use (a crash burns an index, never reuses one), and is capped at MAX_PROOF_ADDRESS_INDEX = 1023 — the receive-side scan bound of the matching grin-wallet submodule patch (kept as a local constant so this crate also builds against the unpatched upstream submodule; the wallet-side patch, which detects the addressed index on receive and signs the payment proof with the matching key, lives in the wallet submodule on a local branch pending the owner's decision on where that patch is pinned). Tests: allocation monotonic + persistent from 1, refuses past the scan bound, corrupt counter degrades to address reuse (the old single-address world), never a fund risk.
42 lines
931 B
Rust
42 lines
931 B
Rust
// Copyright 2023 The Grim Developers
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
pub mod types;
|
|
|
|
mod mnemonic;
|
|
pub use mnemonic::Mnemonic;
|
|
|
|
mod connections;
|
|
pub use connections::*;
|
|
|
|
mod wallet;
|
|
pub use wallet::*;
|
|
|
|
mod config;
|
|
pub use config::*;
|
|
|
|
mod list;
|
|
pub use list::*;
|
|
|
|
mod utils;
|
|
pub use utils::WalletUtils;
|
|
|
|
mod seed;
|
|
pub mod store;
|
|
|
|
pub mod proof_addrs;
|
|
|
|
#[cfg(all(test, feature = "e2e-internal"))]
|
|
mod e2e;
|