Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps-dev): bump postcss from 8.4.28 to 8.4.31 in /website #759

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ version = "0.3.64"
features = [
"Url",
"Navigator",
"Window",
]

[dev-dependencies.wasm-bindgen-test]
Expand Down
3 changes: 2 additions & 1 deletion wasm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ use walkdir::WalkDir;
const EXPECTED_LICENSE_TEXT: &[u8] = include_bytes!("../.resources/license_header");

// The following directories will be excluded from the license scan.
const DIRS_TO_SKIP: [&str; 9] = [".cargo", ".circleci", ".git", ".github", ".resources", "examples", "sdk", "target", "node_modules"];
const DIRS_TO_SKIP: [&str; 9] =
[".cargo", ".circleci", ".git", ".github", ".resources", "examples", "sdk", "target", "node_modules"];

fn check_file_licenses<P: AsRef<Path>>(path: P) {
let path = path.as_ref();
Expand Down
6 changes: 1 addition & 5 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ impl Credits for RecordPlaintextNative {
}
}


#[cfg(not(test))]
pub use thread_pool::initialize_worker;

Expand All @@ -215,10 +214,7 @@ pub use thread_pool::initialize_worker;
pub async fn init_thread_pool(url: web_sys::Url, num_threads: usize) -> Result<(), JsValue> {
console_error_panic_hook::set_once();

ThreadPool::builder()
.url(url)
.num_threads(num_threads)
.build_global().await?;
ThreadPool::builder().url(url).num_threads(num_threads).build_global().await?;

Ok(())
}
2 changes: 1 addition & 1 deletion wasm/src/programs/manager/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl ProgramManager {
// Convert fee to microcredits and check that the fee record has enough credits to pay it
let fee_microcredits = match &fee_record {
Some(fee_record) => Self::validate_amount(fee_credits, fee_record, true)?,
None => (fee_credits as u64) * 1_000_000,
None => (fee_credits * 1_000_000.0) as u64,
};

let mut new_process;
Expand Down
2 changes: 1 addition & 1 deletion wasm/src/programs/manager/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl ProgramManager {
log(&format!("Executing function: {function} on-chain"));
let fee_microcredits = match &fee_record {
Some(fee_record) => Self::validate_amount(fee_credits, fee_record, true)?,
None => (fee_credits as u64) * 1_000_000,
None => (fee_credits * 1_000_000.0) as u64,
};

let mut new_process;
Expand Down
2 changes: 1 addition & 1 deletion wasm/src/programs/manager/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl ProgramManager {
log("Executing join program");
let fee_microcredits = match &fee_record {
Some(fee_record) => Self::validate_amount(fee_credits, fee_record, true)?,
None => (fee_credits as u64) * 1_000_000,
None => (fee_credits * 1_000_000.0) as u64,
};
let rng = &mut StdRng::from_entropy();

Expand Down
4 changes: 2 additions & 2 deletions wasm/src/programs/manager/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ impl ProgramManager {
log("Executing transfer program");
let fee_microcredits = match &fee_record {
Some(fee_record) => Self::validate_amount(fee_credits, fee_record, true)?,
None => (fee_credits as u64) * 1_000_000,
None => (fee_credits * 1_000_000.0) as u64,
};
let amount_microcredits = match &amount_record {
Some(amount_record) => Self::validate_amount(amount_credits, amount_record, true)?,
None => (fee_credits as u64) * 1_000_000,
None => (amount_credits * 1_000_000.0) as u64,
};

log("Setup the program and inputs");
Expand Down
43 changes: 14 additions & 29 deletions wasm/src/thread_pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with the Aleo SDK library. If not, see <https://www.gnu.org/licenses/>.

use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::JsFuture;
use rayon::ThreadBuilder;
use futures::future::try_join_all;
use rayon::ThreadBuilder;
use spmc::{channel, Receiver, Sender};
use std::future::Future;
use spmc::{channel, Sender, Receiver};

use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::JsFuture;

#[wasm_bindgen(inline_js = r###"
export function spawnWorker(url, module, memory, address) {
Expand Down Expand Up @@ -54,7 +53,6 @@ extern "C" {
) -> js_sys::Promise;
}


async fn spawn_workers(url: web_sys::Url, num_threads: usize) -> Result<Sender<ThreadBuilder>, JsValue> {
let module = wasm_bindgen::module();
let memory = wasm_bindgen::memory();
Expand All @@ -63,9 +61,8 @@ async fn spawn_workers(url: web_sys::Url, num_threads: usize) -> Result<Sender<T

let receiver = Box::leak(Box::new(receiver));

let workers = try_join_all((0..num_threads).map(|_| {
JsFuture::from(spawn_worker(&url, &module, &memory, receiver))
})).await?;
let workers =
try_join_all((0..num_threads).map(|_| JsFuture::from(spawn_worker(&url, &module, &memory, receiver)))).await?;

// Needed to work around a Firefox bug where Workers get garbage collected too early
// https://bugzilla.mozilla.org/show_bug.cgi?id=1592227
Expand All @@ -78,12 +75,7 @@ async fn spawn_local_thread_pool(url: web_sys::Url, num_threads: usize) -> Resul
let pool;

if num_threads == 1 {
pool = rayon::ThreadPoolBuilder::new()
.num_threads(1)
.use_current_thread()
.build()
.unwrap_throw();

pool = rayon::ThreadPoolBuilder::new().num_threads(1).use_current_thread().build().unwrap_throw();
} else {
let mut sender = spawn_workers(url, num_threads).await?;

Expand All @@ -102,12 +94,7 @@ async fn spawn_local_thread_pool(url: web_sys::Url, num_threads: usize) -> Resul

async fn spawn_global_thread_pool(url: web_sys::Url, num_threads: usize) -> Result<(), JsValue> {
if num_threads == 1 {
rayon::ThreadPoolBuilder::new()
.num_threads(1)
.use_current_thread()
.build_global()
.unwrap_throw();

rayon::ThreadPoolBuilder::new().num_threads(1).use_current_thread().build_global().unwrap_throw();
} else {
let mut sender = spawn_workers(url, num_threads).await?;

Expand All @@ -124,18 +111,14 @@ async fn spawn_global_thread_pool(url: web_sys::Url, num_threads: usize) -> Resu
Ok(())
}


pub struct ThreadPool {
url: Option<web_sys::Url>,
num_threads: Option<usize>,
}

impl ThreadPool {
pub fn builder() -> Self {
Self {
url: None,
num_threads: None,
}
Self { url: None, num_threads: None }
}

pub fn url(mut self, url: web_sys::Url) -> Self {
Expand All @@ -151,7 +134,6 @@ impl ThreadPool {
fn defaults(self) -> (web_sys::Url, usize) {
(
self.url.expect("Missing url for ThreadPool"),

self.num_threads.unwrap_or_else(|| {
let window: web_sys::Window = js_sys::global().unchecked_into();
window.navigator().hardware_concurrency() as usize
Expand All @@ -171,9 +153,12 @@ impl ThreadPool {
}
}


#[wasm_bindgen(js_name = initializeWorker)]
pub fn initialize_worker(receiver: *const Receiver<ThreadBuilder>) where Receiver<ThreadBuilder>: Sync {
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn initialize_worker(receiver: *const Receiver<ThreadBuilder>)
where
Receiver<ThreadBuilder>: Sync,
{
// This is safe because it uses `Box::leak` so the Receiver lives forever
let receiver = unsafe { &*receiver };
receiver.recv().unwrap_throw().run();
Expand Down
24 changes: 12 additions & 12 deletions website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"preview": "vite preview"
},
"dependencies": {
"@aleohq/sdk": "0.5.11",
"@aleohq/sdk": "0.5.12",
"@ant-design/icons": "^4.4.0",
"@codemirror/language": "^6.8.0",
"@codemirror/legacy-modes": "^6.3.3",
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/develop/Deploy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Deploy = () => {

const [form] = Form.useForm();
const [deploymentFeeRecord, setDeploymentFeeRecord] = useState(null);
const [deployUrl, setDeployUrl] = useState("https://vm.aleo.org/api");
const [deployUrl, setDeployUrl] = useState("https://api.explorer.aleo.org/v1");
const [deploymentFee, setDeploymentFee] = useState("1");
const [loading, setLoading] = useState(false);
const [feeLoading, setFeeLoading] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/develop/ExecuteLegacy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useAleoWASM } from "../../aleo-wasm-hook";

export const ExecuteLegacy = () => {
const [executionFeeRecord, setExecutionFeeRecord] = useState(null);
const [executeUrl, setExecuteUrl] = useState("https://vm.aleo.org/api");
const [executeUrl, setExecuteUrl] = useState("https://api.explorer.aleo.org/v1");
const [functionID, setFunctionID] = useState(null);
const [executionFee, setExecutionFee] = useState("1");
const [inputs, setInputs] = useState(null);
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/develop/Join.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const Join = () => {
const [joinFeeRecord, setJoinFeeRecord] = useState(null);
const [recordOne, setRecordOne] = useState(null);
const [recordTwo, setRecordTwo] = useState(null);
const [joinUrl, setJoinUrl] = useState("https://vm.aleo.org/api");
const [joinUrl, setJoinUrl] = useState("https://api.explorer.aleo.org/v1");
const [joinFee, setJoinFee] = useState("1.0");
const [privateFee, setPrivateFee] = useState(true);
const [loading, setLoading] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/develop/Split.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import axios from "axios";

export const Split = () => {
const [amountRecord, setAmountRecord] = useState(null);
const [splitUrl, setSplitUrl] = useState("https://vm.aleo.org/api");
const [splitUrl, setSplitUrl] = useState("https://api.explorer.aleo.org/v1");
const [splitAmount, setSplitAmount] = useState("1.0");
const [loading, setLoading] = useState(false);
const [privateKey, setPrivateKey] = useState(null);
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/develop/Transfer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import axios from "axios";
export const Transfer = () => {
const [transferFeeRecord, setTransferFeeRecord] = useState(null);
const [amountRecord, setAmountRecord] = useState(null);
const [transferUrl, setTransferUrl] = useState("https://vm.aleo.org/api");
const [transferUrl, setTransferUrl] = useState("https://api.explorer.aleo.org/v1");
const [transferAmount, setTransferAmount] = useState("1.0");
const [transferFee, setTransferFee] = useState("1.0");
const [privateFee, setPrivateFee] = useState(true);
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/develop/execute/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export const Execute = () => {
<Form.Item
label="Peer URL"
name="peer_url"
initialValue="https://vm.aleo.org/api"
initialValue="https://api.explorer.aleo.org/v1"
hidden={!getFieldValue("execute_onchain")}
>
<Input />
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/rest/GetBlockByHash.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const GetBlockByHash = () => {
try {
if (hash) {
axios
.get(`https://vm.aleo.org/api/testnet3/block/${hash}`)
.get(`https://api.explorer.aleo.org/v1/testnet3/block/${hash}`)
.then((response) => {
setBlockByHash(JSON.stringify(response.data, null, 2));
setStatus("success");
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/rest/GetBlockByHeight.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const GetBlockByHeight = () => {
try {
if (height) {
axios
.get(`https://vm.aleo.org/api/testnet3/block/${height}`)
.get(`https://api.explorer.aleo.org/v1/testnet3/block/${height}`)
.then((response) => {
setBlockByHeight(
JSON.stringify(response.data, null, 2),
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/rest/GetLatestBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const GetLatestBlock = () => {
setLatestBlock(null);
try {
axios
.get(`https://vm.aleo.org/api/testnet3/latest/block`)
.get(`https://api.explorer.aleo.org/v1/testnet3/latest/block`)
.then((response) =>
setLatestBlock(JSON.stringify(response.data, null, 2)),
);
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/rest/GetLatestBlockHeight.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const GetLatestBlockHeight = () => {
setLatestHeight(null);
try {
axios
.get(`https://vm.aleo.org/api/testnet3/latest/height`)
.get(`https://api.explorer.aleo.org/v1/testnet3/latest/height`)
.then((response) =>
setLatestHeight(JSON.stringify(response.data, null, 2)),
);
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/rest/GetMappingNames.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const GetMappingNames = () => {
if (id) {
axios
.get(
`https://vm.aleo.org/api/testnet3/program/${id}/mappings`,
`https://api.explorer.aleo.org/v1/testnet3/program/${id}/mappings`,
)
.then((response) => {
setStatus("success");
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/rest/GetMappingValue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const GetMappingValue = () => {
if (programID && mappingName && mappingKey) {
axios
.get(
`https://vm.aleo.org/api/testnet3/program/${programID}/mapping/${mappingName}/${mappingKey}`,
`https://api.explorer.aleo.org/v1/testnet3/program/${programID}/mapping/${mappingName}/${mappingKey}`,
)
.then((response) => {
if (response.data === null) {
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/rest/GetProgram.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const GetProgram = () => {
try {
if (id) {
axios
.get(`https://vm.aleo.org/api/testnet3/program/${id}`)
.get(`https://api.explorer.aleo.org/v1/testnet3/program/${id}`)
.then((response) => {
setStatus("success");
setProgram(response.data);
Expand Down
2 changes: 1 addition & 1 deletion website/src/tabs/rest/GetTransaction.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const GetTransaction = () => {
try {
if (id) {
axios
.get(`https://vm.aleo.org/api/testnet3/transaction/${id}`)
.get(`https://api.explorer.aleo.org/v1/testnet3/transaction/${id}`)
.then((response) => {
setTransaction(JSON.stringify(response.data, null, 2));
setStatus("success");
Expand Down
2 changes: 1 addition & 1 deletion website/src/workers/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as aleo from "@aleohq/sdk";
await aleo.initializeWasm();
await aleo.initThreadPool(10);

const defaultHost = "https://vm.aleo.org/api";
const defaultHost = "https://api.explorer.aleo.org/v1";
const keyProvider = new aleo.AleoKeyProvider();
const programManager = new aleo.ProgramManager(defaultHost, keyProvider, undefined);

Expand Down
Loading