mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 07:31:02 +00:00
Solidity contract that accepts unverified substrate headers (#65)
* solidity contract * continue * upd * cargo update * fixes * ehtereum_headers -> headers * extracted some common stuff * ethereum_sync.rs -> sync.rs * make sync generic * continue extracting * continue * add eth-contract argument * continue * some fixes * contract v2 * continue * more fixes * more fixes * deal with duplicated params * removed multiple call_rpc variants * bail_on_error!() * fn submit_ethereum_transaction * more fixes * cargo fmt --all * fix * bail_on_arg_error!() * fix * fix * remove async_extra stuff * substrate-bridge.json -> substrate-bridge-abi.json * get rid of substrate transactions hashes * get rid of ethereum transactions hashes * extracted contract bytecode to separate file * cargo fmt --all * avoid duplicate import in contracts * removed Default::default() * swapped configurations for sub2eth && eth2sub * fix compilation * do not double gas limit when submitting Substrate headers * cargo fmt --all * solidity contract removed * consts * extracted solc compilation details to separate file * removed (obsolete in future Vec<u8> justification) * fixed cli option description * fix typos * fix grumble * extracted constants * log decoded header * cargo fmt --all * comment
This commit is contained in:
committed by
Bastian Köcher
parent
50d6ed186f
commit
3d15ac7c90
@@ -117,7 +117,10 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
|
||||
self.maybe_extra.keys().next_back().cloned().unwrap_or_else(Zero::zero),
|
||||
std::cmp::max(
|
||||
self.extra.keys().next_back().cloned().unwrap_or_else(Zero::zero),
|
||||
self.ready.keys().next_back().cloned().unwrap_or_else(Zero::zero),
|
||||
std::cmp::max(
|
||||
self.ready.keys().next_back().cloned().unwrap_or_else(Zero::zero),
|
||||
self.submitted.keys().next_back().cloned().unwrap_or_else(Zero::zero),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -226,6 +229,7 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
|
||||
// all ancestors of this header are now synced => let's remove them from
|
||||
// queues
|
||||
let mut current = *id;
|
||||
let mut id_processed = false;
|
||||
loop {
|
||||
let header = match self.status(¤t) {
|
||||
HeaderStatus::Unknown => break,
|
||||
@@ -253,22 +257,26 @@ impl<P: HeadersSyncPipeline> QueuedHeaders<P> {
|
||||
.entry(current.1)
|
||||
.or_insert(HeaderStatus::Synced) = HeaderStatus::Synced;
|
||||
current = header.parent_id();
|
||||
id_processed = true;
|
||||
}
|
||||
|
||||
// remember that the header is synced
|
||||
log::debug!(
|
||||
target: "bridge",
|
||||
"{} header {:?} is now {:?}",
|
||||
P::SOURCE_NAME,
|
||||
id,
|
||||
HeaderStatus::Synced,
|
||||
);
|
||||
*self
|
||||
.known_headers
|
||||
.entry(id.0)
|
||||
.or_default()
|
||||
.entry(id.1)
|
||||
.or_insert(HeaderStatus::Synced) = HeaderStatus::Synced;
|
||||
if !id_processed {
|
||||
// to avoid duplicate log message
|
||||
log::debug!(
|
||||
target: "bridge",
|
||||
"{} header {:?} is now {:?}",
|
||||
P::SOURCE_NAME,
|
||||
id,
|
||||
HeaderStatus::Synced,
|
||||
);
|
||||
*self
|
||||
.known_headers
|
||||
.entry(id.0)
|
||||
.or_default()
|
||||
.entry(id.1)
|
||||
.or_insert(HeaderStatus::Synced) = HeaderStatus::Synced;
|
||||
}
|
||||
|
||||
// now let's move all descendants from maybe_orphan && orphan queues to
|
||||
// maybe_extra queue
|
||||
|
||||
Reference in New Issue
Block a user