Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions prdoc/pr_7786.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
title: 'pallet revive: rpc build script should not panic'
doc:
- audience: Runtime Dev
description: |-
This can error when you use `cargo remote` and probably also with `cargo vendor`.
Still seeing two more build errors, but at least this one is fixed.

Other one:
```pre
error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
--> substrate/frame/revive/rpc/src/receipt_provider/db.rs:123:17
|
123 | let result = query!(
| __________________________^
124 | | r#"
125 | | INSERT OR REPLACE INTO transaction_hashes (transaction_hash, block_hash, transaction_index)
126 | | VALUES ($1, $2, $3)
... |
130 | | transaction_index
131 | | )
```

and (maybe Rust version related, this is 1.84.1)
```pre
error[E0282]: type annotations needed
--> substrate/frame/revive/rpc/src/receipt_provider/db.rs:102:34
|
102 | let (tx_result, logs_result) = tokio::join!(delete_transaction_hashes, delete_logs);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
|
= note: this error originates in the macro `$crate::join` which comes from the expansion of the macro `tokio::join` (in Nightly builds, run with -Z macro-backtrace for more info)
```
crates:
- name: pallet-revive-eth-rpc
bump: patch
17 changes: 11 additions & 6 deletions substrate/frame/revive/rpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,17 @@ fn main() {
.join("");
let target = std::env::var("TARGET").unwrap_or_else(|_| "unknown".to_string());

let repo = git2::Repository::open("../../../..").expect("should be a repository");
let head = repo.head().expect("should have head");
let commit = head.peel_to_commit().expect("should have commit");
let branch = head.shorthand().unwrap_or("unknown").to_string();
let id = &commit.id().to_string()[..7];
println!("cargo:rustc-env=GIT_REVISION={branch}-{id}");
let (branch, id) = if let Ok(repo) = git2::Repository::open("../../../..") {
let head = repo.head().expect("should have head");
let commit = head.peel_to_commit().expect("should have commit");
let branch = head.shorthand().unwrap_or("unknown").to_string();
let id = &commit.id().to_string()[..7];
(branch, id.to_string())
} else {
("unknown".to_string(), "unknown".to_string())
};

println!("cargo:rustc-env=RUSTC_VERSION={rustc_version}");
println!("cargo:rustc-env=TARGET={target}");
println!("cargo:rustc-env=GIT_REVISION={branch}-{id}");
}
Loading