Skip to content

Commit

Permalink
Merge branch 'main' into update-portal
Browse files Browse the repository at this point in the history
  • Loading branch information
wow-sven authored May 30, 2024
2 parents ec04d99 + cf8535b commit d91a16d
Show file tree
Hide file tree
Showing 175 changed files with 4,291 additions and 2,644 deletions.
7 changes: 6 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ bitcoincore-rpc-json = "0.18.0"
toml = "0.8.12"
csv = "1.2.1"
revm-precompile = "7.0.0"
revm-primitives = "4.0.0"

# Note: the BEGIN and END comments below are required for external tooling. Do not remove.
# BEGIN MOVE DEPENDENCIES
Expand Down
4 changes: 1 addition & 3 deletions crates/rooch-benchmarks/benches/bench_tx_sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ pub fn tx_sequence_benchmark(c: &mut Criterion) {

let rooch_account = keystore.addresses()[0];
let rooch_key_pair = keystore
.get_key_pairs(&rooch_account, None)
.unwrap()
.pop()
.get_key_pair(&rooch_account, None)
.expect("key pair should have value");
let sequencer_keypair = rooch_key_pair.copy();
let mut sequencer =
Expand Down
12 changes: 5 additions & 7 deletions crates/rooch-benchmarks/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ use rooch_sequencer::actor::sequencer::SequencerActor;
use rooch_sequencer::proxy::SequencerProxy;
use rooch_store::RoochStore;
use rooch_test_transaction_builder::TestTransactionBuilder;
use rooch_types::address::RoochAddress;
use rooch_types::crypto::RoochKeyPair;
use rooch_types::multichain_id::RoochMultiChainID;
use rooch_types::rooch_network::{BuiltinChainID, RoochNetwork};
Expand Down Expand Up @@ -78,25 +77,24 @@ pub async fn setup_service(

// init storage
let (mut moveos_store, mut rooch_store) = init_storage(datadir)?;
let (indexer_store, indexer_reader) = init_indexer(datadir)?;
let (mut indexer_store, indexer_reader) = init_indexer(datadir)?;

// init keystore
let rooch_account = keystore.addresses()[0];
let rooch_key_pair = keystore
.get_key_pairs(&rooch_account, None)?
.pop()
.get_key_pair(&rooch_account, None)
.expect("Key pair should have value");

let sequencer_keypair = rooch_key_pair.copy();
let proposer_keypair = rooch_key_pair.copy();
let sequencer_account = RoochAddress::from(&sequencer_keypair.public());
let proposer_account = RoochAddress::from(&proposer_keypair.public());
let sequencer_account = sequencer_keypair.public().rooch_address()?;
let proposer_account = proposer_keypair.public().rooch_address()?;

// Init executor
let mut network: RoochNetwork = BuiltinChainID::Dev.into();
network.set_sequencer_account(rooch_account.into());
let genesis: RoochGenesis = RoochGenesis::build(network)?;
let root = genesis.init_genesis(&mut moveos_store, &mut rooch_store)?;
let root = genesis.init_genesis(&mut moveos_store, &mut rooch_store, &mut indexer_store)?;

let executor_actor =
ExecutorActor::new(root.clone(), moveos_store.clone(), rooch_store.clone())?;
Expand Down
1 change: 1 addition & 0 deletions crates/rooch-framework-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ rooch-executor = { workspace = true }
rooch-store = { workspace = true }
rooch-config = { workspace = true }
rooch-sequencer = { workspace = true }
rooch-indexer = { workspace = true }

bitcoin-move = { workspace = true }

Expand Down
4 changes: 3 additions & 1 deletion crates/rooch-framework-tests/src/binding_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use rooch_config::store_config::StoreConfig;
use rooch_executor::actor::reader_executor::ReaderExecutorActor;
use rooch_executor::actor::{executor::ExecutorActor, messages::ExecuteTransactionResult};
use rooch_genesis::RoochGenesis;
use rooch_indexer::IndexerStore;
use rooch_store::RoochStore;
use rooch_types::rooch_network::{BuiltinChainID, RoochNetwork};
use rooch_types::transaction::{L1BlockWithBody, RoochTransaction};
Expand Down Expand Up @@ -63,11 +64,12 @@ impl RustBindingTest {
let mut moveos_store =
MoveOSStore::mock_moveos_store_with_data_dir(moveos_db_path.as_path())?;
let mut rooch_store = RoochStore::mock_rooch_store_with_data_dir(rooch_db_path.as_path())?;
let mut indexer_store = IndexerStore::mock_indexer_store()?;
let network: RoochNetwork = BuiltinChainID::Local.into();
let sequencer = network.genesis_config.sequencer_account;

let genesis = RoochGenesis::build(network)?;
let root = genesis.init_genesis(&mut moveos_store, &mut rooch_store)?;
let root = genesis.init_genesis(&mut moveos_store, &mut rooch_store, &mut indexer_store)?;

let executor = ExecutorActor::new(root.clone(), moveos_store.clone(), rooch_store.clone())?;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Copyright (c) RoochNetwork
// SPDX-License-Identifier: Apache-2.0

use moveos_types::module_binding::MoveFunctionCaller;
use move_core_types::vm_status::VMStatus;
use moveos_types::transaction::{MoveAction, MoveOSTransaction};
use rooch_key::keystore::account_keystore::AccountKeystore;
use rooch_key::keystore::memory_keystore::InMemKeystore;
use rooch_types::framework::auth_validator::{AuthValidatorCaller, BuiltinAuthValidator};
use rooch_types::framework::empty::Empty;
use rooch_types::transaction::rooch::RoochTransactionData;

Expand All @@ -14,9 +15,9 @@ use crate::binding_test;
fn test_validate() {
let binding_test = binding_test::RustBindingTest::new().unwrap();
let root = binding_test.root().clone();
let native_validator = binding_test
.as_module_binding::<rooch_types::framework::native_validator::NativeValidatorModule>(
);

let auth_validator = BuiltinAuthValidator::Bitcoin.auth_validator();
let validator_caller = AuthValidatorCaller::new(&binding_test, auth_validator);

let keystore = InMemKeystore::new_insecure_for_tests(1);
let sender = keystore.addresses()[0];
Expand All @@ -28,7 +29,8 @@ fn test_validate() {

let move_tx: MoveOSTransaction = tx.into_moveos_transaction(root);

native_validator
let result = validator_caller
.validate(&move_tx.ctx, auth_info.authenticator.payload)
.unwrap();
assert_eq!(result.vm_status, VMStatus::Executed);
}
4 changes: 2 additions & 2 deletions crates/rooch-framework-tests/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0

mod bitcoin_test;
mod bitcoin_validator_tests;
mod brc20_test;
mod chain_id_test;
mod empty_tests;
mod ethereum_test;
mod native_validator_tests;
mod ord_test;
mod transaction_validator_tests;
mod session_validator_tests;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-12:
status ABORTED with code 10014 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//# publish
module 0x1.TestModule1 {
struct S0<T> has copy, drop {x: T}
// error code 10014: INVALID_DATA_STRUCT_NOT_ALLOWED_TYPE
struct S1 has drop,copy {v: Self.S0<u32>}

metadata {
data_struct {
0x1::TestModule1::S1 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-13:
status ABORTED with code 10014 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//# publish
module 0x1.TestModule1 {
import 0x1.option;
struct S0<T> has copy, drop {x: T}
// error code 10014: INVALID_DATA_STRUCT_NOT_ALLOWED_TYPE
struct S1 has copy,drop {v: option.Option<Self.S0<u32>>}

metadata {
data_struct {
0x1::TestModule1::S1 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
processed 2 tasks

task 0 'publish'. lines 1-4:
status EXECUTED

task 1 'publish'. lines 6-18:
status ABORTED with code 10015 in 0000000000000000000000000000000000000000000000000000000000000002::move_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//# publish
module 0x1.TestModule0 {
struct S0 has drop,copy { x: address }
}

//# publish
module 0x1.TestModule1 {
import 0x1.TestModule0;

// error code 10015: INVALID_DATA_STRUCT_NOT_IN_MODULE_METADATA
struct S0 has drop,copy {v: TestModule0.S0}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-11:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//# publish
module 0x1.TestModule1 {
import 0x1.ascii;
struct S0 has copy,drop {v: ascii.String}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-11:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//# publish
module 0x1.TestModule1 {
import 0x1.option;
struct S0 has copy,drop {v: option.Option<u32>}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
processed 2 tasks

task 0 'publish'. lines 1-10:
status EXECUTED

task 1 'publish'. lines 12-24:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//# publish
module 0x123.TestModule0 {
struct S0 has copy, drop {x: u32}

metadata {
data_struct {
0x123::TestModule0::S0 -> true;
}
}
}

//# publish
module 0x1.TestModule1 {
import 0x123.TestModule0;
import 0x1.option;

struct S1 has copy,drop {v: option.Option<TestModule0.S0>}

metadata {
data_struct {
0x1::TestModule1::S1 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-11:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//# publish
module 0x1.TestModule1 {
import 0x1.string;
struct S0 has copy,drop {v: string.String}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-11:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//# publish
module 0x1.TestModule1 {
import 0x2.object;
struct S0 has copy,drop {v: object.ObjectID}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 1-10:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//# publish
module 0x1.TestModule1 {
struct S0 has copy,drop {v: u64}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
processed 2 tasks

task 0 'publish'. lines 1-10:
status EXECUTED

task 1 'publish'. lines 12-23:
status EXECUTED
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//# publish
module 0x1.TestModule0 {
struct S0 has copy,drop {v: u64}

metadata {
data_struct {
0x1::TestModule0::S0 -> true;
}
}
}

//# publish
module 0x1.TestModule1 {
import 0x1.TestModule0;

struct S0 has copy,drop {v: TestModule0.S0}

metadata {
data_struct {
0x1::TestModule1::S0 -> true;
}
}
}
Loading

0 comments on commit d91a16d

Please sign in to comment.