Skip to content

Commit

Permalink
feat(deps): bump to tezedge 0.6.0 pre-release
Browse files Browse the repository at this point in the history
  • Loading branch information
emturner committed Jul 12, 2024
1 parent 5d7411a commit cc4502c
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 99 deletions.
252 changes: 180 additions & 72 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ version = "0.2.2"
version = "0.2.2"

[workspace.dependencies.tezos_crypto_rs]
version = "0.5.2"
version = "0.6.0"
default-features = false

[patch.crates-io]
Expand All @@ -97,4 +97,4 @@ boa_gc = { git = "https://github.com/trilitech/boa.git", branch = "ryutamago/fix
boa_interner = { git = "https://github.com/trilitech/boa.git", branch = "ryutamago/fix-undefined-to-json" }
boa_macros = { git = "https://github.com/trilitech/boa.git", branch = "ryutamago/fix-undefined-to-json" }
boa_parser = { git = "https://github.com/trilitech/boa.git", branch = "ryutamago/fix-undefined-to-json" }
boa_profiler = { git = "https://github.com/trilitech/boa.git", branch = "ryutamago/fix-undefined-to-json" }
boa_profiler = { git = "https://github.com/trilitech/boa.git", branch = "ryutamago/fix-undefined-to-json" }
7 changes: 1 addition & 6 deletions crates/jstz_crypto/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
use derive_more::{Display, Error, From};

use tezos_crypto_rs::{
base58::FromBase58CheckError,
hash::{FromBytesError, TryFromPKError},
CryptoError,
};
use tezos_crypto_rs::{base58::FromBase58CheckError, hash::FromBytesError, CryptoError};

#[derive(Display, Debug, Error, From)]
pub enum Error {
TezosFromBase58Error { source: FromBase58CheckError },
TezosFromBytesError { source: FromBytesError },
TezosTryFromPKError { source: TryFromPKError },
TezosCryptoError { source: CryptoError },
InvalidSignature,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/jstz_crypto/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl ToString for Blake2b {

impl<'a> From<&'a [u8]> for Blake2b {
fn from(data: &'a [u8]) -> Self {
let digest = tezos_crypto_rs::blake2b::digest_256(data).unwrap();
let digest = tezos_crypto_rs::blake2b::digest_256(data);
Self(digest.try_into().unwrap())
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/jstz_crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{hash::Blake2b, public_key::PublicKey, secret_key::SecretKey};

pub fn keypair_from_passphrase(passphrase: &str) -> Result<(SecretKey, PublicKey)> {
let ikm = Blake2b::from(passphrase.as_bytes()).as_array().to_vec();
let seed = SeedEd25519(ikm);
let seed = SeedEd25519::try_from(ikm)?;
let (pk, sk) = seed.keypair()?;
Ok((SecretKey::Ed25519(sk), PublicKey::Ed25519(pk)))
}
Expand Down
4 changes: 2 additions & 2 deletions crates/jstz_crypto/src/public_key_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl PublicKeyHash {

pub fn as_bytes(&self) -> &[u8] {
let PublicKeyHash::Tz1(tz1) = self;
&tz1.0
tz1.as_ref()
}
pub fn digest(data: &[u8]) -> Result<Self> {
let out_len = ContractTz1Hash::hash_size();
Expand All @@ -70,7 +70,7 @@ impl TryFrom<&PublicKey> for PublicKeyHash {

fn try_from(pk: &PublicKey) -> Result<Self> {
let PublicKey::Ed25519(key) = pk;
let tz1 = key.pk_hash()?;
let tz1 = key.pk_hash();
Ok(PublicKeyHash::Tz1(tz1))
}
}
17 changes: 9 additions & 8 deletions crates/jstz_crypto/src/secret_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ impl Debug for SecretKey {

impl SecretKey {
pub fn to_base58(&self) -> String {
let SecretKey::Ed25519(SecretKeyEd25519(sk)) = self;
let sk = SeedEd25519(sk.clone());
let Self::Ed25519(sk) = self;
sk.to_base58_check()
}

pub fn from_base58(data: &str) -> Result<Self> {
let SeedEd25519(sk) = SeedEd25519::from_base58_check(data)?;
let sk = SecretKeyEd25519::from_base58_check(data)?;

Ok(SecretKey::Ed25519(SecretKeyEd25519(sk)))
Ok(SecretKey::Ed25519(sk))
}

pub fn sign(&self, message: impl AsRef<[u8]>) -> Result<Signature> {
Expand All @@ -53,14 +52,16 @@ enum SecretKeySerde {

impl From<SecretKey> for SecretKeySerde {
fn from(s: SecretKey) -> Self {
let SecretKey::Ed25519(SecretKeyEd25519(sk)) = s;
Self::Ed25519(SeedEd25519(sk))
let SecretKey::Ed25519(sk) = s;
let sk: Vec<u8> = sk.into();
Self::Ed25519(SeedEd25519::try_from(sk).unwrap())
}
}

impl From<SecretKeySerde> for SecretKey {
fn from(s: SecretKeySerde) -> Self {
let SecretKeySerde::Ed25519(SeedEd25519(sk)) = s;
Self::Ed25519(SecretKeyEd25519(sk))
let SecretKeySerde::Ed25519(sk) = s;
let sk: Vec<u8> = sk.into();
Self::Ed25519(SecretKeyEd25519::try_from(sk).unwrap())
}
}
2 changes: 1 addition & 1 deletion crates/jstz_crypto/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{public_key::PublicKey, Error, Result};

#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum Signature {
Ed25519(tezos_crypto_rs::hash::Signature),
Ed25519(tezos_crypto_rs::hash::Ed25519Signature),
}

impl Signature {
Expand Down
2 changes: 1 addition & 1 deletion crates/jstz_kernel/src/inbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn read_transfer(
}
};

if transfer.destination.hash().0 != &rt.reveal_metadata().raw_rollup_address {
if transfer.destination.hash().as_ref() != &rt.reveal_metadata().raw_rollup_address {
debug_msg!(
rt,
"Deposit ignored because of different smart rollup address"
Expand Down
5 changes: 2 additions & 3 deletions crates/jstz_kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use jstz_core::kv::{Storage, Transaction};
use jstz_proto::{executor, Result};
use tezos_crypto_rs::hash::ContractKt1Hash;
use tezos_smart_rollup::{
kernel_entry,
entrypoint,
prelude::{debug_msg, Runtime},
storage::path::RefPath,
};
Expand Down Expand Up @@ -38,6 +38,7 @@ fn handle_message(hrt: &mut impl Runtime, message: Message) -> Result<()> {
}

// kernel entry
#[entrypoint::main]
pub fn entry(rt: &mut impl Runtime) {
let ticketer = read_ticketer(rt);

Expand All @@ -46,5 +47,3 @@ pub fn entry(rt: &mut impl Runtime) {
.unwrap_or_else(|err| debug_msg!(rt, "[🔴] {err:?}\n"));
}
}

kernel_entry!(entry);
2 changes: 1 addition & 1 deletion crates/jstz_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ actix-cors = "0.6.5"
base64 = "0.13.1"
tezos-smart-rollup.workspace = true
tezos-smart-rollup-encoding.workspace = true
tezos_data_encoding = "0.5.2"
tezos_data_encoding = "0.6.0"
tezos_crypto_rs.workspace = true

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion nix/jstz.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
cargoLock = {
lockFile = ../Cargo.lock;
outputHashes = {
"tezos-smart-rollup-0.2.2" = "sha256-v0ayPeHzhGzCdaHLpYh0bQm1569KrHgR/IxCXwBwhQU=";
"tezos-smart-rollup-0.2.2" = "sha256-sw+7iPP4rdtrS4rmtNy0t/Rhua2Nh726y/+x7YmyfdQ=";
"boa_engine-0.17.0" = "sha256-xMLwVEORTJgoSBxi3znF8AIOOZ8RF6aX0OXMdjEs2K0=";
"boa_gc-0.17.0" = "sha256-bf6i5ESIHwepb1a4dUYREPprz7Rijq+P5z+NXpsT16Q=";
"hermit-0.7.2" = "sha256-GJLujJml6IpT1+rbOG0BdDVkoI1PQGc3McryTggPu+o=";
Expand Down

0 comments on commit cc4502c

Please sign in to comment.