Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Misc fixes (paritytech#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgeddes authored May 31, 2022
1 parent 18c6225 commit af5434c
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 60 deletions.
Binary file modified parachain/tools/query-events/metadata.scale
Binary file not shown.
47 changes: 25 additions & 22 deletions parachain/tools/query-events/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#[subxt::subxt(runtime_metadata_path = "metadata.scale")]
pub mod runtime { }
pub mod runtime {}

use subxt::{ClientBuilder, DefaultConfig, SubstrateExtrinsicParams};
use subxt::sp_core::H256;
use std::str::FromStr;
use codec::Encode;
use serde::Serialize;
use serde_json;
use serde_hex::{SerHexSeq, StrictPfx};
use codec::Encode;
use serde_json;
use std::io::{self, Write};

use std::str::FromStr;
use subxt::sp_core::H256;
use subxt::{ClientBuilder, DefaultConfig, SubstrateExtrinsicParams};

#[derive(Debug, Serialize)]
struct Items {
items: Vec<Item>
items: Vec<Item>,
}

#[derive(Debug, Serialize)]
Expand All @@ -22,7 +21,7 @@ struct Item {
#[serde(with = "SerHexSeq::<StrictPfx>")]
hash: Vec<u8>,
#[serde(with = "SerHexSeq::<StrictPfx>")]
data: Vec<u8>
data: Vec<u8>,
}

use clap::Parser;
Expand All @@ -31,34 +30,36 @@ use clap::Parser;
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
/// Name of the person to greet
#[clap(short, long)]
api: String,
/// Name of the person to greet
#[clap(short, long)]
api: String,

/// Number of times to greet
#[clap(short, long)]
block: String,
/// Number of times to greet
#[clap(short, long)]
block: String,
}


#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = Args::parse();

let block_hash = H256::from_str(args.block.trim_start_matches("0x"))?;

let api = ClientBuilder::new()
.set_url(args.api)
.build()
.await?
.to_runtime_api::<runtime::RuntimeApi<DefaultConfig, SubstrateExtrinsicParams<DefaultConfig>>>();
.set_url(args.api)
.build()
.await?
.to_runtime_api::<runtime::RuntimeApi<DefaultConfig, SubstrateExtrinsicParams<DefaultConfig>>>(
);

let events = api.storage().system().events(Some(block_hash.into())).await?;

let mut items: Vec<Item> = Vec::new();

for event in events.into_iter() {
if let runtime::runtime_types::snowbase_runtime::Event::BasicOutboundChannel(ev) = &event.event {
if let runtime::runtime_types::snowbase_runtime::Event::BasicOutboundChannel(ev) =
&event.event
{
if let runtime::runtime_types::snowbridge_basic_channel::outbound::pallet::Event::Committed { hash, data } = ev {
items.push(Item {
id: 0,
Expand All @@ -67,7 +68,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
});
}
}
if let runtime::runtime_types::snowbase_runtime::Event::IncentivizedOutboundChannel(ev) = &event.event {
if let runtime::runtime_types::snowbase_runtime::Event::IncentivizedOutboundChannel(ev) =
&event.event
{
if let runtime::runtime_types::snowbridge_incentivized_channel::outbound::pallet::Event::Committed { hash, data } = ev {
items.push(Item {
id: 1,
Expand Down
60 changes: 50 additions & 10 deletions relayer/go.mod
Original file line number Diff line number Diff line change
@@ -1,32 +1,72 @@
module github.com/snowfork/snowbridge/relayer

go 1.16
go 1.18

require (
github.com/ethereum/go-ethereum v1.10.18
github.com/magefile/mage v1.11.0
github.com/sirupsen/logrus v1.7.0
github.com/snowfork/ethashproof v0.0.0-20210729080250-93b61cd82454
github.com/snowfork/go-substrate-rpc-client/v4 v4.0.1-0.20220330174912-586a653ad92d
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
github.com/ChainSafe/go-schnorrkel v0.0.0-20210527232834-58622d036665 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/ethereum/go-ethereum v1.10.17
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/base58 v1.0.3 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/magefile/mage v1.11.0
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/magiconair/properties v1.8.4 // indirect
github.com/mattn/go-runewidth v0.0.10 // indirect
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/pierrec/xxHash v0.1.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/tsdb v0.10.0 // indirect
github.com/rivo/uniseg v0.1.0 // indirect
github.com/rjeczalik/notify v0.9.2 // indirect
github.com/rs/cors v1.8.0 // indirect
github.com/sirupsen/logrus v1.7.0
github.com/snowfork/ethashproof v0.0.0-20210729080250-93b61cd82454
github.com/snowfork/go-substrate-rpc-client/v4 v4.0.1-0.20220330174912-586a653ad92d
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/spf13/afero v1.5.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v1.1.3
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.1.1 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/vedhavyas/go-subkey v1.0.2 // indirect
golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit af5434c

Please sign in to comment.