Skip to content

Commit

Permalink
Readable address (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier authored Jan 18, 2023
1 parent ca2dd66 commit a7bfc4a
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 22 deletions.
3 changes: 2 additions & 1 deletion 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 pallet/account-migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ version = "6.0.0"

[dependencies]
# crates.io
codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
array-bytes = { version = "6.0" }
codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }

# darwinia
darwinia-deposit = { default-features = false, path = "../deposit" }
Expand Down
2 changes: 1 addition & 1 deletion pallet/account-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ pub enum ExistenceReason {
pub fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec<u8> {
[
b"I authorize the migration to ",
account_id_20.0.as_slice(),
array_bytes::bytes2hex("0x", account_id_20.0).as_bytes(),
b", an unused address on ",
spec_name,
b". Sign this message to authorize using the Substrate key associated with the account on ",
Expand Down
2 changes: 1 addition & 1 deletion pallet/account-migration/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn sr25519_signable_message_should_work() {
sr25519_signable_message(s.as_bytes(), &Default::default()),
format!(
"I authorize the migration to {}, an unused address on {}. Sign this message to authorize using the Substrate key associated with the account on {} that you wish to migrate.",
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
"0x0000000000000000000000000000000000000000",
s,
&s[..s.len() - 1],
).as_bytes()
Expand Down
15 changes: 7 additions & 8 deletions pallet/message-transact/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ version = "6.0.0"

[dependencies]
# crates.io
codec = { default-features = false, package = "parity-scale-codec", version = "3.2", features = ["derive"] }
ethereum = { default-features = false, version = "0.14.0", features = ["with-codec"] }
scale-info = { default-features = false, version = "2.3.0", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] }
ethereum = { version = "0.14", default-features = false, features = ["with-codec"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }

# frontier
fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" }
fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" }
pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" }

# paritytech
# substrate
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }

[dev-dependencies]
array-bytes = { version = "4.1" }
array-bytes = { version = "6.0" }
libsecp256k1 = { version = "0.5", features = ["static-context", "hmac"] }
rlp = { version = "0.5" }
sha3 = { version = "0.9" }
Expand All @@ -40,13 +40,13 @@ pallet-bridge-dispatch = { git = "https://github.com/darwinia-network/darwinia-m

# frontier
fp-self-contained = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" }
pallet-ethereum = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" }

# moonbeam
precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] }

# substrate
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
pallet-ethereum = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }

Expand All @@ -62,9 +62,8 @@ std = [
"fp-evm/std",
"fp-ethereum/std",
"pallet-evm/std",
"pallet-ethereum/std",

# paritytech
# substrate
"frame-support/std",
"frame-system/std",
"sp-core/std",
Expand Down
4 changes: 1 addition & 3 deletions pallet/message-transact/src/tests/eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// You should have received a copy of the GNU General Public License
// along with Darwinia. If not, see <https://www.gnu.org/licenses/>.

// crates
use array_bytes::hex2bytes;
// darwinia
use crate::{mock::*, tests::*};
// frontier
Expand All @@ -35,7 +33,7 @@ pub fn eip1559_erc20_creation_unsigned_transaction() -> EIP1559UnsignedTransacti
gas_limit: U256::from(1_000_000),
action: ethereum::TransactionAction::Create,
value: U256::zero(),
input: hex2bytes(ERC20_CONTRACT_BYTECODE).unwrap(),
input: array_bytes::hex2bytes_unchecked(ERC20_CONTRACT_BYTECODE),
}
}

Expand Down
4 changes: 1 addition & 3 deletions pallet/message-transact/src/tests/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// You should have received a copy of the GNU General Public License
// along with Darwinia. If not, see <https://www.gnu.org/licenses/>.

// crates.io
use array_bytes::hex2bytes;
// darwinia
use crate::{mock::*, tests::*};
// frontier
Expand All @@ -34,7 +32,7 @@ fn eip2930_erc20_creation_unsigned_transaction() -> EIP2930UnsignedTransaction {
gas_limit: U256::from(1_000_000),
action: ethereum::TransactionAction::Create,
value: U256::zero(),
input: hex2bytes(ERC20_CONTRACT_BYTECODE).unwrap(),
input: array_bytes::hex2bytes_unchecked(ERC20_CONTRACT_BYTECODE),
}
}

Expand Down
4 changes: 1 addition & 3 deletions pallet/message-transact/src/tests/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// You should have received a copy of the GNU General Public License
// along with Darwinia. If not, see <https://www.gnu.org/licenses/>.

// crates.io
use array_bytes::hex2bytes;
// darwinia
use crate::{mock::*, tests::*};
// frontier
Expand All @@ -34,7 +32,7 @@ pub fn legacy_erc20_creation_unsigned_transaction() -> LegacyUnsignedTransaction
gas_limit: U256::from(1_000_000),
action: ethereum::TransactionAction::Create,
value: U256::zero(),
input: hex2bytes(ERC20_CONTRACT_BYTECODE).unwrap(),
input: array_bytes::hex2bytes_unchecked(ERC20_CONTRACT_BYTECODE),
}
}

Expand Down

0 comments on commit a7bfc4a

Please sign in to comment.