diff --git a/Cargo.lock b/Cargo.lock index bc2f5b1707..31cf5fa3db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,7 +14,7 @@ dependencies = [ [[package]] name = "accumulator" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs-ext", @@ -930,7 +930,7 @@ dependencies = [ [[package]] name = "bitcoin-move" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -2544,7 +2544,7 @@ dependencies = [ [[package]] name = "data-verify" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -3723,7 +3723,7 @@ dependencies = [ [[package]] name = "framework-builder" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -3765,7 +3765,7 @@ dependencies = [ [[package]] name = "framework-release" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -3786,7 +3786,7 @@ dependencies = [ [[package]] name = "framework-types" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "clap 4.5.4", @@ -5580,7 +5580,7 @@ dependencies = [ [[package]] name = "metrics" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "futures", @@ -6343,7 +6343,7 @@ dependencies = [ [[package]] name = "moveos" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "backtrace", @@ -6396,7 +6396,7 @@ dependencies = [ [[package]] name = "moveos-common" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -6408,7 +6408,7 @@ dependencies = [ [[package]] name = "moveos-compiler" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "move-binary-format", @@ -6422,7 +6422,7 @@ dependencies = [ [[package]] name = "moveos-config" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "clap 4.5.4", @@ -6439,7 +6439,7 @@ dependencies = [ [[package]] name = "moveos-object-runtime" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "better_any", @@ -6475,7 +6475,7 @@ dependencies = [ [[package]] name = "moveos-stdlib" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bech32 0.11.0", @@ -6522,7 +6522,7 @@ dependencies = [ [[package]] name = "moveos-store" -version = "0.4.1" +version = "0.5.0" dependencies = [ "accumulator", "anyhow", @@ -6551,7 +6551,7 @@ dependencies = [ [[package]] name = "moveos-types" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -6580,7 +6580,7 @@ dependencies = [ [[package]] name = "moveos-verifier" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -6607,7 +6607,7 @@ dependencies = [ [[package]] name = "moveos-wasm" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "ciborium", @@ -8314,7 +8314,7 @@ dependencies = [ [[package]] name = "raw-store" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -8801,7 +8801,7 @@ dependencies = [ [[package]] name = "rooch" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -8877,7 +8877,7 @@ dependencies = [ [[package]] name = "rooch-benchmarks" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -8949,7 +8949,7 @@ dependencies = [ [[package]] name = "rooch-config" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "clap 4.5.4", @@ -8975,7 +8975,7 @@ dependencies = [ [[package]] name = "rooch-da" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -8996,7 +8996,7 @@ dependencies = [ [[package]] name = "rooch-executor" -version = "0.4.1" +version = "0.5.0" dependencies = [ "accumulator", "anyhow", @@ -9038,7 +9038,7 @@ dependencies = [ [[package]] name = "rooch-faucet" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -9072,7 +9072,7 @@ dependencies = [ [[package]] name = "rooch-framework" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -9110,7 +9110,7 @@ dependencies = [ [[package]] name = "rooch-framework-tests" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -9165,7 +9165,7 @@ dependencies = [ [[package]] name = "rooch-genesis" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -9211,7 +9211,7 @@ dependencies = [ [[package]] name = "rooch-indexer" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -9257,7 +9257,7 @@ dependencies = [ [[package]] name = "rooch-integration-test-runner" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -9298,7 +9298,7 @@ dependencies = [ [[package]] name = "rooch-key" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "argon2", @@ -9330,7 +9330,7 @@ dependencies = [ [[package]] name = "rooch-open-rpc" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -9347,7 +9347,7 @@ dependencies = [ [[package]] name = "rooch-open-rpc-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "derive-syn-parse", "itertools 0.10.5", @@ -9359,7 +9359,7 @@ dependencies = [ [[package]] name = "rooch-open-rpc-spec" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -9380,7 +9380,7 @@ dependencies = [ [[package]] name = "rooch-open-rpc-spec-builder" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -9400,7 +9400,7 @@ dependencies = [ [[package]] name = "rooch-pipeline-processor" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -9438,7 +9438,7 @@ dependencies = [ [[package]] name = "rooch-proposer" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -9471,7 +9471,7 @@ dependencies = [ [[package]] name = "rooch-relayer" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -9515,7 +9515,7 @@ dependencies = [ [[package]] name = "rooch-rpc-api" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -9559,7 +9559,7 @@ dependencies = [ [[package]] name = "rooch-rpc-client" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -9589,7 +9589,7 @@ dependencies = [ [[package]] name = "rooch-rpc-server" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -9647,7 +9647,7 @@ dependencies = [ [[package]] name = "rooch-sequencer" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "async-trait", @@ -9682,7 +9682,7 @@ dependencies = [ [[package]] name = "rooch-store" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -9704,7 +9704,7 @@ dependencies = [ [[package]] name = "rooch-test-transaction-builder" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bcs", @@ -9740,7 +9740,7 @@ dependencies = [ [[package]] name = "rooch-types" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "argon2", @@ -10888,7 +10888,7 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" [[package]] name = "smt" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "backtrace", @@ -11389,7 +11389,7 @@ dependencies = [ [[package]] name = "testsuite" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "assert_cmd", @@ -11512,7 +11512,7 @@ dependencies = [ [[package]] name = "timeout-join-handler" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "thiserror", diff --git a/crates/data_verify/Cargo.toml b/crates/data_verify/Cargo.toml index cc50a25d8d..c7007a0c0c 100644 --- a/crates/data_verify/Cargo.toml +++ b/crates/data_verify/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "data-verify" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-benchmarks/Cargo.toml b/crates/rooch-benchmarks/Cargo.toml index d7c8b7fcb6..5dd4ba6d01 100644 --- a/crates/rooch-benchmarks/Cargo.toml +++ b/crates/rooch-benchmarks/Cargo.toml @@ -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 diff --git a/crates/rooch-config/Cargo.toml b/crates/rooch-config/Cargo.toml index 1e2a263686..c19ce9cb44 100644 --- a/crates/rooch-config/Cargo.toml +++ b/crates/rooch-config/Cargo.toml @@ -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 diff --git a/crates/rooch-da/Cargo.toml b/crates/rooch-da/Cargo.toml index 0a3ae6f389..60c76325e8 100644 --- a/crates/rooch-da/Cargo.toml +++ b/crates/rooch-da/Cargo.toml @@ -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 diff --git a/crates/rooch-executor/Cargo.toml b/crates/rooch-executor/Cargo.toml index 3691dedef5..9f5bc97fc4 100644 --- a/crates/rooch-executor/Cargo.toml +++ b/crates/rooch-executor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-executor" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-faucet/Cargo.toml b/crates/rooch-faucet/Cargo.toml index c69ce2a5ca..a455fd8d01 100644 --- a/crates/rooch-faucet/Cargo.toml +++ b/crates/rooch-faucet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-faucet" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-framework-tests/Cargo.toml b/crates/rooch-framework-tests/Cargo.toml index 951ff8ea2f..a272f6ee7e 100644 --- a/crates/rooch-framework-tests/Cargo.toml +++ b/crates/rooch-framework-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-framework-tests" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-framework-tests/src/tests/session_validator_tests.rs b/crates/rooch-framework-tests/src/tests/session_validator_tests.rs index 5f783ba686..b09363c71b 100644 --- a/crates/rooch-framework-tests/src/tests/session_validator_tests.rs +++ b/crates/rooch-framework-tests/src/tests/session_validator_tests.rs @@ -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") @@ -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") diff --git a/crates/rooch-genesis/Cargo.toml b/crates/rooch-genesis/Cargo.toml index 24f15c6264..5a89218829 100644 --- a/crates/rooch-genesis/Cargo.toml +++ b/crates/rooch-genesis/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-genesis" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-indexer/Cargo.toml b/crates/rooch-indexer/Cargo.toml index 22b1ac9a19..f769f04a87 100644 --- a/crates/rooch-indexer/Cargo.toml +++ b/crates/rooch-indexer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-indexer" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-integration-test-runner/Cargo.toml b/crates/rooch-integration-test-runner/Cargo.toml index 5138a9fd36..62d1b7874a 100644 --- a/crates/rooch-integration-test-runner/Cargo.toml +++ b/crates/rooch-integration-test-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-integration-test-runner" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-key/Cargo.toml b/crates/rooch-key/Cargo.toml index ba3629353c..85ed20b953 100644 --- a/crates/rooch-key/Cargo.toml +++ b/crates/rooch-key/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-key" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-open-rpc-macros/Cargo.toml b/crates/rooch-open-rpc-macros/Cargo.toml index d65aab968a..0575cd70b2 100644 --- a/crates/rooch-open-rpc-macros/Cargo.toml +++ b/crates/rooch-open-rpc-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-open-rpc-macros" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-open-rpc-spec-builder/Cargo.toml b/crates/rooch-open-rpc-spec-builder/Cargo.toml index bcb3a4ad81..36a2299a29 100644 --- a/crates/rooch-open-rpc-spec-builder/Cargo.toml +++ b/crates/rooch-open-rpc-spec-builder/Cargo.toml @@ -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 } diff --git a/crates/rooch-open-rpc-spec/Cargo.toml b/crates/rooch-open-rpc-spec/Cargo.toml index 01f66b188f..53cceb0ecb 100644 --- a/crates/rooch-open-rpc-spec/Cargo.toml +++ b/crates/rooch-open-rpc-spec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-open-rpc-spec" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-open-rpc-spec/schemas/openrpc.json b/crates/rooch-open-rpc-spec/schemas/openrpc.json index dc6fe53ea7..002c09455f 100644 --- a/crates/rooch-open-rpc-spec/schemas/openrpc.json +++ b/crates/rooch-open-rpc-spec/schemas/openrpc.json @@ -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": [ { diff --git a/crates/rooch-open-rpc/Cargo.toml b/crates/rooch-open-rpc/Cargo.toml index 1413c1cdfa..265f91389e 100644 --- a/crates/rooch-open-rpc/Cargo.toml +++ b/crates/rooch-open-rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-open-rpc" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-pipeline-processor/Cargo.toml b/crates/rooch-pipeline-processor/Cargo.toml index 575a3d152f..e93022c4d8 100644 --- a/crates/rooch-pipeline-processor/Cargo.toml +++ b/crates/rooch-pipeline-processor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-pipeline-processor" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-proposer/Cargo.toml b/crates/rooch-proposer/Cargo.toml index 6315cd7f06..dfdcce639a 100644 --- a/crates/rooch-proposer/Cargo.toml +++ b/crates/rooch-proposer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-proposer" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-relayer/Cargo.toml b/crates/rooch-relayer/Cargo.toml index 19599331f2..8aaed4b8d8 100644 --- a/crates/rooch-relayer/Cargo.toml +++ b/crates/rooch-relayer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-relayer" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-rpc-api/Cargo.toml b/crates/rooch-rpc-api/Cargo.toml index 35f993fde0..fd42e59db9 100644 --- a/crates/rooch-rpc-api/Cargo.toml +++ b/crates/rooch-rpc-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-rpc-api" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-rpc-client/Cargo.toml b/crates/rooch-rpc-client/Cargo.toml index 72141ccd39..83334e6308 100644 --- a/crates/rooch-rpc-client/Cargo.toml +++ b/crates/rooch-rpc-client/Cargo.toml @@ -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 diff --git a/crates/rooch-rpc-server/Cargo.toml b/crates/rooch-rpc-server/Cargo.toml index 0e0164f873..b96b533270 100644 --- a/crates/rooch-rpc-server/Cargo.toml +++ b/crates/rooch-rpc-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-rpc-server" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-sequencer/Cargo.toml b/crates/rooch-sequencer/Cargo.toml index dd3e9b6434..7b3550b2f2 100644 --- a/crates/rooch-sequencer/Cargo.toml +++ b/crates/rooch-sequencer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-sequencer" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-store/Cargo.toml b/crates/rooch-store/Cargo.toml index d1db933a44..cfe65df99f 100644 --- a/crates/rooch-store/Cargo.toml +++ b/crates/rooch-store/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-store" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-test-transaction-builder/Cargo.toml b/crates/rooch-test-transaction-builder/Cargo.toml index a6047f1700..092f91a76e 100644 --- a/crates/rooch-test-transaction-builder/Cargo.toml +++ b/crates/rooch-test-transaction-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-test-transaction-builder" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-types/Cargo.toml b/crates/rooch-types/Cargo.toml index 5169b5d544..5f068b3a1b 100644 --- a/crates/rooch-types/Cargo.toml +++ b/crates/rooch-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-types" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/rooch-types/src/framework/auth_payload.rs b/crates/rooch-types/src/framework/auth_payload.rs index 43dc4332c0..b5f07dba9d 100644 --- a/crates/rooch-types/src/framework/auth_payload.rs +++ b/crates/rooch-types/src/framework/auth_payload.rs @@ -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 { @@ -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 { - // 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 } @@ -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(), diff --git a/crates/rooch-types/src/genesis_config.rs b/crates/rooch-types/src/genesis_config.rs index 6c2584fdd9..dc0fd51503 100644 --- a/crates/rooch-types/src/genesis_config.rs +++ b/crates/rooch-types/src/genesis_config.rs @@ -50,12 +50,12 @@ pub static G_DEV_CONFIG: Lazy = Lazy::new(|| GenesisConfig { }); pub static G_TEST_CONFIG: Lazy = 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", ) diff --git a/crates/rooch/Cargo.toml b/crates/rooch/Cargo.toml index ce9cec6b8b..24709cba73 100644 --- a/crates/rooch/Cargo.toml +++ b/crates/rooch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/crates/testsuite/Cargo.toml b/crates/testsuite/Cargo.toml index e45cbbd50c..7925f66059 100644 --- a/crates/testsuite/Cargo.toml +++ b/crates/testsuite/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "testsuite" -version = "0.4.1" +version = "0.5.0" authors = { workspace = true } edition = { workspace = true } diff --git a/examples/noop_auth_validator/sources/noop_validator.move b/examples/noop_auth_validator/sources/noop_validator.move index 0279e98877..d699c3de43 100644 --- a/examples/noop_auth_validator/sources/noop_validator.move +++ b/examples/noop_auth_validator/sources/noop_validator.move @@ -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) { - assert!(vector::length(&authenticator_payload) > 0, auth_validator::error_invalid_authenticator()); + assert!(vector::length(&authenticator_payload) > 0, auth_validator::error_validate_invalid_authenticator()); } } diff --git a/frameworks/bitcoin-move/Cargo.toml b/frameworks/bitcoin-move/Cargo.toml index c91fdc7ed1..effaa3de07 100644 --- a/frameworks/bitcoin-move/Cargo.toml +++ b/frameworks/bitcoin-move/Cargo.toml @@ -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 } diff --git a/frameworks/bitcoin-move/sources/bitcoin.move b/frameworks/bitcoin-move/sources/bitcoin.move index 314eb18b34..16140afee9 100644 --- a/frameworks/bitcoin-move/sources/bitcoin.move +++ b/frameworks/bitcoin-move/sources/bitcoin.move @@ -432,6 +432,7 @@ module bitcoin_move::bitcoin{ #[test_only] use moveos_std::address; + #[test_only] use std::ascii; #[test] diff --git a/frameworks/framework-builder/Cargo.toml b/frameworks/framework-builder/Cargo.toml index 2357eb3398..845738f5b3 100644 --- a/frameworks/framework-builder/Cargo.toml +++ b/frameworks/framework-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework-builder" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/frameworks/framework-release/Cargo.toml b/frameworks/framework-release/Cargo.toml index 6f4ffdf53a..6bcad1e641 100644 --- a/frameworks/framework-release/Cargo.toml +++ b/frameworks/framework-release/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework-release" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/frameworks/framework-release/released/1/stdlib b/frameworks/framework-release/released/1/stdlib index 50b89860a9..5cc0bcf122 100644 Binary files a/frameworks/framework-release/released/1/stdlib and b/frameworks/framework-release/released/1/stdlib differ diff --git a/frameworks/framework-types/Cargo.toml b/frameworks/framework-types/Cargo.toml index 6692d83c23..59ba05fae8 100644 --- a/frameworks/framework-types/Cargo.toml +++ b/frameworks/framework-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework-types" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/frameworks/moveos-stdlib/Cargo.toml b/frameworks/moveos-stdlib/Cargo.toml index 9fb722501a..fb3ecba104 100644 --- a/frameworks/moveos-stdlib/Cargo.toml +++ b/frameworks/moveos-stdlib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moveos-stdlib" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/frameworks/rooch-framework/Cargo.toml b/frameworks/rooch-framework/Cargo.toml index f5a4ea6d85..68e1281820 100644 --- a/frameworks/rooch-framework/Cargo.toml +++ b/frameworks/rooch-framework/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rooch-framework" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/frameworks/rooch-framework/doc/auth_validator.md b/frameworks/rooch-framework/doc/auth_validator.md index 7ca7c5a031..63a177e9ea 100644 --- a/frameworks/rooch-framework/doc/auth_validator.md +++ b/frameworks/rooch-framework/doc/auth_validator.md @@ -13,8 +13,19 @@ fun post_execute() - [Struct `AuthValidator`](#0x3_auth_validator_AuthValidator) - [Struct `TxValidateResult`](#0x3_auth_validator_TxValidateResult) - [Constants](#@Constants_0) -- [Function `error_invalid_account_auth_key`](#0x3_auth_validator_error_invalid_account_auth_key) -- [Function `error_invalid_authenticator`](#0x3_auth_validator_error_invalid_authenticator) +- [Function `error_validate_sequence_number_too_old`](#0x3_auth_validator_error_validate_sequence_number_too_old) +- [Function `error_validate_sequence_number_too_new`](#0x3_auth_validator_error_validate_sequence_number_too_new) +- [Function `error_validate_account_does_not_exist`](#0x3_auth_validator_error_validate_account_does_not_exist) +- [Function `error_validate_cant_pay_gas_deposit`](#0x3_auth_validator_error_validate_cant_pay_gas_deposit) +- [Function `error_validate_transaction_expired`](#0x3_auth_validator_error_validate_transaction_expired) +- [Function `error_validate_bad_chain_id`](#0x3_auth_validator_error_validate_bad_chain_id) +- [Function `error_validate_sequence_number_too_big`](#0x3_auth_validator_error_validate_sequence_number_too_big) +- [Function `error_validate_max_gas_amount_exceeded`](#0x3_auth_validator_error_validate_max_gas_amount_exceeded) +- [Function `error_validate_invalid_account_auth_key`](#0x3_auth_validator_error_validate_invalid_account_auth_key) +- [Function `error_validate_invalid_authenticator`](#0x3_auth_validator_error_validate_invalid_authenticator) +- [Function `error_validate_not_installed_auth_validator`](#0x3_auth_validator_error_validate_not_installed_auth_validator) +- [Function `error_validate_session_is_expired`](#0x3_auth_validator_error_validate_session_is_expired) +- [Function `error_validate_function_call_beyond_session_scope`](#0x3_auth_validator_error_validate_function_call_beyond_session_scope) - [Function `new_auth_validator`](#0x3_auth_validator_new_auth_validator) - [Function `validator_id`](#0x3_auth_validator_validator_id) - [Function `validator_module_address`](#0x3_auth_validator_validator_module_address) @@ -76,12 +87,49 @@ The function must be executed after the transaction is validated + + + + +
const ErrorValidateAccountDoesNotExist: u64 = 1003;
+
+ + + + + + + +
const ErrorValidateBadChainId: u64 = 1006;
+
+ + + + + + + +
const ErrorValidateCantPayGasDeposit: u64 = 1004;
+
+ + + + + +The function call is beyond the session's scope + + +
const ErrorValidateFunctionCallBeyondSessionScope: u64 = 1013;
+
+ + + The AuthKey in transaction's authenticator do not match with the sender's account auth key -
const ErrorValidateInvalidAccountAuthKey: u64 = 1001;
+
const ErrorValidateInvalidAccountAuthKey: u64 = 1009;
 
@@ -91,29 +139,218 @@ The AuthKey in transaction's authenticator do not match with the sender's accoun InvalidAuthenticator, include invalid signature -
const ErrorValidateInvalidAuthenticator: u64 = 1002;
+
const ErrorValidateInvalidAuthenticator: u64 = 1010;
+
+ + + + + + + +
const ErrorValidateMaxGasAmountExceeded: u64 = 1008;
+
+ + + + + +The authenticator's auth validator id is not installed to the sender's account + + +
const ErrorValidateNotInstalledAuthValidator: u64 = 1011;
+
+ + + + + +Validate errors. These are separated out from the other errors in this +module since they are mapped separately to major VM statuses, and are +important to the semantics of the system. + + +
const ErrorValidateSequenceNuberTooOld: u64 = 1001;
+
+ + + + + + + +
const ErrorValidateSequenceNumberTooBig: u64 = 1007;
+
+ + + + + + + +
const ErrorValidateSequenceNumberTooNew: u64 = 1002;
+
+ + + + + +The session is expired + + +
const ErrorValidateSessionIsExpired: u64 = 1012;
+
+ + + + + + + +
const ErrorValidateTransactionExpired: u64 = 1005;
+
+ + + + + +## Function `error_validate_sequence_number_too_old` + + + +
public fun error_validate_sequence_number_too_old(): u64
+
+ + + + + +## Function `error_validate_sequence_number_too_new` + + + +
public fun error_validate_sequence_number_too_new(): u64
+
+ + + + + +## Function `error_validate_account_does_not_exist` + + + +
public fun error_validate_account_does_not_exist(): u64
+
+ + + + + +## Function `error_validate_cant_pay_gas_deposit` + + + +
public fun error_validate_cant_pay_gas_deposit(): u64
+
+ + + + + +## Function `error_validate_transaction_expired` + + + +
public fun error_validate_transaction_expired(): u64
+
+ + + + + +## Function `error_validate_bad_chain_id` + + + +
public fun error_validate_bad_chain_id(): u64
+
+ + + + + +## Function `error_validate_sequence_number_too_big` + + + +
public fun error_validate_sequence_number_too_big(): u64
+
+ + + + + +## Function `error_validate_max_gas_amount_exceeded` + + + +
public fun error_validate_max_gas_amount_exceeded(): u64
+
+ + + + + +## Function `error_validate_invalid_account_auth_key` + + + +
public fun error_validate_invalid_account_auth_key(): u64
+
+ + + + + +## Function `error_validate_invalid_authenticator` + + + +
public fun error_validate_invalid_authenticator(): u64
+
+ + + + + +## Function `error_validate_not_installed_auth_validator` + + + +
public fun error_validate_not_installed_auth_validator(): u64
 
- + -## Function `error_invalid_account_auth_key` +## Function `error_validate_session_is_expired` -
public fun error_invalid_account_auth_key(): u64
+
public fun error_validate_session_is_expired(): u64
 
- + -## Function `error_invalid_authenticator` +## Function `error_validate_function_call_beyond_session_scope` -
public fun error_invalid_authenticator(): u64
+
public fun error_validate_function_call_beyond_session_scope(): u64
 
diff --git a/frameworks/rooch-framework/doc/session_validator.md b/frameworks/rooch-framework/doc/session_validator.md index 1190dbea21..9b3702f374 100644 --- a/frameworks/rooch-framework/doc/session_validator.md +++ b/frameworks/rooch-framework/doc/session_validator.md @@ -39,35 +39,6 @@ This module implements the session auth validator. ## Constants - - -The function call is beyond the session's scope - - -
const ErrorFunctionCallBeyondSessionScope: u64 = 3;
-
- - - - - - - -
const ErrorInvalidPublicKeyLength: u64 = 1;
-
- - - - - -The session is expired - - -
const ErrorSessionIsExpired: u64 = 2;
-
- - - there defines auth validator id for each auth validator diff --git a/frameworks/rooch-framework/doc/transaction_validator.md b/frameworks/rooch-framework/doc/transaction_validator.md index 3d10c008df..2f9dc113c3 100644 --- a/frameworks/rooch-framework/doc/transaction_validator.md +++ b/frameworks/rooch-framework/doc/transaction_validator.md @@ -61,91 +61,6 @@ Just using to get module signer - - - - -
const ErrorMaxGasAmountExceeded: u64 = 1008;
-
- - - - - - - -
const ErrorValidateAccountDoesNotExist: u64 = 1003;
-
- - - - - - - -
const ErrorValidateBadChainId: u64 = 1006;
-
- - - - - - - -
const ErrorValidateCantPayGasDeposit: u64 = 1004;
-
- - - - - -The authenticator's auth validator id is not installed to the sender's account - - -
const ErrorValidateNotInstalledAuthValidator: u64 = 1010;
-
- - - - - -Validate errors. These are separated out from the other errors in this -module since they are mapped separately to major VM statuses, and are -important to the semantics of the system. - - -
const ErrorValidateSequenceNuberTooOld: u64 = 1001;
-
- - - - - - - -
const ErrorValidateSequenceNumberTooBig: u64 = 1007;
-
- - - - - - - -
const ErrorValidateSequenceNumberTooNew: u64 = 1002;
-
- - - - - - - -
const ErrorValidateTransactionExpired: u64 = 1005;
-
- - - ## Function `validate` diff --git a/frameworks/rooch-framework/sources/auth_validator/auth_validator.move b/frameworks/rooch-framework/sources/auth_validator/auth_validator.move index eb114d0f35..aab0c21b1b 100644 --- a/frameworks/rooch-framework/sources/auth_validator/auth_validator.move +++ b/frameworks/rooch-framework/sources/auth_validator/auth_validator.move @@ -18,19 +18,80 @@ module rooch_framework::auth_validator { /// The function must be executed after the transaction is validated const ErrorMustExecuteAfterValidate: u64 = 1; + /// Validate errors. These are separated out from the other errors in this + /// module since they are mapped separately to major VM statuses, and are + /// important to the semantics of the system. + const ErrorValidateSequenceNuberTooOld: u64 = 1001; + const ErrorValidateSequenceNumberTooNew: u64 = 1002; + const ErrorValidateAccountDoesNotExist: u64 = 1003; + const ErrorValidateCantPayGasDeposit: u64 = 1004; + const ErrorValidateTransactionExpired: u64 = 1005; + const ErrorValidateBadChainId: u64 = 1006; + const ErrorValidateSequenceNumberTooBig: u64 = 1007; + const ErrorValidateMaxGasAmountExceeded: u64 = 1008; /// The AuthKey in transaction's authenticator do not match with the sender's account auth key - const ErrorValidateInvalidAccountAuthKey: u64 = 1001; + const ErrorValidateInvalidAccountAuthKey: u64 = 1009; /// InvalidAuthenticator, include invalid signature - const ErrorValidateInvalidAuthenticator: u64 = 1002; + const ErrorValidateInvalidAuthenticator: u64 = 1010; + /// The authenticator's auth validator id is not installed to the sender's account + const ErrorValidateNotInstalledAuthValidator: u64 = 1011; + /// The session is expired + const ErrorValidateSessionIsExpired: u64 = 1012; + /// The function call is beyond the session's scope + const ErrorValidateFunctionCallBeyondSessionScope: u64 = 1013; + + public fun error_validate_sequence_number_too_old(): u64 { + ErrorValidateSequenceNuberTooOld + } + + public fun error_validate_sequence_number_too_new(): u64 { + ErrorValidateSequenceNumberTooNew + } + + public fun error_validate_account_does_not_exist(): u64 { + ErrorValidateAccountDoesNotExist + } + + public fun error_validate_cant_pay_gas_deposit(): u64 { + ErrorValidateCantPayGasDeposit + } + + public fun error_validate_transaction_expired(): u64 { + ErrorValidateTransactionExpired + } + + public fun error_validate_bad_chain_id(): u64 { + ErrorValidateBadChainId + } + + public fun error_validate_sequence_number_too_big(): u64 { + ErrorValidateSequenceNumberTooBig + } - public fun error_invalid_account_auth_key(): u64 { + public fun error_validate_max_gas_amount_exceeded(): u64 { + ErrorValidateMaxGasAmountExceeded + } + + public fun error_validate_invalid_account_auth_key(): u64 { ErrorValidateInvalidAccountAuthKey } - public fun error_invalid_authenticator(): u64 { + public fun error_validate_invalid_authenticator(): u64 { ErrorValidateInvalidAuthenticator } + public fun error_validate_not_installed_auth_validator(): u64 { + ErrorValidateNotInstalledAuthValidator + } + + public fun error_validate_session_is_expired(): u64 { + ErrorValidateSessionIsExpired + } + + public fun error_validate_function_call_beyond_session_scope(): u64 { + ErrorValidateFunctionCallBeyondSessionScope + } + /// The Authentication Validator struct AuthValidator has store, copy, drop { id: u64, diff --git a/frameworks/rooch-framework/sources/auth_validator/bitcoin_validator.move b/frameworks/rooch-framework/sources/auth_validator/bitcoin_validator.move index b18fbf80c6..7cf8d2b2fc 100644 --- a/frameworks/rooch-framework/sources/auth_validator/bitcoin_validator.move +++ b/frameworks/rooch-framework/sources/auth_validator/bitcoin_validator.move @@ -38,7 +38,7 @@ module rooch_framework::bitcoin_validator { &message_hash, ecdsa_k1::sha256() ), - auth_validator::error_invalid_authenticator() + auth_validator::error_validate_invalid_authenticator() ); } @@ -57,7 +57,7 @@ module rooch_framework::bitcoin_validator { // Check if the address and public key are related assert!( bitcoin_address::verify_with_public_key(&from_address_in_payload, &auth_payload::public_key(payload)), - auth_validator::error_invalid_authenticator() + auth_validator::error_validate_invalid_authenticator() ); let rooch_addr = bitcoin_address::to_rooch_address(&bitcoin_addr); @@ -65,7 +65,7 @@ module rooch_framework::bitcoin_validator { // Check if the sender is related to the Rooch address assert!( sender == rooch_addr, - auth_validator::error_invalid_authenticator() + auth_validator::error_validate_invalid_authenticator() ); bitcoin_addr } @@ -77,18 +77,18 @@ module rooch_framework::bitcoin_validator { #[test] fun test_validate_signature_success() { - let tx_hash = x"21756929c0b93b54daf211d0b7607a5876bf9d34bb069d3330eef198d23ae1f0"; - let auth_payload_bytes = x"40a761d2cb97cde5535e65f918d111061207e16701f4cfc24fdcf3db474bbfae0f0e751a47c1536ea1bfc6860ca647238c234b86d02fbba6853e34a3c845b643c918426974636f696e205369676e6564204d6573736167653a0a9d0157656c636f6d6520746f206c6f63616c686f73740a596f752077696c6c20617574686f72697a652073657373696f6e3a0a53636f70653a0a3078343965653363663137613031376233333161623262386134643430656363393730366633323835363266396462363363626136323561396331303663646633353a3a2a3a3a2a0a54696d654f75743a313230300a526f6f636820747820686173683a0a21038e3d29b653e40f5b620f9443ee05222d1e40be58f544b6fed3d464edd54db8833e626331703878706a706b6339757a6a3264657863786a67397377386c786a6538357861343037307a7063797335383965337266366b3230716d36676a7274"; + let tx_hash = x"5415b18de0b880bb2af5dfe1ee27fd19ae8a0c99b5328e8b4b44f4c86cc7176a"; + let auth_payload_bytes = x"407e5b0c1da7d2bed7c2497b7c7c46b1a485883029a3bb1479493688ad347bcafa2bd82c6fd9bb2515f9e0c697f621ac0a28fb9f8c0e565d5b6d4e20bf18ce86621a18426974636f696e205369676e6564204d6573736167653a0ae2a201526f6f6368205472616e73616374696f6e3a0a57656c636f6d6520746f20726f6f63685f746573740a596f752077696c6c20617574686f72697a652073657373696f6e3a0a53636f70653a0a3078663962313065366337363066316361646365393563363634623361336561643363393835626265396436336264353161396266313736303738356432366131623a3a2a3a3a2a0a54696d654f75743a313030300a21031a446b6ac064acb14687764871dad6c08186a788248d585b3cce69231b48d1382a62633171333234356e706d3430346874667a76756c783676347736356d61717a7536617474716c336677"; let payload = auth_payload::from_bytes(auth_payload_bytes); validate_signature(payload, tx_hash); } #[test] - #[expected_failure(location=Self, abort_code = 1002)] + #[expected_failure(location=Self, abort_code = 1010)] fun test_validate_signature_fail() { - let tx_hash = x"22756929c0b93b54daf211d0b7607a5876bf9d34bb069d3330eef198d23ae1f0"; - let auth_payload_bytes = x"40a761d2cb97cde5535e65f918d111061207e16701f4cfc24fdcf3db474bbfae0f0e751a47c1536ea1bfc6860ca647238c234b86d02fbba6853e34a3c845b643c918426974636f696e205369676e6564204d6573736167653a0a9d0157656c636f6d6520746f206c6f63616c686f73740a596f752077696c6c20617574686f72697a652073657373696f6e3a0a53636f70653a0a3078343965653363663137613031376233333161623262386134643430656363393730366633323835363266396462363363626136323561396331303663646633353a3a2a3a3a2a0a54696d654f75743a313230300a526f6f636820747820686173683a0a21038e3d29b653e40f5b620f9443ee05222d1e40be58f544b6fed3d464edd54db8833e626331703878706a706b6339757a6a3264657863786a67397377386c786a6538357861343037307a7063797335383965337266366b3230716d36676a7274"; + let tx_hash = x"5515b18de0b880bb2af5dfe1ee27fd19ae8a0c99b5328e8b4b44f4c86cc7176a"; + let auth_payload_bytes = x"407e5b0c1da7d2bed7c2497b7c7c46b1a485883029a3bb1479493688ad347bcafa2bd82c6fd9bb2515f9e0c697f621ac0a28fb9f8c0e565d5b6d4e20bf18ce86621a18426974636f696e205369676e6564204d6573736167653a0ae2a201526f6f6368205472616e73616374696f6e3a0a57656c636f6d6520746f20726f6f63685f746573740a596f752077696c6c20617574686f72697a652073657373696f6e3a0a53636f70653a0a3078663962313065366337363066316361646365393563363634623361336561643363393835626265396436336264353161396266313736303738356432366131623a3a2a3a3a2a0a54696d654f75743a313030300a21031a446b6ac064acb14687764871dad6c08186a788248d585b3cce69231b48d1382a62633171333234356e706d3430346874667a76756c783676347736356d61717a7536617474716c336677"; let payload = auth_payload::from_bytes(auth_payload_bytes); validate_signature(payload, tx_hash); diff --git a/frameworks/rooch-framework/sources/auth_validator/session_validator.move b/frameworks/rooch-framework/sources/auth_validator/session_validator.move index e07a885f5f..ef245b2516 100644 --- a/frameworks/rooch-framework/sources/auth_validator/session_validator.move +++ b/frameworks/rooch-framework/sources/auth_validator/session_validator.move @@ -19,12 +19,6 @@ module rooch_framework::session_validator { const SIGNATURE_SCHEME_ED25519: u8 = 0; - // error code - const ErrorInvalidPublicKeyLength: u64 = 1; - /// The session is expired - const ErrorSessionIsExpired: u64 = 2; - /// The function call is beyond the session's scope - const ErrorFunctionCallBeyondSessionScope: u64 = 3; struct SessionValidator has store, drop {} @@ -35,7 +29,7 @@ module rooch_framework::session_validator { /// Validate the authenticator payload, return public key and signature fun validate_authenticator_payload(authenticator_payload: &vector): (vector, vector) { let scheme = vector::borrow(authenticator_payload, 0); - assert!(*scheme == SIGNATURE_SCHEME_ED25519, auth_validator::error_invalid_authenticator()); + assert!(*scheme == SIGNATURE_SCHEME_ED25519, auth_validator::error_validate_invalid_authenticator()); let sign = vector::empty(); let i = 1; @@ -74,7 +68,7 @@ module rooch_framework::session_validator { &public_key, tx_hash ), - auth_validator::error_invalid_authenticator() + auth_validator::error_validate_invalid_authenticator() ); public_key_to_authentication_key(SIGNATURE_SCHEME_ED25519, public_key) } @@ -82,18 +76,18 @@ module rooch_framework::session_validator { public(friend) fun validate(authenticator_payload: vector) :vector { let sender_addr = tx_context::sender(); - assert!(session_key::has_session_key(sender_addr), auth_validator::error_invalid_account_auth_key()); + assert!(session_key::has_session_key(sender_addr), auth_validator::error_validate_invalid_account_auth_key()); let tx_hash = tx_context::tx_hash(); let auth_key = validate_signature(&authenticator_payload, &tx_hash); let session_key_option = session_key::get_session_key(sender_addr, auth_key); - assert!(option::is_some(&session_key_option), auth_validator::error_invalid_account_auth_key()); + assert!(option::is_some(&session_key_option), auth_validator::error_validate_invalid_account_auth_key()); let session_key = option::extract(&mut session_key_option); - assert!(!session_key::is_expired(&session_key), ErrorSessionIsExpired); + assert!(!session_key::is_expired(&session_key), auth_validator::error_validate_session_is_expired()); - assert!(session_key::in_session_scope(&session_key), ErrorFunctionCallBeyondSessionScope); + assert!(session_key::in_session_scope(&session_key), auth_validator::error_validate_function_call_beyond_session_scope()); auth_key } diff --git a/frameworks/rooch-framework/sources/transaction_validator.move b/frameworks/rooch-framework/sources/transaction_validator.move index a5bd73c526..40d0bb53d6 100644 --- a/frameworks/rooch-framework/sources/transaction_validator.move +++ b/frameworks/rooch-framework/sources/transaction_validator.move @@ -25,21 +25,6 @@ module rooch_framework::transaction_validator { const MAX_U64: u128 = 18446744073709551615; - /// Validate errors. These are separated out from the other errors in this - /// module since they are mapped separately to major VM statuses, and are - /// important to the semantics of the system. - const ErrorValidateSequenceNuberTooOld: u64 = 1001; - const ErrorValidateSequenceNumberTooNew: u64 = 1002; - const ErrorValidateAccountDoesNotExist: u64 = 1003; - const ErrorValidateCantPayGasDeposit: u64 = 1004; - const ErrorValidateTransactionExpired: u64 = 1005; - const ErrorValidateBadChainId: u64 = 1006; - const ErrorValidateSequenceNumberTooBig: u64 = 1007; - const ErrorMaxGasAmountExceeded: u64 = 1008; - - /// The authenticator's auth validator id is not installed to the sender's account - const ErrorValidateNotInstalledAuthValidator: u64 = 1010; - /// Just using to get module signer struct TransactionValidatorPlaceholder {} @@ -54,27 +39,27 @@ module rooch_framework::transaction_validator { // === validate the chain id === assert!( chain_id == chain_id::chain_id(), - ErrorValidateBadChainId + auth_validator::error_validate_bad_chain_id(), ); // === validate the sequence number === let tx_sequence_number = tx_context::sequence_number(); assert!( (tx_sequence_number as u128) < MAX_U64, - ErrorValidateSequenceNumberTooBig + auth_validator::error_validate_sequence_number_too_big(), ); let sender = tx_context::sender(); let account_sequence_number = account::sequence_number(sender); assert!( tx_sequence_number >= account_sequence_number, - ErrorValidateSequenceNuberTooOld + auth_validator::error_validate_sequence_number_too_old(), ); // Check that the transaction's sequence number matches the // current sequence number. Otherwise sequence number is too new. assert!( tx_sequence_number == account_sequence_number, - ErrorValidateSequenceNumberTooNew + auth_validator::error_validate_sequence_number_too_new(), ); // === validate gas === @@ -85,7 +70,7 @@ module rooch_framework::transaction_validator { let max_gas_amount_config = gas_schedule::gas_schedule_max_gas_amount(gas_schedule); assert!( max_gas_amount <= max_gas_amount_config, - ErrorMaxGasAmountExceeded + auth_validator::error_validate_max_gas_amount_exceeded(), ); let gas_balance = gas_coin::balance(sender); @@ -94,7 +79,7 @@ module rooch_framework::transaction_validator { if(!chain_id::is_local_or_dev()){ assert!( gas_balance >= gas, - ErrorValidateCantPayGasDeposit + auth_validator::error_validate_cant_pay_gas_deposit(), ); }; @@ -113,12 +98,12 @@ module rooch_framework::transaction_validator { let validator_id = auth_validator::validator_id(auth_validator); // The third-party auth validator must be installed to the sender's account assert!(account_authentication::is_auth_validator_installed(sender, validator_id), - ErrorValidateNotInstalledAuthValidator); + auth_validator::error_validate_not_installed_auth_validator()); let bitcoin_address = address_mapping::resolve_bitcoin(sender); (bitcoin_address, option::none(), option::some(*auth_validator)) }; //The bitcoin address must exist - assert!(option::is_some(&bitcoin_address), ErrorValidateAccountDoesNotExist); + assert!(option::is_some(&bitcoin_address), auth_validator::error_validate_account_does_not_exist()); let bitcoin_address = option::destroy_some(bitcoin_address); auth_validator::new_tx_validate_result(auth_validator_id, auth_validator, session_key, bitcoin_address) } diff --git a/frameworks/rooch-nursery/sources/ethereum_validator.move b/frameworks/rooch-nursery/sources/ethereum_validator.move index d861ac98e9..3f32c964d8 100644 --- a/frameworks/rooch-nursery/sources/ethereum_validator.move +++ b/frameworks/rooch-nursery/sources/ethereum_validator.move @@ -32,13 +32,13 @@ module rooch_nursery::ethereum_validator { let pk = ecdsa_k1::ecrecover(&auth_payload::signature(payload), &message, ecdsa_k1::keccak256()); assert!( vector::length(&pk) == ecdsa_k1::public_key_length(), - auth_validator::error_invalid_authenticator() + auth_validator::error_validate_invalid_authenticator() ); let address = ethereum_address::new(pk); assert!( ethereum_address::as_bytes(&address) == string::bytes(&auth_payload::from_address(payload)), - auth_validator::error_invalid_authenticator() + auth_validator::error_validate_invalid_authenticator() ); address @@ -58,7 +58,7 @@ module rooch_nursery::ethereum_validator { // Check if the sender is related to the Rooch address // assert!( // sender == rooch_addr, - // auth_validator::error_invalid_authenticator() + // auth_validator::error_validate_invalid_authenticator() // ); multi_chain_addr @@ -68,22 +68,4 @@ module rooch_nursery::ethereum_validator { fun post_execute() {} - #[test] - fun test_validate_signature_success() { - let tx_hash = x"7190467737b5da545c362dfa804ddeaab8a858d0829260440ea44856ed4ca3ca"; - let auth_payload_bytes = x"419ecf38ec41946dfb50c2e0c2fe2dcc40a69c36b684c6a00bfc6ef26908b018a739f49249c614b77576066aa8a8b844559c02de024874a5b4267e6b00e8615ccf011d19457468657265756d205369676e6564204d6573736167653a0a3232319d0157656c636f6d6520746f206c6f63616c686f73740a596f752077696c6c20617574686f72697a652073657373696f6e3a0a53636f70653a0a3078343965653363663137613031376233333161623262386134643430656363393730366633323835363266396462363363626136323561396331303663646633353a3a2a3a3a2a0a54696d654f75743a313230300a526f6f636820747820686173683a0a0014442e5c30b5f6a8ae12d5b72e4db68ed6ecfdff25"; - let payload = auth_payload::from_bytes(auth_payload_bytes); - - validate_signature(payload, tx_hash); - } - - #[test] - #[expected_failure(location=Self, abort_code = 1002)] - fun test_validate_signature_fail() { - let tx_hash = x"7290467737b5da545c362dfa804ddeaab8a858d0829260440ea44856ed4ca3ca"; - let auth_payload_bytes = x"419ecf38ec41946dfb50c2e0c2fe2dcc40a69c36b684c6a00bfc6ef26908b018a739f49249c614b77576066aa8a8b844559c02de024874a5b4267e6b00e8615ccf011d19457468657265756d205369676e6564204d6573736167653a0a3232319d0157656c636f6d6520746f206c6f63616c686f73740a596f752077696c6c20617574686f72697a652073657373696f6e3a0a53636f70653a0a3078343965653363663137613031376233333161623262386134643430656363393730366633323835363266396462363363626136323561396331303663646633353a3a2a3a3a2a0a54696d654f75743a313230300a526f6f636820747820686173683a0a0014442e5c30b5f6a8ae12d5b72e4db68ed6ecfdff25"; - let payload = auth_payload::from_bytes(auth_payload_bytes); - - validate_signature(payload, tx_hash); - } } diff --git a/moveos/metrics/Cargo.toml b/moveos/metrics/Cargo.toml index 41c23df0b2..f8d978eaec 100644 --- a/moveos/metrics/Cargo.toml +++ b/moveos/metrics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "metrics" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/moveos/moveos-commons/accumulator/Cargo.toml b/moveos/moveos-commons/accumulator/Cargo.toml index 559f8260a8..8db2140640 100644 --- a/moveos/moveos-commons/accumulator/Cargo.toml +++ b/moveos/moveos-commons/accumulator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "accumulator" -version = "0.4.1" +version = "0.5.0" edition = "2021" [dependencies] diff --git a/moveos/moveos-commons/moveos-common/Cargo.toml b/moveos/moveos-commons/moveos-common/Cargo.toml index 2d5ec879ec..194322babb 100644 --- a/moveos/moveos-commons/moveos-common/Cargo.toml +++ b/moveos/moveos-commons/moveos-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moveos-common" -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 diff --git a/moveos/moveos-commons/timeout-join-handler/Cargo.toml b/moveos/moveos-commons/timeout-join-handler/Cargo.toml index 5ed7f7846c..5750920c5e 100644 --- a/moveos/moveos-commons/timeout-join-handler/Cargo.toml +++ b/moveos/moveos-commons/timeout-join-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "timeout-join-handler" -version = "0.4.1" +version = "0.5.0" edition = "2021" [dependencies] diff --git a/moveos/moveos-compiler/Cargo.toml b/moveos/moveos-compiler/Cargo.toml index c8a35a4775..f1f705cbf7 100644 --- a/moveos/moveos-compiler/Cargo.toml +++ b/moveos/moveos-compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moveos-compiler" -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 diff --git a/moveos/moveos-config/Cargo.toml b/moveos/moveos-config/Cargo.toml index 1953c751fb..888fcc030a 100644 --- a/moveos/moveos-config/Cargo.toml +++ b/moveos/moveos-config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moveos-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 diff --git a/moveos/moveos-object-runtime/Cargo.toml b/moveos/moveos-object-runtime/Cargo.toml index 22561fb281..4da3a275ca 100644 --- a/moveos/moveos-object-runtime/Cargo.toml +++ b/moveos/moveos-object-runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moveos-object-runtime" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/moveos/moveos-store/Cargo.toml b/moveos/moveos-store/Cargo.toml index ddcdb11f33..2e4c0bd9ba 100644 --- a/moveos/moveos-store/Cargo.toml +++ b/moveos/moveos-store/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moveos-store" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/moveos/moveos-types/Cargo.toml b/moveos/moveos-types/Cargo.toml index ebf6955b67..5748b4453c 100644 --- a/moveos/moveos-types/Cargo.toml +++ b/moveos/moveos-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moveos-types" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/moveos/moveos-verifier/Cargo.toml b/moveos/moveos-verifier/Cargo.toml index 4c7aac1c11..cf41c970fe 100644 --- a/moveos/moveos-verifier/Cargo.toml +++ b/moveos/moveos-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moveos-verifier" -version = "0.4.1" +version = "0.5.0" edition = "2021" [dependencies] diff --git a/moveos/moveos-wasm/Cargo.toml b/moveos/moveos-wasm/Cargo.toml index 3d1123a6df..f6e0364d1b 100644 --- a/moveos/moveos-wasm/Cargo.toml +++ b/moveos/moveos-wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moveos-wasm" -version = "0.4.1" +version = "0.5.0" edition = "2021" [dependencies] diff --git a/moveos/moveos/Cargo.toml b/moveos/moveos/Cargo.toml index 602292f902..dc7a4cdda3 100644 --- a/moveos/moveos/Cargo.toml +++ b/moveos/moveos/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moveos" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/moveos/raw-store/Cargo.toml b/moveos/raw-store/Cargo.toml index 16940cf35e..465fe050e5 100644 --- a/moveos/raw-store/Cargo.toml +++ b/moveos/raw-store/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "raw-store" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true } diff --git a/moveos/smt/Cargo.toml b/moveos/smt/Cargo.toml index d7fd3abdaf..bcaeb24e49 100644 --- a/moveos/smt/Cargo.toml +++ b/moveos/smt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "smt" -version = "0.4.1" +version = "0.5.0" # Workspace inherited keys authors = { workspace = true }