-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorg rpc (no logic changes) #601
Conversation
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
@sorpaas PTAL |
@sorpaas could you give me some feedback? |
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Sorry about my review order, but can you merge master? (Should be a simple one just due to |
@sorpaas PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the improvements of code clarity where we split eth_
implementations into multiple files, but honestly, I don't see much reasons why we need to split the traits as well, which I hope you can explain more. Plus the later will add a lot of API changes to downstream users that they need to adopt.
Alternatively, my recommendation is that we can revert the trait changes, but keep the impl file split structure (you can split a single structs impl into multiple files).
I think this may be more flexible, such as only accepting some json-rpc methods, filtering out sendTransaction/sendRawTransaction methods, etc. Maybe we can add a trait #[rpc(server)]
pub trait EthApiT:
EthClientApiT
+ EthBlockApiT
+ EthTransactionApiT
+ EthStateApiT
+ EthExecuteApiT
+ EthFeeApiT
+ EthMiningApiT
+ EthSubmitApiT
{
}
pub struct EthApi<B: BlockT, C, P, CT, BE, H: ExHashT, A: ChainApi> {
block_api: EthBlockApi<B, C, BE>,
client_api: EthClientApi<B, C, BE, H>,
execute_api: EthExecuteApi<B, C, BE, A>,
fee_api: EthFeeApi<B, C, BE>,
mining_api: EthMiningApi,
state_api: EthStateApi<B, C, BE, P, A>,
submit_api: EthSubmitApi<B, C, P, CT, BE, H, A>,
transaction_api: EthTransactionApi<B, C, BE, A>,
}
impl<B: BlockT, C, P, CT, BE, H: ExHashT, A: ChainApi> EthApiT for EthApi<B, C, P, CT, BE, H, A> {}
impl<B: BlockT, C, P, CT, BE, H: ExHashT, A: ChainApi> EthBlockApiT for EthApi<B, C, P, CT, BE, H, A> {
...
}
impl<B: BlockT, C, P, CT, BE, H: ExHashT, A: ChainApi> EthClientApiT for EthApi<B, C, P, CT, BE, H, A> {
...
}
impl<B: BlockT, C, P, CT, BE, H: ExHashT, A: ChainApi> EthExecuteApiT for EthApi<B, C, P, CT, BE, H, A> {
...
}
... |
@sorpaas what do you think? |
My main concern is regarding the split trait is honestly how the categorization is done. We'll have more RPC methods in the If you can explain more about how you did the categorization, it may be helpful. Otherwise, if there are any official EIP categorization, then my recommendation is that we follow that (we of course don't need to strictly follow EIPs if there's something absurd, but given this is not really in our main area of concern, in this case it's useful). If both of the above cannot be satisfied, then my recommendation is still that we tentatively don't split the trait. |
I know what you meaning. Actually, I largely follow the ethereum/execution-apis categorization, but it doesn't include all |
@sorpaas what do you think? If it's still not acceptable, I'd split eth_ implementations into multiple files firstly. |
Yeah I'd prefer that at this moment. Right now I just don't see much benefits to split the traits (it's unlikely that end users will want to use only a subset of |
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
@sorpaas could you PTAL again? |
Please pull master. |
* Split net api and web3 api into their own modules Signed-off-by: koushiro <koushiro.cqx@gmail.com> * some nits Signed-off-by: koushiro <koushiro.cqx@gmail.com> * remove some useless trait bound Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Reorg eth rpc Signed-off-by: koushiro <koushiro.cqx@gmail.com> * remove useless Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix fmt Signed-off-by: koushiro <koushiro.cqx@gmail.com> * rename src/eth.rs => src/eth/mod.rs Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix fmt Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Some nits Signed-off-by: koushiro <koushiro.cqx@gmail.com> * remove some useless trait bound Signed-off-by: koushiro <koushiro.cqx@gmail.com> * fix some doc Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix license header of each file Signed-off-by: koushiro <koushiro.cqx@gmail.com> * enable use_field_init_shorthand format config Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix warning, replace AllPallets with AllPalletsWithSystem Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Split eth_ impls into multiple files Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Some nits Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Description
This is a big PR without any logical changes about rpc.
I think the big file module is hard to maintain and read, so I made the following changes:
EthApi
into multiple filesBlock
State
Execute
Fee
Mining
Block
Transaction
Submit
eth_getLogs
method toEthFilterApi
EthBlockDataCache
andEthTask
intoeth/cache
module.EthSigner
andEthDevSigner
intosigner
module.Waiting #593 to be merged firstly