-
Notifications
You must be signed in to change notification settings - Fork 43
[ᚬframework] feat(core/binding): add service_sdk, chain_querier, request_context #58
Conversation
@@ -17,3 +17,6 @@ rocksdb = "0.12" | |||
lazy_static = "1.4" | |||
byteorder = "1.3" | |||
rlp = "0.4" | |||
futures = "0.3" | |||
async-trait = "0.1" |
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.
Where is the async-trait
used?
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.
used in tests/sdk.rs, to mock Storage trait
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.
move [devDependencies]
assert_eq!(ctx.get_cycles_price(), 8); | ||
assert_eq!(ctx.get_caller(), mock_address()); | ||
assert_eq!(ctx.get_current_epoch_id(), 1); | ||
assert_eq!(ctx.get_service_name(), "service_name".to_owned()); |
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 don't think can pass the test case.
ctx.get_service_name()
returns &str
service_name".to_owned()
returns String
Did you run the cargo test
?
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.
fixed.
I did run cargo test
, but it did not complain
…est_context (nervosnetwork#58) * feat(core/binding): finish alloc type and chain querier of sdk * feat(core/binding): add sdk test * feat(core/binding): add service sdk and request context * fix style
* feat: metrics logger (#43) * add logger config * add logger.metrics example * Revert "add logger.metrics example" This reverts commit 7c04ff3. * add logger module instruction * chore: add newline to the end of text file * refactor: change serde to json crate to manipulate json * chore: remove patch version in Cargo.toml depencencies * chore: tips for running `make ci` before create PR (#54) * feat: support consensus tracing (#53) * feat: support consensus trace * feat: avoid unsafe unwrap * feat: check is_err when init_tracer to ensure tracer init correctly * feat: panic when init tracer failed * chore: cargo fmt * feat: return ProtocolResult for standard when init tracer * feat: update tracer sdk * refactor: remove unnecessary code * chore: upgrade bytes to 0.5 (#57) Also upgrade prost to pinned git commit, ophelia to 0.2. All of these are required to upgrade bytes. * reafctor(consensus): redesign the consensus architecture (#45) * refactor rpc * refactor: muta consensus * fix CI * chore(ci): reduce travis cache size (#62) * chore(ci): use sccache and limit its cache size to 2G (#63) * chore(ci): use sccache and limit its cache size to 2G Try fix cahce timeout * fix(ci): disable sccache to install it * chore(ci): enable sccache * chore(ci): remove cargo sweep from script.sh * chore(ci): disable sccache on master (#66) * fix(consensus): empty block receipts root (#61) * fix: empty block receipts root * upgrade rust toolchain version * chore(ci): enable sccache (#67) * fix(ci): fail to install sccache after new rust-toolchain (#68) * feat(consensus): develop aggregate crypto with overlord (#60) * update ophelia * feat: aggregated signature * refactor(protocol): Adjust the data structure of transactions and receipts. * feat(protocol/types): Add cycles_price for raw_transaction. (#46) * feat(protocol/traits): Add traits of binding. (#47) * feat(core/binding): Implementation of service state. (#48) * feat(core/binding-macro): Add `read` and `write` proc-macro. (#49) * feat(core/binding-macro): Add cycles proc-marco. (#52) * [ᚬframework] feat(core/binding): add default StoreBool, StoreUint64, StoreString (#51) * feat(core/binding): add DefaultStoreBool, DefaultStoreUint64, DefaultStoreString * feat(core/binding): adjust tests path * feat(core/binding): adjust code * feat(core/binding): fix fmt * feat(core/binding): change BigEndian to LittleEndian * [ᚬframework] feat(core/binding): add StoreMap, StoreArray (#55) * feat(core/binding): add StoreMap * feat(core/binding): add StoreArray * feat(core/binding): fix some issues * feat(core/binding): add TODO comment * [ᚬframework] feat(core/binding): add service_sdk, chain_querier, request_context (#58) * feat(core/binding): finish alloc type and chain querier of sdk * feat(core/binding): add sdk test * feat(core/binding): add service sdk and request context * fix style * [ᚬframework] feat(core/binding-macro): Add #[service] to automatically implement the service trait. (#56) * feat(core/binding-macro): Add #[service] to automatically implement the service trait. * Documents do not run tests. * split for impl * fix read/write result * update cargo.lock * [ᚬframework] feat(core/binding-macro): Add #[init] attribute. (#64) * feat(core/binding-macro): Add #[init] attribute. * fix typo * fix binding trait * chore: Add framework dir. (#65) * feat(core/binding-macro): Support for returning a struct. (#70) * feat(build-in-services): Add asset service. * feat(framework): Service executor. * exec hook * fix stash * fix typo * fix typo * fix overflow * fix typo * rebase master * . * [ᚬframework] feat(framework/binding): add Iterator and impl FixedCodec for rust primitive type (#72) Co-authored-by: Wenchao Hu <[email protected]> Co-authored-by: yonghui <[email protected]> Co-authored-by: zeroqn <[email protected]> Co-authored-by: Eason Gao <[email protected]> Co-authored-by: zhounan <[email protected]>
…est_context (nervosnetwork#58) * feat(core/binding): finish alloc type and chain querier of sdk * feat(core/binding): add sdk test * feat(core/binding): add service sdk and request context * fix style
* feat: metrics logger (nervosnetwork#43) * add logger config * add logger.metrics example * Revert "add logger.metrics example" This reverts commit 7c04ff3. * add logger module instruction * chore: add newline to the end of text file * refactor: change serde to json crate to manipulate json * chore: remove patch version in Cargo.toml depencencies * chore: tips for running `make ci` before create PR (nervosnetwork#54) * feat: support consensus tracing (nervosnetwork#53) * feat: support consensus trace * feat: avoid unsafe unwrap * feat: check is_err when init_tracer to ensure tracer init correctly * feat: panic when init tracer failed * chore: cargo fmt * feat: return ProtocolResult for standard when init tracer * feat: update tracer sdk * refactor: remove unnecessary code * chore: upgrade bytes to 0.5 (nervosnetwork#57) Also upgrade prost to pinned git commit, ophelia to 0.2. All of these are required to upgrade bytes. * reafctor(consensus): redesign the consensus architecture (nervosnetwork#45) * refactor rpc * refactor: muta consensus * fix CI * chore(ci): reduce travis cache size (nervosnetwork#62) * chore(ci): use sccache and limit its cache size to 2G (nervosnetwork#63) * chore(ci): use sccache and limit its cache size to 2G Try fix cahce timeout * fix(ci): disable sccache to install it * chore(ci): enable sccache * chore(ci): remove cargo sweep from script.sh * chore(ci): disable sccache on master (nervosnetwork#66) * fix(consensus): empty block receipts root (nervosnetwork#61) * fix: empty block receipts root * upgrade rust toolchain version * chore(ci): enable sccache (nervosnetwork#67) * fix(ci): fail to install sccache after new rust-toolchain (nervosnetwork#68) * feat(consensus): develop aggregate crypto with overlord (nervosnetwork#60) * update ophelia * feat: aggregated signature * refactor(protocol): Adjust the data structure of transactions and receipts. * feat(protocol/types): Add cycles_price for raw_transaction. (nervosnetwork#46) * feat(protocol/traits): Add traits of binding. (nervosnetwork#47) * feat(core/binding): Implementation of service state. (nervosnetwork#48) * feat(core/binding-macro): Add `read` and `write` proc-macro. (nervosnetwork#49) * feat(core/binding-macro): Add cycles proc-marco. (nervosnetwork#52) * [ᚬframework] feat(core/binding): add default StoreBool, StoreUint64, StoreString (nervosnetwork#51) * feat(core/binding): add DefaultStoreBool, DefaultStoreUint64, DefaultStoreString * feat(core/binding): adjust tests path * feat(core/binding): adjust code * feat(core/binding): fix fmt * feat(core/binding): change BigEndian to LittleEndian * [ᚬframework] feat(core/binding): add StoreMap, StoreArray (nervosnetwork#55) * feat(core/binding): add StoreMap * feat(core/binding): add StoreArray * feat(core/binding): fix some issues * feat(core/binding): add TODO comment * [ᚬframework] feat(core/binding): add service_sdk, chain_querier, request_context (nervosnetwork#58) * feat(core/binding): finish alloc type and chain querier of sdk * feat(core/binding): add sdk test * feat(core/binding): add service sdk and request context * fix style * [ᚬframework] feat(core/binding-macro): Add #[service] to automatically implement the service trait. (nervosnetwork#56) * feat(core/binding-macro): Add #[service] to automatically implement the service trait. * Documents do not run tests. * split for impl * fix read/write result * update cargo.lock * [ᚬframework] feat(core/binding-macro): Add #[init] attribute. (nervosnetwork#64) * feat(core/binding-macro): Add #[init] attribute. * fix typo * fix binding trait * chore: Add framework dir. (nervosnetwork#65) * feat(core/binding-macro): Support for returning a struct. (nervosnetwork#70) * feat(build-in-services): Add asset service. * feat(framework): Service executor. * exec hook * fix stash * fix typo * fix typo * fix overflow * fix typo * rebase master * . * [ᚬframework] feat(framework/binding): add Iterator and impl FixedCodec for rust primitive type (nervosnetwork#72) Co-authored-by: Wenchao Hu <[email protected]> Co-authored-by: yonghui <[email protected]> Co-authored-by: zeroqn <[email protected]> Co-authored-by: Eason Gao <[email protected]> Co-authored-by: zhounan <[email protected]>
* refactor(protocol): Adjust the data structure of transactions and receipts. * feat(protocol/types): Add cycles_price for raw_transaction. (#46) * feat(protocol/traits): Add traits of binding. (#47) * feat(core/binding): Implementation of service state. (#48) * feat(core/binding-macro): Add `read` and `write` proc-macro. (#49) * feat(core/binding-macro): Add cycles proc-marco. (#52) * [ᚬframework] feat(core/binding): add default StoreBool, StoreUint64, StoreString (#51) * feat(core/binding): add DefaultStoreBool, DefaultStoreUint64, DefaultStoreString * feat(core/binding): adjust tests path * feat(core/binding): adjust code * feat(core/binding): fix fmt * feat(core/binding): change BigEndian to LittleEndian * [ᚬframework] feat(core/binding): add StoreMap, StoreArray (#55) * feat(core/binding): add StoreMap * feat(core/binding): add StoreArray * feat(core/binding): fix some issues * feat(core/binding): add TODO comment * [ᚬframework] feat(core/binding): add service_sdk, chain_querier, request_context (#58) * feat(core/binding): finish alloc type and chain querier of sdk * feat(core/binding): add sdk test * feat(core/binding): add service sdk and request context * fix style * [ᚬframework] feat(core/binding-macro): Add #[service] to automatically implement the service trait. (#56) * feat(core/binding-macro): Add #[service] to automatically implement the service trait. * Documents do not run tests. * split for impl * fix read/write result * update cargo.lock * [ᚬframework] feat(core/binding-macro): Add #[init] attribute. (#64) * feat(core/binding-macro): Add #[init] attribute. * fix typo * fix binding trait * chore: Add framework dir. (#65) * feat(core/binding-macro): Support for returning a struct. (#70) * [ᚬframework] feat(framework): Service executor. (#71) * feat(build-in-services): Add asset service. * feat(framework): Service executor. * exec hook * fix stash * fix typo * fix typo * fix overflow * fix typo * Update protocol/Cargo.toml Co-Authored-By: Eason Gao <[email protected]> Co-authored-by: Eason Gao <[email protected]> * [ᚬframework] feat(framework/binding): add Iterator and impl FixedCodec for rust primitive type (#72) * feat(framework/binding): 1. add iterator for StoreMap and StoreArray \n 2. impl FixedCodec for u8,u32,u64,bool,String * fix FixedCodecError * rebase * fix u64 for overflowing_add * [ᚬframework] Rebase master (#73) * feat: metrics logger (#43) * add logger config * add logger.metrics example * Revert "add logger.metrics example" This reverts commit 7c04ff3. * add logger module instruction * chore: add newline to the end of text file * refactor: change serde to json crate to manipulate json * chore: remove patch version in Cargo.toml depencencies * chore: tips for running `make ci` before create PR (#54) * feat: support consensus tracing (#53) * feat: support consensus trace * feat: avoid unsafe unwrap * feat: check is_err when init_tracer to ensure tracer init correctly * feat: panic when init tracer failed * chore: cargo fmt * feat: return ProtocolResult for standard when init tracer * feat: update tracer sdk * refactor: remove unnecessary code * chore: upgrade bytes to 0.5 (#57) Also upgrade prost to pinned git commit, ophelia to 0.2. All of these are required to upgrade bytes. * reafctor(consensus): redesign the consensus architecture (#45) * refactor rpc * refactor: muta consensus * fix CI * chore(ci): reduce travis cache size (#62) * chore(ci): use sccache and limit its cache size to 2G (#63) * chore(ci): use sccache and limit its cache size to 2G Try fix cahce timeout * fix(ci): disable sccache to install it * chore(ci): enable sccache * chore(ci): remove cargo sweep from script.sh * chore(ci): disable sccache on master (#66) * fix(consensus): empty block receipts root (#61) * fix: empty block receipts root * upgrade rust toolchain version * chore(ci): enable sccache (#67) * fix(ci): fail to install sccache after new rust-toolchain (#68) * feat(consensus): develop aggregate crypto with overlord (#60) * update ophelia * feat: aggregated signature * refactor(protocol): Adjust the data structure of transactions and receipts. * feat(protocol/types): Add cycles_price for raw_transaction. (#46) * feat(protocol/traits): Add traits of binding. (#47) * feat(core/binding): Implementation of service state. (#48) * feat(core/binding-macro): Add `read` and `write` proc-macro. (#49) * feat(core/binding-macro): Add cycles proc-marco. (#52) * [ᚬframework] feat(core/binding): add default StoreBool, StoreUint64, StoreString (#51) * feat(core/binding): add DefaultStoreBool, DefaultStoreUint64, DefaultStoreString * feat(core/binding): adjust tests path * feat(core/binding): adjust code * feat(core/binding): fix fmt * feat(core/binding): change BigEndian to LittleEndian * [ᚬframework] feat(core/binding): add StoreMap, StoreArray (#55) * feat(core/binding): add StoreMap * feat(core/binding): add StoreArray * feat(core/binding): fix some issues * feat(core/binding): add TODO comment * [ᚬframework] feat(core/binding): add service_sdk, chain_querier, request_context (#58) * feat(core/binding): finish alloc type and chain querier of sdk * feat(core/binding): add sdk test * feat(core/binding): add service sdk and request context * fix style * [ᚬframework] feat(core/binding-macro): Add #[service] to automatically implement the service trait. (#56) * feat(core/binding-macro): Add #[service] to automatically implement the service trait. * Documents do not run tests. * split for impl * fix read/write result * update cargo.lock * [ᚬframework] feat(core/binding-macro): Add #[init] attribute. (#64) * feat(core/binding-macro): Add #[init] attribute. * fix typo * fix binding trait * chore: Add framework dir. (#65) * feat(core/binding-macro): Support for returning a struct. (#70) * feat(build-in-services): Add asset service. * feat(framework): Service executor. * exec hook * fix stash * fix typo * fix typo * fix overflow * fix typo * rebase master * . * [ᚬframework] feat(framework/binding): add Iterator and impl FixedCodec for rust primitive type (#72) Co-authored-by: Wenchao Hu <[email protected]> Co-authored-by: yonghui <[email protected]> Co-authored-by: zeroqn <[email protected]> Co-authored-by: Eason Gao <[email protected]> Co-authored-by: zhounan <[email protected]> * feat(graphql): Modify the API to fit the framework data structure. (#74) * feat: Extract muta as crate. * rebase master Co-authored-by: zhounan <[email protected]> Co-authored-by: Eason Gao <[email protected]> Co-authored-by: Wenchao Hu <[email protected]> Co-authored-by: yonghui <[email protected]> Co-authored-by: zeroqn <[email protected]>
…est_context (#58) * feat(core/binding): finish alloc type and chain querier of sdk * feat(core/binding): add sdk test * feat(core/binding): add service sdk and request context * fix style
* feat: metrics logger (#43) * add logger config * add logger.metrics example * Revert "add logger.metrics example" This reverts commit 7c04ff3. * add logger module instruction * chore: add newline to the end of text file * refactor: change serde to json crate to manipulate json * chore: remove patch version in Cargo.toml depencencies * chore: tips for running `make ci` before create PR (#54) * feat: support consensus tracing (#53) * feat: support consensus trace * feat: avoid unsafe unwrap * feat: check is_err when init_tracer to ensure tracer init correctly * feat: panic when init tracer failed * chore: cargo fmt * feat: return ProtocolResult for standard when init tracer * feat: update tracer sdk * refactor: remove unnecessary code * chore: upgrade bytes to 0.5 (#57) Also upgrade prost to pinned git commit, ophelia to 0.2. All of these are required to upgrade bytes. * reafctor(consensus): redesign the consensus architecture (#45) * refactor rpc * refactor: muta consensus * fix CI * chore(ci): reduce travis cache size (#62) * chore(ci): use sccache and limit its cache size to 2G (#63) * chore(ci): use sccache and limit its cache size to 2G Try fix cahce timeout * fix(ci): disable sccache to install it * chore(ci): enable sccache * chore(ci): remove cargo sweep from script.sh * chore(ci): disable sccache on master (#66) * fix(consensus): empty block receipts root (#61) * fix: empty block receipts root * upgrade rust toolchain version * chore(ci): enable sccache (#67) * fix(ci): fail to install sccache after new rust-toolchain (#68) * feat(consensus): develop aggregate crypto with overlord (#60) * update ophelia * feat: aggregated signature * refactor(protocol): Adjust the data structure of transactions and receipts. * feat(protocol/types): Add cycles_price for raw_transaction. (#46) * feat(protocol/traits): Add traits of binding. (#47) * feat(core/binding): Implementation of service state. (#48) * feat(core/binding-macro): Add `read` and `write` proc-macro. (#49) * feat(core/binding-macro): Add cycles proc-marco. (#52) * [ᚬframework] feat(core/binding): add default StoreBool, StoreUint64, StoreString (#51) * feat(core/binding): add DefaultStoreBool, DefaultStoreUint64, DefaultStoreString * feat(core/binding): adjust tests path * feat(core/binding): adjust code * feat(core/binding): fix fmt * feat(core/binding): change BigEndian to LittleEndian * [ᚬframework] feat(core/binding): add StoreMap, StoreArray (#55) * feat(core/binding): add StoreMap * feat(core/binding): add StoreArray * feat(core/binding): fix some issues * feat(core/binding): add TODO comment * [ᚬframework] feat(core/binding): add service_sdk, chain_querier, request_context (#58) * feat(core/binding): finish alloc type and chain querier of sdk * feat(core/binding): add sdk test * feat(core/binding): add service sdk and request context * fix style * [ᚬframework] feat(core/binding-macro): Add #[service] to automatically implement the service trait. (#56) * feat(core/binding-macro): Add #[service] to automatically implement the service trait. * Documents do not run tests. * split for impl * fix read/write result * update cargo.lock * [ᚬframework] feat(core/binding-macro): Add #[init] attribute. (#64) * feat(core/binding-macro): Add #[init] attribute. * fix typo * fix binding trait * chore: Add framework dir. (#65) * feat(core/binding-macro): Support for returning a struct. (#70) * feat(build-in-services): Add asset service. * feat(framework): Service executor. * exec hook * fix stash * fix typo * fix typo * fix overflow * fix typo * rebase master * . * [ᚬframework] feat(framework/binding): add Iterator and impl FixedCodec for rust primitive type (#72) Co-authored-by: Wenchao Hu <[email protected]> Co-authored-by: yonghui <[email protected]> Co-authored-by: zeroqn <[email protected]> Co-authored-by: Eason Gao <[email protected]> Co-authored-by: zhounan <[email protected]>
What type of PR is this?
feat(core/binding)
What this PR does / why we need it:
service_sdk: used by developer to write service of framework
chain_querier: used by sdk to query chain data
request_context: manage cycles and events
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: