mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-16 21:20:00 +00:00
fix: suggestions fix 2
This commit is contained in:
parent
2c9361c6b5
commit
afa0a63c95
16
Cargo.lock
generated
16
Cargo.lock
generated
@ -3716,6 +3716,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"storage",
|
"storage",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
|
"testnet_initial_state",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
@ -3844,6 +3845,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"testcontainers",
|
"testcontainers",
|
||||||
|
"testnet_initial_state",
|
||||||
"token_core",
|
"token_core",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
@ -7449,6 +7451,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"storage",
|
"storage",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
|
"testnet_initial_state",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
@ -7476,6 +7479,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
|
"testnet_initial_state",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -8179,6 +8183,17 @@ dependencies = [
|
|||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "testnet_initial_state"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"common",
|
||||||
|
"key_protocol",
|
||||||
|
"nssa",
|
||||||
|
"nssa_core",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.69"
|
version = "1.0.69"
|
||||||
@ -8976,6 +8991,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2",
|
"sha2",
|
||||||
|
"testnet_initial_state",
|
||||||
"token_core",
|
"token_core",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
|
|||||||
@ -33,6 +33,7 @@ members = [
|
|||||||
"examples/program_deployment/methods",
|
"examples/program_deployment/methods",
|
||||||
"examples/program_deployment/methods/guest",
|
"examples/program_deployment/methods/guest",
|
||||||
"bedrock_client",
|
"bedrock_client",
|
||||||
|
"testnet_initial_state",
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
@ -57,6 +58,7 @@ amm_core = { path = "programs/amm/core" }
|
|||||||
amm_program = { path = "programs/amm" }
|
amm_program = { path = "programs/amm" }
|
||||||
test_program_methods = { path = "test_program_methods" }
|
test_program_methods = { path = "test_program_methods" }
|
||||||
bedrock_client = { path = "bedrock_client" }
|
bedrock_client = { path = "bedrock_client" }
|
||||||
|
testnet_initial_state = { path = "testnet_initial_state" }
|
||||||
|
|
||||||
tokio = { version = "1.50", features = [
|
tokio = { version = "1.50", features = [
|
||||||
"net",
|
"net",
|
||||||
|
|||||||
@ -14,6 +14,7 @@ nssa.workspace = true
|
|||||||
nssa_core.workspace = true
|
nssa_core.workspace = true
|
||||||
storage.workspace = true
|
storage.workspace = true
|
||||||
key_protocol.workspace = true
|
key_protocol.workspace = true
|
||||||
|
testnet_initial_state.workspace = true
|
||||||
|
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
@ -29,4 +30,3 @@ async-stream.workspace = true
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile.workspace = true
|
tempfile.workspace = true
|
||||||
|
|
||||||
|
|||||||
@ -9,11 +9,9 @@ use anyhow::{Context as _, Result};
|
|||||||
pub use bedrock_client::BackoffConfig;
|
pub use bedrock_client::BackoffConfig;
|
||||||
use common::config::BasicAuth;
|
use common::config::BasicAuth;
|
||||||
use humantime_serde;
|
use humantime_serde;
|
||||||
use key_protocol::initial_state::{
|
|
||||||
PrivateAccountPublicInitialData, PublicAccountPublicInitialData,
|
|
||||||
};
|
|
||||||
pub use logos_blockchain_core::mantle::ops::channel::ChannelId;
|
pub use logos_blockchain_core::mantle::ops::channel::ChannelId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use testnet_initial_state::{PrivateAccountPublicInitialData, PublicAccountPublicInitialData};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|||||||
@ -6,13 +6,13 @@ use common::{
|
|||||||
HashType, PINATA_BASE58,
|
HashType, PINATA_BASE58,
|
||||||
block::{Block, HashableBlockData},
|
block::{Block, HashableBlockData},
|
||||||
};
|
};
|
||||||
use key_protocol::initial_state::initial_state_testnet;
|
|
||||||
use log::{debug, error, info};
|
use log::{debug, error, info};
|
||||||
use logos_blockchain_core::mantle::{
|
use logos_blockchain_core::mantle::{
|
||||||
Op, SignedMantleTx,
|
Op, SignedMantleTx,
|
||||||
ops::channel::{ChannelId, inscribe::InscriptionOp},
|
ops::channel::{ChannelId, inscribe::InscriptionOp},
|
||||||
};
|
};
|
||||||
use nssa::V02State;
|
use nssa::V02State;
|
||||||
|
use testnet_initial_state::initial_state_testnet;
|
||||||
|
|
||||||
use crate::{block_store::IndexerStore, config::IndexerConfig};
|
use crate::{block_store::IndexerStore, config::IndexerConfig};
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ impl IndexerCore {
|
|||||||
|
|
||||||
let initial_commitments: Option<Vec<nssa_core::Commitment>> = config
|
let initial_commitments: Option<Vec<nssa_core::Commitment>> = config
|
||||||
.initial_private_accounts
|
.initial_private_accounts
|
||||||
.clone()
|
.as_ref()
|
||||||
.map(|initial_commitments| {
|
.map(|initial_commitments| {
|
||||||
initial_commitments
|
initial_commitments
|
||||||
.iter()
|
.iter()
|
||||||
@ -78,7 +78,7 @@ impl IndexerCore {
|
|||||||
|
|
||||||
let init_accs: Option<Vec<(nssa::AccountId, u128)>> = config
|
let init_accs: Option<Vec<(nssa::AccountId, u128)>> = config
|
||||||
.initial_public_accounts
|
.initial_public_accounts
|
||||||
.clone()
|
.as_ref()
|
||||||
.map(|initial_accounts| {
|
.map(|initial_accounts| {
|
||||||
initial_accounts
|
initial_accounts
|
||||||
.iter()
|
.iter()
|
||||||
|
|||||||
@ -20,6 +20,7 @@ serde_json.workspace = true
|
|||||||
token_core.workspace = true
|
token_core.workspace = true
|
||||||
indexer_service_rpc.workspace = true
|
indexer_service_rpc.workspace = true
|
||||||
wallet-ffi.workspace = true
|
wallet-ffi.workspace = true
|
||||||
|
testnet_initial_state.workspace = true
|
||||||
|
|
||||||
url.workspace = true
|
url.workspace = true
|
||||||
|
|
||||||
|
|||||||
@ -3,16 +3,14 @@ use std::{net::SocketAddr, path::PathBuf, time::Duration};
|
|||||||
use anyhow::{Context as _, Result};
|
use anyhow::{Context as _, Result};
|
||||||
use bytesize::ByteSize;
|
use bytesize::ByteSize;
|
||||||
use indexer_service::{BackoffConfig, ChannelId, ClientConfig, IndexerConfig};
|
use indexer_service::{BackoffConfig, ChannelId, ClientConfig, IndexerConfig};
|
||||||
use key_protocol::{
|
use key_protocol::key_management::KeyChain;
|
||||||
initial_state::{
|
|
||||||
PrivateAccountPrivateInitialData, PrivateAccountPublicInitialData,
|
|
||||||
PublicAccountPrivateInitialData, PublicAccountPublicInitialData,
|
|
||||||
},
|
|
||||||
key_management::KeyChain,
|
|
||||||
};
|
|
||||||
use nssa::{Account, AccountId, PrivateKey, PublicKey};
|
use nssa::{Account, AccountId, PrivateKey, PublicKey};
|
||||||
use nssa_core::{account::Data, program::DEFAULT_PROGRAM_ID};
|
use nssa_core::{account::Data, program::DEFAULT_PROGRAM_ID};
|
||||||
use sequencer_core::config::{BedrockConfig, SequencerConfig};
|
use sequencer_core::config::{BedrockConfig, SequencerConfig};
|
||||||
|
use testnet_initial_state::{
|
||||||
|
PrivateAccountPrivateInitialData, PrivateAccountPublicInitialData,
|
||||||
|
PublicAccountPrivateInitialData, PublicAccountPublicInitialData,
|
||||||
|
};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use wallet::config::{InitialAccountData, WalletConfig};
|
use wallet::config::{InitialAccountData, WalletConfig};
|
||||||
|
|
||||||
|
|||||||
@ -20,17 +20,16 @@ pub struct SeedHolder {
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||||
/// Secret spending key object. Can produce `PrivateKeyHolder` objects.
|
/// Secret spending key object. Can produce `PrivateKeyHolder` objects.
|
||||||
pub struct SecretSpendingKey(pub(crate) [u8; 32]);
|
pub struct SecretSpendingKey(pub [u8; 32]);
|
||||||
|
|
||||||
pub type ViewingSecretKey = Scalar;
|
pub type ViewingSecretKey = Scalar;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
/// Private key holder. Produces public keys. Can produce `account_id`. Can produce shared secret
|
/// Private key holder. Produces public keys. Can produce `account_id`. Can produce shared secret
|
||||||
/// for recepient.
|
/// for recepient.
|
||||||
#[expect(clippy::partial_pub_fields, reason = "TODO: fix later")]
|
|
||||||
pub struct PrivateKeyHolder {
|
pub struct PrivateKeyHolder {
|
||||||
pub nullifier_secret_key: NullifierSecretKey,
|
pub nullifier_secret_key: NullifierSecretKey,
|
||||||
pub(crate) viewing_secret_key: ViewingSecretKey,
|
pub viewing_secret_key: ViewingSecretKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SeedHolder {
|
impl SeedHolder {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#![expect(clippy::print_stdout, reason = "TODO: fix later")]
|
#![expect(clippy::print_stdout, reason = "TODO: fix later")]
|
||||||
|
|
||||||
pub mod initial_state;
|
|
||||||
pub mod key_management;
|
pub mod key_management;
|
||||||
pub mod key_protocol_core;
|
pub mod key_protocol_core;
|
||||||
|
|||||||
@ -37,4 +37,4 @@ test-case = "3.3.1"
|
|||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
prove = ["risc0-zkvm/prove"]
|
prove = ["risc0-zkvm/prove"]
|
||||||
test-utils = []
|
test-utils = []
|
||||||
|
|||||||
@ -8,10 +8,12 @@ license = { workspace = true }
|
|||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nssa = { workspace = true, optional = true, features = ["test-utils"], default-features = true }
|
nssa = { workspace = true, optional = true, features = [
|
||||||
|
"test-utils",
|
||||||
|
], default-features = true }
|
||||||
nssa_core.workspace = true
|
nssa_core.workspace = true
|
||||||
token_core.workspace = true
|
token_core.workspace = true
|
||||||
amm_core.workspace = true
|
amm_core.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
nssa = ["dep:nssa"]
|
nssa = ["dep:nssa"]
|
||||||
|
|||||||
@ -15,6 +15,7 @@ storage.workspace = true
|
|||||||
mempool.workspace = true
|
mempool.workspace = true
|
||||||
bedrock_client.workspace = true
|
bedrock_client.workspace = true
|
||||||
key_protocol.workspace = true
|
key_protocol.workspace = true
|
||||||
|
testnet_initial_state.workspace = true
|
||||||
|
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
|
|||||||
@ -10,11 +10,9 @@ use bedrock_client::BackoffConfig;
|
|||||||
use bytesize::ByteSize;
|
use bytesize::ByteSize;
|
||||||
use common::config::BasicAuth;
|
use common::config::BasicAuth;
|
||||||
use humantime_serde;
|
use humantime_serde;
|
||||||
use key_protocol::initial_state::{
|
|
||||||
PrivateAccountPublicInitialData, PublicAccountPublicInitialData,
|
|
||||||
};
|
|
||||||
use logos_blockchain_core::mantle::ops::channel::ChannelId;
|
use logos_blockchain_core::mantle::ops::channel::ChannelId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use testnet_initial_state::{PrivateAccountPublicInitialData, PublicAccountPublicInitialData};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
// TODO: Provide default values
|
// TODO: Provide default values
|
||||||
|
|||||||
@ -10,13 +10,13 @@ use common::{
|
|||||||
transaction::NSSATransaction,
|
transaction::NSSATransaction,
|
||||||
};
|
};
|
||||||
use config::SequencerConfig;
|
use config::SequencerConfig;
|
||||||
use key_protocol::initial_state::initial_state;
|
|
||||||
use log::{error, info, warn};
|
use log::{error, info, warn};
|
||||||
use logos_blockchain_key_management_system_service::keys::{ED25519_SECRET_KEY_SIZE, Ed25519Key};
|
use logos_blockchain_key_management_system_service::keys::{ED25519_SECRET_KEY_SIZE, Ed25519Key};
|
||||||
use mempool::{MemPool, MemPoolHandle};
|
use mempool::{MemPool, MemPoolHandle};
|
||||||
#[cfg(feature = "mock")]
|
#[cfg(feature = "mock")]
|
||||||
pub use mock::SequencerCoreWithMockClients;
|
pub use mock::SequencerCoreWithMockClients;
|
||||||
use nssa::V02State;
|
use nssa::V02State;
|
||||||
|
use testnet_initial_state::initial_state;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
block_settlement_client::{BlockSettlementClient, BlockSettlementClientTrait, MsgId},
|
block_settlement_client::{BlockSettlementClient, BlockSettlementClientTrait, MsgId},
|
||||||
@ -386,9 +386,9 @@ mod tests {
|
|||||||
|
|
||||||
use bedrock_client::BackoffConfig;
|
use bedrock_client::BackoffConfig;
|
||||||
use common::{test_utils::sequencer_sign_key_for_testing, transaction::NSSATransaction};
|
use common::{test_utils::sequencer_sign_key_for_testing, transaction::NSSATransaction};
|
||||||
use key_protocol::initial_state::{initial_accounts, initial_pub_accounts_private_keys};
|
|
||||||
use logos_blockchain_core::mantle::ops::channel::ChannelId;
|
use logos_blockchain_core::mantle::ops::channel::ChannelId;
|
||||||
use mempool::MemPoolHandle;
|
use mempool::MemPoolHandle;
|
||||||
|
use testnet_initial_state::{initial_accounts, initial_pub_accounts_private_keys};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{BedrockConfig, SequencerConfig},
|
config::{BedrockConfig, SequencerConfig},
|
||||||
|
|||||||
@ -14,6 +14,7 @@ mempool.workspace = true
|
|||||||
sequencer_core = { workspace = true }
|
sequencer_core = { workspace = true }
|
||||||
bedrock_client.workspace = true
|
bedrock_client.workspace = true
|
||||||
key_protocol.workspace = true
|
key_protocol.workspace = true
|
||||||
|
testnet_initial_state.workspace = true
|
||||||
|
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
|||||||
@ -23,13 +23,13 @@ use common::{
|
|||||||
transaction::{NSSATransaction, TransactionMalformationError},
|
transaction::{NSSATransaction, TransactionMalformationError},
|
||||||
};
|
};
|
||||||
use itertools::Itertools as _;
|
use itertools::Itertools as _;
|
||||||
use key_protocol::initial_state::initial_accounts;
|
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use nssa::{self, program::Program};
|
use nssa::{self, program::Program};
|
||||||
use sequencer_core::{
|
use sequencer_core::{
|
||||||
block_settlement_client::BlockSettlementClientTrait, indexer_client::IndexerClientTrait,
|
block_settlement_client::BlockSettlementClientTrait, indexer_client::IndexerClientTrait,
|
||||||
};
|
};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
use testnet_initial_state::initial_accounts;
|
||||||
|
|
||||||
use super::{JsonHandler, respond, types::err_rpc::RpcErr};
|
use super::{JsonHandler, respond, types::err_rpc::RpcErr};
|
||||||
|
|
||||||
@ -342,13 +342,13 @@ mod tests {
|
|||||||
use common::{
|
use common::{
|
||||||
config::BasicAuth, test_utils::sequencer_sign_key_for_testing, transaction::NSSATransaction,
|
config::BasicAuth, test_utils::sequencer_sign_key_for_testing, transaction::NSSATransaction,
|
||||||
};
|
};
|
||||||
use key_protocol::initial_state::{initial_accounts, initial_pub_accounts_private_keys};
|
|
||||||
use sequencer_core::{
|
use sequencer_core::{
|
||||||
config::{BedrockConfig, SequencerConfig},
|
config::{BedrockConfig, SequencerConfig},
|
||||||
mock::{MockBlockSettlementClient, MockIndexerClient, SequencerCoreWithMockClients},
|
mock::{MockBlockSettlementClient, MockIndexerClient, SequencerCoreWithMockClients},
|
||||||
};
|
};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
use testnet_initial_state::{initial_accounts, initial_pub_accounts_private_keys};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
use crate::rpc_handler;
|
use crate::rpc_handler;
|
||||||
|
|||||||
16
testnet_initial_state/Cargo.toml
Normal file
16
testnet_initial_state/Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[package]
|
||||||
|
name = "testnet_initial_state"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
license.workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
key_protocol.workspace = true
|
||||||
|
nssa.workspace = true
|
||||||
|
nssa_core.workspace = true
|
||||||
|
common.workspace = true
|
||||||
|
|
||||||
|
serde.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
@ -1,12 +1,11 @@
|
|||||||
use common::PINATA_BASE58;
|
use common::PINATA_BASE58;
|
||||||
use nssa::{Account, AccountId, Data, PrivateKey, PublicKey, V02State};
|
use key_protocol::key_management::{
|
||||||
use nssa_core::{NullifierPublicKey, encryption::shared_key_derivation::Secp256k1Point};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use crate::key_management::{
|
|
||||||
KeyChain,
|
KeyChain,
|
||||||
secret_holders::{PrivateKeyHolder, SecretSpendingKey},
|
secret_holders::{PrivateKeyHolder, SecretSpendingKey},
|
||||||
};
|
};
|
||||||
|
use nssa::{Account, AccountId, Data, PrivateKey, PublicKey, V02State};
|
||||||
|
use nssa_core::{NullifierPublicKey, encryption::shared_key_derivation::Secp256k1Point};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
const PRIVATE_KEY_PUB_ACC_A: [u8; 32] = [
|
const PRIVATE_KEY_PUB_ACC_A: [u8; 32] = [
|
||||||
16, 162, 106, 154, 236, 125, 52, 184, 35, 100, 238, 174, 69, 197, 41, 77, 187, 10, 118, 75, 0,
|
16, 162, 106, 154, 236, 125, 52, 184, 35, 100, 238, 174, 69, 197, 41, 77, 187, 10, 118, 75, 0,
|
||||||
@ -14,6 +14,7 @@ common.workspace = true
|
|||||||
key_protocol.workspace = true
|
key_protocol.workspace = true
|
||||||
token_core.workspace = true
|
token_core.workspace = true
|
||||||
amm_core.workspace = true
|
amm_core.workspace = true
|
||||||
|
testnet_initial_state.workspace = true
|
||||||
|
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
|||||||
@ -99,39 +99,24 @@ impl WalletChainStore {
|
|||||||
let mut public_init_acc_map = BTreeMap::new();
|
let mut public_init_acc_map = BTreeMap::new();
|
||||||
let mut private_init_acc_map = BTreeMap::new();
|
let mut private_init_acc_map = BTreeMap::new();
|
||||||
|
|
||||||
// If initial accounts are present in config, need to construct state from them
|
let initial_accounts = config
|
||||||
if let Some(initial_accounts) = config.initial_accounts.clone() {
|
.initial_accounts
|
||||||
for init_acc_data in initial_accounts {
|
.clone()
|
||||||
match init_acc_data {
|
.unwrap_or_else(InitialAccountData::create_initial_accounts_data);
|
||||||
InitialAccountData::Public(data) => {
|
|
||||||
public_init_acc_map.insert(data.account_id, data.pub_sign_key);
|
for init_acc_data in initial_accounts {
|
||||||
}
|
match init_acc_data {
|
||||||
InitialAccountData::Private(data) => {
|
InitialAccountData::Public(data) => {
|
||||||
let mut account = data.account;
|
public_init_acc_map.insert(data.account_id, data.pub_sign_key);
|
||||||
// TODO: Program owner is only known after code is compiled and can't be set
|
|
||||||
// in the config. Therefore we overwrite it here on
|
|
||||||
// startup. Fix this when program id can be fetched
|
|
||||||
// from the node and queried from the wallet.
|
|
||||||
account.program_owner = Program::authenticated_transfer_program().id();
|
|
||||||
private_init_acc_map.insert(data.account_id, (data.key_chain, account));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
InitialAccountData::Private(data) => {
|
||||||
} else {
|
let mut account = data.account;
|
||||||
for init_acc_data in InitialAccountData::create_initial_accounts_data() {
|
// TODO: Program owner is only known after code is compiled and can't be set
|
||||||
match init_acc_data {
|
// in the config. Therefore we overwrite it here on
|
||||||
InitialAccountData::Public(data) => {
|
// startup. Fix this when program id can be fetched
|
||||||
public_init_acc_map.insert(data.account_id, data.pub_sign_key);
|
// from the node and queried from the wallet.
|
||||||
}
|
account.program_owner = Program::authenticated_transfer_program().id();
|
||||||
InitialAccountData::Private(data) => {
|
private_init_acc_map.insert(data.account_id, (data.key_chain, account));
|
||||||
let mut account = data.account;
|
|
||||||
// TODO: Program owner is only known after code is compiled and can't be set
|
|
||||||
// in the config. Therefore we overwrite it here on
|
|
||||||
// startup. Fix this when program id can be fetched
|
|
||||||
// from the node and queried from the wallet.
|
|
||||||
account.program_owner = Program::authenticated_transfer_program().id();
|
|
||||||
private_init_acc_map.insert(data.account_id, (data.key_chain, account));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,7 +69,17 @@ impl WalletSubcommand for ConfigSubcommand {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
"initial_accounts" => {
|
"initial_accounts" => {
|
||||||
println!("{:#?}", InitialAccountData::create_initial_accounts_data());
|
println!(
|
||||||
|
"{:#?}",
|
||||||
|
wallet_core
|
||||||
|
.storage
|
||||||
|
.wallet_config
|
||||||
|
.initial_accounts
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_else(
|
||||||
|
InitialAccountData::create_initial_accounts_data
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
"basic_auth" => {
|
"basic_auth" => {
|
||||||
if let Some(basic_auth) = &wallet_core.storage.wallet_config.basic_auth
|
if let Some(basic_auth) = &wallet_core.storage.wallet_config.basic_auth
|
||||||
|
|||||||
@ -8,17 +8,15 @@ use std::{
|
|||||||
use anyhow::{Context as _, Result};
|
use anyhow::{Context as _, Result};
|
||||||
use common::config::BasicAuth;
|
use common::config::BasicAuth;
|
||||||
use humantime_serde;
|
use humantime_serde;
|
||||||
use key_protocol::{
|
use key_protocol::key_management::key_tree::{
|
||||||
initial_state::{
|
chain_index::ChainIndex, keys_private::ChildKeysPrivate, keys_public::ChildKeysPublic,
|
||||||
PrivateAccountPrivateInitialData, PublicAccountPrivateInitialData,
|
|
||||||
initial_priv_accounts_private_keys, initial_pub_accounts_private_keys,
|
|
||||||
},
|
|
||||||
key_management::key_tree::{
|
|
||||||
chain_index::ChainIndex, keys_private::ChildKeysPrivate, keys_public::ChildKeysPublic,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use testnet_initial_state::{
|
||||||
|
PrivateAccountPrivateInitialData, PublicAccountPrivateInitialData,
|
||||||
|
initial_priv_accounts_private_keys, initial_pub_accounts_private_keys,
|
||||||
|
};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|||||||
@ -2,14 +2,12 @@ use std::{collections::HashMap, path::PathBuf, str::FromStr as _};
|
|||||||
|
|
||||||
use anyhow::{Context as _, Result};
|
use anyhow::{Context as _, Result};
|
||||||
use base58::ToBase58 as _;
|
use base58::ToBase58 as _;
|
||||||
use key_protocol::{
|
use key_protocol::key_protocol_core::NSSAUserData;
|
||||||
initial_state::{PrivateAccountPrivateInitialData, PublicAccountPrivateInitialData},
|
|
||||||
key_protocol_core::NSSAUserData,
|
|
||||||
};
|
|
||||||
use nssa::Account;
|
use nssa::Account;
|
||||||
use nssa_core::account::Nonce;
|
use nssa_core::account::Nonce;
|
||||||
use rand::{RngCore as _, rngs::OsRng};
|
use rand::{RngCore as _, rngs::OsRng};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
use testnet_initial_state::{PrivateAccountPrivateInitialData, PublicAccountPrivateInitialData};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
HOME_DIR_ENV_VAR,
|
HOME_DIR_ENV_VAR,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user