mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-18 23:02:35 +03:00
commit
645b5a2be7
821
Cargo.lock
generated
821
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -38,6 +38,10 @@ version = "1.5.3"
|
||||
path = "../../leo/span"
|
||||
version = "1.5.3"
|
||||
|
||||
[dependencies.snarkvm-dpc]
|
||||
git = "https://github.com/AleoHQ/snarkVM.git"
|
||||
rev = "85b7a79"
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.8"
|
||||
|
||||
|
@ -17,10 +17,11 @@
|
||||
use crate::tokenizer::{Char, Token};
|
||||
use leo_errors::{ParserError, Result};
|
||||
use leo_span::{Span, Symbol};
|
||||
use snarkvm_dpc::{prelude::*, testnet2::Testnet2};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use std::{fmt, iter::Peekable};
|
||||
use std::{fmt, iter::Peekable, str::FromStr};
|
||||
|
||||
///
|
||||
/// Returns a new `StrTendril` string if an identifier can be eaten, otherwise returns [`None`].
|
||||
@ -458,16 +459,8 @@ impl fmt::Debug for SpannedToken {
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns true if the given string looks like Aleo address.
|
||||
/// This method DOES NOT check if the address is valid on-chain.
|
||||
/// Returns true if the given string is a valid Aleo address.
|
||||
///
|
||||
pub(crate) fn check_address(address: &str) -> bool {
|
||||
// "aleo1" (LOWERCASE_LETTER | ASCII_DIGIT){58}
|
||||
if !address.starts_with("aleo1") || address.len() != 63 {
|
||||
return false;
|
||||
}
|
||||
address
|
||||
.chars()
|
||||
.skip(5)
|
||||
.all(|x| x.is_ascii_lowercase() || x.is_ascii_digit())
|
||||
Address::<Testnet2>::from_str(address).is_ok()
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ type str = [char; _];
|
||||
|
||||
function main(y: bool) -> bool {
|
||||
let s = "abc";
|
||||
let a: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9;
|
||||
return (first_el(s) == 'a') == y;
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,6 @@ namespace: Token
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- "'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8s7pyjh9' @ 1:1-64"
|
||||
- "'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9' @ 1:1-64"
|
||||
- "'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9' @ 1:1-64"
|
||||
- "'aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st' @ 1:1-64"
|
||||
- "'ALEO1' @ 1:1-6"
|
||||
- "'Aleo1' @ 1:1-6"
|
||||
- "'aleO1' @ 1:1-6"
|
||||
|
@ -4,6 +4,7 @@ expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370001]: invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1'\n --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EPAR0370001]: invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6Z2eu975wnpz2925ntjccd5cfqxtyu8sta57J9'\n --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6Z2eu975wnpz2925ntjccd5cfqxtyu8sta57J9\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EPAR0370001]: invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9'\n --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EPAR0370001]: invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d'\n --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EPAR0370001]: invalid address literal: 'aleo1'\n --> test:1:1\n |\n 1 | aleo1\n | ^^^^^"
|
||||
- "Error [EPAR0370001]: invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st'\n --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
|
@ -12,33 +12,3 @@ outputs:
|
||||
col_stop: 64
|
||||
path: ""
|
||||
content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8s7pyjh9
|
||||
- Value:
|
||||
Address:
|
||||
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9
|
||||
- span:
|
||||
line_start: 1
|
||||
line_stop: 1
|
||||
col_start: 1
|
||||
col_stop: 64
|
||||
path: ""
|
||||
content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9
|
||||
- Value:
|
||||
Address:
|
||||
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9
|
||||
- span:
|
||||
line_start: 1
|
||||
line_stop: 1
|
||||
col_start: 1
|
||||
col_stop: 64
|
||||
path: ""
|
||||
content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9
|
||||
- Value:
|
||||
Address:
|
||||
- aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st
|
||||
- span:
|
||||
line_start: 1
|
||||
line_stop: 1
|
||||
col_start: 1
|
||||
col_stop: 64
|
||||
path: ""
|
||||
content: aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st
|
||||
|
@ -3,9 +3,6 @@ namespace: Token
|
||||
expectation: Pass
|
||||
*/
|
||||
aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8s7pyjh9
|
||||
aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9
|
||||
aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9
|
||||
aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st
|
||||
|
||||
ALEO1
|
||||
Aleo1
|
||||
|
@ -6,6 +6,8 @@ aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1
|
||||
|
||||
aleo1qnr4dkkvkgfqph0vzc3y6Z2eu975wnpz2925ntjccd5cfqxtyu8sta57J9
|
||||
|
||||
aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9
|
||||
|
||||
aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d
|
||||
|
||||
aleo1
|
||||
|
@ -4,6 +4,3 @@ expectation: Pass
|
||||
*/
|
||||
|
||||
aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8s7pyjh9
|
||||
aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9
|
||||
aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9
|
||||
aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st
|
||||
|
Loading…
Reference in New Issue
Block a user