Merge branch 'master' into rpc-server

pull/1276/head
Byron Hambly 6 months ago committed by GitHub
commit df75cd95c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,12 +45,12 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout tagged commit
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
with:
ref: ${{ github.event.release.target_commitish }}
token: ${{ secrets.BOTTY_GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- uses: dtolnay/rust-toolchain@master
with:

@ -13,14 +13,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.67
components: clippy,rustfmt
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- name: Check formatting
uses: dprint/check@v2.2
@ -37,9 +37,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- name: Build swap
run: cargo build --bin swap
@ -51,9 +51,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- name: Install sqlx-cli
run: cargo install sqlx-cli --locked
@ -78,9 +78,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- uses: dtolnay/rust-toolchain@master
with:
@ -118,9 +118,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- name: Build tests
run: cargo build --tests --workspace --all-features
@ -155,9 +155,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- name: Run test ${{ matrix.test_name }}
run: cargo test --package swap --all-features --test ${{ matrix.test_name }} -- --nocapture

@ -11,7 +11,7 @@ jobs:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.1
- name: Extract version from branch name
id: extract-version

@ -12,7 +12,7 @@ jobs:
name: "Draft a new release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.1
with:
token: ${{ secrets.BOTTY_GITHUB_TOKEN }}

@ -10,7 +10,7 @@ jobs:
name: Create preview release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.1
- name: Delete 'preview' release
uses: larryjoelane/delete-release-action@v1.0.24

7
Cargo.lock generated

@ -2964,11 +2964,12 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "pem"
version = "1.1.1"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8"
checksum = "3163d2912b7c3b52d651a055f2c7eec9ba5cd22d26ef75b8dd3a59980b185923"
dependencies = [
"base64 0.13.1",
"base64 0.21.2",
"serde",
]
[[package]]

@ -36,7 +36,7 @@ jsonrpsee-core = "0.16.2"
libp2p = { version = "0.42.2", default-features = false, features = [ "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket", "ping", "rendezvous", "identify" ] }
monero = { version = "0.12", features = [ "serde_support" ] }
monero-rpc = { path = "../monero-rpc" }
pem = "1.1"
pem = "3.0"
proptest = "1"
qrcode = "0.12"
rand = "0.8"

@ -106,11 +106,12 @@ impl Seed {
}
fn from_pem(pem: pem::Pem) -> Result<Self, Error> {
if pem.contents.len() != SEED_LENGTH {
Err(Error::IncorrectLength(pem.contents.len()))
let contents = pem.contents();
if contents.len() != SEED_LENGTH {
Err(Error::IncorrectLength(contents.len()))
} else {
let mut array = [0; SEED_LENGTH];
for (i, b) in pem.contents.iter().enumerate() {
for (i, b) in contents.iter().enumerate() {
array[i] = *b;
}
@ -122,10 +123,7 @@ impl Seed {
ensure_directory_exists(&seed_file)?;
let data = self.bytes();
let pem = Pem {
tag: String::from("SEED"),
contents: data.to_vec(),
};
let pem = Pem::new("SEED", data);
let pem_string = encode(&pem);
@ -224,19 +222,20 @@ VnZUNFZ4dlY=
}
#[test]
#[should_panic]
fn seed_from_pem_fails_for_long_seed() {
let long = "-----BEGIN SEED-----
mbKANv2qKGmNVg1qtquj6Hx1pFPelpqOfE2JaJJAMEg1FlFhNRNlFlE=
mbKANv2qKGmNVg1qtquj6Hx1pFPelpqOfE2JaJJAMEg1FlFhNRNlFlE=
MIIBPQIBAAJBAOsfi5AGYhdRs/x6q5H7kScxA0Kzzqe6WI6gf6+tc6IvKQJo5rQc
dWWSQ0nRGt2hOPDO+35NKhQEjBQxPh/v7n0CAwEAAQJBAOGaBAyuw0ICyENy5NsO
-----END SEED-----
";
let pem = pem::parse(long).unwrap();
assert_eq!(pem.contents().len(), 96);
match Seed::from_pem(pem) {
Ok(_) => panic!("should fail for long payload"),
Err(e) => {
match e {
Error::IncorrectLength(_) => {} // pass
Error::IncorrectLength(len) => assert_eq!(len, 96), // pass
_ => panic!("should fail with IncorrectLength error"),
}
}

Loading…
Cancel
Save