Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
0402ecc
Adds try_state to elections pallet
gpestana Mar 27, 2023
af0e6a5
Finishes elections try-state hook; starts EPM hook impl
gpestana Mar 28, 2023
788ddf4
Adds scaffolding for EPM try_state checks
gpestana Mar 28, 2023
b721463
implements checks for EPM
gpestana Mar 30, 2023
3103262
Update frame/election-provider-multi-phase/src/lib.rs
gpestana Apr 20, 2023
6cbf9ab
Update frame/elections-phragmen/src/lib.rs
gpestana Apr 20, 2023
a483470
chore(sc-cli): improve runner and signals (#13688)
yjhmelody Mar 26, 2023
8077b19
add a new ci job to fuzz sp-arithmetic (#13673)
Mar 27, 2023
19e9edc
sc-slots: Forward block size limit (#13716)
bkchr Mar 27, 2023
322d31b
FRAME: Fix the Referenda confirming alarm (#13704)
gavofyork Mar 27, 2023
c04f812
Update pallet licenses to Apache-2.0 (#13467)
aaronbassett Mar 27, 2023
f0bcd0d
Reward pool migration fix (#13715)
Mar 27, 2023
f94fce0
contracts: Add host function tracing (#13648)
pgherveou Mar 27, 2023
67e1cab
Change license of node-template and FRAME examples to MIT-0 (#13465)
aaronbassett Mar 27, 2023
08e037a
updating labels descriptions (#13557)
the-right-joyce Mar 27, 2023
9522b75
CI: Investigate why `RUSTFLAGS` differs on `master` and PRs (#13686)
rcny Mar 28, 2023
998d768
Remove HeaderBackend requirement from AuthorityDiscovery and NetworkW…
skunert Mar 28, 2023
f34444b
CI: rephrase `RUSTFLAGS` (#13735)
rcny Mar 28, 2023
f799177
contracts: proper event link in docs (#13729)
kziemianek Mar 28, 2023
9bc5215
Support stable rust for compiling the runtime (#13580)
bkchr Mar 29, 2023
6618041
provide a default value for RELENG_SCRIPTS_BRANCH (#13743)
Mar 29, 2023
42ee907
roll out new debian 11 ci image (#13744)
Mar 29, 2023
2482f20
Swap 'base58' with 'bs58' (#13739)
davxy Mar 29, 2023
204296a
proc-macro: check for non-args runtime calls added (#13742)
michalkucharczyk Mar 29, 2023
08a35e1
Clean up after debian 11 rollout (#13762)
Mar 29, 2023
17a5d9e
[Fix] Bump tuple element number in frame-support. (#13760)
ruseinov Mar 29, 2023
57dddd2
Generic keystore internals (#13749)
davxy Mar 29, 2023
8929804
Application Crypto cleanup (#13746)
davxy Mar 30, 2023
cb3869d
Attempt to relieve pressure on `mpsc_network_worker` (#13725)
altonen Mar 30, 2023
daf303f
[Enhancement] Throw an error when there are too many pallets (#13763)
ruseinov Mar 30, 2023
6e4e5f5
Build wasm for mvp cpu (#13758)
athei Mar 30, 2023
2fbf914
BEEFY: gossip finality proofs (#13727)
acatangiu Mar 30, 2023
6c1b1ad
Fix nomiantion pools doc render (#13748)
kianenigma Mar 30, 2023
e070908
sp-runtime-interface-test: Fix flaky test (#13770)
bkchr Mar 30, 2023
83d9516
bump zombienet version (#13772)
pepoviola Mar 30, 2023
7756bb1
[Contracts] Overflowing bounded `DeletionQueue` allows DoS against co…
pgherveou Mar 31, 2023
668d61b
Refactor: extract most aura logic out to standalone module, make use …
rphmeier Mar 31, 2023
c9a1ff0
contracts: make test work with debugger (#13776)
pgherveou Mar 31, 2023
19fe15a
add claim_commission weight (#13774)
Apr 1, 2023
76adcec
FRAME: Minor fix for failsafe. (#13741)
gavofyork Apr 1, 2023
81ea064
Adjustments to RPC-query docstrings. (#13698)
DamianStraszak Apr 3, 2023
e1b12eb
Force upgrade snow to 0.9.2 (#13806)
bkchr Apr 3, 2023
a066028
Scheduler pre block limit note (#13231)
muharem Apr 3, 2023
6d38833
Disable `sign-ext` WASM feature when building runtimes (#13804)
koute Apr 3, 2023
71eaef9
refactor: inconsistent BalanceConversion fn (#13610)
wischli Apr 4, 2023
fae245d
Remove deprecated batch verification (#13799)
bkchr Apr 4, 2023
d5ddea6
Uniform pallet warnings (#13798)
ggwpez Apr 4, 2023
cc3f56a
Update documentation for uniques (This PR renames classes and instanc…
simonsso Apr 4, 2023
ee40229
Implement #[pallet::composite_enum] (#13722)
KiChjang Apr 4, 2023
f6f7ced
Expose WASM extensions in executor semantics (#13811)
s0me0ne-unkn0wn Apr 4, 2023
6c45413
Deprecate V1 Weights (#13699)
ggwpez Apr 4, 2023
32f601b
update links to ink! (#13819)
agryaznov Apr 5, 2023
d1e309f
Move registration of `ReadRuntimeVersionExt` to `ExecutionExtension` …
bkchr Apr 5, 2023
5b508e9
Mention `on_idle` round-robin logic to `trait Hooks` cargo doc (#13797)
gpestana Apr 5, 2023
a930258
ProofRecorder: Implement transactional support (#13769)
bkchr Apr 5, 2023
a98e3c2
remove duplicate sync option documentation (#13828)
liamaharon Apr 6, 2023
74c0cf6
Add HoldReason to the NIS pallet (#13823)
KiChjang Apr 6, 2023
3c139bc
Fix `try-runtime follow-chain`, try-runtime upgrade tuple tests, cli …
liamaharon Apr 6, 2023
37479ad
Use proper weights in the `pallet-template` (#13817)
AlexD10S Apr 6, 2023
359d86d
Addresses PR review comments
gpestana Apr 23, 2023
c6633c8
Merge branch 'master' into gpestana/try_state_elections
gpestana Apr 23, 2023
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
Prev Previous commit
Next Next commit
ProofRecorder: Implement transactional support (#13769)
* TrieRecorder: Start adding support for transactions

* Adds `transactions` functions and some test

* More tests

* Docs

* Ensure that we rollback failed transactions in the storage proof

* FMT

* Update primitives/trie/src/recorder.rs

Co-authored-by: Dmitry Markin <[email protected]>

* Review comments

* Update primitives/trie/src/recorder.rs

Co-authored-by: Sebastian Kunert <[email protected]>

* ".git/.scripts/commands/fmt/fmt.sh"

* For the holy clippy!

* Update primitives/trie/src/recorder.rs

Co-authored-by: Anton <[email protected]>

---------

Co-authored-by: Dmitry Markin <[email protected]>
Co-authored-by: Sebastian Kunert <[email protected]>
Co-authored-by: command-bot <>
Co-authored-by: Anton <[email protected]>
  • Loading branch information
4 people authored and gpestana committed Apr 20, 2023
commit a93025880bf109d4e5989e110b190e0fa82df7c2
62 changes: 61 additions & 1 deletion client/block-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ mod tests {
use sp_blockchain::HeaderBackend;
use sp_core::Blake2Hasher;
use sp_state_machine::Backend;
use substrate_test_runtime_client::{DefaultTestClientBuilderExt, TestClientBuilderExt};
use substrate_test_runtime_client::{
runtime::Extrinsic, DefaultTestClientBuilderExt, TestClientBuilderExt,
};

#[test]
fn block_building_storage_proof_does_not_include_runtime_by_default() {
Expand Down Expand Up @@ -345,4 +347,62 @@ mod tests {
.unwrap_err()
.contains("Database missing expected key"),);
}

#[test]
fn failing_extrinsic_rolls_back_changes_in_storage_proof() {
let builder = substrate_test_runtime_client::TestClientBuilder::new();
let backend = builder.backend();
let client = builder.build();

let mut block_builder = BlockBuilder::new(
&client,
client.info().best_hash,
client.info().best_number,
RecordProof::Yes,
Default::default(),
&*backend,
)
.unwrap();

block_builder.push(Extrinsic::ReadAndPanic(8)).unwrap_err();

let block = block_builder.build().unwrap();

let proof_with_panic = block.proof.expect("Proof is build on request").encoded_size();

let mut block_builder = BlockBuilder::new(
&client,
client.info().best_hash,
client.info().best_number,
RecordProof::Yes,
Default::default(),
&*backend,
)
.unwrap();

block_builder.push(Extrinsic::Read(8)).unwrap();

let block = block_builder.build().unwrap();

let proof_without_panic = block.proof.expect("Proof is build on request").encoded_size();

let block = BlockBuilder::new(
&client,
client.info().best_hash,
client.info().best_number,
RecordProof::Yes,
Default::default(),
&*backend,
)
.unwrap()
.build()
.unwrap();

let proof_empty_block = block.proof.expect("Proof is build on request").encoded_size();

// Ensure that we rolled back the changes of the panicked transaction.
assert!(proof_without_panic > proof_with_panic);
assert!(proof_without_panic > proof_empty_block);
assert_eq!(proof_empty_block, proof_with_panic);
}
}
50 changes: 40 additions & 10 deletions primitives/api/proc-macro/src/impl_runtime_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ fn generate_runtime_api_base_structures() -> Result<TokenStream> {
&self,
call: F,
) -> R where Self: Sized {
#crate_::OverlayedChanges::start_transaction(&mut std::cell::RefCell::borrow_mut(&self.changes));
self.start_transaction();

*std::cell::RefCell::borrow_mut(&self.commit_on_success) = false;
let res = call(self);
*std::cell::RefCell::borrow_mut(&self.commit_on_success) = true;
Expand Down Expand Up @@ -347,18 +348,51 @@ fn generate_runtime_api_base_structures() -> Result<TokenStream> {
transactions; qed";
if *std::cell::RefCell::borrow(&self.commit_on_success) {
let res = if commit {
#crate_::OverlayedChanges::commit_transaction(
let res = if let Some(recorder) = &self.recorder {
#crate_::ProofRecorder::<Block>::commit_transaction(&recorder)
} else {
Ok(())
};

let res2 = #crate_::OverlayedChanges::commit_transaction(
&mut std::cell::RefCell::borrow_mut(&self.changes)
)
);

// Will panic on an `Err` below, however we should call commit
// on the recorder and the changes together.
std::result::Result::and(res, std::result::Result::map_err(res2, drop))
} else {
#crate_::OverlayedChanges::rollback_transaction(
let res = if let Some(recorder) = &self.recorder {
#crate_::ProofRecorder::<Block>::rollback_transaction(&recorder)
} else {
Ok(())
};

let res2 = #crate_::OverlayedChanges::rollback_transaction(
&mut std::cell::RefCell::borrow_mut(&self.changes)
)
);

// Will panic on an `Err` below, however we should call commit
// on the recorder and the changes together.
std::result::Result::and(res, std::result::Result::map_err(res2, drop))
};

std::result::Result::expect(res, proof);
}
}

fn start_transaction(&self) {
if !*std::cell::RefCell::borrow(&self.commit_on_success) {
return
}

#crate_::OverlayedChanges::start_transaction(
&mut std::cell::RefCell::borrow_mut(&self.changes)
);
if let Some(recorder) = &self.recorder {
#crate_::ProofRecorder::<Block>::start_transaction(&recorder);
}
}
}
))
}
Expand Down Expand Up @@ -450,11 +484,7 @@ impl<'a> ApiRuntimeImplToApiRuntimeApiImpl<'a> {
params: std::vec::Vec<u8>,
fn_name: &dyn Fn(#crate_::RuntimeVersion) -> &'static str,
) -> std::result::Result<std::vec::Vec<u8>, #crate_::ApiError> {
if *std::cell::RefCell::borrow(&self.commit_on_success) {
#crate_::OverlayedChanges::start_transaction(
&mut std::cell::RefCell::borrow_mut(&self.changes)
);
}
self.start_transaction();

let res = (|| {
let version = #crate_::CallApiAt::<__SrApiBlock__>::runtime_version_at(
Expand Down
Loading