Skip to content

Commit

Permalink
Merge branch 'nightly' into talip/fix-inscription-tx-test
Browse files Browse the repository at this point in the history
  • Loading branch information
otaliptus committed Mar 22, 2024
2 parents 5dff9d6 + 2afefde commit d3616d1
Show file tree
Hide file tree
Showing 9 changed files with 292 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion adapters/mock-da/src/db_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ pub(crate) struct DbConnector {
impl DbConnector {
pub fn new() -> Self {
let thread = std::thread::current();
let thread_name = thread.name().unwrap_or("unnamed");
let mut thread_name = thread.name().unwrap_or("unnamed");
if thread_name == "tokio-runtime-worker" {
thread_name = "main"
}
let dir = workspace_dir()
.join("test-da-dbs")
.join(thread_name.to_string() + ".db");
Expand Down
22 changes: 22 additions & 0 deletions examples/demo-rollup/publish_da_block.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# script to auto send 'eth_publishBatch' requests every 2 seconds
# TODO: read sequencer url from .toml files

SLEEP_DURATION=60
SEQUENCER_URL='http://0.0.0.0:12345'

echo "Publishing da blocks every 60 seconds"
echo "Sequencer URL: $SEQUENCER_URL"

while true; do
sleep $SLEEP_DURATION

curl -s -o /dev/null --location $SEQUENCER_URL \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "da_publishBlock",
"params": [],
"id": 1
}'

done
2 changes: 1 addition & 1 deletion examples/demo-rollup/tests/evm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async fn web3_rpc_tests() -> Result<(), anyhow::Error> {

assert_eq!(
test_client.web3_client_version().await,
format!("citrea/{}/{}/rust-1.76.0", tag, arch)
format!("citrea/{}/{}/rust-1.77.0", tag, arch)
);
assert_eq!(
test_client
Expand Down
2 changes: 1 addition & 1 deletion full-node/chainway-sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ citrea-stf = { path = "../../examples/demo-rollup/citrea-stf", features = [
sov-modules-api = { path = "../../module-system/sov-modules-api" }
sov-accounts = { path = "../../module-system/module-implementations/sov-accounts" }
sov-state = { path = "../../module-system/sov-state" }

sov-mock-da = { path = "../../adapters/mock-da" }
hex = { workspace = true }

[dev-dependencies]
Expand Down
9 changes: 9 additions & 0 deletions full-node/chainway-sequencer/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use reth_primitives::{Bytes, FromRecoveredPooledTransaction, IntoRecoveredTransa
use reth_rpc_types_compat::transaction::from_recovered;
use reth_transaction_pool::{EthPooledTransaction, TransactionOrigin, TransactionPool};
use sov_evm::Evm;
use sov_mock_da::{MockAddress, MockDaService};
use sov_modules_api::utils::to_jsonrpsee_error_object;
use sov_modules_api::WorkingSet;
use tracing::info;
Expand Down Expand Up @@ -49,6 +50,14 @@ pub(crate) fn create_rpc_module<C: sov_modules_api::Context>(
ctx.l2_force_block_tx.unbounded_send(()).unwrap();
Ok::<(), ErrorObjectOwned>(())
})?;
rpc.register_async_method("da_publishBlock", |_, _ctx| async move {
info!("Sequencer: da_publishBlock");
let da = MockDaService::new(MockAddress::from([0; 32]));
da.publish_test_block()
.await
.expect("Should publish mock-da block");
Ok::<(), ErrorObjectOwned>(())
})?;
rpc.register_async_method("eth_getTransactionByHash", |parameters, ctx| async move {
let mut params = parameters.sequence();
let hash: B256 = params.next().unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::{
enum ProverStatus<StateRoot, Witness, Da: DaSpec> {
WitnessSubmitted(StateTransitionData<StateRoot, Witness, Da>),
ProvingInProgress,
#[allow(dead_code)]
Proved(Proof),
Err(anyhow::Error),
}
Expand Down
1 change: 1 addition & 0 deletions module-system/sov-modules-macros/src/rpc/rpc_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ pub(crate) fn rpc_gen(
build_rpc_trait(attrs, type_name.clone(), input)
}

#[allow(dead_code)]
struct TypeList(pub Punctuated<syn::Type, syn::token::Comma>);

impl Parse for TypeList {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,255 @@ error[E0220]: associated type `Storage` not found for `S`
| ^^^^^^^^^^^^^ associated type `Storage` not found
|
= note: this error originates in the attribute macro `expose_rpc` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `S: sov_modules_api::Context` is not satisfied
--> tests/rpc/expose_rpc_first_generic_not_context.rs:99:16
|
99 | struct Runtime<S: TestSpec, C: Context> {
| ^ the trait `sov_modules_api::Context` is not implemented for `S`
|
note: required by a bound in `sov_modules_api::Genesis::Context`
--> $WORKSPACE/module-system/sov-modules-core/src/module/mod.rs
|
| type Context: Context;
| ^^^^^^^ required by this bound in `Genesis::Context`
help: consider further restricting this bound
|
99 | struct Runtime<S: TestSpec + sov_modules_api::Context, C: Context> {
| ++++++++++++++++++++++++++

error[E0277]: `<S as TestSpec>::Data` cannot be shared between threads safely
--> tests/rpc/expose_rpc_first_generic_not_context.rs:99:8
|
99 | struct Runtime<S: TestSpec, C: Context> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<S as TestSpec>::Data` cannot be shared between threads safely
|
= help: within `Runtime<S, C>`, the trait `std::marker::Sync` is not implemented for `<S as TestSpec>::Data`, which is required by `Runtime<S, C>: std::marker::Sync`
note: required because it appears within the type `PhantomData<<S as TestSpec>::Data>`
--> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `sov_modules_api::StateValue<<S as TestSpec>::Data>`
--> $WORKSPACE/module-system/sov-modules-api/src/containers/value.rs
|
| pub struct StateValue<V, Codec = BorshCodec> {
| ^^^^^^^^^^
note: required because it appears within the type `QueryModule<C, <S as TestSpec>::Data>`
--> tests/rpc/expose_rpc_first_generic_not_context.rs:33:16
|
33 | pub struct QueryModule<C: Context, D: Data> {
| ^^^^^^^^^^^
note: required because it appears within the type `Runtime<S, C>`
--> tests/rpc/expose_rpc_first_generic_not_context.rs:99:8
|
99 | struct Runtime<S: TestSpec, C: Context> {
| ^^^^^^^
note: required by a bound in `sov_modules_api::DispatchCall`
--> $WORKSPACE/module-system/sov-modules-core/src/module/dispatch.rs
|
| pub trait DispatchCall: Send + Sync {
| ^^^^ required by this bound in `DispatchCall`
help: consider further restricting the associated type
|
99 | struct Runtime<S: TestSpec, C: Context> where <S as TestSpec>::Data: std::marker::Sync {
| ++++++++++++++++++++++++++++++++++++++++++++++

error[E0277]: `<S as TestSpec>::Data` cannot be sent between threads safely
--> tests/rpc/expose_rpc_first_generic_not_context.rs:99:8
|
99 | struct Runtime<S: TestSpec, C: Context> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<S as TestSpec>::Data` cannot be sent between threads safely
|
= help: within `Runtime<S, C>`, the trait `Send` is not implemented for `<S as TestSpec>::Data`, which is required by `Runtime<S, C>: Send`
note: required because it appears within the type `PhantomData<<S as TestSpec>::Data>`
--> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `sov_modules_api::StateValue<<S as TestSpec>::Data>`
--> $WORKSPACE/module-system/sov-modules-api/src/containers/value.rs
|
| pub struct StateValue<V, Codec = BorshCodec> {
| ^^^^^^^^^^
note: required because it appears within the type `QueryModule<C, <S as TestSpec>::Data>`
--> tests/rpc/expose_rpc_first_generic_not_context.rs:33:16
|
33 | pub struct QueryModule<C: Context, D: Data> {
| ^^^^^^^^^^^
note: required because it appears within the type `Runtime<S, C>`
--> tests/rpc/expose_rpc_first_generic_not_context.rs:99:8
|
99 | struct Runtime<S: TestSpec, C: Context> {
| ^^^^^^^
note: required by a bound in `sov_modules_api::DispatchCall`
--> $WORKSPACE/module-system/sov-modules-core/src/module/dispatch.rs
|
| pub trait DispatchCall: Send + Sync {
| ^^^^ required by this bound in `DispatchCall`
help: consider further restricting the associated type
|
99 | struct Runtime<S: TestSpec, C: Context> where <S as TestSpec>::Data: Send {
| +++++++++++++++++++++++++++++++++

error[E0277]: the trait bound `S: sov_modules_api::Context` is not satisfied
--> tests/rpc/expose_rpc_first_generic_not_context.rs:99:16
|
99 | struct Runtime<S: TestSpec, C: Context> {
| ^ the trait `sov_modules_api::Context` is not implemented for `S`
|
note: required by a bound in `sov_modules_api::DispatchCall::Context`
--> $WORKSPACE/module-system/sov-modules-core/src/module/dispatch.rs
|
| type Context: Context;
| ^^^^^^^ required by this bound in `DispatchCall::Context`
help: consider further restricting this bound
|
99 | struct Runtime<S: TestSpec + sov_modules_api::Context, C: Context> {
| ++++++++++++++++++++++++++

error[E0277]: `<S as TestSpec>::Data` cannot be shared between threads safely
--> tests/rpc/expose_rpc_first_generic_not_context.rs:97:19
|
97 | #[derive(Genesis, DispatchCall, MessageCodec, DefaultRuntime)]
| ^^^^^^^^^^^^ `<S as TestSpec>::Data` cannot be shared between threads safely
|
= help: within `RuntimeCall<S, C>`, the trait `std::marker::Sync` is not implemented for `<S as TestSpec>::Data`, which is required by `RuntimeCall<S, C>: std::marker::Sync`
note: required because it appears within the type `RuntimeCall<S, C>`
--> tests/rpc/expose_rpc_first_generic_not_context.rs:97:19
|
97 | #[derive(Genesis, DispatchCall, MessageCodec, DefaultRuntime)]
| ^^^^^^^^^^^^
note: required by a bound in `sov_modules_api::DispatchCall::Decodable`
--> $WORKSPACE/module-system/sov-modules-core/src/module/dispatch.rs
|
| type Decodable: Send + Sync;
| ^^^^ required by this bound in `DispatchCall::Decodable`
= note: this error originates in the derive macro `DispatchCall` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting the associated type
|
99 | struct Runtime<S: TestSpec, C: Context> where <S as TestSpec>::Data: std::marker::Sync {
| ++++++++++++++++++++++++++++++++++++++++++++++

error[E0277]: `<S as TestSpec>::Data` cannot be sent between threads safely
--> tests/rpc/expose_rpc_first_generic_not_context.rs:97:19
|
97 | #[derive(Genesis, DispatchCall, MessageCodec, DefaultRuntime)]
| ^^^^^^^^^^^^ `<S as TestSpec>::Data` cannot be sent between threads safely
|
= help: within `RuntimeCall<S, C>`, the trait `Send` is not implemented for `<S as TestSpec>::Data`, which is required by `RuntimeCall<S, C>: Send`
note: required because it appears within the type `RuntimeCall<S, C>`
--> tests/rpc/expose_rpc_first_generic_not_context.rs:97:19
|
97 | #[derive(Genesis, DispatchCall, MessageCodec, DefaultRuntime)]
| ^^^^^^^^^^^^
note: required by a bound in `sov_modules_api::DispatchCall::Decodable`
--> $WORKSPACE/module-system/sov-modules-core/src/module/dispatch.rs
|
| type Decodable: Send + Sync;
| ^^^^ required by this bound in `DispatchCall::Decodable`
= note: this error originates in the derive macro `DispatchCall` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting the associated type
|
99 | struct Runtime<S: TestSpec, C: Context> where <S as TestSpec>::Data: Send {
| +++++++++++++++++++++++++++++++++

error[E0277]: the trait bound `S: Spec` is not satisfied
--> tests/rpc/expose_rpc_first_generic_not_context.rs:97:19
|
97 | #[derive(Genesis, DispatchCall, MessageCodec, DefaultRuntime)]
| ^^^^^^^^^^^^ the trait `Spec` is not implemented for `S`
|
= note: this error originates in the derive macro `DispatchCall` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
99 | struct Runtime<S: TestSpec + sov_modules_api::Spec, C: Context> {
| +++++++++++++++++++++++

error[E0277]: the trait bound `S: Spec` is not satisfied
--> tests/rpc/expose_rpc_first_generic_not_context.rs:96:1
|
96 | #[expose_rpc]
| ^^^^^^^^^^^^^ the trait `Spec` is not implemented for `S`
|
= note: this error originates in the attribute macro `expose_rpc` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
99 | struct Runtime<S: TestSpec + sov_modules_api::Spec, C: Context> {
| +++++++++++++++++++++++

error[E0053]: method `get_working_set` has an incompatible type for trait
--> tests/rpc/expose_rpc_first_generic_not_context.rs:96:1
|
96 | #[expose_rpc]
| ^^^^^^^^^^^^^
| |
| expected type parameter `C`, found type parameter `S`
| help: change the output type to match the trait: `sov_modules_api::WorkingSet<C>`
...
99 | struct Runtime<S: TestSpec, C: Context> {
| - - expected type parameter
| |
| found type parameter
|
note: type in trait
--> tests/rpc/expose_rpc_first_generic_not_context.rs:86:57
|
86 | pub fn query_value(&self, working_set: &mut WorkingSet<C>) -> RpcResult<QueryResponse> {
| ^^^^^^^^^^^^^
= note: expected signature `fn(&RpcStorage<_, _>) -> sov_modules_api::WorkingSet<C>`
found signature `fn(&RpcStorage<_, _>) -> sov_modules_api::WorkingSet<S>`
= note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
= note: this error originates in the attribute macro `expose_rpc` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `S: sov_modules_api::Context` is not satisfied
--> tests/rpc/expose_rpc_first_generic_not_context.rs:97:10
|
97 | #[derive(Genesis, DispatchCall, MessageCodec, DefaultRuntime)]
| ^^^^^^^ the trait `sov_modules_api::Context` is not implemented for `S`
|
note: required by a bound in `sov_modules_api::WorkingSet`
--> $WORKSPACE/module-system/sov-modules-core/src/storage/scratchpad.rs
|
| pub struct WorkingSet<C: Context> {
| ^^^^^^^ required by this bound in `WorkingSet`
= note: this error originates in the derive macro `Genesis` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
99 | struct Runtime<S: TestSpec + sov_modules_api::Context, C: Context> {
| ++++++++++++++++++++++++++

error[E0277]: the trait bound `S: sov_modules_api::Context` is not satisfied
--> tests/rpc/expose_rpc_first_generic_not_context.rs:97:19
|
97 | #[derive(Genesis, DispatchCall, MessageCodec, DefaultRuntime)]
| ^^^^^^^^^^^^ the trait `sov_modules_api::Context` is not implemented for `S`
|
note: required by a bound in `sov_modules_api::WorkingSet`
--> $WORKSPACE/module-system/sov-modules-core/src/storage/scratchpad.rs
|
| pub struct WorkingSet<C: Context> {
| ^^^^^^^ required by this bound in `WorkingSet`
= note: this error originates in the derive macro `DispatchCall` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
99 | struct Runtime<S: TestSpec + sov_modules_api::Context, C: Context> {
| ++++++++++++++++++++++++++

error[E0277]: the trait bound `S: sov_modules_api::Context` is not satisfied
--> tests/rpc/expose_rpc_first_generic_not_context.rs:96:1
|
96 | #[expose_rpc]
| ^^^^^^^^^^^^^ the trait `sov_modules_api::Context` is not implemented for `S`
|
note: required by a bound in `sov_modules_api::WorkingSet`
--> $WORKSPACE/module-system/sov-modules-core/src/storage/scratchpad.rs
|
| pub struct WorkingSet<C: Context> {
| ^^^^^^^ required by this bound in `WorkingSet`
= note: this error originates in the attribute macro `expose_rpc` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
99 | struct Runtime<S: TestSpec + sov_modules_api::Context, C: Context> {
| ++++++++++++++++++++++++++

0 comments on commit d3616d1

Please sign in to comment.