Skip to content

Commit

Permalink
Add metadata hash (#1299)
Browse files Browse the repository at this point in the history
* feat: 🎸 add buy-back

* Bifrost v0.10.001

* feat: 🎸 benchmark

* SLPx mint support commission id (#1261)

* Add vtoken exchange rate rpc (#1260)

* fix: 🐛 add event (#1263)

* add update_currency_metadata function (#1259)

* add update_currency_metadata function

* fix: 🐛 correct update_currency_metadata weight

* add the use of Vec (#1264)

* Add vtoken exchange rate rpc

* add the use of Vec

* Upgrade to Polkadot-SDK v1.7.0 (#1262)

* Bifrost v0.10.0

* fix: 🐛 clippy

* Fix chain spec (#1243)

* Upgrade to polkadot-v1.7.0

---------

Co-authored-by: SunTiebing <[email protected]>
Co-authored-by: Edwin Wang <[email protected]>

* Fix compile

* feat: 🎸 add metadata-hash-extension (#1265)

* feat: 🎸 add metadata-hash-extension

* Fix compile (#1266)

* Fix/fix vtoken voting unlock (#1267)

* update the exchange rate of vtokenminting of vtokenvoting test

* Resolve the frozen anomaly when unlocking

* Revert "feat: 🎸 add metadata-hash-extension (#1265)" (#1268)

This reverts commit 489fc9c.

* rename the version number to 0.11.0

* Slp supports XCMv4 and reconstruct integration tests (#1272)

* Fix compile

* Reconstruct integration tests and slp supports XCMv4

* Fix slp construct_xcm_message

* Feat/slpx mint add commission (#1273)

* SLPx mint support commission id

* remove the channel_id parameter from the mint method

* add mint_with_channel_id method

* perform data migration for OrderQueue storage

* slpx: set the default value of channel_id to 0

* resolve conflicts

* change the location of the old data structure during storage migration

* Feat/add vtoken exchange rate rpc (#1274)

* Add vtoken exchange rate rpc

* add the use of Vec

* supplement the RPC logic && fix bugs

* adjust the RPC exchange rate precision to three decimal places

* fix clippy

* fix bug: storage migration anomaly (#1276)

* SLPx mint support commission id

* remove the channel_id parameter from the mint method

* add mint_with_channel_id method

* perform data migration for OrderQueue storage

* slpx: set the default value of channel_id to 0

* resolve conflicts

* change the location of the old data structure during storage migration

* fix bug: storage migration anomaly

* Slp removes refund (#1275)

* Slp removes refund

* Fix clippy

* Feat/add vtoken exchange rate rpc (#1277)

* Add vtoken exchange rate rpc

* add the use of Vec

* supplement the RPC logic && fix bugs

* adjust the RPC exchange rate precision to three decimal places

* fix clippy

* supplement omissions: adjust the RPC exchange rate precision to three decimal places

* Remove dmp queue (#1279)

* fix: 🐛 CheckMetadataHash to false

* fix: 🐛 update sp-api

* refactor: 💡 fmt

* fix: 🐛 add metadata-hash

* fix: 🐛 add feature metadata-hash

* fix: 🐛 rm metadata-hash feature

---------

Co-authored-by: SunTiebing <[email protected]>
Co-authored-by: SunTiebing <[email protected]>
Co-authored-by: NingBo Wang <[email protected]>
Co-authored-by: Edwin Wang <[email protected]>
  • Loading branch information
5 people committed Jul 10, 2024
1 parent 9c022a0 commit 55ecaec
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 33 deletions.
95 changes: 78 additions & 17 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ cumulus-primitives-utility = { version = "0.8.0", default-featur
cumulus-test-relay-sproof-builder = { version = "0.8.0", default-features = false }
frame-benchmarking = { version = "29.0.0", default-features = false }
frame-executive = { version = "29.0.0", default-features = false }
frame-metadata-hash-extension = { version = "0.1.0", default-features = false }
frame-support = { version = "29.0.0", default-features = false }
frame-system = { version = "29.0.0", default-features = false }
frame-system-benchmarking = { version = "29.0.0", default-features = false }
Expand Down Expand Up @@ -181,7 +182,7 @@ polkadot-parachain-primitives = { version = "7.0.0", default-featur
polkadot-primitives = { version = "8.0.0", default-features = false }
polkadot-runtime-common = { version = "8.0.0", default-features = false }
polkadot-runtime-parachains = { version = "8.0.0", default-features = false }
sp-api = { version = "27.0.0", default-features = false }
sp-api = { version = "27.0.1", default-features = false }
sp-application-crypto = { version = "31.0.0", default-features = false }
sp-arithmetic = { version = "24.0.0", default-features = false }
sp-authority-discovery = { version = "27.0.0", default-features = false }
Expand Down Expand Up @@ -266,7 +267,7 @@ sp-rpc = { version = "27.0.0" }
substrate-build-script-utils = { version = "11.0.0" }
substrate-frame-rpc-system = { version = "29.0.0" }
substrate-prometheus-endpoint = { version = "0.17.0" }
substrate-wasm-builder = { version = "18.0.0" }
substrate-wasm-builder = { version = "18.0.1" }
try-runtime-cli = { version = "0.39.0" }
xcm-emulator = { version = "0.6.0" }
xcm-simulator = { version = "8.0.0" }
Expand Down
2 changes: 1 addition & 1 deletion node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ with-bifrost-kusama-runtime = ["bifrost-service/with-bifrost-kusama-runtime"]
with-bifrost-polkadot-runtime = ["bifrost-service/with-bifrost-polkadot-runtime"]
with-all-runtime = ["with-bifrost-runtime"]
try-runtime = ["bifrost-service/try-runtime", "try-runtime-cli/try-runtime"]
fast-runtime = ["bifrost-service/fast-runtime"]
fast-runtime = ["bifrost-service/fast-runtime"]
1 change: 0 additions & 1 deletion node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,3 @@ fast-runtime = [
"bifrost-kusama-runtime/fast-runtime",
"bifrost-polkadot-runtime/fast-runtime",
]

6 changes: 5 additions & 1 deletion runtime/bifrost-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ serde_json = { workspace = true }
# frame dependencies
frame-benchmarking = { workspace = true, optional = true }
frame-executive = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-support = { workspace = true, features = ["tuples-96"] }
frame-system = { workspace = true }
frame-system-benchmarking = { workspace = true, optional = true }
Expand Down Expand Up @@ -158,6 +159,7 @@ std = [

"frame-benchmarking?/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
Expand Down Expand Up @@ -394,6 +396,8 @@ try-runtime = [
"bifrost-channel-commission/try-runtime",
]

# Enable the metadata hash generation in the wasm builder.
metadata-hash = ["substrate-wasm-builder?/metadata-hash"]
# When enabled, the runtime API will not be build.
#
# This is required by Cumulus to access certain types of the
Expand All @@ -404,7 +408,7 @@ disable-runtime-api = []
# A feature that should be enabled when the runtime should be build for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
on-chain-release-build = ["sp-api/disable-logging"]
on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"]

# Set timing constants (e.g. session period) to faster versions to speed up testing.
fast-runtime = []
13 changes: 8 additions & 5 deletions runtime/bifrost-kusama/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#[cfg(feature = "std")]
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("BNC", 12)
.build()
}

#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
fn main() {
substrate_wasm_builder::WasmBuilder::build_using_defaults()
}

#[cfg(not(feature = "std"))]
fn main() {}
2 changes: 2 additions & 0 deletions runtime/bifrost-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ where
frame_system::CheckNonce::<Runtime>::from(nonce),
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(false),
);
let raw_payload = SignedPayload::new(call, extra)
.map_err(|e| {
Expand Down Expand Up @@ -2020,6 +2021,7 @@ pub type SignedExtra = (
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
Expand Down
6 changes: 5 additions & 1 deletion runtime/bifrost-polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ serde_json = { workspace = true }
# frame dependencies
frame-benchmarking = { workspace = true, optional = true }
frame-executive = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-support = { workspace = true, features = ["tuples-96"] }
frame-system = { workspace = true }
frame-system-benchmarking = { workspace = true, optional = true }
Expand Down Expand Up @@ -155,6 +156,7 @@ std = [
"strum/std",

"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
Expand Down Expand Up @@ -369,6 +371,8 @@ try-runtime = [
"zenlink-protocol/try-runtime",
]

# Enable the metadata hash generation in the wasm builder.
metadata-hash = ["substrate-wasm-builder?/metadata-hash"]
# When enabled, the runtime API will not be build.
#
# This is required by Cumulus to access certain types of the
Expand All @@ -379,7 +383,7 @@ disable-runtime-api = []
# A feature that should be enabled when the runtime should be build for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
on-chain-release-build = ["sp-api/disable-logging"]
on-chain-release-build = ["sp-api/disable-logging", "metadata-hash"]

# Set timing constants (e.g. session period) to faster versions to speed up testing.
fast-runtime = []
13 changes: 8 additions & 5 deletions runtime/bifrost-polkadot/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#[cfg(feature = "std")]
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("BNC", 12)
.build()
}

#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
fn main() {
substrate_wasm_builder::WasmBuilder::build_using_defaults()
}

#[cfg(not(feature = "std"))]
fn main() {}
1 change: 1 addition & 0 deletions runtime/bifrost-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,7 @@ pub type SignedExtra = (
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
Expand Down

0 comments on commit 55ecaec

Please sign in to comment.