Skip to content

Commit

Permalink
update Solana to repeated string
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Dec 15, 2024
1 parent ea5be9a commit bbf5b9e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 11 deletions.
4 changes: 2 additions & 2 deletions blocks/solana/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ run:

.PHONY: protogen
protogen:
substreams protogen --exclude-paths sf/substreams,google
substreams protogen

.PHONY: cache
cache:
Expand All @@ -43,7 +43,7 @@ gui:

.PHONY: parquet
parquet:
substreams-sink-files run solana.substreams.pinax.network:443 substreams.yaml map_events './out' 203100000:203100500 --encoder parquet --file-block-count 100 --development-mode
substreams-sink-files run solana.substreams.pinax.network:443 substreams.yaml map_events './out' 203100000:203100001 --encoder parquet --file-block-count 1 --development-mode

.PHONY: deploy
deploy:
Expand Down
36 changes: 35 additions & 1 deletion blocks/solana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,38 @@ graph TD;
raw --> vote_instruction_calls;
raw --> vote_account_activity;
raw --> discriminators;
```
```

## Graph

```mermaid
graph TD;
map_events[map: map_events];
sf.substreams.v1.Clock[source: sf.substreams.v1.Clock] --> map_events;
common:blocks_without_votes --> map_events;
map_events_with_votes[map: map_events_with_votes];
sf.substreams.v1.Clock[source: sf.substreams.v1.Clock] --> map_events_with_votes;
sf.solana.type.v1.Block[source: sf.solana.type.v1.Block] --> map_events_with_votes;
common:blocks_without_votes[map: common:blocks_without_votes];
sf.solana.type.v1.Block[source: sf.solana.type.v1.Block] --> common:blocks_without_votes;
```

## Modules

```bash
Name: map_events
Initial block: 0
Kind: map
Input: source: sf.substreams.v1.Clock
Input: map: common:blocks_without_votes
Output Type: proto:pinax.solana.v1.Events
Hash: dcee2536d77ebb585cb3562cf6ed34b3103f6dbc

Name: map_events_with_votes
Initial block: 0
Kind: map
Input: source: sf.substreams.v1.Clock
Input: source: sf.solana.type.v1.Block
Output Type: proto:pinax.solana.v1.Events
Hash: c86e7d4fafa5bca66dc5b775c3174ae864eb5cac
```
8 changes: 4 additions & 4 deletions blocks/solana/src/pb/pinax.solana.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ pub struct Transaction {
pub account_keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag="19")]
pub log_messages: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(uint64, repeated, tag="20")]
pub pre_balances: ::prost::alloc::vec::Vec<u64>,
#[prost(uint64, repeated, tag="21")]
pub post_balances: ::prost::alloc::vec::Vec<u64>,
#[prost(string, repeated, tag="20")]
pub pre_balances: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag="21")]
pub post_balances: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag="22")]
pub signatures: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag="23")]
Expand Down
4 changes: 2 additions & 2 deletions blocks/solana/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ pub fn collect_transaction(transaction: &ConfirmedTransaction, index: usize, blo
recent_block_hash: base58::encode(&message.recent_blockhash),
account_keys: account_keys.iter().map(|key| base58::encode(key)).collect::<Vec<String>>(),
log_messages: meta.log_messages.clone(),
pre_balances: meta.pre_balances.clone(),
post_balances: meta.post_balances.clone(),
pre_balances: meta.pre_balances.clone().iter().map(|balance| balance.to_string()).collect::<Vec<String>>(),
post_balances: meta.post_balances.clone().iter().map(|balance| balance.to_string()).collect::<Vec<String>>(),
signatures: trx.signatures.iter().map(|sig| base58::encode(sig)).collect::<Vec<String>>(),
signer: message.account_keys.iter().take(trx.signatures.len()).map(|key| base58::encode(key)).next().unwrap(),
signers,
Expand Down
4 changes: 2 additions & 2 deletions proto/solana.proto
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ message Transaction {
string recent_block_hash = 17;
repeated string account_keys = 18;
repeated string log_messages = 19;
repeated uint64 pre_balances = 20;
repeated uint64 post_balances = 21;
repeated string pre_balances = 20; // repeated uint64
repeated string post_balances = 21; // repeated uint64
repeated string signatures = 22;
string signer = 23;
repeated string signers = 24;
Expand Down

0 comments on commit bbf5b9e

Please sign in to comment.