Skip to content

Commit

Permalink
add on chain events types for generating types of python && Fix strat…
Browse files Browse the repository at this point in the history
…um id (starcoinorg#2468)
  • Loading branch information
sanlee42 authored Apr 30, 2021
1 parent 5b59123 commit 843dfac
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 11 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions stratum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ edition = "2018"

[dependencies]

jsonrpc-tcp-server = { git = "https://github.com/starcoinorg/jsonrpc", rev = "ea1c05d445a8c9e2deef09d439674eb820489e0b"}
jsonrpc-derive = { git = "https://github.com/starcoinorg/jsonrpc", rev = "ea1c05d445a8c9e2deef09d439674eb820489e0b"}
jsonrpc-core = { git = "https://github.com/starcoinorg/jsonrpc", rev = "ea1c05d445a8c9e2deef09d439674eb820489e0b",features=["arbitrary_precision"]}
jsonrpc-pubsub = { git = "https://github.com/starcoinorg/jsonrpc", rev = "ea1c05d445a8c9e2deef09d439674eb820489e0b"}
jsonrpc-tcp-server = { git = "https://github.com/starcoinorg/jsonrpc", rev = "a913ce4632c1989c8fa1810823ec7c209a50d26c"}
jsonrpc-derive = { git = "https://github.com/starcoinorg/jsonrpc", rev = "a913ce4632c1989c8fa1810823ec7c209a50d26c"}
jsonrpc-core = { git = "https://github.com/starcoinorg/jsonrpc", rev = "a913ce4632c1989c8fa1810823ec7c209a50d26c",features=["arbitrary_precision"]}
jsonrpc-pubsub = { git = "https://github.com/starcoinorg/jsonrpc", rev = "a913ce4632c1989c8fa1810823ec7c209a50d26c"}
serde_json = { version="1.0", features = ["arbitrary_precision"]}
serde = { version = "1.0.125" }
hex = { version = "0.4.3", default-features = false }
Expand Down
3 changes: 2 additions & 1 deletion stratum/src/stratum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ impl Stratum {
}
}
fn next_id(&self) -> SubscriptionId {
SubscriptionId::Number(1)
let id = self.uid.fetch_add(1, atomic::Ordering::SeqCst);
SubscriptionId::Number(id)
}
fn sync_current_job(&mut self) -> Result<Option<MintBlockEvent>> {
let service = self.miner_service.clone();
Expand Down
69 changes: 68 additions & 1 deletion testsuite/generate-format/tests/staged/starcoin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,71 @@ EventFilter:
SEQ:
TYPENAME: EventKey
- limit:
OPTION: U64
OPTION: U64
AcceptTokenEvent:
STRUCT:
- token_code:
TYPENAME: TokenCode
AccountAddress:
NEWTYPESTRUCT:
TUPLEARRAY:
CONTENT: U8
SIZE: 16
BlockRewardEvent:
STRUCT:
- block_number: U64
- block_reward: U128
- gas_fees: U128
- miner:
TYPENAME: AccountAddress
BurnEvent:
STRUCT:
- amount: U128
- token_code:
TYPENAME: TokenCode
DepositEvent:
STRUCT:
- amount: U128
- token_code:
TYPENAME: TokenCode
- metadata:
SEQ: U8
MintEvent:
STRUCT:
- amount: U128
- token_code:
TYPENAME: TokenCode
NewBlockEvent:
STRUCT:
- number: U64
- author:
TYPENAME: AccountAddress
- timestamp: U64
- uncles: U64
ProposalCreatedEvent:
STRUCT:
- proposal_id: U64
- proposer:
TYPENAME: AccountAddress
TokenCode:
STRUCT:
- address:
TYPENAME: AccountAddress
- module: STR
- name: STR
VoteChangedEvent:
STRUCT:
- proposal_id: U64
- proposer:
TYPENAME: AccountAddress
- voter:
TYPENAME: AccountAddress
- agree: BOOL
- vote: U128
WithdrawEvent:
STRUCT:
- amount: U128
- token_code:
TYPENAME: TokenCode
- metadata:
SEQ: U8

0 comments on commit 843dfac

Please sign in to comment.