Skip to content

Commit

Permalink
Fake VRF for ethereum pending blocks (#2576)
Browse files Browse the repository at this point in the history
* upgrade moonkit

* upgrade frontier

* implement new runtime api initialize_pending_block

* update frontier pin

* add zombi test with an RPC node that is not a collator

* update frontier pin

* fix zombi rpc tests for moonbase

* add zombi rpc tests for moonbeam

* Execute zombi RPC tests on CI

* typo

* lint

* typo

* zombi RPC tests: add moonbeam

* lints

* min gas price is higher on moonbeam

* fix typo in moonwall config zombie_moonbeam_rpc
  • Loading branch information
librelois committed Nov 28, 2023
1 parent 31dd0f3 commit 81a83f4
Show file tree
Hide file tree
Showing 8 changed files with 570 additions and 33 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,20 @@ jobs:
## Start zombie network and run tests
chmod uog+x ../target/release/moonbeam
pnpm moonwall test zombie_${{ matrix.chain }}
- name: "Run zombie RPC test"
run: |
cd test
pnpm install
## Generate old spec using latest published node, modify it, and generate raw spec
chmod uog+x tmp/moonbeam_rt
tmp/moonbeam_rt build-spec --chain ${{ matrix.chain }}-local > tmp/${{ matrix.chain }}-plain-spec.json
pnpm tsx scripts/modify-plain-specs.ts process tmp/${{ matrix.chain }}-plain-spec.json tmp/${{ matrix.chain }}-modified-spec.json
tmp/moonbeam_rt build-spec --chain tmp/${{ matrix.chain }}-modified-spec.json --raw > tmp/${{ matrix.chain }}-raw-spec.json
## Start zombie network and run tests
chmod uog+x ../target/release/moonbeam
pnpm moonwall test zombie_${{ matrix.chain }}_rpc
- name: Zip and Upload Node Logs on Failure
if: failure()
run: |
Expand Down
67 changes: 34 additions & 33 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions runtime/common/src/apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ macro_rules! impl_runtime_apis_plus_common {
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
)
}

fn initialize_pending_block(header: &<Block as BlockT>::Header) {
pallet_randomness::vrf::using_fake_vrf(|| Executive::initialize_block(header))
}
}

impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
Expand Down
65 changes: 65 additions & 0 deletions test/configs/zombieAlphanetRpc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"settings": {
"timeout": 1000,
"provider": "native"
},
"relaychain": {
"chain": "rococo-local",
"default_command": "tmp/polkadot",
"default_args": [
"--no-hardware-benchmarks",
"-lparachain=debug",
"--database=paritydb"
],
"nodes": [
{
"name": "alice",
"ws_port": 33356,
"validator": true
},
{
"name": "bob",
"validator": true
}
]
},
"parachains": [
{
"id": 1000,
"chain": "moonbase-local",
"chain_spec_path": "tmp/moonbase-raw-spec.json",
"collators": [
{
"name": "alith",
"ws_port": 33345,
"command": "../target/release/moonbeam",
"args": [
"--no-hardware-benchmarks",
"--force-authoring",
"-lparachain=debug",
"--database=paritydb"
]
},
{
"name": "RPC1",
"validator": false,
"ws_port": 33048,
"p2p_port": 33049,
"command": "../target/release/moonbeam",
"args": [
"--no-hardware-benchmarks",
"-lparachain=debug",
"--database=paritydb"
]
}
]
}
],
"types": {
"Header": {
"number": "u64",
"parent_hash": "Hash",
"post_state": "Hash"
}
}
}
Loading

0 comments on commit 81a83f4

Please sign in to comment.