Skip to content

Commit

Permalink
Prepare Release v0.5 (rooch-network#1785)
Browse files Browse the repository at this point in the history
* [fix] fix auth paylaod

* [genesis] Update genesis config and release stdlib v1

* [cargo] Update version to 0.5.0

* fix bitcoin validator test

* [auth] Add length to auth payload

* [framework] Unify the auth error code

* rebase and release stdlib v1 again

---------

Co-authored-by: sven Tan <sven.tan@icloud.com>
  • Loading branch information
2 people authored and geometryolife committed Jun 4, 2024
1 parent be348fb commit 83b3ffb
Show file tree
Hide file tree
Showing 63 changed files with 457 additions and 316 deletions.
94 changes: 47 additions & 47 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/data_verify/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "data-verify"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-benchmarks"
version = "0.4.1"
version = "0.5.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-config"
version = "0.4.1"
version = "0.5.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-da/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-da"
version = "0.4.1"
version = "0.5.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-executor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-executor"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-faucet/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-faucet"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-framework-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-framework-tests"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ fn test_session_key_rooch() {
}
_ => panic!("expect move abort in module"),
}
// ErrorFunctionCallBeyondSessionScope = 3
assert_eq!(*code, 3, "expect ErrorFunctionCallBeyondSessionScope");
// ErrorValidateFunctionCallBeyondSessionScope = 1013
assert_eq!(
*code, 1013,
"expect ErrorValidateFunctionCallBeyondSessionScope"
);
}
_ => {
panic!("Expect move abort")
Expand Down Expand Up @@ -173,8 +176,8 @@ fn test_session_key_rooch() {
}
_ => panic!("expect move abort in module"),
}
// ErrorSessionIsExpired = 2
assert_eq!(*code, 2, "expect ErrorSessionIsExpired");
// ErrorValidateSessionIsExpired = 1012
assert_eq!(*code, 1012, "expect ErrorValidateSessionIsExpired");
}
_ => {
panic!("Expect move abort")
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-genesis/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-genesis"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-indexer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-indexer"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-integration-test-runner/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-integration-test-runner"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-key/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-key"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-open-rpc-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-open-rpc-macros"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-open-rpc-spec-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-open-rpc-spec-builder"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-open-rpc-spec/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-open-rpc-spec"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-open-rpc-spec/schemas/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"name": "Apache-2.0",
"url": "https://raw.githubusercontent.com/rooch-network/rooch/main/LICENSE"
},
"version": "0.4.1"
"version": "0.5.0"
},
"methods": [
{
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-open-rpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-open-rpc"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-pipeline-processor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-pipeline-processor"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-proposer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-proposer"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-relayer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-relayer"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-rpc-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-rpc-api"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-rpc-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-rpc-client"
version = "0.4.1"
version = "0.5.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-rpc-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-rpc-server"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-sequencer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-sequencer"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-store/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-store"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-test-transaction-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-test-transaction-builder"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-types"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
34 changes: 13 additions & 21 deletions crates/rooch-types/src/framework/auth_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use serde::{Deserialize, Serialize};

pub const MODULE_NAME: &IdentStr = ident_str!("auth_payload");

const SIGN_INFO_PREFIX: &[u8] = b"\x18Bitcoin Signed Message:\n";
const SIGN_INFO: &[u8] = b"Rooch Transaction:\n";
const MESSAGE_INFO_PREFIX: &[u8] = b"\x18Bitcoin Signed Message:\n";
const MESSAGE_INFO: &[u8] = b"Rooch Transaction:\n";

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SignData {
Expand All @@ -33,28 +33,24 @@ pub struct SignData {
impl SignData {
pub fn new(tx_data: &RoochTransactionData) -> Self {
let tx_hash_hex = hex::encode(tx_data.tx_hash().as_bytes()).into_bytes();
let message_info = MESSAGE_INFO.to_vec();

// We simulate the format of the Bitcoin wallet, append the length of message info and tx hash to the prefix
let mut encode_message_prefix = MESSAGE_INFO_PREFIX.to_vec();
encode_message_prefix.push((message_info.len() + tx_hash_hex.len()) as u8);

SignData {
message_prefix: SIGN_INFO_PREFIX.to_vec(),
message_info: SIGN_INFO.to_vec(),
message_prefix: encode_message_prefix,
message_info,
tx_hash_hex,
}
}

pub fn encode(&self) -> Vec<u8> {
// We keep the encode format consistent with the Bitcoin wallet
let mut data = Vec::new();
data.extend_from_slice(&self.message_prefix);

let message_info_len = self.message_info.len() as u8;
let tx_hash_len = self.tx_hash_hex.len() as u8;
if message_info_len > 0 {
data.push(message_info_len + tx_hash_len);
data.extend_from_slice(&self.message_info);
data.extend_from_slice(&self.tx_hash_hex);
} else {
data.push(tx_hash_len);
data.extend_from_slice(&self.tx_hash_hex);
}
data.extend_from_slice(&self.message_info);
data.extend_from_slice(&self.tx_hash_hex);
data
}

Expand Down Expand Up @@ -110,13 +106,9 @@ impl AuthPayload {
pub fn new(sign_data: SignData, signature: Signature, bitcoin_address: String) -> Self {
debug_assert_eq!(signature.scheme(), SignatureScheme::Secp256k1);

let mut encode_message_prefix =
vec![(sign_data.message_info.len() + sign_data.tx_hash_hex.len()) as u8];
encode_message_prefix.splice(0..0, sign_data.message_prefix.iter().cloned());

AuthPayload {
signature: signature.signature_bytes().to_vec(),
message_prefix: encode_message_prefix,
message_prefix: sign_data.message_prefix,
message_info: sign_data.message_info,
public_key: signature.public_key_bytes().to_vec(),
from_address: bitcoin_address.into_bytes(),
Expand Down
6 changes: 3 additions & 3 deletions crates/rooch-types/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ pub static G_DEV_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| GenesisConfig {
});

pub static G_TEST_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| {
// curl -sSL "https://mempool.space/testnet/api/block/00000000000000076f7641550f6c5b37c7e383eae883545fa72c05aa7a7a65ef"
// curl -sSL "https://mempool.space/testnet/api/block/000000008dfa22c53891f9a7b48a75ae8a523dec558873b061a321fd03a93bac"

GenesisConfig {
bitcoin_network: crate::bitcoin::network::Network::Testnet.to_num(),
bitcoin_block_height: 2816175,
timestamp: 1716012694000,
bitcoin_block_height: 2819132,
timestamp: 1717208620000,
sequencer_account: BitcoinAddress::from_str(
"bcrt1p56tdhxkcpc5xvdurfnufn9lkkywsh0gxttv5ktkvlezj0t23nasqawwrla",
)
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/testsuite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "testsuite"
version = "0.4.1"
version = "0.5.0"

authors = { workspace = true }
edition = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion examples/noop_auth_validator/sources/noop_validator.move
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ module noop_auth_validator::noop_validator {
/// It is used for testing purposes, and should not be used in production.
/// It is only failed when the authenticator_payload is empty.
public fun validate(authenticator_payload: vector<u8>) {
assert!(vector::length(&authenticator_payload) > 0, auth_validator::error_invalid_authenticator());
assert!(vector::length(&authenticator_payload) > 0, auth_validator::error_validate_invalid_authenticator());
}
}
2 changes: 1 addition & 1 deletion frameworks/bitcoin-move/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
#Bitcoin Move framework
name = "bitcoin-move"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions frameworks/bitcoin-move/sources/bitcoin.move
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ module bitcoin_move::bitcoin{

#[test_only]
use moveos_std::address;
#[test_only]
use std::ascii;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion frameworks/framework-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "framework-builder"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion frameworks/framework-release/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "framework-release"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
Binary file modified frameworks/framework-release/released/1/stdlib
Binary file not shown.
2 changes: 1 addition & 1 deletion frameworks/framework-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "framework-types"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion frameworks/moveos-stdlib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "moveos-stdlib"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion frameworks/rooch-framework/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rooch-framework"
version = "0.4.1"
version = "0.5.0"

# Workspace inherited keys
authors = { workspace = true }
Expand Down
Loading

0 comments on commit 83b3ffb

Please sign in to comment.