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 1, 2024
1 parent d9f8d3f commit ee0421c
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 115 deletions.
195 changes: 112 additions & 83 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 13 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,23 @@ version = "0.5.2"
default-features = false

[patch.crates-io]
tezos-smart-rollup = { git = "https://gitlab.com/tezos/tezos.git" }
tezos-smart-rollup-host = { git = "https://gitlab.com/tezos/tezos.git" }
tezos-smart-rollup-core = { git = "https://gitlab.com/tezos/tezos.git" }
tezos-smart-rollup-mock = { git = "https://gitlab.com/tezos/tezos.git" }
tezos-smart-rollup-encoding = { git = "https://gitlab.com/tezos/tezos.git" }
tezos-smart-rollup-entrypoint = { git = "https://gitlab.com/tezos/tezos.git" }
tezos-smart-rollup-debug = { git = "https://gitlab.com/tezos/tezos.git" }
tezos-smart-rollup-panic-hook = { git = "https://gitlab.com/tezos/tezos.git" }
tezos-smart-rollup-storage = { git = "https://gitlab.com/tezos/tezos.git" }
tezos-smart-rollup = { git = "https://gitlab.com/tezos/tezos.git", rev = "4fd8e9a794226a44914611a07213063068ef0c96" }
tezos-smart-rollup-host = { git = "https://gitlab.com/tezos/tezos.git", rev = "4fd8e9a794226a44914611a07213063068ef0c96" }
tezos-smart-rollup-core = { git = "https://gitlab.com/tezos/tezos.git", rev = "4fd8e9a794226a44914611a07213063068ef0c96" }
tezos-smart-rollup-mock = { git = "https://gitlab.com/tezos/tezos.git", rev = "4fd8e9a794226a44914611a07213063068ef0c96" }
tezos-smart-rollup-encoding = { git = "https://gitlab.com/tezos/tezos.git", rev = "4fd8e9a794226a44914611a07213063068ef0c96" }
tezos-smart-rollup-entrypoint = { git = "https://gitlab.com/tezos/tezos.git", rev = "4fd8e9a794226a44914611a07213063068ef0c96" }
tezos-smart-rollup-debug = { git = "https://gitlab.com/tezos/tezos.git", rev = "4fd8e9a794226a44914611a07213063068ef0c96" }
tezos-smart-rollup-panic-hook = { git = "https://gitlab.com/tezos/tezos.git", rev = "4fd8e9a794226a44914611a07213063068ef0c96" }
tezos-smart-rollup-storage = { git = "https://gitlab.com/tezos/tezos.git", rev = "4fd8e9a794226a44914611a07213063068ef0c96" }
boa_ast = { git = "https://github.com/trilitech/boa.git", branch = "ryutamago/fix-undefined-to-json" }
boa_engine = { git = "https://github.com/trilitech/boa.git", branch = "ryutamago/fix-undefined-to-json" }
boa_gc = { git = "https://github.com/trilitech/boa.git", branch = "ryutamago/fix-undefined-to-json" }
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" }

tezos_crypto_rs = { git = "https://github.com/trilitech/tezedge.git", rev = "0468da39f3133dbe6355fa8d443d3aeee10e3c0b" }
tezos_data_encoding = { git = "https://github.com/trilitech/tezedge.git", rev = "0468da39f3133dbe6355fa8d443d3aeee10e3c0b" }
tezos_data_encoding_derive = { git = "https://github.com/trilitech/tezedge.git", rev = "0468da39f3133dbe6355fa8d443d3aeee10e3c0b" }
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);

0 comments on commit ee0421c

Please sign in to comment.