Skip to content

Commit

Permalink
feat: linux riscv64gc version (#374)
Browse files Browse the repository at this point in the history
* Update jsonrpsee to 0.18.0

* Update jsonrpsee ErrorObject

After v0.18.0, jsonrpsee::core::Error was removed.

These are just naive changes to get it to compile.

See: https://github.com/paritytech/jsonrpsee/releases/tag/v0.18.0

* Update jsonrpsee to 0.19.0

* jsonrpsee Server::start is infallible according to:
paritytech/jsonrpsee#1137

This change allows to compile with jsonrpsee v0.19.0

* Release the linux riscv64gc version

Depends on #372.

Part of #370.

* Install risc-v version with heliosup.

* cargo fmt
  • Loading branch information
come-maiz authored Sep 26, 2024
1 parent a8c61f0 commit b9bc6bf
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 142 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,48 @@ jobs:
helios_linux_armv7.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-linux-riscv:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v1

- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true

- name: install target
run: rustup target add riscv64gc-unknown-linux-gnu

- name: install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y gcc-riscv64-linux-gnu
echo "CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
- uses: Swatinem/rust-cache@v2

- name: build
run: cargo build --package cli --release --target riscv64gc-unknown-linux-gnu

- name: archive
run: tar -czvf "helios_linux_riscv64gc.tar.gz" -C ./target/riscv64gc-unknown-linux-gnu/release helios

- name: generate tag name
id: tag
run: |
echo "::set-output name=release_tag::nightly-${GITHUB_SHA}"
- name: release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
prerelease: true
files: |
helios_linux_riscv64gc.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110 changes: 37 additions & 73 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 client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ config = { path = "../config" }
common = { path = "../common" }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
jsonrpsee = { version = "0.17.1", features = ["full"] }
jsonrpsee = { version = "0.19.0", features = ["full"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
gloo-timers = "0.3.0"
Expand Down
20 changes: 10 additions & 10 deletions client/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ pub enum NodeError {

#[cfg(not(target_arch = "wasm32"))]
impl NodeError {
pub fn to_json_rpsee_error(self) -> jsonrpsee::core::Error {
pub fn to_json_rpsee_error(self) -> jsonrpsee::types::error::ErrorObjectOwned {
match self {
NodeError::ExecutionEvmError(evm_err) => match evm_err {
EvmError::Revert(data) => {
let mut msg = "execution reverted".to_string();
if let Some(reason) = data.as_ref().and_then(EvmError::decode_revert_reason) {
msg = format!("{msg}: {reason}")
}
jsonrpsee::core::Error::Call(jsonrpsee::types::error::CallError::Custom(
jsonrpsee::types::error::ErrorObject::owned(
3,
msg,
data.map(|data| format!("0x{}", hex::encode(data))),
),
))
jsonrpsee::types::error::ErrorObject::owned(
3,
msg,
data.map(|data| format!("0x{}", hex::encode(data))),
)
}
_ => {
jsonrpsee::types::error::ErrorObject::owned(1, evm_err.to_string(), None::<()>)
}
_ => jsonrpsee::core::Error::Custom(evm_err.to_string()),
},
_ => jsonrpsee::core::Error::Custom(self.to_string()),
_ => jsonrpsee::types::error::ErrorObject::owned(1, self.to_string(), None::<()>),
}
}
}
Loading

0 comments on commit b9bc6bf

Please sign in to comment.