Skip to content

Commit 149a49f

Browse files
committed
fix consistency
1 parent cfde8c2 commit 149a49f

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎packages/evm-service/source/instances/evm-contract-events.test.ts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe<{
5959
const [sender, other] = wallets;
6060
const voter = getAddress(sender.address);
6161
const validator = getAddress(other.address);
62-
const blsPublicKey = `0x${"aa".repeat(48)}`;
62+
const blsPublicKey = "aa".repeat(48);
6363

6464
const consensusContract = getContractAddress({ from: voter, nonce: 0n });
6565
const usernamesContract = getContractAddress({ from: voter, nonce: 1n });
@@ -102,7 +102,7 @@ describe<{
102102
const usernamesTxHash = getRandomTxHash();
103103

104104
for (const [nonce, txHash, to, functionName, args] of [
105-
[2n, consensusTxHash, consensusContract, "emitConsensusEvents", [voter, validator, blsPublicKey]],
105+
[2n, consensusTxHash, consensusContract, "emitConsensusEvents", [voter, validator, `0x${blsPublicKey}`]],
106106
[3n, usernamesTxHash, usernamesContract, "emitUsernameEvents", [voter]],
107107
] as const) {
108108
const { receipt } = await evm.process({
@@ -127,27 +127,27 @@ describe<{
127127
assert.equal(
128128
events.map(normalize),
129129
[
130-
{ event: "Voted", txHash: `0x${consensusTxHash}`, txIndex: 0, validator, voter },
131-
{ event: "Unvoted", txHash: `0x${consensusTxHash}`, txIndex: 0, validator, voter },
132-
{ addr: voter, blsPublicKey, event: "ValidatorRegistered", txHash: `0x${consensusTxHash}`, txIndex: 0 },
133-
{ addr: voter, event: "ValidatorResigned", txHash: `0x${consensusTxHash}`, txIndex: 0 },
134-
{ addr: voter, blsPublicKey, event: "ValidatorUpdated", txHash: `0x${consensusTxHash}`, txIndex: 0 },
130+
{ event: "Voted", txHash: consensusTxHash, txIndex: 0, validator, voter },
131+
{ event: "Unvoted", txHash: consensusTxHash, txIndex: 0, validator, voter },
132+
{ addr: voter, blsPublicKey, event: "ValidatorRegistered", txHash: consensusTxHash, txIndex: 0 },
133+
{ addr: voter, event: "ValidatorResigned", txHash: consensusTxHash, txIndex: 0 },
134+
{ addr: voter, blsPublicKey, event: "ValidatorUpdated", txHash: consensusTxHash, txIndex: 0 },
135135
{
136136
addr: voter,
137137
event: "UsernameRegistered",
138-
txHash: `0x${usernamesTxHash}`,
138+
txHash: usernamesTxHash,
139139
txIndex: 1,
140140
username: "alice",
141141
},
142142
{
143143
addr: voter,
144144
event: "UsernameRegistered",
145145
previousUsername: "alice",
146-
txHash: `0x${usernamesTxHash}`,
146+
txHash: usernamesTxHash,
147147
txIndex: 1,
148148
username: "bob",
149149
},
150-
{ addr: voter, event: "UsernameResigned", txHash: `0x${usernamesTxHash}`, txIndex: 1, username: "bob" },
150+
{ addr: voter, event: "UsernameResigned", txHash: usernamesTxHash, txIndex: 1, username: "bob" },
151151
].map(normalize),
152152
);
153153

‎packages/evm/bindings/src/result.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl JsContractEvent {
8585
pub fn new(event: ContractEvent) -> Self {
8686
let mut js_event = Self {
8787
event: event.data.name().to_string(),
88-
tx_hash: event.tx_hash.to_string(),
88+
tx_hash: format!("{:x}", event.tx_hash),
8989
tx_index: event.tx_index,
9090
..Default::default()
9191
};
@@ -105,7 +105,7 @@ impl JsContractEvent {
105105
bls_public_key,
106106
} => {
107107
js_event.addr = Some(addr.to_checksum(None));
108-
js_event.bls_public_key = Some(bls_public_key.to_string());
108+
js_event.bls_public_key = Some(bls_public_key.encode_hex());
109109
}
110110
ContractEventData::ValidatorResigned { addr } => {
111111
js_event.addr = Some(addr.to_checksum(None));

‎packages/processor/source/block-processor.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ describe<{
1818

1919
const blockData = { hash: blockHash, number: 3 };
2020
const contractEvents: Contracts.Evm.ContractEvent[] = [
21-
{ event: "Voted", txHash: `0x${"1".repeat(64)}`, txIndex: 0, validator, voter },
22-
{ addr: validator, event: "ValidatorResigned", txHash: `0x${"2".repeat(64)}`, txIndex: 1 },
21+
{ event: "Voted", txHash: "1".repeat(64), txIndex: 0, validator, voter },
22+
{ addr: validator, event: "ValidatorResigned", txHash: "2".repeat(64), txIndex: 1 },
2323
];
2424

2525
beforeEach((context) => {

0 commit comments

Comments
 (0)