-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release branch polkadot-v1.0.0 #1123
Merged
sorpaas
merged 1 commit into
polkadot-evm:polkadot-v1.0.0
from
koushiro:v1.0.0-backport
Jul 29, 2023
Merged
Release branch polkadot-v1.0.0 #1123
sorpaas
merged 1 commit into
polkadot-evm:polkadot-v1.0.0
from
koushiro:v1.0.0-backport
Jul 29, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Let's just do backports. |
@sorpaas I found CI was broken by the tests about checking pending state. related PR:
FrontierThe pending runtime api use the same runtime api instance for different blocks. The implementation here is wrong, and so is #814. We should intruduce the inherent provider rather than to change the at params of runtime api. fn pending_runtime_api<'a, B: BlockT, C, BE, A: ChainApi>(
client: &'a C,
graph: &'a Pool<A>,
) -> RpcResult<ApiRef<'a, C::Api>>
where
B: BlockT,
C: ProvideRuntimeApi<B>,
C::Api: BlockBuilderApi<B> + EthereumRuntimeRPCApi<B>,
C: HeaderBackend<B> + StorageProvider<B, BE> + 'static,
BE: Backend<B>,
A: ChainApi<Block = B> + 'static,
{
// In case of Pending, we need an overlayed state to query over.
let api = client.runtime_api();
let best_hash = client.info().best_hash;
// Get all transactions in the ready queue.
let xts: Vec<<B as BlockT>::Extrinsic> = graph
.validated_pool()
.ready()
.map(|in_pool_tx| in_pool_tx.data().clone())
.collect::<Vec<<B as BlockT>::Extrinsic>>();
// Manually initialize the overlay.
if let Ok(Some(header)) = client.header(best_hash) {
let parent_hash = *header.parent_hash();
api.initialize_block(parent_hash, &header) <======================== parent_hash
.map_err(|e| internal_err(format!("Runtime api access error: {:?}", e)))?;
// Apply the ready queue to the best block's state.
for xt in xts {
let _ = api.apply_extrinsic(best_hash, xt); <======================== best_hash
}
Ok(api)
} else {
Err(internal_err(format!(
"Cannot get header for block {:?}",
best_hash
)))
}
} Substratefn __runtime_api_internal_call_api_at(
&self,
at: <__SrApiBlock__ as #crate_::BlockT>::Hash,
params: std::vec::Vec<u8>,
fn_name: &dyn Fn(#crate_::RuntimeVersion) -> &'static str,
) -> std::result::Result<std::vec::Vec<u8>, #crate_::ApiError> {
// If we are not already in a transaction, we should create a new transaction
// and then commit/roll it back at the end!
let transaction_depth = *std::cell::RefCell::borrow(&self.transaction_depth);
if transaction_depth == 0 {
self.start_transaction();
}
let res = (|| {
let version = #crate_::CallApiAt::<__SrApiBlock__>::runtime_version_at(
self.call,
at,
)?;
match &mut *std::cell::RefCell::borrow_mut(&self.extensions_generated_for) {
Some(generated_for) => {
if *generated_for != at {
return std::result::Result::Err(
#crate_::ApiError::UsingSameInstanceForDifferentBlocks <============== error
)
}
},
generated_for @ None => {
#crate_::CallApiAt::<__SrApiBlock__>::initialize_extensions(
self.call,
at,
&mut std::cell::RefCell::borrow_mut(&self.extensions),
)?;
*generated_for = Some(at);
}
}
let params = #crate_::CallApiAtParams {
at,
function: (*fn_name)(version),
arguments: params,
overlayed_changes: &self.changes,
storage_transaction_cache: &self.storage_transaction_cache,
call_context: self.call_context,
recorder: &self.recorder,
extensions: &self.extensions,
};
#crate_::CallApiAt::<__SrApiBlock__>::call_api_at(
self.call,
params,
)
})();
if transaction_depth == 0 {
self.commit_or_rollback_transaction(std::result::Result::is_ok(&res));
}
res
} |
This was referenced Jul 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
related PR: paritytech/substrate#14594
Close #1122