serai/coins/monero/tests/scan.rs

306 lines
9.3 KiB
Rust
Raw Normal View History

Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
use rand::RngCore;
use monero_serai::{
transaction::Transaction,
wallet::{address::SubaddressIndex, extra::PaymentId},
};
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
mod runner;
test!(
scan_standard_address,
(
|_, mut builder: Builder, _| async move {
let view = runner::random_address().1;
let scanner = Scanner::from_view(view.clone(), Some(HashSet::new()));
builder.add_payment(view.address(Network::Mainnet, AddressSpec::Standard), 5);
(builder.build().unwrap(), scanner)
},
|_, tx: Transaction, _, mut state: Scanner| async move {
let output = state.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
let dummy_payment_id = PaymentId::Encrypted([0u8; 8]);
assert_eq!(output.metadata.payment_id, Some(dummy_payment_id));
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
},
),
);
test!(
scan_subaddress,
(
|_, mut builder: Builder, _| async move {
2023-01-07 09:44:23 +00:00
let subaddress = SubaddressIndex::new(0, 1).unwrap();
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
let view = runner::random_address().1;
let mut scanner = Scanner::from_view(view.clone(), Some(HashSet::new()));
scanner.register_subaddress(subaddress);
2023-01-07 09:44:23 +00:00
builder.add_payment(view.address(Network::Mainnet, AddressSpec::Subaddress(subaddress)), 5);
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
(builder.build().unwrap(), (scanner, subaddress))
},
2023-01-07 09:44:23 +00:00
|_, tx: Transaction, _, mut state: (Scanner, SubaddressIndex)| async move {
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
let output = state.0.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
2023-01-07 09:44:23 +00:00
assert_eq!(output.metadata.subaddress, Some(state.1));
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
},
),
);
test!(
scan_integrated_address,
(
|_, mut builder: Builder, _| async move {
let view = runner::random_address().1;
let scanner = Scanner::from_view(view.clone(), Some(HashSet::new()));
let mut payment_id = [0u8; 8];
OsRng.fill_bytes(&mut payment_id);
builder.add_payment(view.address(Network::Mainnet, AddressSpec::Integrated(payment_id)), 5);
(builder.build().unwrap(), (scanner, payment_id))
},
|_, tx: Transaction, _, mut state: (Scanner, [u8; 8])| async move {
let output = state.0.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
assert_eq!(output.metadata.payment_id, Some(PaymentId::Encrypted(state.1)));
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
},
),
);
test!(
scan_featured_standard,
(
|_, mut builder: Builder, _| async move {
let view = runner::random_address().1;
let scanner = Scanner::from_view(view.clone(), Some(HashSet::new()));
builder.add_payment(
view.address(
Network::Mainnet,
AddressSpec::Featured { subaddress: None, payment_id: None, guaranteed: false },
),
5,
);
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
(builder.build().unwrap(), scanner)
},
|_, tx: Transaction, _, mut state: Scanner| async move {
let output = state.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
},
),
);
test!(
scan_featured_subaddress,
(
|_, mut builder: Builder, _| async move {
2023-01-07 09:44:23 +00:00
let subaddress = SubaddressIndex::new(0, 2).unwrap();
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
let view = runner::random_address().1;
let mut scanner = Scanner::from_view(view.clone(), Some(HashSet::new()));
scanner.register_subaddress(subaddress);
builder.add_payment(
view.address(
Network::Mainnet,
AddressSpec::Featured {
subaddress: Some(subaddress),
payment_id: None,
guaranteed: false,
},
),
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
5,
);
(builder.build().unwrap(), (scanner, subaddress))
},
2023-01-07 09:44:23 +00:00
|_, tx: Transaction, _, mut state: (Scanner, SubaddressIndex)| async move {
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
let output = state.0.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
2023-01-07 09:44:23 +00:00
assert_eq!(output.metadata.subaddress, Some(state.1));
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
},
),
);
test!(
scan_featured_integrated,
(
|_, mut builder: Builder, _| async move {
let view = runner::random_address().1;
let scanner = Scanner::from_view(view.clone(), Some(HashSet::new()));
let mut payment_id = [0u8; 8];
OsRng.fill_bytes(&mut payment_id);
builder.add_payment(
view.address(
Network::Mainnet,
AddressSpec::Featured {
subaddress: None,
payment_id: Some(payment_id),
guaranteed: false,
},
),
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
5,
);
(builder.build().unwrap(), (scanner, payment_id))
},
|_, tx: Transaction, _, mut state: (Scanner, [u8; 8])| async move {
let output = state.0.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
assert_eq!(output.metadata.payment_id, Some(PaymentId::Encrypted(state.1)));
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
},
),
);
test!(
scan_featured_integrated_subaddress,
(
|_, mut builder: Builder, _| async move {
2023-01-07 09:44:23 +00:00
let subaddress = SubaddressIndex::new(0, 3).unwrap();
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
let view = runner::random_address().1;
let mut scanner = Scanner::from_view(view.clone(), Some(HashSet::new()));
scanner.register_subaddress(subaddress);
let mut payment_id = [0u8; 8];
OsRng.fill_bytes(&mut payment_id);
builder.add_payment(
view.address(
Network::Mainnet,
AddressSpec::Featured {
subaddress: Some(subaddress),
payment_id: Some(payment_id),
guaranteed: false,
},
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
),
5,
);
(builder.build().unwrap(), (scanner, payment_id, subaddress))
},
2023-01-07 09:44:23 +00:00
|_, tx: Transaction, _, mut state: (Scanner, [u8; 8], SubaddressIndex)| async move {
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
let output = state.0.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
assert_eq!(output.metadata.payment_id, Some(PaymentId::Encrypted(state.1)));
2023-01-07 09:44:23 +00:00
assert_eq!(output.metadata.subaddress, Some(state.2));
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
},
),
);
test!(
scan_guaranteed_standard,
(
|_, mut builder: Builder, _| async move {
let view = runner::random_address().1;
let scanner = Scanner::from_view(view.clone(), None);
builder.add_payment(
view.address(
Network::Mainnet,
AddressSpec::Featured { subaddress: None, payment_id: None, guaranteed: true },
),
5,
);
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
(builder.build().unwrap(), scanner)
},
|_, tx: Transaction, _, mut state: Scanner| async move {
let output = state.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
},
),
);
test!(
scan_guaranteed_subaddress,
(
|_, mut builder: Builder, _| async move {
2023-01-07 09:44:23 +00:00
let subaddress = SubaddressIndex::new(1, 0).unwrap();
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
let view = runner::random_address().1;
let mut scanner = Scanner::from_view(view.clone(), None);
scanner.register_subaddress(subaddress);
builder.add_payment(
view.address(
Network::Mainnet,
AddressSpec::Featured {
subaddress: Some(subaddress),
payment_id: None,
guaranteed: true,
},
),
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
5,
);
(builder.build().unwrap(), (scanner, subaddress))
},
2023-01-07 09:44:23 +00:00
|_, tx: Transaction, _, mut state: (Scanner, SubaddressIndex)| async move {
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
let output = state.0.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
2023-01-07 09:44:23 +00:00
assert_eq!(output.metadata.subaddress, Some(state.1));
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
},
),
);
test!(
scan_guaranteed_integrated,
(
|_, mut builder: Builder, _| async move {
let view = runner::random_address().1;
let scanner = Scanner::from_view(view.clone(), None);
let mut payment_id = [0u8; 8];
OsRng.fill_bytes(&mut payment_id);
builder.add_payment(
view.address(
Network::Mainnet,
AddressSpec::Featured {
subaddress: None,
payment_id: Some(payment_id),
guaranteed: true,
},
),
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
5,
);
(builder.build().unwrap(), (scanner, payment_id))
},
|_, tx: Transaction, _, mut state: (Scanner, [u8; 8])| async move {
let output = state.0.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
assert_eq!(output.metadata.payment_id, Some(PaymentId::Encrypted(state.1)));
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
},
),
);
test!(
scan_guaranteed_integrated_subaddress,
(
|_, mut builder: Builder, _| async move {
2023-01-07 09:44:23 +00:00
let subaddress = SubaddressIndex::new(1, 1).unwrap();
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
let view = runner::random_address().1;
let mut scanner = Scanner::from_view(view.clone(), None);
scanner.register_subaddress(subaddress);
let mut payment_id = [0u8; 8];
OsRng.fill_bytes(&mut payment_id);
builder.add_payment(
view.address(
Network::Mainnet,
AddressSpec::Featured {
subaddress: Some(subaddress),
payment_id: Some(payment_id),
guaranteed: true,
},
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
),
5,
);
(builder.build().unwrap(), (scanner, payment_id, subaddress))
},
2023-01-07 09:44:23 +00:00
|_, tx: Transaction, _, mut state: (Scanner, [u8; 8], SubaddressIndex)| async move {
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
let output = state.0.scan_transaction(&tx).not_locked().swap_remove(0);
assert_eq!(output.commitment().amount, 5);
assert_eq!(output.metadata.payment_id, Some(PaymentId::Encrypted(state.1)));
2023-01-07 09:44:23 +00:00
assert_eq!(output.metadata.subaddress, Some(state.2));
Squashed commit of the following: commit e0a9e8825d6c22c797fb84e26ed6ef10136ca9c2 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 04:24:08 2023 -0500 Remove Scanner::address It either needed to return an Option, panic on misconfiguration, or return a distinct Scanner type based on burning bug immunity to offer this API properly. Panicking wouldn't be proper, and the Option<Address> would've been... awkward. The new register_subaddress function, maintaining the needed functionality, also provides further clarity on the intended side effect of the previously present Scanner::address function. commit 7359360ab2fc8c9255c6f58250c214252ce217a4 Author: Luke Parker <lukeparker5132@gmail.com> Date: Fri Jan 6 01:35:02 2023 -0500 fmt/clippy from last commit commit 80d912fc19cd268f3b019a9d9961a48b2c45e828 Author: Luke Parker <lukeparker5132@gmail.com> Date: Thu Jan 5 19:36:49 2023 -0500 Add Substrate "assets" pallet While over-engineered for our purposes, it's still usable. Also cleans the runtime a bit. commit 2ed2944b6598d75bdc3c995aaf39b717846207de Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 23:09:58 2023 -0500 Remove the timestamp pallet It was needed for contracts, which has since been removed. We now no longer need it. commit 7fc1fc2dccecebe1d94cb7b4c00f2b5cb271c87b Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 22:52:41 2023 -0500 Initial validator sets pallet (#187) * Initial work on a Validator Sets pallet * Update Validator Set docs per current discussions * Update validator-sets primitives and storage handling * Add validator set pallets to deny.toml * Remove Curve from primitives Since we aren't reusing keys across coins, there's no reason for it to be on-chain (as previously planned). * Update documentation on Validator Sets * Use Twox64Concat instead of Identity Ensures an even distribution of keys. While xxhash is breakable, these keys aren't manipulatable by users. * Add math ops on Amount and define a coin as 1e8 * Add validator-sets to the runtime and remove contracts Also removes the randomness pallet which was only required by the contracts runtime. Does not remove the contracts folder yet so they can still be referred to while validator-sets is under development. Does remove them from Cargo.toml. * Add vote function to validator-sets * Remove contracts folder * Create an event for the Validator Sets pallet * Remove old contracts crates from deny.toml * Remove line from staking branch * Remove staking from runtime * Correct VS Config in runtime * cargo update * Resolve a few PR comments on terminology * Create a serai-primitives crate Move types such as Amount/Coin out of validator-sets. Will be expanded in the future. * Fixes for last commit * Don't reserve set 0 * Further fixes * Add files meant for last commit * Remove Staking transfer commit 3309295911d22177bd68972d138aea2f8658eb5f Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:17:00 2023 -0500 Reorder coins in README by market cap commit db5d19cad33ccf067d876b7f5b7cca47c228e2fc Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 06:07:58 2023 -0500 Update README commit 606484d744b1c6cc408382994c77f1def25d3e7d Author: Luke Parker <lukeparker5132@gmail.com> Date: Wed Jan 4 03:17:36 2023 -0500 cargo update commit 3a319b229fabd110cc28e5cc0cf718aa88b908bf Author: akildemir <aeg_asd@hotmail.com> Date: Wed Jan 4 16:26:25 2023 +0300 update address public API design commit d9fa88fa76eb361da79f81a1f7758ad19432aca7 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 13:35:06 2023 +0300 fix clippy error commit cc722e897b34afc1e517ece2fc5020d190d97804 Merge: cafa9b3 eeca440 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:39:04 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit cafa9b361e16a37981d45bf3031573c7bc48c5a0 Author: akildemir <aeg_asd@hotmail.com> Date: Mon Jan 2 11:38:26 2023 +0300 fix build errors commit ce5b5f2b37e7cc5a8ca84cbe64e3cefdbf0fe104 Merge: f502d67 49c4acf Author: akildemir <aeg_asd@hotmail.com> Date: Sun Jan 1 15:16:25 2023 +0300 Merge https://github.com/serai-dex/serai into develop commit f502d67282fe4951e3756f041e240c089a945a85 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:13:09 2022 +0300 fix pr issues commit 26ffb226d457ebf0d2f222c4ee6608971b4a8ffc Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 22 13:11:43 2022 +0300 remove extraneous rpc call commit 0e829f853151c06c54d9077b2477e59ac7a1e6e4 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:53 2022 +0300 add scan tests commit 5123c7f121a6823d5e03eeae7eff024a6b6d38c8 Author: akildemir <aeg_asd@hotmail.com> Date: Thu Dec 15 13:56:13 2022 +0300 add new address functions & comments
2023-01-06 09:33:17 +00:00
},
),
);