Skip to content

Commit

Permalink
Owen/wasm gas meter (#1792)
Browse files Browse the repository at this point in the history
* feat: add log for bitseed

* feat: update frameworks/framework-release/build.rs add rooch-nursery changed check

* feat: add trap middleware

* feat: add gas meter middleware

* feat: debug gas_metering

* feat: debug gas_metering

* feat: wasm gas meter ok

* feat: test loop

* feat: fix wasm lint error

* feat: test run_generator

* feat: test generator

* feat: fmt code

* feat: fix lint error

* feat: reset gas used before execute

* feat: remove comment

* feat: recover bitseed.move update

* feat: remove unused import

* feat: fix github action fail

* feat: github action install gh cmd

* feat: install gh cmd

* feat: update values

* feat: refactor gas_meter

* feat: fix lint error

* feat: fmt code
  • Loading branch information
yubing744 authored Jun 7, 2024
1 parent 53b272a commit 6ec8375
Show file tree
Hide file tree
Showing 17 changed files with 925 additions and 132 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/check_build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Install GitHub CLI
run: |
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
- uses: rooch-network/rooch/.github/actions/rust-setup@main
# Todo self-hosted install docker fail
#- name: Set up Docker
Expand Down
5 changes: 5 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ moveos-stdlib = { path = "frameworks/moveos-stdlib" }
rooch-framework = { path = "frameworks/rooch-framework" }
bitcoin-move = { path = "frameworks/bitcoin-move" }


# External crate dependencies.
# Please do not add any test features here: they should be declared by the individual crate.
again = "0.1.2"
Expand Down Expand Up @@ -288,6 +287,7 @@ xxhash-rust = "0.8.8"
base64 = "0.21.3"
#criterion-cpu-time = "0.1.0"
wasmer = "4.2.5"
wasmer-types = "4.2.5"
ciborium = "0.2.1"
pprof = { version = "0.13.0", features = ["flamegraph", "criterion", "cpp", "frame-pointer", "protobuf-codec"] }
celestia-rpc = { git = "https://github.com/eigerco/celestia-node-rs.git", rev = "129272e8d926b4c7badf27a26dea915323dd6489" }
Expand Down
52 changes: 42 additions & 10 deletions crates/testsuite/features/cmd.feature
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,38 @@ Feature: Rooch CLI integration tests

Then stop the server

@serial
Scenario: wasm test
# prepare servers
Given a server for wasm_test

# publish wasm execution
Then cmd: "move publish -p ../../examples/wasm_execution --named-addresses rooch_examples=default"
Then assert: "{{$.move[-1].execution_info.status.type}} == executed"

# test wasm trap
Then cmd: "move run --function default::wasm_execution::run_trap"
Then assert: "{{$.move[-1].execution_info.status.type}} == executed"

# test wasm forever
Then cmd: "move run --function default::wasm_execution::run_infinite_loop"
Then assert: "{{$.move[-1].execution_info.status.type}} == executed"

# test wasm alloc
Then cmd: "move run --function default::wasm_execution::run_alloc"
Then assert: "{{$.move[-1].execution_info.status.type}} == executed"

# run wasm cpp generator
#Then cmd: "move run --function default::wasm_execution::run_generator_cpp"
#Then assert: "{{$.move[-1].execution_info.status.type}} == executed"

# run wasm rust generator
#Then cmd: "move run --function default::wasm_execution::run_generator_rust"
#Then assert: "{{$.move[-1].execution_info.status.type}} == executed"

# release servers
Then stop the server

@serial
Scenario: rooch_bitcoin test
# prepare servers
Expand Down Expand Up @@ -394,22 +426,22 @@ Feature: Rooch CLI integration tests
Then assert: "{{$.move[-1].return_values[0].decoded_value.value.vec[0].value.is_valid}} == true"

# mint
#Then cmd bitseed: "mint --fee-rate 1 --deploy-inscription-id {{$.deploy[-1].inscriptions[0].Id}} --user-input hello_bitseed"
#Then assert: "'{{$.mint[-1]}}' not_contains error"
Then cmd bitseed: "mint --fee-rate 1 --deploy-inscription-id {{$.deploy[-1].inscriptions[0].Id}} --user-input hello_bitseed"
Then assert: "'{{$.mint[-1]}}' not_contains error"

# mine a block
#Then cmd ord: "wallet receive"
#Then cmd bitcoin-cli: "generatetoaddress 1 {{$.wallet[-1].address}}"
#Then sleep: "10"
Then cmd ord: "wallet receive"
Then cmd bitcoin-cli: "generatetoaddress 1 {{$.wallet[-1].address}}"
Then sleep: "10"

# Sync bitseed
#Then cmd: "move run --function default::bitseed_runner::run"
#Then assert: "{{$.move[-1].execution_info.status.type}} == executed"
Then cmd: "move run --function default::bitseed_runner::run"
Then assert: "{{$.move[-1].execution_info.status.type}} == executed"

# Check mint bits validity
#Then cmd: "move view --function 0xa::bitseed::view_validity --args string:{{$.deploy[-1].inscriptions[0].Id}} "
#Then assert: "{{$.move[-1].vm_status}} == Executed"
#Then assert: "{{$.move[-1].return_values[0].decoded_value.value.vec[0].value.is_valid}} == true"
Then cmd: "move view --function 0xa::bitseed::view_validity --args string:{{$.deploy[-1].inscriptions[0].Id}} "
Then assert: "{{$.move[-1].vm_status}} == Executed"
Then assert: "{{$.move[-1].return_values[0].decoded_value.value.vec[0].value.is_valid}} == true"

# release servers
Then stop the server
Expand Down
Loading

0 comments on commit 6ec8375

Please sign in to comment.