Skip to content

Commit 927ae08

Browse files
authored
Merge pull request #26 from thesis/fix-withdrawal-domain-hash-calculation-testnet
Update Chain ID for testnet domain hash calculation in withdrawal signing
2 parents a074302 + 3021f20 commit 927ae08

File tree

7 files changed

+7
-5
lines changed

7 files changed

+7
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ PATH_APP_LOAD_PARAMS = ""
4747
# Application version
4848
APPVERSION_M = 1
4949
APPVERSION_N = 1
50-
APPVERSION_P = 4
50+
APPVERSION_P = 5
5151
APPVERSION_SUFFIX = # if not empty, appended at the end. Do not add a dash.
5252

5353
ifeq ($(APPVERSION_SUFFIX),)

src/handler/withdraw.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@ static unsigned char const BSM_SIGN_MAGIC[] = {'\x18', 'B', 'i', 't', 'c', 'o',
6060
#error "COIN_VARIANT is not defined"
6161
#elif COIN_VARIANT == COIN_VARIANT_ACRE
6262
// Mainnet hash
63+
// Mainnet Chain ID - 1 (0x01)
6364
static const uint8_t abi_encoded_chain_id[32] = {
6465
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6566
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
6667
#elif COIN_VARIANT == COIN_VARIANT_ACRE_TESTNET
6768
// Testnet hash
69+
// Sepolia Chain ID - 11155111 (0xaa36a7)
6870
static const uint8_t abi_encoded_chain_id[32] = {
6971
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x05, 0x77};
72+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x36, 0xa7};
7173
#else
7274
#error "Unsupported COIN_VARIANT value"
7375
#endif
@@ -823,4 +825,4 @@ void handler_withdraw(dispatcher_context_t* dc, uint8_t protocol_version) {
823825
PRINTF("Error in ui_post_processing_confirm_withdraw");
824826
}
825827
return;
826-
}
828+
}
91 Bytes
Loading
2 Bytes
Loading
2 Bytes
Loading
86 Bytes
Loading

tests/test_sign_withdraw.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ def test_sign_withdraw(navigator: Navigator, firmware: Firmware, client: RaggerC
2222
gasToken= "0x0000000000000000000000000000000000000000",
2323
refundReceiver= "0x0000000000000000000000000000000000000000",
2424
nonce= "0x8",
25-
) # tx_hash: 0xed3a7a50496ccca6173ddd9a1ad786d61ea737b70541887ab2c2fadcbe36eeaf
25+
) # tx_hash: 0xa580c0c5a0b8e731f7b7fe8ea3ee41cf0dbe78b352b55ae090160659e2d7410c
2626
path = "m/44'/0'/0'/0/0"
2727
result = client.sign_withdraw(data, path, navigator,
2828
instructions=withdrawal_instruction_approve(firmware),
2929
testname=test_name)
30-
assert result == "IEZDsLh2JweulEOzl2dgLrYvtIqWUW8gFeYdMLAYSk7PeH72uN0JQJGVCYZSpJ5HYRaKZrmSBiG3Ypl+oelXEAM="
30+
assert result == "Hy2UpLBXRUkHBRfXIEYFB8PEteLtjxrqJ7kJ3Qe+i67wP0bzDkFl5Z4bYBFfT/3+xwgPrw3T0rkq6dv53Cff+p0="
3131

3232
def test_sign_withdraw_wrong_address(navigator: Navigator, firmware: Firmware, client: RaggerClient, test_name: str):
3333
data = AcreWithdrawalData(

0 commit comments

Comments
 (0)