-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[genesis] add logic for extracting genesis modules for FastX framework
- Add code in `framework/lib.rs` to build and verify the FastX framework Move modules + their dependencies in the Move stdlib and hand back a list of `CompiledModule`s. Add test to ensure that this code always works on the current set of framework modules. - Add genesis.rs, which calls this code and wraps each module in an `Object` with a freshly generated ID - Add an authority test that creates a genesis state with a module in it, then successfully processes a new `publish` order containing a module that depends on genesis one. - Fix bugs in `publish` flow revealed by attempting to write this test. A couple of issues came up during this that will need to be fixed later. One is #69; it basically stops us from calling the Move linker.
- Loading branch information
1 parent
202a854
commit 1492fca
Showing
20 changed files
with
381 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Mysten Labs | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use anyhow::Result; | ||
use fastx_adapter::adapter; | ||
use fastx_framework::{self}; | ||
use fastx_types::{ | ||
base_types::{PublicKeyBytes, SequenceNumber, TransactionDigest, TxContext}, | ||
object::Object, | ||
FASTX_FRAMEWORK_ADDRESS, | ||
}; | ||
|
||
/// Create and return objects wrapping the genesis modules for fastX | ||
pub fn create_genesis_module_objects() -> Result<Vec<Object>> { | ||
let mut tx_context = TxContext::new(TransactionDigest::genesis()); | ||
let mut modules = fastx_framework::get_framework_modules()?; | ||
adapter::generate_module_ids(&mut modules, &mut tx_context)?; | ||
let module_objects = modules | ||
.into_iter() | ||
.map(|m| { | ||
Object::new_module( | ||
m, | ||
PublicKeyBytes::from_move_address_hack(&FASTX_FRAMEWORK_ADDRESS), | ||
SequenceNumber::new(), | ||
) | ||
}) | ||
.collect(); | ||
Ok(module_objects) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ pub mod authority; | |
pub mod client; | ||
pub mod downloader; | ||
pub mod fastpay_smart_contract; | ||
pub mod genesis; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.